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 11b36a5d
authored
Oct 20, 2023
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交问卷需求
1 parent
23b79d7f
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
548 additions
and
201 deletions
api/env/index.js
api/module/coupons.js
api/module/index.js
api/module/questionnaire.js
packageEquity/pages/freecard/freecard.js
packageEquity/pages/gCoupons/index.scss
packageEquity/pages/gCoupons/index.wxml
packageMall/pages/coupon/coupon.js
packageMine/pages/questionnaire/components/Cascader/Cascader.js
packageMine/pages/questionnaire/components/Cascader/Cascader.wxml
packageMine/pages/questionnaire/components/Checkbox/Checkbox.js
packageMine/pages/questionnaire/components/Checkbox/Checkbox.wxml
packageMine/pages/questionnaire/components/Finish/Finish.js
packageMine/pages/questionnaire/components/Finish/Finish.json
packageMine/pages/questionnaire/components/Finish/Finish.scss
packageMine/pages/questionnaire/components/Finish/Finish.wxml
packageMine/pages/questionnaire/components/Radio/Radio.js
packageMine/pages/questionnaire/components/Radio/Radio.wxml
packageMine/pages/questionnaire/components/Select/Select.js
packageMine/pages/questionnaire/questionnaire.js
packageMine/pages/questionnaire/questionnaire.json
packageMine/pages/questionnaire/questionnaire.wxml
packageStrategy/pages/strategyDetail/index.js
pages/crowdfunding/blank/blank.js
utils/share.js
api/env/index.js
View file @
11b36a5
import
{
preReleaseAppId
}
from
'~/config'
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'preRelease'
]
let
index
=
4
let
index
=
1
/**
*
...
...
api/module/coupons.js
View file @
11b36a5
...
...
@@ -64,9 +64,9 @@ module.exports = {
/**免费领取体验卡 */
tolqFreecard
(
data
)
{
return
api
.
post
({
method
:
`scrm.api.equity.h5.free.card.receive`
,
...
data
},
method
:
`scrm.api.equity.h5.free.card.receive`
,
...
data
},
true
)
},
...
...
@@ -87,10 +87,10 @@ module.exports = {
/**领取优惠券 */
receiveCoupon
(
data
)
{
return
api
.
post
({
method
:
`scrm.api.coupon.share.receive`
,
...
data
,
receiveSource
:
4
},
method
:
`scrm.api.coupon.share.receive`
,
...
data
,
receiveSource
:
4
},
true
)
},
...
...
@@ -187,4 +187,13 @@ module.exports = {
...
data
})
},
/**
* 领取调查问卷 商城券
*/
reciveQuestionnaireCoupon
(
data
)
{
return
api
.
post
({
method
:
`scrm.api.coupon.user.questionnaire.get`
,
...
data
})
},
}
\ No newline at end of file
api/module/index.js
View file @
11b36a5
...
...
@@ -10,6 +10,7 @@ import equityApi from './equity'
import
common
from
'./common'
import
entmicroApi
from
'./entmicro'
import
strategyApi
from
'./strategy'
import
questionnaireApi
from
'./questionnaire'
module
.
exports
=
{
wechatApi
,
...
...
@@ -23,5 +24,6 @@ module.exports = {
equityApi
,
common
,
entmicroApi
,
strategyApi
strategyApi
,
questionnaireApi
}
\ No newline at end of file
api/module/questionnaire.js
0 → 100644
View file @
11b36a5
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
packageEquity/pages/freecard/freecard.js
View file @
11b36a5
...
...
@@ -148,11 +148,12 @@ Page({
})
},
receiveRed
(
equityFreeCardId
)
{
let
{
isOpenMember
,
nickName
}
=
this
.
data
let
{
isOpenMember
,
nickName
,
bindingSource
}
=
this
.
data
let
params
=
{
equityFreeCardId
,
nickName
:
nickName
}
if
(
bindingSource
)
params
.
bindingSource
=
bindingSource
wx
.
p
.
api
.
equityApi
.
checkReceiveRed
(
params
).
then
(
res
=>
{
console
.
log
(
res
,
'checkReceiveRed---'
)
let
{
code
,
message
,
data
}
=
res
...
...
@@ -212,11 +213,15 @@ Page({
},
async
onLoad
(
options
)
{
let
system
=
wx
.
getSystemInfoSync
()
//从调查问卷来
let
system
=
wx
.
getSystemInfoSync
(),
bindingSource
=
''
const
authStatus
=
await
wx
.
p
.
router
.
intercept
(
false
)
const
{
merchantId
}
=
wx
.
p
.
storage
.
get
(
'merchant_info'
)
if
(
options
.
bindingSource
)
bindingSource
=
options
.
bindingSource
this
.
setData
({
merchantId
merchantId
,
bindingSource
})
wx
.
p
.
wxApi
.
showLoading
()
const
{
...
...
packageEquity/pages/gCoupons/index.scss
View file @
11b36a5
...
...
@@ -7,7 +7,7 @@
width
:
100%
;
height
:
664rpx
;
position
:
relative
;
background-size
:
100%
100%
;
.title
{
position
:
absolute
;
left
:
50%
;
...
...
@@ -86,7 +86,12 @@
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
{
width
:
100%
;
display
:
flex
;
...
...
packageEquity/pages/gCoupons/index.wxml
View file @
11b36a5
<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 wx:if="{{detailInfo.denomination}}" class="title">
<text class="price">{{detailInfo.denomination || ''}}</text>
<text class="unit">元</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 class="main_box {{handleStatus==1?'lq_g_bg':'lq_w_bag'}}">
<view wx:if="{{detailInfo.denomination}}" class="title">
<text class="price">{{detailInfo.denomination || ''}}</text>
<text class="unit">元</text>
<text class="tip">无门槛</text>
</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 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 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>
\ No newline at end of file
packageMall/pages/coupon/coupon.js
View file @
11b36a5
import
QR
from
'~/lib/wxqrcode'
import
{
IMG_URL
}
from
'~/config'
;
import
{
IMG_URL
}
from
'~/config'
;
Page
({
/**
* 页面的初始数据
...
...
@@ -19,7 +20,7 @@ Page({
useMemberType
:
0
,
list
:
[],
pageNum
:
1
,
IMGURL
:
IMG_URL
IMGURL
:
IMG_URL
},
navbarReady
(
e
)
{
this
.
setData
({
...
...
@@ -130,7 +131,6 @@ Page({
useMemberType
,
detailInfo
})
=>
{
console
.
log
(
userCouponId
)
wx
.
p
.
wxApi
.
showLoading
(
'加载中...'
)
this
.
setData
({
detailInfo
...
...
@@ -154,6 +154,12 @@ Page({
if
(
options
&&
options
.
couponId
)
{
console
.
log
(
options
)
wx
.
p
.
wxApi
.
showLoading
(
'加载中...'
)
if
(
options
.
bindingSource
)
{
this
.
setData
({
bindingSource
:
options
.
bindingSource
})
return
this
.
getCouponInfo
(
options
.
couponId
)
}
this
.
checkCoupon
(
options
)
if
(
options
.
activity_id
)
{
this
.
data
.
activiOptions
=
options
...
...
@@ -166,6 +172,14 @@ Page({
if
(
isReceive
)
this
.
confirm
()
}
},
/**调查问卷查询券详情 */
async
getCouponInfo
(
couponId
)
{
const
res
=
await
wx
.
p
.
api
.
couponsApi
.
getCouponInfo
({
couponId
})
wx
.
hideLoading
()
this
.
setCouponData
(
res
)
},
checkCoupon
(
options
,
callBack
)
{
wx
.
p
.
api
.
couponsApi
.
checkCoupon
(
options
).
then
(
couponInfo
=>
{
console
.
log
(
couponInfo
)
...
...
@@ -229,8 +243,30 @@ Page({
issueDate
,
userCouponId
,
merchantId
,
shareSource
shareSource
,
bindingSource
}
=
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
wx
.
p
.
router
.
intercept
().
then
(
response
=>
{
if
(
response
)
{
...
...
packageMine/pages/questionnaire/components/Cascader/Cascader.js
View file @
11b36a5
...
...
@@ -6,7 +6,8 @@ Component({
*/
properties
:
{
title
:
String
,
data
:
Array
data
:
Array
,
num
:
Number
},
/**
...
...
@@ -15,7 +16,7 @@ Component({
data
:
{
show
:
false
,
fieldValue
:
''
,
cascaderValue
:
''
,
cascaderValue
:
''
},
/**
...
...
@@ -37,11 +38,18 @@ Component({
const
{
selectedOptions
,
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
({
fieldValue
,
cascaderValue
:
value
})
this
.
triggerEvent
(
'change'
,
{
num
,
value
:
fieldValue
})
this
.
onClose
()
}
}
...
...
packageMine/pages/questionnaire/components/Cascader/Cascader.wxml
View file @
11b36a5
...
...
@@ -5,6 +5,6 @@
</view>
<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-popup>
\ No newline at end of file
packageMine/pages/questionnaire/components/Checkbox/Checkbox.js
View file @
11b36a5
...
...
@@ -5,14 +5,16 @@ Component({
* 组件的属性列表
*/
properties
:
{
data
:
Array
data
:
Array
,
num
:
Number
},
/**
* 组件的初始数据
*/
data
:
{
chooseList
:
[]
chooseList
:
[],
valueList
:
[]
},
/**
...
...
@@ -21,15 +23,28 @@ Component({
methods
:
{
choose
(
e
)
{
const
{
index
index
,
value
}
=
e
.
currentTarget
.
dataset
,
{
chooseList
chooseList
,
valueList
,
num
}
=
this
.
data
,
item
=
chooseList
.
findIndex
(
i
=>
i
==
index
)
if
(
item
==
-
1
)
chooseList
.
push
(
index
)
else
chooseList
.
splice
(
item
,
1
)
if
(
item
==
-
1
)
{
chooseList
.
push
(
index
)
valueList
.
push
(
value
)
}
else
{
chooseList
.
splice
(
item
,
1
)
valueList
.
splice
(
item
,
1
)
}
this
.
setData
({
chooseList
chooseList
,
valueList
})
this
.
triggerEvent
(
'change'
,
{
num
,
value
:
valueList
.
join
(
','
)
})
}
}
...
...
packageMine/pages/questionnaire/components/Checkbox/Checkbox.wxml
View file @
11b36a5
...
...
@@ -6,7 +6,7 @@
}
</wxs>
<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>
{{item}}
</view>
...
...
packageMine/pages/questionnaire/components/Finish/Finish.js
0 → 100644
View file @
11b36a5
// 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
()
},
1
e3
)
}
},
})
\ No newline at end of file
packageMine/pages/questionnaire/components/Finish/Finish.json
0 → 100644
View file @
11b36a5
{
"component"
:
true
,
"usingComponents"
:
{}
}
\ No newline at end of file
packageMine/pages/questionnaire/components/Finish/Finish.scss
0 → 100644
View file @
11b36a5
/* 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
packageMine/pages/questionnaire/components/Finish/Finish.wxml
0 → 100644
View file @
11b36a5
<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
packageMine/pages/questionnaire/components/Radio/Radio.js
View file @
11b36a5
...
...
@@ -5,7 +5,8 @@ Component({
* 组件的属性列表
*/
properties
:
{
data
:
Array
data
:
Array
,
num
:
Number
},
/**
...
...
@@ -21,14 +22,20 @@ Component({
methods
:
{
choose
(
e
)
{
const
{
index
index
,
value
}
=
e
.
currentTarget
.
dataset
,
{
raidoIndex
raidoIndex
,
num
}
=
this
.
data
if
(
raidoIndex
==
index
)
return
this
.
setData
({
raidoIndex
:
index
})
this
.
triggerEvent
(
'change'
,
{
num
,
value
})
}
}
})
\ No newline at end of file
packageMine/pages/questionnaire/components/Radio/Radio.wxml
View file @
11b36a5
<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>
{{item}}
</view>
...
...
packageMine/pages/questionnaire/components/Select/Select.js
View file @
11b36a5
...
...
@@ -6,7 +6,8 @@ Component({
*/
properties
:
{
data
:
Array
,
title
:
String
title
:
String
,
num
:
Number
},
/**
...
...
@@ -35,10 +36,16 @@ Component({
onConfirm
(
e
)
{
const
{
value
}
=
e
.
detail
}
=
e
.
detail
,
{
num
}
=
this
.
data
this
.
setData
({
value
})
this
.
triggerEvent
(
'change'
,
{
num
,
value
})
this
.
onClose
()
}
}
...
...
packageMine/pages/questionnaire/questionnaire.js
View file @
11b36a5
...
...
@@ -5,75 +5,20 @@ Page({
* 页面的初始数据
*/
data
:
{
tips
:
'亲爱的住户,你好。\n为了给你提供更好的居住环境和服务,由中海物业发起的调查问卷,邀请您填写,十分感谢!'
,
//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
:{
}
finish
:
false
},
blur
(
e
){
const
{
value
}
=
e
.
detail
console
.
log
(
value
)
blur
(
e
)
{
const
{
value
}
=
e
.
detail
,
{
num
}
=
e
.
currentTarget
.
dataset
this
.
change
({
detail
:
{
num
,
value
}
})
},
/**
* 生命周期函数--监听页面加载
...
...
@@ -81,49 +26,138 @@ Page({
onLoad
(
options
)
{
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady
()
{
async
getQuestionnaireDetail
(
options
)
{
const
res
=
await
wx
.
p
.
router
.
intercept
()
if
(
!
res
)
{
const
{
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
)
}
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow
()
{
transformData
(
data
)
{
const
result
=
[]
data
.
forEach
((
item
,
index
)
=>
{
const
levels
=
item
.
split
(
'/'
)
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
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide
()
{
change
(
e
)
{
console
.
log
(
e
)
const
{
num
,
value
}
=
e
.
detail
this
.
setData
({
[
`questionnaireObj.questions[
${
num
}
].answer`
]:
value
})
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload
()
{
async
submit
()
{
const
{
questionnaireObj
}
=
this
.
data
,
{
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
)
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh
()
{
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`
wx
.
p
.
router
.
jumpH5
(
wxUrl
)
},
/**
*
页面上拉触底事件的处理函数
*
生命周期函数--监听页面显示
*/
onReachBottom
()
{
onShow
()
{
const
{
options
}
=
this
if
(
options
.
id
)
this
.
getQuestionnaireDetail
(
options
)
},
/**
* 用户点击右上角分享
*/
...
...
packageMine/pages/questionnaire/questionnaire.json
View file @
11b36a5
...
...
@@ -4,7 +4,7 @@
"gl-checkbox"
:
"./components/Checkbox/Checkbox"
,
"gl-select"
:
"./components/Select/Select"
,
"gl-cascader"
:
"./components/Cascader/Cascader"
,
"van-field"
:
"@vant/weapp/field/index"
},
"navigationBarTitleText"
:
"调查问卷"
"van-field"
:
"@vant/weapp/field/index"
,
"finish"
:
"./components/Finish/Finish"
}
}
\ No newline at end of file
packageMine/pages/questionnaire/questionnaire.wxml
View file @
11b36a5
<view class="layout">
<text class="tips">{{tips}}</text>
<view class="form-box">
<block wx:for="{{test}}" wx:key="index">
<view class="title {{item.required?'required':''}}">
<view class="num">{{index + 1}}.</view>
<view class="text">{{item.title}}</view>
</view>
<view class="item {{item.type == 3?'textarea':''}}">
<block wx:if="{{item.type == 1}}">
<gl-radio data="{{item.data}}" />
</block>
<block wx:elif="{{item.type == 2}}">
<gl-checkbox data="{{item.data}}" />
</block>
<block wx:elif="{{item.type == 3}}">
<van-field type="textarea" autosize placeholder="请输入" border="{{ false }}" bindblur="blur" maxlength="{{item.maxlength}}" />
</block>
<block wx:elif="{{item.type == 4}}">
<gl-select data="{{item.data}}" title="{{item.title}}" />
</block>
<block wx:else>
<gl-cascader data="{{item.data}}" title="{{item.title}}" />
<block wx:if="{{questionnaireObj.id}}">
<block wx:if="{{!finish}}">
<view class="layout">
<text class="tips">{{questionnaireObj.desc}}</text>
<view class="form-box">
<block wx:for="{{questionnaireObj.questions}}" wx:key="index">
<view class="title {{item.required?'required':''}}">
<view class="num">{{item.num}}.</view>
<view class="text">{{item.text}}</view>
</view>
<view class="item {{item.type == 3?'textarea':''}}">
<block wx:if="{{item.type == 1}}">
<gl-radio data="{{item.data}}" num="{{index}}" bindchange="change" />
</block>
<block wx:elif="{{item.type == 2}}">
<gl-checkbox data="{{item.data}}" num="{{index}}" bindchange="change" />
</block>
<block wx:elif="{{item.type == 3}}">
<van-field type="textarea" autosize placeholder="请输入" border="{{ false }}" bindblur="blur" maxlength="{{item.maxLength}}" data-num="{{index}}" />
</block>
<block wx:elif="{{item.type == 4}}">
<gl-select data="{{item.data}}" title="{{item.text}}" num="{{index}}" bindchange="change" />
</block>
<block wx:else>
<gl-cascader data="{{item.data}}" title="{{item.text}}" num="{{index}}" bindchange="change" />
</block>
</view>
</block>
</view>
</block>
</view>
</view>
<view class="fixed-btn text-center">
<button class="default-btn">提交</button>
</view>
\ 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
packageStrategy/pages/strategyDetail/index.js
View file @
11b36a5
...
...
@@ -22,7 +22,6 @@ Page({
item_type
:
6
,
view
:
1
})
this
},
...
...
pages/crowdfunding/blank/blank.js
View file @
11b36a5
...
...
@@ -15,16 +15,21 @@ Page({
async
onLoad
(
options
)
{
const
info
=
JSON
.
parse
(
decodeURIComponent
(
options
.
userProfile
))
const
res
=
await
USERAPI
.
updateUserInfo
({
nickName
:
info
.
nickName
,
avatarUrl
:
info
.
avatarUrl
})
nickName
:
info
.
nickName
,
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
=>
{
res
.
setData
({
nickName
:
info
.
nickName
,
headImgUrl
:
info
.
avatarUrl
,
hasUserInfo
:
true
hasUserInfo
:
true
,
userInfo
})
res
.
toCheckMember
()
res
.
toCheckMember
&&
res
.
toCheckMember
()
let
item
=
{
add_way
:
'104'
,
customer_phone
:
res
.
data
.
userInfo
.
phone
,
...
...
@@ -34,7 +39,9 @@ Page({
}
let
json
=
JSON
.
stringify
(
item
)
// 数据上报
wx
.
p
.
api
.
common
.
trackHttp
({
json
}).
then
(
response
=>
{
})
wx
.
p
.
api
.
common
.
trackHttp
({
json
}).
then
(
response
=>
{})
})
},
...
...
utils/share.js
View file @
11b36a5
...
...
@@ -93,7 +93,7 @@ class Share {
}
}
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'
)
||
{}
//这个是针对登录的
const
{
merchantId
...
...
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