Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
zhwy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 69e8e502
authored
Jan 16, 2024
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交
1 parent
4214a1c8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
24 deletions
packageActivity/pages/redEnvelope/index/index.js
packageActivity/pages/redEnvelope/index/index.wxml
packageActivity/pages/solitaire/index/index.js
pages/loading/loading.js
router/router.js
packageActivity/pages/redEnvelope/index/index.js
View file @
69e8e50
// packageActivity/pages/redEnvelope/index/index.js
// packageActivity/pages/redEnvelope/index/index.js
import
{
jumpAuthMixin
}
from
'~/mixins/index'
import
{
domain
}
from
'~/api/env/index'
Page
({
Page
({
behaviors
:
[
jumpAuthMixin
],
/**
/**
* 页面的初始数据
* 页面的初始数据
*/
*/
...
@@ -26,9 +32,55 @@ Page({
...
@@ -26,9 +32,55 @@ Page({
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
*/
*/
onShow
()
{
onShow
()
{
const
{
options
}
=
this
if
(
options
.
isLogin
)
this
.
jumpRedEnvelopeH5
()
else
{
//强制登陆、防止sessionId失效
let
query
=
[
'isLogin=1'
]
Object
.
keys
(
options
).
map
(
key
=>
{
query
.
push
(
`
${
key
}
=
${
options
[
key
]}
`
)
})
let
url
=
encodeURIComponent
(
`/
${
this
.
route
}
?
${
query
.
join
(
'&'
)}
`
)
wx
.
p
.
router
.
redirectTo
(
'/pages/loading/loading'
,
{
url
,
merchantId
:
options
.
merchantId
})
}
},
async
jumpRedEnvelopeH5
()
{
const
res
=
await
wx
.
p
.
router
.
intercept
()
if
(
!
res
)
{
const
{
userInfo
}
=
this
.
data
,
{
activityId
,
merchantId
}
=
this
.
options
,
{
sessionId
}
=
wx
.
p
.
storage
.
get
()
if
(
!
userInfo
.
nickName
)
return
this
.
getNickNameAndHeadUrl
()
const
{
accountId
,
nickName
,
unionId
,
openid
,
phone
}
=
userInfo
let
user
=
encodeURIComponent
(
JSON
.
stringify
({
accountId
,
nickName
,
unionId
,
openid
,
phone
}))
this
.
setData
({
// url: `${domain}/scrm-wx-red-packet/#/redEnvelope?activityId=${activityId}&merchantId=${merchantId}&sessionId=${sessionId}&userInfo=${user}` //测试、预发布、生产
url
:
`
${
domain
}
/dj-scrm-wx-work-main-lwk/#/?activityId=
${
activityId
}
&merchantId=
${
merchantId
}
&sessionId=
${
sessionId
}
&userInfo=
${
user
}
`
//开发环境
})
}
},
},
/**
/**
* 生命周期函数--监听页面隐藏
* 生命周期函数--监听页面隐藏
*/
*/
...
@@ -55,12 +107,5 @@ Page({
...
@@ -55,12 +107,5 @@ Page({
*/
*/
onReachBottom
()
{
onReachBottom
()
{
},
/**
* 用户点击右上角分享
*/
onShareAppMessage
()
{
}
}
})
})
\ No newline at end of file
\ No newline at end of file
packageActivity/pages/redEnvelope/index/index.wxml
View file @
69e8e50
<!--packageActivity/pages/redEnvelope/index/index.wxml-->
<text>packageActivity/pages/redEnvelope/index/index.wxml</text>
\ No newline at end of file
\ No newline at end of file
<web-view src="{{url}}"/>
\ No newline at end of file
\ No newline at end of file
packageActivity/pages/solitaire/index/index.js
View file @
69e8e50
...
@@ -118,7 +118,6 @@ Page({
...
@@ -118,7 +118,6 @@ Page({
this
.
getSolitaireDetail
(
params
)
this
.
getSolitaireDetail
(
params
)
}
else
throw
message
}
else
throw
message
}
catch
(
error
)
{
}
catch
(
error
)
{
return
console
.
log
(
error
)
console
.
log
(
error
)
wx
.
showModal
({
wx
.
showModal
({
title
:
'温馨提示'
,
title
:
'温馨提示'
,
...
@@ -186,5 +185,4 @@ Page({
...
@@ -186,5 +185,4 @@ Page({
onReachBottom
()
{
onReachBottom
()
{
},
},
onShareAppMessage
()
{}
})
})
\ No newline at end of file
\ No newline at end of file
pages/loading/loading.js
View file @
69e8e50
// pages/loading/loading.js
// pages/loading/loading.js
import
{
systemApi
}
from
'~/api/index'
import
{
systemApi
}
from
'~/api/index'
Page
({
Page
({
/**
/**
* 页面的初始数据
* 页面的初始数据
...
@@ -26,7 +28,7 @@ Page({
...
@@ -26,7 +28,7 @@ Page({
async
login
(
options
=
{})
{
async
login
(
options
=
{})
{
console
.
log
(
options
,
'options.merchantId'
)
console
.
log
(
options
,
'options.merchantId'
)
// wx.p.router.goHome()
// wx.p.router.goHome()
if
(
options
.
merchantId
){
if
(
options
.
merchantId
)
{
wx
.
$merchant_id
=
options
.
merchantId
wx
.
$merchant_id
=
options
.
merchantId
wx
.
p
.
storage
.
set
(
'merchant_info'
,
{
wx
.
p
.
storage
.
set
(
'merchant_info'
,
{
merchantId
:
options
.
merchantId
,
merchantId
:
options
.
merchantId
,
...
@@ -35,7 +37,11 @@ Page({
...
@@ -35,7 +37,11 @@ Page({
wx
.
p
.
storage
.
set
(
'first_enter_miniprograme'
,
true
)
wx
.
p
.
storage
.
set
(
'first_enter_miniprograme'
,
true
)
}
}
try
{
try
{
const
{
code
,
data
,
message
}
=
await
wx
.
p
.
api
.
userApi
.
login
()
const
{
code
,
data
,
message
}
=
await
wx
.
p
.
api
.
userApi
.
login
()
wx
.
$LoginStatus
=
code
!=
0
wx
.
$LoginStatus
=
code
!=
0
if
(
data
)
if
(
data
)
wx
.
p
.
storage
.
set
(
'merchant_info'
,
{
wx
.
p
.
storage
.
set
(
'merchant_info'
,
{
...
@@ -65,12 +71,16 @@ Page({
...
@@ -65,12 +71,16 @@ Page({
},
},
async
getSceneById
(
scene
)
{
async
getSceneById
(
scene
)
{
const
id
=
decodeURIComponent
(
scene
).
split
(
'='
).
at
(
-
1
)
const
id
=
decodeURIComponent
(
scene
).
split
(
'='
).
at
(
-
1
)
console
.
log
(
decodeURIComponent
(
scene
),
'decodeURIComponent(scene)'
);
console
.
log
(
decodeURIComponent
(
scene
),
'decodeURIComponent(scene)'
);
try
{
try
{
const
{
code
,
data
}
=
await
wx
.
p
.
api
.
wechatApi
.
getSceneById
({
const
{
code
,
data
}
=
await
wx
.
p
.
api
.
wechatApi
.
getSceneById
({
id
id
})
})
const
params
=
data
.
scene
.
split
(
'url='
),
options
=
{}
const
params
=
data
.
scene
.
split
(
'url='
),
options
=
{}
data
.
scene
.
split
(
'&'
).
map
(
item
=>
{
data
.
scene
.
split
(
'&'
).
map
(
item
=>
{
const
[
key
,
val
]
=
item
.
split
(
'='
)
const
[
key
,
val
]
=
item
.
split
(
'='
)
options
[
key
]
=
val
options
[
key
]
=
val
...
@@ -86,7 +96,10 @@ Page({
...
@@ -86,7 +96,10 @@ Page({
jumpPage
(
options
)
{
jumpPage
(
options
)
{
console
.
log
(
options
);
console
.
log
(
options
);
const
targetPath
=
decodeURIComponent
(
options
.
url
),
const
targetPath
=
decodeURIComponent
(
options
.
url
),
{
url
,
events
}
=
this
.
setRouteData
(
targetPath
),
{
url
,
events
}
=
this
.
setRouteData
(
targetPath
),
routeName
=
this
.
tabList
.
findIndex
(
e
=>
`/
${
e
.
pagePath
}
`
==
`
${
url
}
.html`
)
>
-
1
?
'switchTab'
:
'redirectTo'
routeName
=
this
.
tabList
.
findIndex
(
e
=>
`/
${
e
.
pagePath
}
`
==
`
${
url
}
.html`
)
>
-
1
?
'switchTab'
:
'redirectTo'
events
.
notIntercept
=
true
events
.
notIntercept
=
true
events
.
merchantId
=
options
.
merchantId
||
''
events
.
merchantId
=
options
.
merchantId
||
''
...
@@ -94,7 +107,9 @@ Page({
...
@@ -94,7 +107,9 @@ Page({
},
},
setRouteData
(
targetPath
)
{
setRouteData
(
targetPath
)
{
let
[
url
,
query
]
=
targetPath
.
split
(
'?'
),
let
[
url
,
query
]
=
targetPath
.
split
(
'?'
),
events
=
{}
events
=
{
isLogin
:
1
}
if
(
query
)
{
if
(
query
)
{
let
arr
=
query
.
split
(
'&'
)
let
arr
=
query
.
split
(
'&'
)
arr
.
map
(
e
=>
{
arr
.
map
(
e
=>
{
...
...
router/router.js
View file @
69e8e50
...
@@ -88,8 +88,9 @@ class Router {
...
@@ -88,8 +88,9 @@ class Router {
* @param {*} callBack true未登录 false已登录
* @param {*} callBack true未登录 false已登录
*/
*/
async
intercept
(
auto
=
true
)
{
async
intercept
(
auto
=
true
)
{
const
authStatus
=
wx
.
$LoginStatus
const
authStatus
=
wx
.
$LoginStatus
,
if
(
authStatus
)
{
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
||
{}
if
(
!
userInfo
.
phone
||
authStatus
)
{
if
(
auto
)
wx
.
navigateTo
({
if
(
auto
)
wx
.
navigateTo
({
url
:
'/pages/Login/Login'
,
url
:
'/pages/Login/Login'
,
})
})
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment