Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-school-app
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜雷
wx-school-app
Commits
7437d4d0
Commit
7437d4d0
authored
Aug 14, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into test
parents
3795e6a0
88042cb9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
1 deletion
+122
-1
customer.ts
src/api/customer.ts
+13
-0
app.tsx
src/app.tsx
+1
-0
AppLaunch.scss
src/pages/AppLaunch/AppLaunch.scss
+6
-0
AppLaunch.tsx
src/pages/AppLaunch/AppLaunch.tsx
+75
-0
Home.tsx
src/pages/Home/Home.tsx
+27
-1
No files found.
src/api/customer.ts
View file @
7437d4d0
...
...
@@ -167,3 +167,16 @@ export const switchBalanceState = (
url
:
`/app/customer/swich/balance/
${
entity
.
customerId
}
/
${
entity
.
isEnabled
}
`
,
method
:
'PUT'
,
});
type
FetchAppLaunchCustomerParams
=
{
secretCode
:
string
;
uuId
:
string
;
serviceId
:
string
;
timeStamp
:
string
;
sign
:
string
;
};
export
const
fetchAppLaunchCustomer
=
(
entity
:
FetchAppLaunchCustomerParams
)
=>
customerFetch
({
url
:
'/dcxy/wechat/anxinpay/app/jump/mini/validatelogin'
,
data
:
entity
,
});
src/app.tsx
View file @
7437d4d0
...
...
@@ -47,6 +47,7 @@ class App extends Component {
'pages/Password/ChangePwd'
,
'pages/Password/ChangeHardwareAccount'
,
'pages/Password/ChangeTelAccount'
,
'pages/AppLaunch/AppLaunch'
,
],
window
:
{
backgroundTextStyle
:
'light'
,
...
...
src/pages/AppLaunch/AppLaunch.scss
0 → 100644
View file @
7437d4d0
.AppLaunch
{
padding
:
60px
48px
;
.AppLaunch-Message
{
margin-bottom
:
40px
;
}
}
src/pages/AppLaunch/AppLaunch.tsx
0 → 100644
View file @
7437d4d0
import
'./AppLaunch.scss'
;
import
{
View
,
Button
}
from
'@tarojs/components'
;
import
Taro
,
{
useEffect
,
useState
}
from
'@tarojs/taro'
;
import
{
fetchAppLaunchCustomer
}
from
'@/api/customer'
;
import
{
LogoutCode
}
from
'@/constants'
;
import
{
useDispatch
}
from
'@tarojs/redux'
;
import
{
updateUserInfo
}
from
'@/store/rootReducers/userinfo'
;
function
AppLaunch
()
{
const
dispatch
=
useDispatch
();
const
goNextPage
=
(
serviceId
:
string
)
=>
{
Taro
.
redirectTo
({
url
:
`/pages/Home/Home?serviceId=
${
serviceId
}
`
,
});
};
const
[
showBackButtonState
,
setShowBackButtonState
]
=
useState
(
false
);
const
[
errorMsg
,
setErrorMsg
]
=
useState
(
''
);
useEffect
(()
=>
{
console
.
log
(
'AppLaunch'
,
this
.
$router
.
params
);
let
entity
=
this
.
$router
.
params
;
Taro
.
showLoading
();
const
{
uuId
,
serviceId
}
=
entity
;
if
(
uuId
&&
serviceId
)
{
fetchAppLaunchCustomer
(
entity
)
.
then
(
res
=>
{
console
.
log
(
res
);
Taro
.
hideLoading
();
dispatch
(
updateUserInfo
(
res
.
data
));
goNextPage
(
serviceId
);
})
.
catch
(
err
=>
{
Taro
.
hideLoading
();
let
msg
=
err
.
msg
||
'请求失败'
;
Taro
.
showToast
({
title
:
msg
,
icon
:
'none'
,
});
if
(
err
.
code
!==
LogoutCode
)
{
setErrorMsg
(
msg
);
setShowBackButtonState
(
true
);
}
});
}
else
{
Taro
.
hideLoading
();
console
.
log
(
'no uuid'
);
setErrorMsg
(
'进入小程序参数错误'
);
setShowBackButtonState
(
true
);
}
},
[]);
const
goBackAppError
=
e
=>
{
console
.
log
(
e
);
Taro
.
showModal
({
title
:
'提示'
,
content
:
'呼起APP失败,请手动回到APP'
,
});
};
return
(
<
View
className=
'AppLaunch'
>
<
View
className=
'AppLaunch-Message'
>
{
errorMsg
}
</
View
>
{
showBackButtonState
&&
(
<
Button
open
-
type=
'launchApp'
app
-
parameter=
'wechat'
onError=
{
goBackAppError
}
>
返回APP
</
Button
>
)
}
</
View
>
);
}
export
default
AppLaunch
;
src/pages/Home/Home.tsx
View file @
7437d4d0
...
...
@@ -118,12 +118,37 @@ class Home extends Component {
onShareAppMessage
=
shareHandle
;
componentWillMount
()
{
const
{
serviceId
}
=
this
.
$router
.
params
;
console
.
log
(
'in componentWillMount'
,
serviceId
);
if
(
serviceId
)
{
return
this
.
redirectFromAppLaunch
(
serviceId
);
}
this
.
getInitData
();
}
componentDidShow
()
{
this
.
getInitData
();
}
redirectFromAppLaunch
(
serviceId
:
string
)
{
switch
(
serviceId
)
{
case
'9'
:
return
this
.
goDispenser
();
case
'10'
:
return
this
.
goShower
();
case
'11'
:
case
'12'
:
return
this
.
goBarCode
(
Number
(
serviceId
));
default
:
console
.
log
(
'redirectFromAppLaunch serviceId: '
+
serviceId
);
Taro
.
showToast
({
title
:
'无法识别的服务'
,
icon
:
'none'
,
});
break
;
}
}
getInitData
()
{
this
.
getServiceList
();
this
.
getAnn
();
...
...
@@ -294,7 +319,8 @@ class Home extends Component {
{
userinfo
.
customerName
}
</
View
>
<
View
className=
'Home-UserBox-tel'
>
{
this
.
formatePhone
(
userinfo
.
customerPhone
)
}
{
userinfo
.
customerPhone
&&
this
.
formatePhone
(
userinfo
.
customerPhone
)
}
</
View
>
<
View
className=
'Home-UserBox-addr'
>
{
userinfo
.
areaName
}
</
View
>
</
View
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment