Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
Overview
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
高淑倩
7-Eleven
Commits
c35e2b5b
Commit
c35e2b5b
authored
Jul 29, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 动态设置导航栏背景颜色
parent
2181b981
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
65 deletions
+113
-65
userCenter.js
src/pages/userCenter/userCenter.js
+2
-0
wxService.js
src/utils/wxService.js
+111
-65
No files found.
src/pages/userCenter/userCenter.js
View file @
c35e2b5b
...
@@ -32,6 +32,8 @@ wxService.page({
...
@@ -32,6 +32,8 @@ wxService.page({
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
()
{
onLoad
()
{
// 设置 导航栏背景颜色
// wxService.getNavBarBackGroundColor('#000000', '#ff0000')
this
.
setData
(
this
.
setData
(
{
{
pages
:
[],
pages
:
[],
...
...
src/utils/wxService.js
View file @
c35e2b5b
...
@@ -8,7 +8,9 @@ import {
...
@@ -8,7 +8,9 @@ import {
}
from
'./helper'
}
from
'./helper'
import
Router
from
'./router'
import
Router
from
'./router'
import
ManageDate
from
'./manageDate'
import
ManageDate
from
'./manageDate'
import
{
cEvent
}
from
'./event'
import
{
cEvent
}
from
'./event'
import
Http
from
'./Http'
import
Http
from
'./Http'
const
Promise
=
require
(
'../lib/bluebird'
)
const
Promise
=
require
(
'../lib/bluebird'
)
const
config
=
require
(
'../config/index'
).
envInfo
const
config
=
require
(
'../config/index'
).
envInfo
...
@@ -19,13 +21,13 @@ let openCardLister = null
...
@@ -19,13 +21,13 @@ let openCardLister = null
*/
*/
const
manageDate
=
new
ManageDate
()
const
manageDate
=
new
ManageDate
()
class
WXService
extends
Http
{
class
WXService
extends
Http
{
constructor
()
{
constructor
()
{
super
()
super
()
this
.
Promise
=
Promise
this
.
Promise
=
Promise
this
.
currentPage
=
null
this
.
currentPage
=
null
}
}
getToken
()
{
getToken
()
{
return
super
.
getToken
()
return
super
.
getToken
()
}
}
...
@@ -33,7 +35,7 @@ class WXService extends Http {
...
@@ -33,7 +35,7 @@ class WXService extends Http {
* 所有接口中返回401就登录
* 所有接口中返回401就登录
* 返回402 重试 (getUserInfoLimitCount:重试次数),超过重试次数提示会员系统异常,请联系管理员
* 返回402 重试 (getUserInfoLimitCount:重试次数),超过重试次数提示会员系统异常,请联系管理员
*/
*/
request
({
request
({
url
,
url
,
data
,
data
,
header
,
header
,
...
@@ -42,7 +44,8 @@ class WXService extends Http {
...
@@ -42,7 +44,8 @@ class WXService extends Http {
responseType
,
responseType
,
success
,
success
,
fail
,
fail
,
complete
})
{
complete
})
{
return
super
.
request
.
apply
(
this
,
arguments
).
finally
(()
=>
{
return
super
.
request
.
apply
(
this
,
arguments
).
finally
(()
=>
{
this
.
setPageLoadStatus
()
this
.
setPageLoadStatus
()
wx
.
hideLoading
()
wx
.
hideLoading
()
...
@@ -77,7 +80,7 @@ class WXService extends Http {
...
@@ -77,7 +80,7 @@ class WXService extends Http {
// const perpage = pages[pages.length - 1]
// const perpage = pages[pages.length - 1]
// perpage.onShow()
// perpage.onShow()
// },2000)
// },2000)
// }
// }
if
(
res
.
msg
&&
res
.
msg
.
indexOf
(
'未登录'
)
>
-
1
)
{
if
(
res
.
msg
&&
res
.
msg
.
indexOf
(
'未登录'
)
>
-
1
)
{
if
(
!
this
.
getUserInfoLimitCount
)
{
if
(
!
this
.
getUserInfoLimitCount
)
{
...
@@ -95,7 +98,7 @@ class WXService extends Http {
...
@@ -95,7 +98,7 @@ class WXService extends Http {
}
else
{
}
else
{
this
.
reLogin
()
this
.
reLogin
()
}
}
}
else
if
(
res
.
msg
&&
res
.
msg
.
indexOf
(
'请重新授权'
)
>
-
1
)
{
}
else
if
(
res
.
msg
&&
res
.
msg
.
indexOf
(
'请重新授权'
)
>
-
1
)
{
wx
.
setStorageSync
(
'reLoginErr'
,
true
)
wx
.
setStorageSync
(
'reLoginErr'
,
true
)
// wxService.router(`/pages/userCenter/userCenter`).replace()
// wxService.router(`/pages/userCenter/userCenter`).replace()
console
.
log
(
"授权跳转"
)
console
.
log
(
"授权跳转"
)
...
@@ -105,7 +108,7 @@ class WXService extends Http {
...
@@ -105,7 +108,7 @@ class WXService extends Http {
}
}
// 所有页面都有接口load状态
// 所有页面都有接口load状态
setPageLoadStatus
()
{
setPageLoadStatus
()
{
if
(
this
.
currentPage
)
{
if
(
this
.
currentPage
)
{
this
.
nextTick
(()
=>
{
this
.
nextTick
(()
=>
{
this
.
currentPage
.
setData
({
this
.
currentPage
.
setData
({
...
@@ -120,52 +123,57 @@ class WXService extends Http {
...
@@ -120,52 +123,57 @@ class WXService extends Http {
* @param url
* @param url
* @param switchTab 是否是switchTab导航
* @param switchTab 是否是switchTab导航
*/
*/
router
(
url
,
switchTab
)
{
router
(
url
,
switchTab
)
{
return
new
Router
(
url
,
switchTab
)
return
new
Router
(
url
,
switchTab
)
}
}
back
(
dintance
)
{
back
(
dintance
)
{
this
.
router
().
back
(
dintance
)
this
.
router
().
back
(
dintance
)
}
}
replace
(
url
)
{
replace
(
url
)
{
this
.
router
(
url
).
replace
()
this
.
router
(
url
).
replace
()
}
}
all
()
{
all
()
{
return
Promise
.
all
.
apply
(
Promise
,
arguments
)
return
Promise
.
all
.
apply
(
Promise
,
arguments
)
}
}
/**
/**
* 更新缓存 登陆
* 更新缓存 登陆
*
*
*/
*/
reLogin
()
{
reLogin
()
{
wx
.
setStorageSync
(
'token'
,
''
)
wx
.
setStorageSync
(
'token'
,
''
)
const
app
=
getApp
()
const
app
=
getApp
()
var
_this
=
this
var
_this
=
this
return
_this
.
login
().
then
(
result
=>
{
return
_this
.
login
().
then
(
result
=>
{
if
(
result
.
code
)
{
if
(
result
.
code
)
{
_this
.
post
(
`/member/minaLogin`
,
{
_this
.
post
(
`/member/minaLogin`
,
{
code
:
result
.
code
,
code
:
result
.
code
,
wechatInfo
:
null
,
wechatInfo
:
null
,
brandId
:
app
.
globalData
.
brandId
,
brandId
:
app
.
globalData
.
brandId
,
}).
then
(
response
=>
{
}).
then
(
response
=>
{
let
dataResp
=
response
.
data
.
data
let
dataResp
=
response
.
data
.
data
wx
.
setStorageSync
(
'token'
,
dataResp
.
token
)
wx
.
setStorageSync
(
'token'
,
dataResp
.
token
)
wx
.
setStorageSync
(
'_baseUserInfo'
,
dataResp
)
wx
.
setStorageSync
(
'_baseUserInfo'
,
dataResp
)
return
Promise
.
resolve
({
response
})
return
Promise
.
resolve
({
}).
catch
(
err
=>
{
response
})
}).
catch
(
err
=>
{
return
Promise
.
reject
(
err
)
return
Promise
.
reject
(
err
)
})
})
}
else
{
}
else
{
return
Promise
.
reject
({
state
:
2
,
info
:
res
.
data
.
data
})
return
Promise
.
reject
({
state
:
2
,
info
:
res
.
data
.
data
})
}
}
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
})
})
}
}
login
()
{
login
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
login
({
wx
.
login
({
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
...
@@ -179,7 +187,7 @@ class WXService extends Http {
...
@@ -179,7 +187,7 @@ class WXService extends Http {
})
})
}
}
getBaseUserInfo
()
{
getBaseUserInfo
()
{
if
(
!
this
.
baseUserInfo
)
{
if
(
!
this
.
baseUserInfo
)
{
let
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
let
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
this
.
baseUserInfo
=
baseUserInfo
this
.
baseUserInfo
=
baseUserInfo
...
@@ -188,7 +196,7 @@ class WXService extends Http {
...
@@ -188,7 +196,7 @@ class WXService extends Http {
}
}
// 通过unionId获取用户信息并更新token(防止token信息过期)
// 通过unionId获取用户信息并更新token(防止token信息过期)
getUserInfo
()
{
getUserInfo
()
{
const
baseUserInfo
=
this
.
getBaseUserInfo
()
const
baseUserInfo
=
this
.
getBaseUserInfo
()
wx
.
showLoading
({
wx
.
showLoading
({
title
:
'正在加载...'
,
title
:
'正在加载...'
,
...
@@ -203,30 +211,40 @@ class WXService extends Http {
...
@@ -203,30 +211,40 @@ class WXService extends Http {
console
.
log
(
'i-user/info res is %o '
,
res
)
console
.
log
(
'i-user/info res is %o '
,
res
)
if
(
res
.
data
.
code
===
-
10001
)
{
if
(
res
.
data
.
code
===
-
10001
)
{
this
.
showToast
(
`
${
res
.
data
.
message
}
`
)
this
.
showToast
(
`
${
res
.
data
.
message
}
`
)
return
Promise
.
reject
({
state
:
-
10001
})
return
Promise
.
reject
({
state
:
-
10001
})
}
else
if
(
res
.
data
.
data
.
isMember
===
'1'
)
{
}
else
if
(
res
.
data
.
data
.
isMember
===
'1'
)
{
let
baseUserInfo
=
this
.
getBaseUserInfo
()
let
baseUserInfo
=
this
.
getBaseUserInfo
()
let
newBaseUserInfo
=
{
...
baseUserInfo
,
...
res
.
data
.
data
}
let
newBaseUserInfo
=
{
...
baseUserInfo
,
...
res
.
data
.
data
}
this
.
baseUserInfo
=
newBaseUserInfo
this
.
baseUserInfo
=
newBaseUserInfo
wx
.
setStorageSync
(
'_baseUserInfo'
,
newBaseUserInfo
)
wx
.
setStorageSync
(
'_baseUserInfo'
,
newBaseUserInfo
)
// wx.setStorageSync('buyer-token', res.data.data.token)
// wx.setStorageSync('buyer-token', res.data.data.token)
wx
.
setStorageSync
(
'token'
,
res
.
data
.
data
.
token
)
wx
.
setStorageSync
(
'token'
,
res
.
data
.
data
.
token
)
this
.
startReport
()
this
.
startReport
()
return
Promise
.
resolve
({
state
:
1
,
info
:
res
.
data
.
data
})
return
Promise
.
resolve
({
state
:
1
,
info
:
res
.
data
.
data
})
}
else
{
}
else
{
// this.openCard()
// this.openCard()
return
Promise
.
resolve
({
state
:
2
,
info
:
res
.
data
.
data
})
return
Promise
.
resolve
({
state
:
2
,
info
:
res
.
data
.
data
})
}
}
}).
finally
(()
=>
{
}).
finally
(()
=>
{
wx
.
hideLoading
()
wx
.
hideLoading
()
})
})
}
}
getManageDate
()
{
getManageDate
()
{
return
manageDate
return
manageDate
}
}
selectAll
(
selector
,
options
)
{
selectAll
(
selector
,
options
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
createSelectorQuery
().
selectAll
(
'.page-body'
).
fields
(
options
,
(
res
)
=>
{
wx
.
createSelectorQuery
().
selectAll
(
'.page-body'
).
fields
(
options
,
(
res
)
=>
{
resolve
(
res
)
resolve
(
res
)
...
@@ -234,15 +252,15 @@ class WXService extends Http {
...
@@ -234,15 +252,15 @@ class WXService extends Http {
})
})
}
}
scrollOffset
()
{
scrollOffset
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
createSelectorQuery
().
selectViewport
().
scrollOffset
(
function
(
res
)
{
wx
.
createSelectorQuery
().
selectViewport
().
scrollOffset
(
function
(
res
)
{
resolve
(
res
)
resolve
(
res
)
}).
exec
()
}).
exec
()
})
})
}
}
showModal
(
config
=
{})
{
showModal
(
config
=
{})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
showModal
({
wx
.
showModal
({
...
config
,
...
config
,
...
@@ -260,7 +278,7 @@ class WXService extends Http {
...
@@ -260,7 +278,7 @@ class WXService extends Http {
})
})
}
}
getSystemInfo
()
{
getSystemInfo
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getSystemInfo
({
wx
.
getSystemInfo
({
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
...
@@ -276,6 +294,17 @@ class WXService extends Http {
...
@@ -276,6 +294,17 @@ class WXService extends Http {
})
})
}
}
getNavBarBackGroundColor
(
fc
,
bgc
)
{
wx
.
setNavigationBarColor
({
frontColor
:
fc
,
backgroundColor
:
bgc
,
animation
:
{
duration
:
400
,
timingFunc
:
'easeIn'
}
})
}
// handlerPage (page) {
// handlerPage (page) {
// const AccreditWhitePages = [
// const AccreditWhitePages = [
...
@@ -334,7 +363,7 @@ class WXService extends Http {
...
@@ -334,7 +363,7 @@ class WXService extends Http {
// }
// }
// 设置异步的全局变量值
// 设置异步的全局变量值
initAppGlobalDataSync
()
{
initAppGlobalDataSync
()
{
const
app
=
this
.
getApp
()
const
app
=
this
.
getApp
()
if
(
!
app
.
globalData
.
userInfo
)
{
if
(
!
app
.
globalData
.
userInfo
)
{
const
userInfo
=
wx
.
getStorageSync
(
'_userInfo'
)
const
userInfo
=
wx
.
getStorageSync
(
'_userInfo'
)
...
@@ -350,35 +379,35 @@ class WXService extends Http {
...
@@ -350,35 +379,35 @@ class WXService extends Http {
}
}
}
}
page
(
config
)
{
page
(
config
)
{
const
_self
=
this
const
_self
=
this
const
CONFIG_PAPGE
=
{
const
CONFIG_PAPGE
=
{
onLoad
:
function
(...
args
)
{
onLoad
:
function
(...
args
)
{
const
page
=
this
const
page
=
this
_self
.
initAppGlobalDataSync
()
_self
.
initAppGlobalDataSync
()
config
.
onLoad
&&
config
.
onLoad
.
apply
(
page
,
args
)
config
.
onLoad
&&
config
.
onLoad
.
apply
(
page
,
args
)
},
},
onShow
:
function
(...
args
)
{
onShow
:
function
(...
args
)
{
const
page
=
this
const
page
=
this
_self
.
currentPage
=
page
_self
.
currentPage
=
page
config
.
onShow
&&
config
.
onShow
.
apply
(
page
,
args
)
config
.
onShow
&&
config
.
onShow
.
apply
(
page
,
args
)
},
},
onReady
:
function
(...
args
)
{
onReady
:
function
(...
args
)
{
config
.
onReady
&&
config
.
onReady
.
apply
(
this
,
args
)
config
.
onReady
&&
config
.
onReady
.
apply
(
this
,
args
)
},
},
onHide
:
function
(...
args
)
{
onHide
:
function
(...
args
)
{
const
page
=
this
const
page
=
this
config
.
onHide
&&
config
.
onHide
.
apply
(
this
,
args
)
config
.
onHide
&&
config
.
onHide
.
apply
(
this
,
args
)
},
},
onUnload
:
function
(...
args
)
{
onUnload
:
function
(...
args
)
{
config
.
onUnload
&&
config
.
onUnload
.
apply
(
this
,
args
)
config
.
onUnload
&&
config
.
onUnload
.
apply
(
this
,
args
)
},
},
onPageScroll
:
function
(...
args
)
{
onPageScroll
:
function
(...
args
)
{
config
.
onPageScroll
&&
config
.
onPageScroll
.
apply
(
this
,
args
)
config
.
onPageScroll
&&
config
.
onPageScroll
.
apply
(
this
,
args
)
},
},
onShareAppMessage
:
function
(...
args
)
{
onShareAppMessage
:
function
(...
args
)
{
const
page
=
this
const
page
=
this
const
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
const
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
let
openId
=
''
let
openId
=
''
...
@@ -390,7 +419,7 @@ class WXService extends Http {
...
@@ -390,7 +419,7 @@ class WXService extends Http {
try
{
try
{
let
shareConfig
=
config
.
onShareAppMessage
.
apply
(
this
,
args
)
let
shareConfig
=
config
.
onShareAppMessage
.
apply
(
this
,
args
)
if
(
!
shareConfig
)
{
if
(
!
shareConfig
)
{
}
else
{
}
else
{
}
}
...
@@ -404,7 +433,7 @@ class WXService extends Http {
...
@@ -404,7 +433,7 @@ class WXService extends Http {
Page
(
Object
.
assign
({},
config
,
CONFIG_PAPGE
))
Page
(
Object
.
assign
({},
config
,
CONFIG_PAPGE
))
}
}
checkSession
()
{
checkSession
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
checkSession
({
wx
.
checkSession
({
success
:
(
data
)
=>
{
success
:
(
data
)
=>
{
...
@@ -417,7 +446,7 @@ class WXService extends Http {
...
@@ -417,7 +446,7 @@ class WXService extends Http {
})
})
}
}
nextTick
(
fn
)
{
nextTick
(
fn
)
{
if
(
wx
.
nextTick
)
{
if
(
wx
.
nextTick
)
{
wx
.
nextTick
(()
=>
{
wx
.
nextTick
(()
=>
{
fn
()
fn
()
...
@@ -429,14 +458,17 @@ class WXService extends Http {
...
@@ -429,14 +458,17 @@ class WXService extends Http {
}
}
}
}
showToast
({
title
,
icon
=
'none'
})
{
showToast
({
title
,
icon
=
'none'
})
{
wx
.
showToast
({
wx
.
showToast
({
title
,
title
,
icon
icon
})
})
}
}
getConnectedWifi
()
{
getConnectedWifi
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getConnectedWifi
({
wx
.
getConnectedWifi
({
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
...
@@ -450,21 +482,29 @@ class WXService extends Http {
...
@@ -450,21 +482,29 @@ class WXService extends Http {
})
})
}
}
navigateToMiniProgram
(
options
)
{
navigateToMiniProgram
(
options
)
{
const
_self
=
this
const
_self
=
this
const
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
const
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
openCardLister
)
{
if
(
!
openCardLister
)
{
openCardLister
=
cEvent
.
on
(
'openCardSuccess'
,
function
(
data
)
{
openCardLister
=
cEvent
.
on
(
'openCardSuccess'
,
function
(
data
)
{
openCardLister
=
null
openCardLister
=
null
resolve
(
data
)
resolve
(
data
)
})
})
}
}
this
.
showOpenCardModal
({
_self
,
options
,
reject
})
this
.
showOpenCardModal
({
_self
,
options
,
reject
})
})
})
return
promise
return
promise
}
}
showOpenCardModal
({
options
,
_self
,
reject
})
{
showOpenCardModal
({
options
,
_self
,
reject
})
{
if
(
this
.
showOpenCardModelLock
)
{
if
(
this
.
showOpenCardModelLock
)
{
return
false
return
false
}
}
...
@@ -473,11 +513,11 @@ class WXService extends Http {
...
@@ -473,11 +513,11 @@ class WXService extends Http {
wx
.
navigateToMiniProgram
({
wx
.
navigateToMiniProgram
({
appId
:
'wxeb490c6f9b154ef9'
,
// 固定为此 appid,不可改动
appId
:
'wxeb490c6f9b154ef9'
,
// 固定为此 appid,不可改动
extraData
:
options
,
// 包括 encrypt_card_id, outer_str, biz三个字段,须从 step3 中获得的链接中获取参数
extraData
:
options
,
// 包括 encrypt_card_id, outer_str, biz三个字段,须从 step3 中获得的链接中获取参数
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
log
(
'navigateToMiniProgram success data is %o'
,
data
)
console
.
log
(
'navigateToMiniProgram success data is %o'
,
data
)
_self
.
lock
=
false
_self
.
lock
=
false
},
},
fail
:
function
(
data
)
{
fail
:
function
(
data
)
{
console
.
log
(
'navigateToMiniProgram fail data is %o'
,
data
)
console
.
log
(
'navigateToMiniProgram fail data is %o'
,
data
)
this
.
router
(
'/pages/userCenter/userCenter'
)
this
.
router
(
'/pages/userCenter/userCenter'
)
// this.router('/pages/welcome/welcome')
// this.router('/pages/welcome/welcome')
...
@@ -521,7 +561,7 @@ class WXService extends Http {
...
@@ -521,7 +561,7 @@ class WXService extends Http {
}
}
/**
/**
* 开卡
* 开卡
*/
*/
openCard
()
{
openCard
()
{
const
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
const
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
@@ -537,7 +577,9 @@ class WXService extends Http {
...
@@ -537,7 +577,9 @@ class WXService extends Http {
outer_str
:
baseUserInfo
.
outerStr
outer_str
:
baseUserInfo
.
outerStr
})
})
}
else
{
}
else
{
reject
({
state
:
0
})
reject
({
state
:
0
})
}
}
})
})
// 注释原因 所有跳转前 判断新老会员
// 注释原因 所有跳转前 判断新老会员
...
@@ -563,22 +605,25 @@ class WXService extends Http {
...
@@ -563,22 +605,25 @@ class WXService extends Http {
*/
*/
openCardList
()
{
openCardList
()
{
// wechatCardId wechatCode
// wechatCardId wechatCode
const
{
wechatCardId
,
wechatCode
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
const
{
wechatCardId
,
wechatCode
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
wx
.
openCard
({
wx
.
openCard
({
cardList
:
[{
cardList
:
[{
cardId
:
wechatCardId
,
cardId
:
wechatCardId
,
code
:
wechatCode
code
:
wechatCode
}],
}],
success
(
res
)
{
success
(
res
)
{
console
.
log
(
'openCardList success'
,
res
)
console
.
log
(
'openCardList success'
,
res
)
},
},
fail
(
err
){
fail
(
err
)
{
console
.
log
(
'openCardList fail data is %o'
,
err
)
console
.
log
(
'openCardList fail data is %o'
,
err
)
}
}
})
})
}
}
getRandom
(
num
=
1
)
{
getRandom
(
num
=
1
)
{
let
random
=
Math
.
random
()
let
random
=
Math
.
random
()
if
(
random
<
0.1
)
{
if
(
random
<
0.1
)
{
random
+=
0.1
random
+=
0.1
...
@@ -591,8 +636,8 @@ class WXService extends Http {
...
@@ -591,8 +636,8 @@ class WXService extends Http {
}
}
// 打开登录弹框
// 打开登录弹框
openAuthModal
(){
openAuthModal
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
resolve
({
resolve
({
isAuthorization
:
true
isAuthorization
:
true
})
})
...
@@ -602,4 +647,4 @@ class WXService extends Http {
...
@@ -602,4 +647,4 @@ class WXService extends Http {
}
}
const
wxService
=
new
WXService
()
const
wxService
=
new
WXService
()
module
.
exports
=
wxService
module
.
exports
=
wxService
\ 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