Commit 839af115 by 李伟康

提交

1 parent 69e8e502
...@@ -31,4 +31,12 @@ module.exports = { ...@@ -31,4 +31,12 @@ module.exports = {
...data ...data
}) })
}, },
/** 提交接龙 */
commitSolitaire(data) {
return api.post({
method: 'marketing.api.activityRedEnvelope.relay.lottery.user.commit',
projectName,
...data
})
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -6,5 +6,19 @@ module.exports = Behavior({ ...@@ -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` 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) 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 \ No newline at end of file
...@@ -36,18 +36,7 @@ Page({ ...@@ -36,18 +36,7 @@ Page({
options options
} = this } = this
if (options.isLogin) this.jumpRedEnvelopeH5() if (options.isLogin) this.jumpRedEnvelopeH5()
else { else this.jumpLoading() //直接打开时跳转、防止sessionId失效
//强制登陆、防止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() { async jumpRedEnvelopeH5() {
const res = await wx.p.router.intercept() const res = await wx.p.router.intercept()
......
// 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 \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* 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 \ No newline at end of file
<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 \ No newline at end of file
...@@ -15,52 +15,35 @@ Page({ ...@@ -15,52 +15,35 @@ Page({
data: { data: {
list: [] list: []
}, },
bindPickerChange: function (e) { /**
this.setData({ * 生命周期函数--监听页面加载
'params.num': e.detail.value */
}) onLoad(options) {
},
inSolitaire() {
const {
userInfo
} = this.data
this.setData({
flag: true
})
this.setData({ this.setData({
'params.name': userInfo.nickName popupTitle: '接龙时间已截止!'
//此群无法进行接龙游戏!
}) })
}, },
submit() {
try {
const { /**
params * 生命周期函数--监听页面初次渲染完成
} = this.data */
console.log(params) onReady() {
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
})
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面显示
*/ */
onLoad(options) { onShow() {
// this.getNickNameAndHeadUrl() const {
// this.setData({ options
// array: generateOptionsArray(9) } = this
// }) if (options.isLogin) this.getGroupEnterInfo(options)
else this.jumpLoading() //直接打开时跳转、防止sessionId失效
},
getGroupEnterInfo(options) {
try { try {
const _this = this const _this = this
wx.getGroupEnterInfo({ wx.getGroupEnterInfo({
...@@ -83,6 +66,7 @@ Page({ ...@@ -83,6 +66,7 @@ Page({
openGid: 'GtsOh6zJoHmautQCAxaxaUzIxYNo' || data openGid: 'GtsOh6zJoHmautQCAxaxaUzIxYNo' || data
}) })
options.chatId = res.data || '' options.chatId = res.data || ''
this.options = options
_this.getSolitaireUserInfo(options) _this.getSolitaireUserInfo(options)
} else throw message } else throw message
}, },
...@@ -94,7 +78,9 @@ Page({ ...@@ -94,7 +78,9 @@ Page({
if (error) wx.p.wxApi.showToast(error) if (error) wx.p.wxApi.showToast(error)
} }
}, },
/**获取用户接龙信息 */
async getSolitaireUserInfo(params) { async getSolitaireUserInfo(params) {
delete params.isLogin
try { try {
const { const {
userInfo: { userInfo: {
...@@ -116,6 +102,17 @@ Page({ ...@@ -116,6 +102,17 @@ Page({
}) })
if (code == 0) { if (code == 0) {
this.getSolitaireDetail(params) this.getSolitaireDetail(params)
if (data) {
//已参加 或 已结束
// const {
// relayContent,
// stateCode,
// stateName
// } = data
// this.setData({
// finishObject: data
// })
}
} else throw message } else throw message
} catch (error) { } catch (error) {
console.log(error) console.log(error)
...@@ -130,34 +127,88 @@ Page({ ...@@ -130,34 +127,88 @@ Page({
} }
}) })
} }
//
}, },
async getSolitaireDetail(params) { async getSolitaireDetail(params) {
try {
wx.p.wxApi.showLoading()
const res = await wx.p.api.solitaireApi.getSolitaireDetail(params) const res = await wx.p.api.solitaireApi.getSolitaireDetail(params)
if (res.groupLimitOpen) {
const {
chatId
} = this.options
res.groupLimitList.map(e => {
// if ()
})
}
this.setData({ this.setData({
activityDetail: decodeURIComponent(res.description), activityDetail: decodeURIComponent(res.description),
title: res.title, title: res.title,
array: generateOptionsArray(res.numLimit),
loading: true
}) })
const list = await wx.p.api.solitaireApi.getSolitaireAewardList(params) wx.p.wxApi.hideLoading()
const {
console.log(list) list
console.log(res) } = await wx.p.api.solitaireApi.getSolitaireAewardList(params)
this.setData({
list
})
} catch (error) {
if (error) wx.p.wxApi.showToast(error)
}
}, },
bindPickerChange: function (e) {
/** this.setData({
* 生命周期函数--监听页面初次渲染完成 'params.num': e.detail.value
*/ })
onReady() {
}, },
inSolitaire() {
/** const {
* 生命周期函数--监听页面显示 userInfo
*/ } = this.data
onShow() { this.setData({
flag: true
})
this.setData({
'params.name': userInfo.nickName
})
},
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
})
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
......
{ {
"usingComponents": { "usingComponents": {
"mp-html": "/components/mp-html/index" "mp-html": "/components/mp-html/index",
"solitaire-popup":"../components/solitairePopup/solitairePopup"
}, },
"navigationBarTitleText": "群接龙抽奖" "navigationBarTitleText": "群接龙抽奖"
} }
\ No newline at end of file \ No newline at end of file
<view class="layout isFullSucreen"> <block wx:if="{{loading}}">
<view class="layout isFullSucreen">
<view class="title flex box">{{title}}</view> <view class="title flex box">{{title}}</view>
<view class="mp-html box"> <view class="mp-html box">
<mp-html content="{{activityDetail}}"></mp-html> <mp-html content="{{activityDetail}}"></mp-html>
...@@ -10,9 +11,9 @@ ...@@ -10,9 +11,9 @@
<block wx:for="{{list}}" wx:key="index"> <block wx:for="{{list}}" wx:key="index">
<block wx:if="{{index < 5}}"> <block wx:if="{{index < 5}}">
<view class="item flex"> <view class="item flex">
<view class="label text-hide">{{index + 1}}.名称:嗖嗖嗖嘀嘀嘀飞飞飞嗖嗖嗖嘀嘀嘀飞飞飞嗖嗖嗖嘀嘀嘀飞飞飞湿湿碎是的 <view class="label text-hide">{{index + 1}}.名称:{{item.name}}
</view> </view>
<view class="value">选择数字:5</view> <view class="value">选择数字:{{item.relayContent}}</view>
</view> </view>
</block> </block>
</block> </block>
...@@ -21,11 +22,12 @@ ...@@ -21,11 +22,12 @@
<view class="item">…</view> <view class="item">…</view>
</block> </block>
<view class="item flex"> <view class="item flex">
<view class="label text-hide">{{list.length}}.名称:asd56asd4as65</view> <view class="label text-hide">{{list.length}}.名称:{{item.name}}</view>
<view class="value">选择数字:5</view> <view class="value">选择数字:{{item.relayContent}}</view>
</view> </view>
</block> </block>
<block wx:if="{{!finishObject}}">
<view class="input-box"> <view class="input-box">
<block wx:if="{{!flag}}"> <block wx:if="{{!flag}}">
<view class="button flex" bindtap="inSolitaire"> <view class="button flex" bindtap="inSolitaire">
...@@ -45,6 +47,10 @@ ...@@ -45,6 +47,10 @@
<button class="default-btn" bindtap="submit">确定</button> <button class="default-btn" bindtap="submit">确定</button>
</block> </block>
</view> </view>
</block>
</view>
</view> </view>
</view> </view>
</view>
\ No newline at end of file \ No newline at end of file
</block>
<solitaire-popup title="{{popupTitle}}" model:show="{{show}}"></solitaire-popup>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!