Commit 11b36a5d by 李伟康

提交问卷需求

1 parent 23b79d7f
import { preReleaseAppId } from '~/config' import { preReleaseAppId } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease'] const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 4 let index = 1
/** /**
* *
......
...@@ -64,9 +64,9 @@ module.exports = { ...@@ -64,9 +64,9 @@ module.exports = {
/**免费领取体验卡 */ /**免费领取体验卡 */
tolqFreecard(data) { tolqFreecard(data) {
return api.post({ return api.post({
method: `scrm.api.equity.h5.free.card.receive`, method: `scrm.api.equity.h5.free.card.receive`,
...data ...data
}, },
true true
) )
}, },
...@@ -87,10 +87,10 @@ module.exports = { ...@@ -87,10 +87,10 @@ module.exports = {
/**领取优惠券 */ /**领取优惠券 */
receiveCoupon(data) { receiveCoupon(data) {
return api.post({ return api.post({
method: `scrm.api.coupon.share.receive`, method: `scrm.api.coupon.share.receive`,
...data, ...data,
receiveSource: 4 receiveSource: 4
}, },
true true
) )
}, },
...@@ -187,4 +187,13 @@ module.exports = { ...@@ -187,4 +187,13 @@ module.exports = {
...data ...data
}) })
}, },
/**
* 领取调查问卷 商城券
*/
reciveQuestionnaireCoupon(data) {
return api.post({
method: `scrm.api.coupon.user.questionnaire.get`,
...data
})
},
} }
\ No newline at end of file \ No newline at end of file
...@@ -10,6 +10,7 @@ import equityApi from './equity' ...@@ -10,6 +10,7 @@ import equityApi from './equity'
import common from './common' import common from './common'
import entmicroApi from './entmicro' import entmicroApi from './entmicro'
import strategyApi from './strategy' import strategyApi from './strategy'
import questionnaireApi from './questionnaire'
module.exports = { module.exports = {
wechatApi, wechatApi,
...@@ -23,5 +24,6 @@ module.exports = { ...@@ -23,5 +24,6 @@ module.exports = {
equityApi, equityApi,
common, common,
entmicroApi, entmicroApi,
strategyApi strategyApi,
questionnaireApi
} }
\ No newline at end of file \ No newline at end of file
import api from '../request/http'
const projectName = 'material'
module.exports = {
/** 查询调查问卷详情 */
getQuestionnaireDetail(data = {}) {
return api.post({
method: 'marketing.api.activityQuestionnaireForm.detail',
projectName,
...data
})
},
/**
* 用户-调查问卷提交
*/
submitQuestionnaireForm(data = {}) {
return api.post({
method: 'marketing.api.activityQuestionnaireUserForm.add',
projectName,
...data
})
}
}
\ No newline at end of file \ No newline at end of file
...@@ -148,11 +148,12 @@ Page({ ...@@ -148,11 +148,12 @@ Page({
}) })
}, },
receiveRed(equityFreeCardId) { receiveRed(equityFreeCardId) {
let { isOpenMember, nickName } = this.data let { isOpenMember, nickName ,bindingSource} = this.data
let params = { let params = {
equityFreeCardId, equityFreeCardId,
nickName: nickName nickName: nickName
} }
if(bindingSource) params.bindingSource = bindingSource
wx.p.api.equityApi.checkReceiveRed(params).then(res => { wx.p.api.equityApi.checkReceiveRed(params).then(res => {
console.log(res, 'checkReceiveRed---') console.log(res, 'checkReceiveRed---')
let { code, message, data } = res let { code, message, data } = res
...@@ -212,11 +213,15 @@ Page({ ...@@ -212,11 +213,15 @@ Page({
}, },
async onLoad(options) { async onLoad(options) {
let system = wx.getSystemInfoSync() //从调查问卷来
let system = wx.getSystemInfoSync(),
bindingSource = ''
const authStatus = await wx.p.router.intercept(false) const authStatus = await wx.p.router.intercept(false)
const { merchantId } = wx.p.storage.get('merchant_info') const { merchantId } = wx.p.storage.get('merchant_info')
if(options.bindingSource) bindingSource = options.bindingSource
this.setData({ this.setData({
merchantId merchantId,
bindingSource
}) })
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
const { const {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
width: 100%; width: 100%;
height: 664rpx; height: 664rpx;
position: relative; position: relative;
background-size: 100% 100%;
.title { .title {
position: absolute; position: absolute;
left: 50%; left: 50%;
...@@ -86,7 +86,12 @@ ...@@ -86,7 +86,12 @@
transform: translateX(-50%); transform: translateX(-50%);
} }
} }
.lq_g_bg{
background: url(https://img02.glsx.com.cn/weapp/resource/miniprogram/wuye/equity/coupons/lq_g_bg.png);
}
.lq_w_bag{
background: url(https://img02.glsx.com.cn/weapp/resource/miniprogram/wuye/equity/coupons/lq_w_bag.png);
}
.footer_rule_box { .footer_rule_box {
width: 100%; width: 100%;
display: flex; display: flex;
......
<view style="background: url({{IMGURL}}equity/coupons/lq_bg_max.png);background-size: 100% 100%;" class="container"> <view style="background: url({{IMGURL}}equity/coupons/lq_bg_max.png);background-size: 100% 100%;" class="container">
<view style="background: url({{IMGURL}}equity/coupons/{{handleStatus==1?'lq_g_bg':'lq_w_bag'}}.png);background-size: 100% 100%;" class="main_box"> <view class="main_box {{handleStatus==1?'lq_g_bg':'lq_w_bag'}}">
<view wx:if="{{detailInfo.denomination}}" class="title"> <view wx:if="{{detailInfo.denomination}}" class="title">
<text class="price">{{detailInfo.denomination || ''}}</text> <text class="price">{{detailInfo.denomination || ''}}</text>
<text class="unit">元</text> <text class="unit">元</text>
<text class="tip">无门槛</text> <text class="tip">无门槛</text>
</view>
<view class="info_box">
<view class="cover_box">
<image class="cover" src="{{detailInfo.goodsImage}}" />
</view>
<view class="right">
<view class="name">{{detailInfo.brandName}}</view>
<view class="desc">{{detailInfo.goodsName}}</view>
</view>
</view>
<view class="btn" bind:tap="toGet"></view>
</view> </view>
<view class="footer_rule_box"> <view class="info_box">
<view class="title">规则</view> <view class="cover_box">
<view class="box"> <image class="cover" src="{{detailInfo.goodsImage}}" />
<view class="line">1. 同一用户每张优惠券仅能领取1次,每次1张</view> </view>
<view class="line">2. 优惠券数量有限,领完即止</view> <view class="right">
</view> <view class="name">{{detailInfo.brandName}}</view>
<view class="desc">{{detailInfo.goodsName}}</view>
</view>
</view> </view>
<view class="btn" bind:tap="toGet"></view>
</view>
<view class="footer_rule_box">
<view class="title">规则</view>
<view class="box">
<view class="line">1. 同一用户每张优惠券仅能领取1次,每次1张</view>
<view class="line">2. 优惠券数量有限,领完即止</view>
</view>
</view>
</view> </view>
\ No newline at end of file \ No newline at end of file
import QR from '~/lib/wxqrcode' import QR from '~/lib/wxqrcode'
import { IMG_URL } from '~/config'; import {
IMG_URL
} from '~/config';
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -19,7 +20,7 @@ Page({ ...@@ -19,7 +20,7 @@ Page({
useMemberType: 0, useMemberType: 0,
list: [], list: [],
pageNum: 1, pageNum: 1,
IMGURL:IMG_URL IMGURL: IMG_URL
}, },
navbarReady(e) { navbarReady(e) {
this.setData({ this.setData({
...@@ -130,7 +131,6 @@ Page({ ...@@ -130,7 +131,6 @@ Page({
useMemberType, useMemberType,
detailInfo detailInfo
}) => { }) => {
console.log(userCouponId)
wx.p.wxApi.showLoading('加载中...') wx.p.wxApi.showLoading('加载中...')
this.setData({ this.setData({
detailInfo detailInfo
...@@ -154,6 +154,12 @@ Page({ ...@@ -154,6 +154,12 @@ Page({
if (options && options.couponId) { if (options && options.couponId) {
console.log(options) console.log(options)
wx.p.wxApi.showLoading('加载中...') wx.p.wxApi.showLoading('加载中...')
if (options.bindingSource) {
this.setData({
bindingSource: options.bindingSource
})
return this.getCouponInfo(options.couponId)
}
this.checkCoupon(options) this.checkCoupon(options)
if (options.activity_id) { if (options.activity_id) {
this.data.activiOptions = options this.data.activiOptions = options
...@@ -166,6 +172,14 @@ Page({ ...@@ -166,6 +172,14 @@ Page({
if (isReceive) this.confirm() if (isReceive) this.confirm()
} }
}, },
/**调查问卷查询券详情 */
async getCouponInfo(couponId) {
const res = await wx.p.api.couponsApi.getCouponInfo({
couponId
})
wx.hideLoading()
this.setCouponData(res)
},
checkCoupon(options, callBack) { checkCoupon(options, callBack) {
wx.p.api.couponsApi.checkCoupon(options).then(couponInfo => { wx.p.api.couponsApi.checkCoupon(options).then(couponInfo => {
console.log(couponInfo) console.log(couponInfo)
...@@ -229,8 +243,30 @@ Page({ ...@@ -229,8 +243,30 @@ Page({
issueDate, issueDate,
userCouponId, userCouponId,
merchantId, merchantId,
shareSource shareSource,
bindingSource
} = this.data } = this.data
// 调查问卷
if (bindingSource) {
const {
couponDetail
} = this.data
wx.p.api.couponsApi.reciveQuestionnaireCoupon({
merchantId: couponDetail.merchantId,
couponId: couponDetail.id
}).then(res => {
if (res.discountType == 3) {
this.jump()
return
}
this.setData({
qr: QR.createQrCodeImg(`t=2&c=${res.verificationCode}`),
verificationCode: res.verificationCode
})
wx.p.wxApi.showToast('领取成功')
})
return
}
if (!couponId && !userCouponId) return if (!couponId && !userCouponId) return
wx.p.router.intercept().then(response => { wx.p.router.intercept().then(response => {
if (response) { if (response) {
......
...@@ -6,7 +6,8 @@ Component({ ...@@ -6,7 +6,8 @@ Component({
*/ */
properties: { properties: {
title: String, title: String,
data: Array data: Array,
num: Number
}, },
/** /**
...@@ -15,7 +16,7 @@ Component({ ...@@ -15,7 +16,7 @@ Component({
data: { data: {
show: false, show: false,
fieldValue: '', fieldValue: '',
cascaderValue: '', cascaderValue: ''
}, },
/** /**
...@@ -37,11 +38,18 @@ Component({ ...@@ -37,11 +38,18 @@ Component({
const { const {
selectedOptions, selectedOptions,
value value
} = e.detail, fieldValue = selectedOptions.map((option) => option.text || option.name).join('/') } = e.detail, {
num
} = this.data,
fieldValue = selectedOptions.map((option) => option.text || option.name).join('/')
this.setData({ this.setData({
fieldValue, fieldValue,
cascaderValue: value cascaderValue: value
}) })
this.triggerEvent('change', {
num,
value: fieldValue
})
this.onClose() this.onClose()
} }
} }
......
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
</view> </view>
<van-popup show="{{ show }}" round position="bottom" bind:click-overlay="onClose"> <van-popup show="{{ show }}" round position="bottom" bind:click-overlay="onClose">
<van-cascader title="{{title}}" value="{{ cascaderValue }}" active-color="#3772EC" options="{{ data }}" bindclose="onClose" bindfinish="onFinish"> <van-cascader title="{{title}}" value="{{ cascaderValue }}" active-color="#3772EC" options="{{ data }}" bindclose="onClose" bindfinish="onFinish" >
</van-cascader> </van-cascader>
</van-popup> </van-popup>
\ No newline at end of file \ No newline at end of file
...@@ -5,14 +5,16 @@ Component({ ...@@ -5,14 +5,16 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
data: Array data: Array,
num: Number
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
chooseList: [] chooseList: [],
valueList: []
}, },
/** /**
...@@ -21,15 +23,28 @@ Component({ ...@@ -21,15 +23,28 @@ Component({
methods: { methods: {
choose(e) { choose(e) {
const { const {
index index,
value
} = e.currentTarget.dataset, { } = e.currentTarget.dataset, {
chooseList chooseList,
valueList,
num
} = this.data, } = this.data,
item = chooseList.findIndex(i => i == index) item = chooseList.findIndex(i => i == index)
if (item == -1) chooseList.push(index) if (item == -1) {
else chooseList.splice(item, 1) chooseList.push(index)
valueList.push(value)
} else {
chooseList.splice(item, 1)
valueList.splice(item, 1)
}
this.setData({ this.setData({
chooseList chooseList,
valueList
})
this.triggerEvent('change', {
num,
value: valueList.join(',')
}) })
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
} }
</wxs> </wxs>
<block wx:for="{{data}}" wx:key="index"> <block wx:for="{{data}}" wx:key="index">
<view class="checkbox-item" bindtap="choose" data-index="{{index}}"> <view class="checkbox-item" bindtap="choose" data-index="{{index}}" data-value="{{item}}">
<view class="icon {{fn.includes(chooseList,index)?'active':''}}"></view> <view class="icon {{fn.includes(chooseList,index)?'active':''}}"></view>
{{item}} {{item}}
</view> </view>
......
// packageMine/pages/questionnaire/components/Finish/Finish.js
Component({
/**
* 组件的属性列表
*/
properties: {
data: Object
},
/**
* 组件的初始数据
*/
data: {
count: 5
},
lifetimes: {
attached() {
this.countDown()
}
},
timer: null,
/**
* 组件的方法列表
*/
methods: {
back() {
clearTimeout(this.timer)
this.timer = null
const {
data
} = this.data
if (data.activityType) {
let url = '/packageEquity/pages/freecard/freecard',
options = {
bindingSource: 1,
notIntercept: true
}
if (data.activityType == 2) {
options.couponId = data.activityId
url = '/packageMall/pages/coupon/coupon'
}
if (data.activityType == 3) console.log('红包')
else wx.p.router.redirectTo(url, options)
} else wx.p.router.goHome()
},
countDown() {
this.timer = setTimeout(() => {
let {
count
} = this.data
if (this.timer && count == 0) {
clearTimeout(this.timer)
this.back()
return
}
--count
this.setData({
count
})
this.countDown()
}, 1e3)
}
},
})
\ 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
/* packageMine/pages/questionnaire/components/Finish/Finish.wxss */
.finish-box {
width: 100vw;
height: 100vh;
background-color: #fff;
display: flex;
flex-direction: column;
align-items: center;
font-weight: 500;
font-size: 40rpx;
color: #333333;
.icon {
width: 160rpx;
height: 160rpx;
margin: 160rpx 0 30rpx;
}
.btn {
margin: 40% 0 30rpx;
width: 494rpx;
height: 88rpx;
background: #3772EC;
border-radius: 44rpx;
color: #fff;
font-weight: 500;
font-size: 32rpx;
letter-spacing: 2rpx;
display: flex;
align-items: center;
justify-content: center;
}
.tips {
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
}
// 提示
.member-dialog {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 998;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.bg {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
background: rgba(0, 0, 0, .5);
}
.content {
position: relative;
text-align: center;
box-sizing: border-box;
.member-bg {
width: 550rpx;
height: 910rpx;
}
.count-down {
position: absolute;
top: 26rpx;
right: 26rpx;
width: 72rpx;
height: 72rpx;
line-height: 72rpx;
background: #EA4D3A;
border-radius: 36rpx;
font-weight: 600;
font-size: 42rpx;
color: #FFFFFF;
}
.open-btn {
position: absolute;
bottom: 50rpx;
left: 28%;
width: 158rpx;
height: 158rpx;
}
}
}
\ No newline at end of file \ No newline at end of file
<view class="finish-box">
<view class="icon">
<glsx-image src="questionnaire/finish.png" />
</view>
提交成功
<view class="btn" bindtap="back">返回</view>
<view class="tips">{{count}}S后自动跳转</view>
</view>
<!-- 红包会员弹窗 -->
<block wx:if="{{data.activityType == 3}}">
<view class="member-dialog">
<view class="bg" />
<view class="content">
<view class="count-down">{{count}}</view>
<glsx-image class="member-bg" src="equity/bg-red.png"></glsx-image>
<glsx-image bindtap="back" class="open-btn" src="equity/icon-open.png"></glsx-image>
</view>
</view>
</block>
\ No newline at end of file \ No newline at end of file
...@@ -5,7 +5,8 @@ Component({ ...@@ -5,7 +5,8 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
data: Array data: Array,
num: Number
}, },
/** /**
...@@ -21,14 +22,20 @@ Component({ ...@@ -21,14 +22,20 @@ Component({
methods: { methods: {
choose(e) { choose(e) {
const { const {
index index,
value
} = e.currentTarget.dataset, { } = e.currentTarget.dataset, {
raidoIndex raidoIndex,
num
} = this.data } = this.data
if (raidoIndex == index) return if (raidoIndex == index) return
this.setData({ this.setData({
raidoIndex: index raidoIndex: index
}) })
this.triggerEvent('change', {
num,
value
})
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
<block wx:for="{{data}}" wx:key="index"> <block wx:for="{{data}}" wx:key="index">
<view class="radio-item" bindtap="choose" data-index="{{index}}"> <view class="radio-item" bindtap="choose" data-index="{{index}}" data-value="{{item}}">
<view class="icon {{index == raidoIndex?'active':''}}"></view> <view class="icon {{index == raidoIndex?'active':''}}"></view>
{{item}} {{item}}
</view> </view>
......
...@@ -6,7 +6,8 @@ Component({ ...@@ -6,7 +6,8 @@ Component({
*/ */
properties: { properties: {
data: Array, data: Array,
title: String title: String,
num: Number
}, },
/** /**
...@@ -35,10 +36,16 @@ Component({ ...@@ -35,10 +36,16 @@ Component({
onConfirm(e) { onConfirm(e) {
const { const {
value value
} = e.detail } = e.detail, {
num
} = this.data
this.setData({ this.setData({
value value
}) })
this.triggerEvent('change', {
num,
value
})
this.onClose() this.onClose()
} }
} }
......
...@@ -5,75 +5,20 @@ Page({ ...@@ -5,75 +5,20 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
tips:'亲爱的住户,你好。\n为了给你提供更好的居住环境和服务,由中海物业发起的调查问卷,邀请您填写,十分感谢!', finish: false
//type 1.单选框,2.复选框,3.多行文本框,4.下拉选择器,5.集联选择器
test: [{
title: '您的年龄',
type: 1,
data: ['20岁以下', '20~35岁', '35~45岁', '45岁以上'],
required: true
},
{
title: '假期闲暇时最常做的事情',
type: 2,
data: ['上网', '睡觉', '看电视', '打游戏', '逛街', '看书', '学习'],
required: true
},
{
title: '请问做兼职的主要目的',
type: 4,
data: ['锻炼自己', '获得工作报酬', '减轻家庭负担', '提前专业实习', '充实漫长假期', '没有做兼职的打算'],
required: true
},
{
title: '请问做兼职的主要目的请问做兼职的主要目的请问做兼职的主要目的请问做兼职的主要目的请问做兼职的主要目的',
type: 1,
data: ['锻炼自己', '获得工作报酬', '减轻家庭负担', '提前专业实习', '充实漫长假期', '没有做兼职的打算'],
required: true
},
{
title: '家在哪里?',
type: 5,
data: [{
text: '浙江省',
value: '330000',
children: [{
text: '杭州市',
value: '330100',
children: [{
text: '嚯嚯嚯',
value: '3301001',
}]
}],
},
{
text: '江苏省',
value: '320000',
children: [{
text: '南京市',
value: '320100',
children: [{
text: '恒河猴',
value: '3301001',
}]
}],
},
],
required: true
},
{
title: '如果校园内开展禁烟活动你会',
type: 3
}
],
obj:{
}
}, },
blur(e){ blur(e) {
const {value} = e.detail const {
console.log(value) value
} = e.detail, {
num
} = e.currentTarget.dataset
this.change({
detail: {
num,
value
}
})
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -81,49 +26,138 @@ Page({ ...@@ -81,49 +26,138 @@ Page({
onLoad(options) { onLoad(options) {
}, },
async getQuestionnaireDetail(options) {
/** const res = await wx.p.router.intercept()
* 生命周期函数--监听页面初次渲染完成 if (!res) {
*/ const {
onReady() { userInfo
} = this.data
if (!userInfo.nickName) return this.getNickNameAndHeadUrl()
try {
const data = await wx.p.api.questionnaireApi.getQuestionnaireDetail(options)
if (data.activityType == 3) {
// const a = await wx.p.api.equityApi.checkReceiveRed({
// equityFreeCardId: data.activityId,
// nickName: userInfo.nickName
// })
// console.log(a)
}
console.log(data)
if (data) {
data.questions.map(e => {
if (e.type != 3) {
let option = e.option.split('\n')
if (e.type == 5) e.data = this.transformData(option)
else e.data = option
}
e.answer = ''
e.userFormId = e.formId
})
this.setData({
questionnaireObj: data
})
wx.setNavigationBarTitle({
title: data.title,
})
} else throw '获取问卷失败'
} catch (error) {
console.log(error)
if (error) wx.p.wxApi.showToast(error)
}
}
}, },
transformData(data) {
/** const result = []
* 生命周期函数--监听页面显示 data.forEach((item, index) => {
*/ const levels = item.split('/')
onShow() { let currentLevel = result
for (let i = 0; i < levels.length; i++) {
const text = levels[i],
value = text,
existingOption = currentLevel.find((option) => option.text === text)
if (existingOption) {
if (i === levels.length - 1) {
continue
}
currentLevel = existingOption.children
} else {
const newOption = {
text,
value,
children: []
}
currentLevel.push(newOption)
if (i === levels.length - 1) {
delete newOption.children
}
currentLevel = newOption.children
}
}
})
return result
}, },
change(e) {
/** console.log(e)
* 生命周期函数--监听页面隐藏 const {
*/ num,
onHide() { value
} = e.detail
this.setData({
[`questionnaireObj.questions[${num}].answer`]: value
})
}, },
async submit() {
/** const {
* 生命周期函数--监听页面卸载 questionnaireObj
*/ } = this.data, {
onUnload() { merchantId,
} = wx.p.storage.get('userInfo')
try {
let questions = []
questionnaireObj.questions.map(e => {
if (e.required && !e.answer) throw `请填写第${e.num}题!`
questions.push({
userFormId: e.userFormId,
num: e.num,
answer: e.answer
})
})
let params = {
questions,
merchantId,
formId: questionnaireObj.id,
}
console.log(params)
const res = await wx.p.api.questionnaireApi.submitQuestionnaireForm(params)
if (res) {
this.setData({
finish: true
})
} else throw '提交失败'
console.log(res)
} catch (error) {
console.log(error)
if (error) wx.p.wxApi.showToast(error)
}
}, },
getNickNameAndHeadUrl() {
/** const redirectUrl = `https://scrm.glsx.com.cn/wy-wx-oauth`,
* 页面相关事件处理函数--监听用户下拉动作 appid = 'wx1cf40dc91c28a7fd',
*/ 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`
onPullDownRefresh() { wx.p.router.jumpH5(wxUrl)
}, },
/** /**
* 页面上拉触底事件的处理函数 * 生命周期函数--监听页面显示
*/ */
onReachBottom() { onShow() {
const {
options
} = this
if (options.id) this.getQuestionnaireDetail(options)
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"gl-checkbox":"./components/Checkbox/Checkbox", "gl-checkbox":"./components/Checkbox/Checkbox",
"gl-select":"./components/Select/Select", "gl-select":"./components/Select/Select",
"gl-cascader":"./components/Cascader/Cascader", "gl-cascader":"./components/Cascader/Cascader",
"van-field": "@vant/weapp/field/index" "van-field": "@vant/weapp/field/index",
}, "finish":"./components/Finish/Finish"
"navigationBarTitleText": "调查问卷" }
} }
\ No newline at end of file \ No newline at end of file
<view class="layout"> <block wx:if="{{questionnaireObj.id}}">
<text class="tips">{{tips}}</text> <block wx:if="{{!finish}}">
<view class="form-box"> <view class="layout">
<block wx:for="{{test}}" wx:key="index"> <text class="tips">{{questionnaireObj.desc}}</text>
<view class="title {{item.required?'required':''}}"> <view class="form-box">
<view class="num">{{index + 1}}.</view> <block wx:for="{{questionnaireObj.questions}}" wx:key="index">
<view class="text">{{item.title}}</view> <view class="title {{item.required?'required':''}}">
</view> <view class="num">{{item.num}}.</view>
<view class="item {{item.type == 3?'textarea':''}}"> <view class="text">{{item.text}}</view>
<block wx:if="{{item.type == 1}}"> </view>
<gl-radio data="{{item.data}}" /> <view class="item {{item.type == 3?'textarea':''}}">
</block> <block wx:if="{{item.type == 1}}">
<block wx:elif="{{item.type == 2}}"> <gl-radio data="{{item.data}}" num="{{index}}" bindchange="change" />
<gl-checkbox data="{{item.data}}" /> </block>
</block> <block wx:elif="{{item.type == 2}}">
<block wx:elif="{{item.type == 3}}"> <gl-checkbox data="{{item.data}}" num="{{index}}" bindchange="change" />
<van-field type="textarea" autosize placeholder="请输入" border="{{ false }}" bindblur="blur" maxlength="{{item.maxlength}}" /> </block>
</block> <block wx:elif="{{item.type == 3}}">
<block wx:elif="{{item.type == 4}}"> <van-field type="textarea" autosize placeholder="请输入" border="{{ false }}" bindblur="blur" maxlength="{{item.maxLength}}" data-num="{{index}}" />
<gl-select data="{{item.data}}" title="{{item.title}}" /> </block>
</block> <block wx:elif="{{item.type == 4}}">
<block wx:else> <gl-select data="{{item.data}}" title="{{item.text}}" num="{{index}}" bindchange="change" />
<gl-cascader data="{{item.data}}" title="{{item.title}}" /> </block>
<block wx:else>
<gl-cascader data="{{item.data}}" title="{{item.text}}" num="{{index}}" bindchange="change" />
</block>
</view>
</block> </block>
</view> </view>
</block>
</view>
</view>
<view class="fixed-btn text-center">
<button class="default-btn">提交</button>
</view>
\ No newline at end of file \ No newline at end of file
</view>
<view class="fixed-btn text-center">
<button class="default-btn" bindtap="submit">提交</button>
</view>
</block>
<block wx:else>
<finish data="{{questionnaireObj}}" />
</block>
</block>
\ No newline at end of file \ No newline at end of file
...@@ -22,7 +22,6 @@ Page({ ...@@ -22,7 +22,6 @@ Page({
item_type: 6, item_type: 6,
view: 1 view: 1
}) })
this
}, },
......
...@@ -15,16 +15,21 @@ Page({ ...@@ -15,16 +15,21 @@ Page({
async onLoad(options) { async onLoad(options) {
const info = JSON.parse(decodeURIComponent(options.userProfile)) const info = JSON.parse(decodeURIComponent(options.userProfile))
const res = await USERAPI.updateUserInfo({ const res = await USERAPI.updateUserInfo({
nickName: info.nickName, nickName: info.nickName,
avatarUrl: info.avatarUrl avatarUrl: info.avatarUrl
}) }),
userInfo = wx.p.storage.get('userInfo')
userInfo.nickName = info.nickName
userInfo.headImgUrl = info.avatarUrl
wx.p.storage.set('userInfo', userInfo)
wx.p.router.back(res => { wx.p.router.back(res => {
res.setData({ res.setData({
nickName: info.nickName, nickName: info.nickName,
headImgUrl: info.avatarUrl, headImgUrl: info.avatarUrl,
hasUserInfo: true hasUserInfo: true,
userInfo
}) })
res.toCheckMember() res.toCheckMember && res.toCheckMember()
let item = { let item = {
add_way: '104', add_way: '104',
customer_phone: res.data.userInfo.phone, customer_phone: res.data.userInfo.phone,
...@@ -34,7 +39,9 @@ Page({ ...@@ -34,7 +39,9 @@ Page({
} }
let json = JSON.stringify(item) let json = JSON.stringify(item)
// 数据上报 // 数据上报
wx.p.api.common.trackHttp({ json }).then(response => { }) wx.p.api.common.trackHttp({
json
}).then(response => {})
}) })
}, },
......
...@@ -93,7 +93,7 @@ class Share { ...@@ -93,7 +93,7 @@ class Share {
} }
} }
getCommonData() { getCommonData() {
const WXUSERINFO = wx.p.storage.get('wx_user_info'), //针对没登录用户,有openid const WXUSERINFO = wx.p.storage.get('wx_user_info') || {}, //针对没登录用户,有openid
USERINFO = wx.p.storage.get('userInfo') || {} //这个是针对登录的 USERINFO = wx.p.storage.get('userInfo') || {} //这个是针对登录的
const { const {
merchantId merchantId
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!