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 839af115
authored
Jan 16, 2024
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交
1 parent
69e8e502
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
313 additions
and
115 deletions
api/module/solitaire.js
mixins/jumpAuthMixin.js
packageActivity/pages/redEnvelope/index/index.js
packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.js
packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.json
packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.scss
packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.wxml
packageActivity/pages/solitaire/index/index.js
packageActivity/pages/solitaire/index/index.json
packageActivity/pages/solitaire/index/index.wxml
api/module/solitaire.js
View file @
839af11
...
...
@@ -31,4 +31,12 @@ module.exports = {
...
data
})
},
/** 提交接龙 */
commitSolitaire
(
data
)
{
return
api
.
post
({
method
:
'marketing.api.activityRedEnvelope.relay.lottery.user.commit'
,
projectName
,
...
data
})
}
}
\ No newline at end of file
mixins/jumpAuthMixin.js
View file @
839af11
...
...
@@ -6,5 +6,19 @@ module.exports = Behavior({
wxUrl
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
appid
}
&redirect_uri=
${
encodeURIComponent
(
redirectUrl
)}
&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
wx
.
p
.
router
.
jumpH5
(
wxUrl
)
},
jumpLoading
()
{
const
{
options
}
=
this
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
})
},
}
})
\ No newline at end of file
packageActivity/pages/redEnvelope/index/index.js
View file @
839af11
...
...
@@ -36,18 +36,7 @@ Page({
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
})
}
else
this
.
jumpLoading
()
//直接打开时跳转、防止sessionId失效
},
async
jumpRedEnvelopeH5
()
{
const
res
=
await
wx
.
p
.
router
.
intercept
()
...
...
packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.js
0 → 100644
View file @
839af11
// packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.js
Component
({
/**
* 组件的属性列表
*/
properties
:
{
show
:
Boolean
,
type
:
{
type
:
Number
,
value
:
2
},
title
:
String
},
/**
* 组件的初始数据
*/
data
:
{
},
/**
* 组件的方法列表
*/
methods
:
{
close
()
{
this
.
setData
({
show
:
false
})
}
}
})
\ No newline at end of file
packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.json
0 → 100644
View file @
839af11
{
"component"
:
true
,
"usingComponents"
:
{}
}
\ No newline at end of file
packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.scss
0 → 100644
View file @
839af11
/* packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.wxss */
.box
{
width
:
100vw
;
height
:
100vh
;
position
:
fixed
;
top
:
0
;
left
:
0
;
z-index
:
101
;
background-color
:
rgba
(
$color
:
#000000
,
$alpha
:
.5
);
.content
{
position
:
absolute
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
width
:
516rpx
;
height
:
641rpx
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
// background-color: #096;
.bg
{
position
:
absolute
;
width
:
682rpx
;
height
:
724rpx
;
z-index
:
-1
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
.title
{
font-weight
:
600
;
font-size
:
40rpx
;
color
:
#333333
;
padding
:
200rpx
0
18rpx
;
max-width
:
360rpx
;
text-align
:
center
;
line-height
:
56rpx
;
}
.text
{
font-weight
:
400
;
font-size
:
28rpx
;
color
:
#333333
;
line-height
:
44rpx
;
max-width
:
352rpx
;
text-align
:
center
;
}
.btn
{
position
:
absolute
;
bottom
:
114rpx
;
left
:
50%
;
transform
:
translateX
(
-50%
);
width
:
272rpx
;
height
:
68rpx
;
background-image
:
linear-gradient
(
90deg
,
#FE9461
15%
,
#FC5B32
90%
);
border-radius
:
34rpx
;
font-size
:
32rpx
;
color
:
#FFFFFF
;
text-align
:
center
;
line-height
:
68rpx
;
}
}
.expire
{}
}
\ No newline at end of file
packageActivity/pages/solitaire/components/solitairePopup/solitairePopup.wxml
0 → 100644
View file @
839af11
<block wx:if="{{show}}">
<view class="box">
<view class="content">
<view class="bg">
<glsx-image src="activity/{{type == 1?'default-bg':'expire-bg'}}.png"></glsx-image>
</view>
<block wx:if="{{type == 1}}">
<view class="title">{{title}}</view>
</block>
<block wx:else>
<view class="title"> 很遗憾您未中奖!敬请期待下次活动!</view>
</block>
<block wx:if="{{type == 1}}">
<view class="text">很遗憾您未参加此次接龙!敬请期待下次活动!</view>
</block>
<block wx:else>
<view class="text">本次开奖数字为:3</view>
<view class="text">您选择的数字为:4</view>
</block>
<view class="btn" bindtap="close">好的</view>
</view>
</view>
</block>
\ No newline at end of file
packageActivity/pages/solitaire/index/index.js
View file @
839af11
...
...
@@ -15,52 +15,35 @@ Page({
data
:
{
list
:
[]
},
bindPickerChange
:
function
(
e
)
{
this
.
setData
({
'params.num'
:
e
.
detail
.
value
})
},
inSolitaire
()
{
const
{
userInfo
}
=
this
.
data
this
.
setData
({
flag
:
true
})
/**
* 生命周期函数--监听页面加载
*/
onLoad
(
options
)
{
this
.
setData
({
'params.name'
:
userInfo
.
nickName
popupTitle
:
'接龙时间已截止!'
//此群无法进行接龙游戏!
})
},
submit
()
{
try
{
const
{
params
}
=
this
.
data
console
.
log
(
params
)
if
(
!
params
.
name
)
throw
'请输入名称!'
if
(
!
params
.
num
)
throw
'请选择数字!'
}
catch
(
error
)
{
if
(
error
)
wx
.
p
.
wxApi
.
showToast
(
error
)
}
},
input
(
e
)
{
const
{
value
}
=
e
.
detail
,
{
name
}
=
e
.
target
.
dataset
this
.
setData
({
[
name
]:
value
})
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady
()
{
},
/**
* 生命周期函数--监听页面
加载
* 生命周期函数--监听页面
显示
*/
onLoad
(
options
)
{
// this.getNickNameAndHeadUrl()
// this.setData({
// array: generateOptionsArray(9)
// })
onShow
()
{
const
{
options
}
=
this
if
(
options
.
isLogin
)
this
.
getGroupEnterInfo
(
options
)
else
this
.
jumpLoading
()
//直接打开时跳转、防止sessionId失效
},
getGroupEnterInfo
(
options
)
{
try
{
const
_this
=
this
wx
.
getGroupEnterInfo
({
...
...
@@ -83,6 +66,7 @@ Page({
openGid
:
'GtsOh6zJoHmautQCAxaxaUzIxYNo'
||
data
})
options
.
chatId
=
res
.
data
||
''
this
.
options
=
options
_this
.
getSolitaireUserInfo
(
options
)
}
else
throw
message
},
...
...
@@ -94,7 +78,9 @@ Page({
if
(
error
)
wx
.
p
.
wxApi
.
showToast
(
error
)
}
},
/**获取用户接龙信息 */
async
getSolitaireUserInfo
(
params
)
{
delete
params
.
isLogin
try
{
const
{
userInfo
:
{
...
...
@@ -116,6 +102,17 @@ Page({
})
if
(
code
==
0
)
{
this
.
getSolitaireDetail
(
params
)
if
(
data
)
{
//已参加 或 已结束
// const {
// relayContent,
// stateCode,
// stateName
// } = data
// this.setData({
// finishObject: data
// })
}
}
else
throw
message
}
catch
(
error
)
{
console
.
log
(
error
)
...
...
@@ -130,34 +127,88 @@ Page({
}
})
}
//
},
async
getSolitaireDetail
(
params
)
{
const
res
=
await
wx
.
p
.
api
.
solitaireApi
.
getSolitaireDetail
(
params
)
try
{
wx
.
p
.
wxApi
.
showLoading
()
const
res
=
await
wx
.
p
.
api
.
solitaireApi
.
getSolitaireDetail
(
params
)
if
(
res
.
groupLimitOpen
)
{
const
{
chatId
}
=
this
.
options
res
.
groupLimitList
.
map
(
e
=>
{
// if ()
})
}
this
.
setData
({
activityDetail
:
decodeURIComponent
(
res
.
description
),
title
:
res
.
title
,
array
:
generateOptionsArray
(
res
.
numLimit
),
loading
:
true
})
wx
.
p
.
wxApi
.
hideLoading
()
const
{
list
}
=
await
wx
.
p
.
api
.
solitaireApi
.
getSolitaireAewardList
(
params
)
this
.
setData
({
list
})
}
catch
(
error
)
{
if
(
error
)
wx
.
p
.
wxApi
.
showToast
(
error
)
}
},
bindPickerChange
:
function
(
e
)
{
this
.
setData
({
activityDetail
:
decodeURIComponent
(
res
.
description
),
title
:
res
.
title
,
'params.num'
:
e
.
detail
.
value
})
const
list
=
await
wx
.
p
.
api
.
solitaireApi
.
getSolitaireAewardList
(
params
)
console
.
log
(
list
)
console
.
log
(
res
)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady
()
{
inSolitaire
()
{
const
{
userInfo
}
=
this
.
data
this
.
setData
({
flag
:
true
})
this
.
setData
({
'params.name'
:
userInfo
.
nickName
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow
()
{
async
submit
()
{
try
{
const
{
params
,
userInfo
}
=
this
.
data
,
{
relayLotteryId
,
chatId
}
=
this
.
options
console
.
log
(
params
)
if
(
!
params
.
name
)
throw
'请输入名称!'
if
(
!
params
.
num
)
throw
'请选择数字!'
const
res
=
await
wx
.
p
.
api
.
solitaireApi
.
commitSolitaire
({
relayLotteryId
,
name
:
params
.
name
,
phone
:
userInfo
.
phone
,
openId
:
userInfo
.
openId
,
unionId
:
userInfo
.
unionId
,
relayContent
:
params
.
num
,
chatId
})
console
.
log
(
res
)
}
catch
(
error
)
{
if
(
error
)
wx
.
p
.
wxApi
.
showToast
(
error
)
}
},
input
(
e
)
{
const
{
value
}
=
e
.
detail
,
{
name
}
=
e
.
target
.
dataset
this
.
setData
({
[
name
]:
value
})
},
/**
* 生命周期函数--监听页面隐藏
*/
...
...
packageActivity/pages/solitaire/index/index.json
View file @
839af11
{
"usingComponents"
:
{
"mp-html"
:
"/components/mp-html/index"
"mp-html"
:
"/components/mp-html/index"
,
"solitaire-popup"
:
"../components/solitairePopup/solitairePopup"
},
"navigationBarTitleText"
:
"群接龙抽奖"
}
\ No newline at end of file
packageActivity/pages/solitaire/index/index.wxml
View file @
839af11
<view class="layout isFullSucreen">
<view class="title flex box">{{title}}</view>
<view class="mp-html box">
<mp-html content="{{activityDetail}}"></mp-html>
</view>
<view class="detail-box box">
<view class="subtitle">参与接龙目前共<text>{{list.length}}</text>人</view>
<view class="list">
接龙明细
<block wx:for="{{list}}" wx:key="index">
<block wx:if="{{index < 5}}">
<view class="item flex">
<view class="label text-hide">{{index + 1}}.名称:嗖嗖嗖嘀嘀嘀飞飞飞嗖嗖嗖嘀嘀嘀飞飞飞嗖嗖嗖嘀嘀嘀飞飞飞湿湿碎是的
<block wx:if="{{loading}}">
<view class="layout isFullSucreen">
<view class="title flex box">{{title}}</view>
<view class="mp-html box">
<mp-html content="{{activityDetail}}"></mp-html>
</view>
<view class="detail-box box">
<view class="subtitle">参与接龙目前共<text>{{list.length}}</text>人</view>
<view class="list">
接龙明细
<block wx:for="{{list}}" wx:key="index">
<block wx:if="{{index < 5}}">
<view class="item flex">
<view class="label text-hide">{{index + 1}}.名称:{{item.name}}
</view>
<view class="value">选择数字:{{item.relayContent}}</view>
</view>
<view class="value">选择数字:5</view>
</view>
</block>
</block>
<block wx:if="{{list.length >= 6}}">
<block wx:if="{{list.length > 6}}">
<view class="item">…</view>
</block>
</block>
<view class="item flex">
<view class="label text-hide">{{list.length}}.名称:asd56asd4as65</view>
<view class="value">选择数字:5</view>
</view>
</block>
<view class="input-box">
<block wx:if="{{!flag}}">
<view class="button flex" bindtap="inSolitaire">
<view class="icon"></view>参与接龙
<block wx:if="{{list.length >= 6}}">
<block wx:if="{{list.length > 6}}">
<view class="item">…</view>
</block>
<view class="item flex">
<view class="label text-hide">{{list.length}}.名称:{{item.name}}</view>
<view class="value">选择数字:{{item.relayContent}}</view>
</view>
</block>
<block wx:else>
<view class="input">
<input type="text" placeholder="请输入名称" maxlength="32" placeholder-class="placeholder" value="{{params.name}}" bindinput="input" data-name="params.name" />
</view>
<view class="input {{array[params.num] ?'':'placeholder'}}">
<picker bindchange="bindPickerChange" range="{{array}}">
{{array[params.num] || '请选择数字'}}
</picker>
<view class="arrow y-center"></view>
<block wx:if="{{!finishObject}}">
<view class="input-box">
<block wx:if="{{!flag}}">
<view class="button flex" bindtap="inSolitaire">
<view class="icon"></view>参与接龙
</view>
</block>
<block wx:else>
<view class="input">
<input type="text" placeholder="请输入名称" maxlength="32" placeholder-class="placeholder" value="{{params.name}}" bindinput="input" data-name="params.name" />
</view>
<view class="input {{array[params.num] ?'':'placeholder'}}">
<picker bindchange="bindPickerChange" range="{{array}}">
{{array[params.num] || '请选择数字'}}
</picker>
<view class="arrow y-center"></view>
</view>
<button class="default-btn" bindtap="submit">确定</button>
</block>
</view>
<button class="default-btn" bindtap="submit">确定</button>
</block>
</view>
</view>
</view>
</view>
\ No newline at end of file
</block>
<solitaire-popup title="{{popupTitle}}" model:show="{{show}}"></solitaire-popup>
\ No newline at end of file
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