Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
Project
Project
Details
Activity
Releases
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
李俊赕
self-support
Commits
f171a843
Commit
f171a843
authored
Apr 25, 2021
by
Morson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交更新页面
parent
5b812f62
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
260 additions
and
93 deletions
+260
-93
App.vue
src/App.vue
+30
-36
order.js
src/common/api/order.js
+12
-7
http.interceptor.js
src/common/http.interceptor.js
+1
-9
pages.json
src/pages.json
+5
-2
index.vue
src/pages/login/index.vue
+32
-22
feedback.vue
src/pages/order/feedback.vue
+131
-16
login.js
src/utils/login.js
+49
-1
No files found.
src/App.vue
View file @
f171a843
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
"./../.env.js"
;
import
"./../.env.js"
;
import
{
AnalysysAgent
}
from
"@/utils/analysys_paas.js"
;
import
{
AnalysysAgent
}
from
"@/utils/analysys_paas.js"
;
import
util
from
"@/utils/util.js"
;
import
util
from
"@/utils/util.js"
;
import
login
from
"@/utils/login.js"
;
export
default
{
export
default
{
globalData
:
{
globalData
:
{
// 开发环境
// 开发环境
...
@@ -50,16 +51,19 @@ export default {
...
@@ -50,16 +51,19 @@ export default {
// 用户入驻信息
// 用户入驻信息
settledInfo
:
{},
settledInfo
:
{},
},
},
onLaunch
:
function
()
{
onLaunch
:
async
function
()
{
// 应用初始化(全局只触发一次)
// 应用初始化(全局只触发一次)
AnalysysAgent
.
registerSuperProperty
(
"platform"
,
"self-support"
);
AnalysysAgent
.
registerSuperProperty
(
"platform"
,
"self-support"
);
// 版本更新
// 版本更新
this
.
updateApp
();
this
.
updateApp
();
},
},
onShow
:
function
()
{
onShow
:
async
function
()
{
// 应用启动,或从后台进入前台显示
// 应用启动,或从后台进入前台显示
this
.
autoLogin
();
// 等待自动授权登录接口调用结束
await
this
.
autoLogin
();
},
},
onHide
:
function
()
{
onHide
:
function
()
{
// 应用从前台进入后台
// 应用从前台进入后台
...
@@ -91,48 +95,38 @@ export default {
...
@@ -91,48 +95,38 @@ export default {
},
},
/**
/**
* 用户自动登录
*
微信
用户自动登录
*/
*/
autoLogin
()
{
a
sync
a
utoLogin
()
{
let
that
=
this
;
let
that
=
this
;
uni
.
login
({
await
login
.
oauth
().
then
(
async
res
=>
{
async
success
(
res
)
{
if
(
res
.
code
)
{
if
(
res
.
code
)
{
let
params
=
{
let
params
=
{
code
:
res
.
code
,
code
:
res
.
code
,
wxAppNo
:
that
.
globalData
.
wxAppNo
,
// 自营平台小程序
wxAppNo
:
that
.
globalData
.
wxAppNo
,
// 自营平台小程序
};
};
let
result
=
await
that
.
$u
.
api
.
loginWechatAuth
(
params
)
let
result
=
await
that
.
$u
.
api
.
loginWechatAuth
(
params
);
if
(
result
&&
result
.
code
==
200
&&
result
.
data
)
{
if
(
result
)
{
that
.
setUserData
(
result
.
data
);
if
(
result
.
code
==
200
&&
result
.
data
)
{
}
that
.
setUserData
(
result
.
data
);
}
else
{
}
uni
.
showModal
({
}
else
{
title
:
"登录失败"
,
uni
.
showModal
({
content
:
"未获取到code"
,
title
:
"请求失败"
,
});
content
:
result
.
message
,
}
showCancel
:
false
,
})
});
}
uni
.
hideLoading
();
}
else
{
uni
.
showModal
({
title
:
"登录失败"
,
content
:
"未获取到code"
,
});
}
},
fail
()
{},
});
},
},
setUserData
(
userInfo
)
{
setUserData
(
userInfo
)
{
if
(
userInfo
&&
userInfo
.
token
)
{
if
(
userInfo
&&
userInfo
.
token
)
{
// 如果已经登录则直接获取相关信息
// 如果已经登录则直接获取相关信息
util
.
setOpenid
(
userInfo
.
wxopenid
);
this
.
$u
.
vuex
(
'vuex_token'
,
userInfo
.
token
);
this
.
$u
.
vuex
(
'vuex_token'
,
userInfo
.
token
);
uni
.
setStorageSync
(
"user-info"
,
userInfo
);
this
.
$u
.
vuex
(
'vuex_user'
,
userInfo
);
this
.
$u
.
vuex
(
'vuex_wx_uid'
,
userInfo
.
wxopenid
);
}
else
{
}
else
{
this
.
$u
.
vuex
(
'vuex_token'
,
''
);
this
.
$u
.
vuex
(
'vuex_token'
,
''
);
this
.
$u
.
vuex
(
'vuex_user'
,
null
);
this
.
$u
.
vuex
(
'vuex_wx_uid'
,
''
);
}
}
},
},
...
...
src/common/api/order.js
View file @
f171a843
import
util
from
'@/utils/util.js'
import
util
from
'@/utils/util.js'
let
prefix
=
""
;
prefix
=
"http://apidoc.banshouhui.com:3000/mock/31"
;
let
orderApiFun
=
function
(
vm
){
let
orderApiFun
=
function
(
vm
){
let
listByRecommendOrder
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
'/wxh-worker-rest/rest/recommend/order'
,
params
);
let
listByRecommendOrder
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
prefix
+
'/wxh-worker-rest/rest/recommend/order'
,
params
);
/**
/**
* 工单数量查询接口
* 工单数量查询接口
*/
*/
let
listOrderCount
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
'http://apidoc.banshouhui.com:3000/mock/31
/wxh-worker-rest/rest/'
+
vm
.
vuex_token
+
'/order/queryOrdersCount/V2'
,
params
);
let
listOrderCount
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
prefix
+
'
/wxh-worker-rest/rest/'
+
vm
.
vuex_token
+
'/order/queryOrdersCount/V2'
,
params
);
/**
/**
* 工单列表接口
* 工单列表接口
*/
*/
let
listOrder
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
'http://apidoc.banshouhui.com:3000/mock/31
/wxh-worker-rest/rest/'
+
vm
.
vuex_token
+
'/order/revision/list'
,
params
);
let
listOrder
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
prefix
+
'
/wxh-worker-rest/rest/'
+
vm
.
vuex_token
+
'/order/revision/list'
,
params
);
/**
/**
* 获取师傅的预约日历
* 获取师傅的预约日历
*/
*/
let
workerCalendar
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
'http://apidoc.banshouhui.com:3000/mock/31
/wxh-worker-rest/rest/'
+
vm
.
vuex_token
+
'/wokerOrder/appointment/calendar'
,
params
);
let
workerCalendar
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
prefix
+
'
/wxh-worker-rest/rest/'
+
vm
.
vuex_token
+
'/wokerOrder/appointment/calendar'
,
params
);
/**
/**
* 师傅预约
* 师傅预约
*/
*/
let
workerAppointment
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'http://apidoc.banshouhui.com:3000/mock/31
/wxh-worker-rest/rest/order/traceAndAppointment/traceOrder/'
+
vm
.
vuex_token
+
'/order/{orderId}'
,
params
,{
'content-type'
:
'application/x-www-form-urlencoded'
});
let
workerAppointment
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
prefix
+
'
/wxh-worker-rest/rest/order/traceAndAppointment/traceOrder/'
+
vm
.
vuex_token
+
'/order/{orderId}'
,
params
,{
'content-type'
:
'application/x-www-form-urlencoded'
});
// 联系顾客时间更新接口,暂时没有
// 联系顾客时间更新接口,暂时没有
/**
/**
* 师傅签到接口
* 师傅签到接口
*/
*/
let
maintainWorkerCheckin
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'http://apidoc.banshouhui.com:3000/mock/31
/wxh-worker-rest/rest/'
+
vm
.
vuex_token
+
'/order/{orderId}/maintainWorkerCheckin'
,
params
,{
'content-type'
:
'application/x-www-form-urlencoded'
});
let
maintainWorkerCheckin
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
prefix
+
'
/wxh-worker-rest/rest/'
+
vm
.
vuex_token
+
'/order/{orderId}/maintainWorkerCheckin'
,
params
,{
'content-type'
:
'application/x-www-form-urlencoded'
});
/* 过程反馈查询接口 */
let
feedbackConfig
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
`
${
prefix
}
/wxh-worker-rest/rst/order/v2/getFeedBack/`
+
vm
.
vuex_token
,
params
)
const
orderApi
=
{
const
orderApi
=
{
listByRecommendOrder
,
listByRecommendOrder
,
...
@@ -35,7 +39,8 @@ let orderApiFun = function(vm){
...
@@ -35,7 +39,8 @@ let orderApiFun = function(vm){
listOrder
,
listOrder
,
workerCalendar
,
workerCalendar
,
workerAppointment
,
workerAppointment
,
maintainWorkerCheckin
maintainWorkerCheckin
,
feedbackConfig
}
}
return
orderApi
return
orderApi
}
}
...
...
src/common/http.interceptor.js
View file @
f171a843
...
@@ -40,7 +40,6 @@ const install = (Vue, vm) => {
...
@@ -40,7 +40,6 @@ const install = (Vue, vm) => {
// toLoginPage()
// toLoginPage()
// return false
// return false
// }
// }
// // const token = app && app.globalData && app.globalData.token || ''
if
(
config
.
url
.
indexOf
(
'access-token='
)
>=
0
&&
config
.
params
[
'access-token'
]){
if
(
config
.
url
.
indexOf
(
'access-token='
)
>=
0
&&
config
.
params
[
'access-token'
]){
// 给默认参数增加access-token (Java端)
// 给默认参数增加access-token (Java端)
if
(
reg
.
test
(
config
.
url
)){
if
(
reg
.
test
(
config
.
url
)){
...
@@ -55,7 +54,6 @@ const install = (Vue, vm) => {
...
@@ -55,7 +54,6 @@ const install = (Vue, vm) => {
}
}
// config.header.token = vm.vuex_token || 'RTOKENe56f873b5823477fa2e15572f8fa7eb3a5fb6f7b';
// config.header.token = vm.vuex_token || 'RTOKENe56f873b5823477fa2e15572f8fa7eb3a5fb6f7b';
config
.
header
[
'x-requested-with'
]
=
'xmlhttprequest'
;
config
.
header
[
'x-requested-with'
]
=
'xmlhttprequest'
;
return
config
;
return
config
;
}
}
...
@@ -94,13 +92,7 @@ const install = (Vue, vm) => {
...
@@ -94,13 +92,7 @@ const install = (Vue, vm) => {
message
:
msg
message
:
msg
};
};
case
401
:
case
401
:
//需要登录的接口,当token 过期时,清掉本地token,到登录页面
// token失效,跳转登录
// if (!token) {
// uni.navigateTo({
// url: '/pages/login/index'
// });
// return;
// }
toLoginPage
()
toLoginPage
()
case
403
:
//没有权限访问
case
403
:
//没有权限访问
case
500
:
case
500
:
...
...
src/pages.json
View file @
f171a843
{
{
"easycom"
:
{
"easycom"
:
{
"^u-(.*)"
:
"@/uview-ui/components/u-$1/u-$1.vue"
"autoscan"
:
true
,
"custom"
:
{
"^u-(.*)"
:
"@/uview-ui/components/u-$1/u-$1.vue"
}
},
},
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https
:
//uniapp.dcloud.io/collocation/pages
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https
:
//uniapp.dcloud.io/collocation/pages
{
{
...
...
src/pages/login/index.vue
View file @
f171a843
...
@@ -53,30 +53,40 @@ export default {
...
@@ -53,30 +53,40 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
// 授权用户信息
//
微信
授权用户信息
getUserProfile
()
{
getUserProfile
()
{
var
that
=
this
var
that
=
this
uni
.
getUserProfile
({
if
(
uni
.
getUserProfile
)
{
desc
:
'用于授权登录'
,
// 每次触发 uni.getUserProfile 均会弹出授权窗口,用户授权后可成功获取用户信息
success
:
function
(
res
)
{
uni
.
getUserProfile
({
const
userInfo
=
res
.
userInfo
;
desc
:
'用于授权登录'
,
app
.
globalData
.
authUserInfo
=
userInfo
success
:
function
(
res
)
{
app
.
globalData
.
authUserInfo
.
nickName
=
app
.
globalData
.
authUserInfo
.
nickName
||
''
const
userInfo
=
res
.
userInfo
;
app
.
globalData
.
authUserInfo
.
avatarUrl
=
app
.
globalData
.
authUserInfo
.
avatarUrl
||
''
app
.
globalData
.
authUserInfo
=
userInfo
uni
.
showLoading
({
app
.
globalData
.
authUserInfo
.
nickName
=
app
.
globalData
.
authUserInfo
.
nickName
||
''
title
:
'授权中..'
,
app
.
globalData
.
authUserInfo
.
avatarUrl
=
app
.
globalData
.
authUserInfo
.
avatarUrl
||
''
mask
:
true
uni
.
showLoading
({
});
title
:
'授权中..'
,
that
.
authLogin
()
mask
:
true
},
});
fail
:
function
(
res
)
{
that
.
authLogin
()
uni
.
showModal
({
},
title
:
'授权失败'
,
fail
:
function
(
res
)
{
content
:
'请允许获取用户信息的授权'
,
uni
.
showModal
({
showCancel
:
false
title
:
'授权失败'
,
});
content
:
'请允许获取用户信息的授权'
,
}
showCancel
:
false
})
});
}
})
}
else
{
// 可能由于账号配置,或者其他原因导致无法调起微信用户授权
uni
.
showModal
({
title
:
'授权失败'
,
content
:
'请确认你的用户授权是否可用'
,
showCancel
:
false
});
}
},
},
authLogin
()
{
authLogin
()
{
var
that
=
this
var
that
=
this
...
...
src/pages/order/feedback.vue
View file @
f171a843
<!-- 过程反馈 -->
<!-- 过程反馈 -->
<
template
>
<
template
>
<view
class=
"feedback-box bg"
>
<view
class=
"feedback-box bg"
>
<u-navbar
back-icon-color=
"#FFFFFF"
:background=
"background"
title=
"过程反馈"
title
-color=
"#fff
"
:border-bottom=
"false"
></u-navbar>
<u-navbar
back-icon-color=
"#FFFFFF"
:background=
"background"
title=
"过程反馈"
title
Color=
"#FFFFFF
"
:border-bottom=
"false"
></u-navbar>
<view
class=
"content u-p-l-30 u-p-r-30"
>
<view
class=
"content u-p-l-30 u-p-r-30"
>
<view
class=
"width-320 u-m-t-20"
>
<
!--
<
view
class=
"width-320 u-m-t-20"
>
<u-subsection
<u-subsection
:bold=
"false"
:bold=
"false"
:current=
"cur
Now
"
:current=
"cur
Sub
"
:list=
"
l
ist"
:list=
"
subL
ist"
active-color=
"white"
active-color=
"white"
bg-color=
"white"
bg-color=
"white"
height=
"72"
height=
"72"
...
@@ -15,24 +15,49 @@
...
@@ -15,24 +15,49 @@
button-color=
"#2272FF"
button-color=
"#2272FF"
border-radius=
"36"
border-radius=
"36"
></u-subsection>
></u-subsection>
</view>
-->
<view
class=
"top-tab"
>
<u-tabs
:list=
"tabList"
:current=
"curTab"
height=
"80"
gutter=
"89"
bar-height=
"4"
bar-width=
"44"
bg-color=
"none"
active-color=
"#FFFFFF"
inactive-color=
"#FFFFFF"
font-size=
"32"
@
change=
"changeTab"
></u-tabs>
</view>
</view>
<!--
<view
class=
"con-box"
>
</view>
-->
<view
class=
"con-box"
>
<view
class=
"con-box"
>
<view
class=
"title"
>
{{
feedback
.
own
.
title
}}
</view>
<view
class=
"title"
>
{{
feedback
.
own
.
title
}}
</view>
<view
class=
"u-flex u-flex-wrap"
>
<view
class=
"u-flex u-flex-wrap"
>
<view
:class=
"
{'txt-item':true,'active':true}" v-for="(txt,index) in feedback.own.list" :key="index">
<view
<text
class=
"txt"
>
{{
txt
}}
</text>
v-for=
"(item, index) in options[curTab]"
:key=
"index"
@
click=
"changeOwn(index)"
:class=
"
{'txt-item':true,'active': (curOwn == index)}">
<text
class=
"txt"
>
{{
index
}}
</text>
</view>
</view>
</view>
</view>
</view>
<u-gap
height=
"30"
></u-gap>
<view
class=
"con-box"
>
<view
class=
"title"
>
{{
feedback
.
type
.
title
}}
</view>
<view
class=
"title"
>
{{
feedback
.
type
.
title
}}
</view>
<view
class=
"u-flex u-flex-wrap"
>
<view
class=
"u-flex u-flex-wrap"
>
<view
:class=
"
{'txt-item':true,'active':false}" v-for="(txt,index) in feedback.type.list" :key="index">
<view
v-for=
"(txt, index) in options[curTab][curOwn]"
:key=
"index"
@
click=
"changeType(txt)"
:class=
"
{'txt-item':true,'active': (curType == txt)}">
<text
class=
"txt"
>
{{
txt
}}
</text>
<text
class=
"txt"
>
{{
txt
}}
</text>
</view>
</view>
</view>
</view>
<u-input
class=
"textarea"
height=
"156"
type=
"textarea"
placeholder=
"请补充详细说明,以便于记录您的接单信用分"
></u-input>
<u-input
v-show=
"showRemark"
class=
"textarea"
height=
"156"
type=
"textarea"
placeholder=
"请补充详细说明,以便于记录您的接单信用分"
></u-input>
</view>
</view>
<appoint-time
@
dateChange=
"dateChange"
@
timeChange=
"timeChange"
@
weekChange=
"weekChange"
></appoint-time>
<appoint-time
@
dateChange=
"dateChange"
@
timeChange=
"timeChange"
@
weekChange=
"weekChange"
></appoint-time>
</view>
</view>
...
@@ -47,31 +72,105 @@
...
@@ -47,31 +72,105 @@
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
orderId
:
null
,
categoryId
:
null
,
showRemark
:
false
,
background
:
{
background
:
{
backgroundColor
:
'none'
,
backgroundColor
:
'none'
,
},
},
// questionList: ['个人', '客户', '现场/客户'],
tabList
:
[],
curTab
:
0
,
curOwn
:
""
,
curType
:
""
,
remark
:
""
,
appointTime
:
""
,
feedback
:
{
feedback
:
{
own
:{
own
:{
title
:
'问题归属'
,
title
:
'问题归属'
,
list
:[
'个人'
,
'客户'
,
'现场/客户'
],
},
},
type
:{
type
:{
title
:
'问题类型'
,
title
:
'问题类型'
,
list
:[
'有事耽搁'
,
'未带齐工具'
,
'个人改约'
,
'其他'
]
},
},
appoint
:{
appoint
:{
title
:
'预约时间'
,
title
:
'预约时间'
,
}
}
},
},
list
:[
'报备'
,
'预约'
]
,
config
:
null
,
curNow
:
1
options
:
[]
};
};
},
},
components
:{
components
:{
appointTime
appointTime
},
},
watch
:
{
vuex_token
(
val
)
{
this
.
initPageData
()
}
},
computed
:
{
},
onLoad
(
e
)
{
this
.
orderId
=
1
this
.
categoryId
=
88
if
(
e
)
{
this
.
orderId
=
e
.
orderId
||
null
this
.
categoryId
=
e
.
categoryId
||
null
}
this
.
initPageData
()
},
methods
:
{
methods
:
{
async
initPageData
()
{
let
self
=
this
let
params
=
{
categoryId
:
self
.
categoryId
}
let
res
=
await
self
.
$u
.
api
.
feedbackConfig
(
params
)
if
(
res
&&
res
.
code
==
200
)
{
self
.
config
=
res
.
data
self
.
initParams
()
self
.
buildConfig
()
}
},
buildConfig
()
{
let
self
=
this
if
(
self
.
config
)
{
let
tabs
=
Object
.
keys
(
self
.
config
)
let
list
=
Object
.
values
(
self
.
config
)
tabs
.
forEach
(
function
(
tab
,
index
){
self
.
tabList
[
index
]
=
{
name
:
tab
}
self
.
options
[
index
]
=
list
[
index
]
})
}
},
initParams
()
{
let
self
=
this
if
(
self
.
config
)
{
let
tabs
=
Object
.
keys
(
self
.
config
)
let
list
=
Object
.
values
(
self
.
config
)
let
ownVal
=
Object
.
keys
(
list
[
self
.
curTab
])[
0
]
let
types
=
Object
.
values
(
list
[
self
.
curTab
][
ownVal
])
self
.
curOwn
=
ownVal
self
.
curType
=
types
[
0
]
if
(
self
.
curTab
)
{
self
.
showRemark
=
true
}
else
{
self
.
showRemark
=
false
self
.
remark
=
""
}
}
},
/**
* 切换tab项
*/
changeTab
(
index
)
{
this
.
curTab
=
index
;
this
.
initParams
()
},
changeOwn
(
key
)
{
this
.
curOwn
=
key
;
},
changeType
(
key
)
{
this
.
curType
=
key
;
},
/**
/**
* 拒单
* 拒单
*/
*/
...
@@ -107,12 +206,28 @@
...
@@ -107,12 +206,28 @@
background-size
:
750rpx
600rpx
;
background-size
:
750rpx
600rpx
;
background-repeat
:
no-repeat
;
background-repeat
:
no-repeat
;
}
}
.feedback-box
{
.header
{
padding
:
12rpx
30rpx
40rpx
30rpx
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
.title
{
font-size
:
40rpx
;
font-weight
:
bold
;
color
:
#FFFFFF
;
}
}
}
/
deep
/
.u-subsection
{
/
deep
/
.u-subsection
{
padding
:
4rpx
!
important
;
padding
:
4rpx
!
important
;
}
}
.top-tab
{
text-align
:
center
;
}
.con-box
{
.con-box
{
margin-top
:
30rpx
;
margin-top
:
30rpx
;
padding
:
30rpx
30rpx
30rpx
2
0rpx
;
padding
:
30rpx
30rpx
28rpx
3
0rpx
;
border-radius
:
12rpx
;
border-radius
:
12rpx
;
background-color
:
#FFFFFF
;
background-color
:
#FFFFFF
;
.title
{
.title
{
...
...
src/utils/login.js
View file @
f171a843
...
@@ -76,9 +76,57 @@ function signup(data) {
...
@@ -76,9 +76,57 @@ function signup(data) {
}
}
function
oauth
()
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
uni
.
getProvider
({
service
:
'oauth'
,
success
:
function
(
res
)
{
console
.
log
(
res
.
provider
)
if
(
~
res
.
provider
.
indexOf
(
'weixin'
))
{
// weixin 微信登录
login
(
'weixin'
).
then
(
res
=>
{
resolve
(
res
)}).
catch
(
err
=>
{
reject
(
err
)})
}
else
if
(
~
res
.
provider
.
indexOf
(
'qq'
))
{
// qq QQ登录
login
(
'qq'
).
then
(
res
=>
{
resolve
(
res
)}).
catch
(
err
=>
{
reject
(
err
)})
}
else
if
(
~
res
.
provider
.
indexOf
(
'sinaweibo'
))
{
// sinaweibo 新浪微博登录
login
(
'sinaweibo'
).
then
(
res
=>
{
resolve
(
res
)}).
catch
(
err
=>
{
reject
(
err
)})
}
else
if
(
~
res
.
provider
.
indexOf
(
'xiaomi'
))
{
// xiaomi 小米登录
login
(
'xiaomi'
).
then
(
res
=>
{
resolve
(
res
)}).
catch
(
err
=>
{
reject
(
err
)})
}
else
if
(
~
res
.
provider
.
indexOf
(
'univerify'
))
{
// univerify 一键登录 App
login
(
'univerify'
).
then
(
res
=>
{
resolve
(
res
)}).
catch
(
err
=>
{
reject
(
err
)})
}
else
if
(
~
res
.
provider
.
indexOf
(
'apple'
))
{
// apple Apple登录
login
(
'apple'
).
then
(
res
=>
{
resolve
(
res
)}).
catch
(
err
=>
{
reject
(
err
)})
}
}
});
});
}
function
login
(
provider
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
uni
.
login
({
provider
:
provider
,
success
(
res
)
{
console
.
log
(
JSON
.
stringify
(
res
));
resolve
(
res
);
},
fail
(
err
)
{
console
.
log
(
JSON
.
stringify
(
err
));
reject
(
err
);
}
});
});
}
module
.
exports
=
{
module
.
exports
=
{
appLogin
:
appLogin
,
appLogin
:
appLogin
,
authorization
:
authorization
,
authorization
:
authorization
,
signup
:
signup
signup
:
signup
,
oauth
:
oauth
}
}
\ No newline at end of file
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