Commit 4214a1c8 by 李伟康

提交

1 parent 9342ecd6
......@@ -12,6 +12,7 @@ import entmicroApi from './entmicro'
import strategyApi from './strategy'
import questionnaireApi from './questionnaire'
import rescueApi from './rescueApi'
import solitaireApi from './solitaire'
module.exports = {
wechatApi,
......@@ -27,5 +28,6 @@ module.exports = {
entmicroApi,
strategyApi,
questionnaireApi,
rescueApi
rescueApi,
solitaireApi
}
\ No newline at end of file
import api from '../request/http'
const projectName = 'material'
module.exports = {
/**获取接龙抽奖详情 */
getSolitaireDetail(data) {
return api.post({
method: 'marketing.api.activityRedEnvelope.relay.lottery.detail',
projectName,
...data
})
},
/**
* 获取用户接龙信息
*/
getSolitaireUserInfo(data) {
return api.post({
method: 'marketing.api.activityRedEnvelope.relay.lottery.user.info',
projectName,
...data,
}, true)
},
/**
* 分页查询群接龙中奖明细列表
*/
getSolitaireAewardList(data) {
data.pageSize = 99999
data.pageNum = 1
return api.post({
method: 'marketing.api.activityRedEnvelope.relay.lottery.record.page',
projectName,
...data
})
},
}
\ No newline at end of file
import http from '../request/http'
const { appId } = wx.getAccountInfoSync().miniProgram
const {
appId
} = wx.getAccountInfoSync().miniProgram
let loginCount = null,
loginCache = null,
loginTimer = null
......@@ -93,5 +95,20 @@ class UsersApi {
...data
})
}
// 解析微信群的opengid
async getOpengid(data) {
const {
code
} = await this.getWxCode()
data.code = code
data.appId = appId
return http.fetch('scrm.api.sso.wechat.convert.analysis.opengid', data)
}
/**opengid转chatId */
async openGIdtoChatId(data) {
data.projectName = 'entmicro'
return http.fetch('entmicro.api.customer.base.chat.opengid.to.chantid', data)
}
}
export default new UsersApi()
\ No newline at end of file
......@@ -13,9 +13,7 @@ Page({
* 页面的初始数据
*/
data: {
activityDetail: decodeURIComponent('<div>叮—— 今天社群打地鼠游戏开始啦!跟群主打的老鼠是同一只的话则会就可以获得“精美福利”哦,那么让我们开始吧。<br>参与规则:大家随意选择一只老鼠,选择对应的数(1~9)接龙即可。答对即可获得“精美福利”一份<br>xxxxxxx<br>游戏将在16:00开奖(15:30停止接龙)<br> 本次福利为xxxxxxx</div>'),
list: new Array(15),
flag:1
list: []
},
bindPickerChange: function (e) {
this.setData({
......@@ -39,10 +37,10 @@ Page({
params
} = this.data
console.log(params)
if(!params.name) throw '请输入名称!'
if(!params.num) throw '请选择数字!'
if (!params.name) throw '请输入名称!'
if (!params.num) throw '请选择数字!'
} catch (error) {
if(error) wx.p.wxApi.showToast(error)
if (error) wx.p.wxApi.showToast(error)
}
},
input(e) {
......@@ -60,9 +58,91 @@ Page({
*/
onLoad(options) {
// this.getNickNameAndHeadUrl()
// this.setData({
// array: generateOptionsArray(9)
// })
try {
const _this = this
wx.getGroupEnterInfo({
async success({
iv,
encryptedData
}) {
const {
data,
code,
message
} = await wx.p.api.userApi.getOpengid({
iv,
encryptedData
})
if (code == 0 && data) {
console.log(data, '------')
const res = await wx.p.api.userApi.openGIdtoChatId({
merchantId: options.merchantId,
openGid: 'GtsOh6zJoHmautQCAxaxaUzIxYNo' || data
})
options.chatId = res.data || ''
_this.getSolitaireUserInfo(options)
} else throw message
},
fail() {
throw '获取群聊ID失败'
}
})
} catch (error) {
if (error) wx.p.wxApi.showToast(error)
}
},
async getSolitaireUserInfo(params) {
try {
const {
userInfo: {
nickName: name,
phone,
openId,
unionId
}
} = this.data, {
code,
data,
message
} = await wx.p.api.solitaireApi.getSolitaireUserInfo({
...params,
name,
phone,
openId,
unionId
})
if (code == 0) {
this.getSolitaireDetail(params)
} else throw message
} catch (error) {
return
console.log(error)
wx.showModal({
title: '温馨提示',
content: error,
showCancel: false,
confirmText: '返回首页',
confirmColor: '#3772EC',
complete: (res) => {
if (res.confirm) wx.p.router.goHome()
}
})
}
//
},
async getSolitaireDetail(params) {
const res = await wx.p.api.solitaireApi.getSolitaireDetail(params)
this.setData({
array: generateOptionsArray(9)
activityDetail: decodeURIComponent(res.description),
title: res.title,
})
const list = await wx.p.api.solitaireApi.getSolitaireAewardList(params)
console.log(list)
console.log(res)
},
/**
......@@ -105,5 +185,6 @@ Page({
*/
onReachBottom() {
}
},
onShareAppMessage() {}
})
\ No newline at end of file
<view class="layout isFullSucreen">
<view class="title flex box">xxx</view>
<view class="title flex box">{{title}}</view>
<view class="mp-html box">
<mp-html content="{{activityDetail}}"></mp-html>
</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!