| @@ -1,103 +0,0 @@ | |||
| const Http = require("../../utils/HttpBasics"); | |||
| var config = require("../../config/config.js"); | |||
| Component({ | |||
| properties: { | |||
| questionnaire: { | |||
| type: Object, | |||
| value: {} | |||
| }, | |||
| questionId: { | |||
| type: String, | |||
| value: {} | |||
| } | |||
| }, | |||
| data: { | |||
| widthScreen: null, | |||
| moveData: null, | |||
| rotateData: null, | |||
| alphaData: null, | |||
| scaleData: null, | |||
| skewData: null, | |||
| matrixData: null, | |||
| flag: false, | |||
| }, | |||
| methods:{ | |||
| close:function(){ | |||
| this.alphaClick(); | |||
| this.queueClick(); | |||
| // 子组件向父组件传值 | |||
| // 传值到 coupon=>detail页面 | |||
| var myEvent = "questions1"; | |||
| this.triggerEvent('myevent', myEvent); | |||
| }, | |||
| /** | |||
| * 点击提交问题单选 | |||
| */ | |||
| formSubmit:function(e){ | |||
| let that = this; | |||
| /** | |||
| * 多选 | |||
| */ | |||
| if (e.currentTarget.dataset.flags =='multi'){ | |||
| if (that.data.anwserId.length==0){ | |||
| var answserIs = "" | |||
| }else{ | |||
| var answserIs = that.data.anwserId.join(","); | |||
| } | |||
| } | |||
| else{ | |||
| var answserIs = e.target.dataset.answerid; | |||
| } | |||
| Http.post({ | |||
| url: config.api.answerQuestion, | |||
| data: { | |||
| answer: answserIs, | |||
| questionId: e.currentTarget.dataset.questionid | |||
| } | |||
| }) | |||
| .then(res => { | |||
| this.alphaClick(); | |||
| this.queueClick(); | |||
| }) | |||
| .catch(err => { | |||
| wx.showToast({ | |||
| title: err.errMsg, | |||
| icon: 'none', | |||
| duration: 2000, | |||
| mask: false | |||
| }); | |||
| }) | |||
| // 子组件向父组件传值 | |||
| // 传值到 coupon=>detail页面 | |||
| var myEvent1 = "questions2"; | |||
| this.triggerEvent('myevent', myEvent1); | |||
| }, | |||
| /** | |||
| * 多选 | |||
| */ | |||
| checkboxChange:function(e){ | |||
| this.setData({ | |||
| anwserId:e.detail.value | |||
| }) | |||
| }, | |||
| queueClick: function () { | |||
| let that = this; | |||
| var animation = wx.createAnimation({}); | |||
| setTimeout(function () { | |||
| that.setData({ flag: true }) | |||
| }, 600) | |||
| animation.translate((this.data.widthScreen - 0), 0).scale(0).opacity(0.5).step({ duration: 1000 }) | |||
| that.setData({ queueData: animation.export()}) | |||
| }, | |||
| alphaClick: function (even) { | |||
| let that = this; | |||
| var animation = wx.createAnimation({}); | |||
| setTimeout(function () { | |||
| that.setData({ flag: true }) | |||
| }, 600) | |||
| animation.opacity(0).step({ duration: 1000 }) | |||
| that.setData({ alphaData: animation.export()}); | |||
| } | |||
| }, | |||
| }); | |||
| @@ -1,6 +0,0 @@ | |||
| { | |||
| "component": true, | |||
| "usingComponents": { | |||
| } | |||
| } | |||
| @@ -1,25 +0,0 @@ | |||
| <view hidden="{{flag}}"> | |||
| <view class="b1" animation="{{alphaData}}"> | |||
| <view id='con' class='con' animation="{{queueData}}"> | |||
| <image class='close' mode='widthFix' src="./../../assets/img/closed.png" bindtap="close"></image> | |||
| <image class='ques_gou' mode='widthFix' src="./../../assets/img/ques_gou.png"></image> | |||
| <image class='image' src="./../../assets/img/headbg.png" mode='widthFix'></image> | |||
| <image class='img image' src="./../../assets/img/ques_bg.png" mode='widthFix'></image> | |||
| <view class='question'> | |||
| <text class='title'>{{questionnaire.title}}</text> | |||
| <!-- 单选 --> | |||
| <radio-group class="radio-group" wx:if="{{questionnaire.flag=='single'}}" data-flags="sigle" bindtap="formSubmit" data-questionId="{{questionId}}"> | |||
| <radio class="radio ques" wx:for="{{questionnaire.answers}}" wx:key="{{index}}" value="{{item.id}}" data-answer="{{item.name}}" data-answerId="{{item.id}}"> | |||
| <view>{{item.name}}</view> | |||
| </radio> | |||
| </radio-group> | |||
| <!-- 多选 --> | |||
| <checkbox-group bindchange="checkboxChange" wx:if="{{questionnaire.flag=='multi'}}" bindchange="checkboxChange"> | |||
| <label class="radio ques" wx:for="{{questionnaire.answers}}" wx:key=""> | |||
| <checkbox value="{{item.id}}" />{{item.name}} | |||
| </label> | |||
| </checkbox-group> | |||
| <view class='ques btns' wx:if="{{questionnaire.flag=='multi'}}" data-flags='multi' bindtap='formSubmit' data-questionId="{{questionId}}">确定</view> | |||
| </view> </view> | |||
| </view> | |||
| </view> | |||
| @@ -1,84 +0,0 @@ | |||
| .b1 { | |||
| position: fixed; | |||
| top: 0px; | |||
| bottom: 0px; | |||
| left: 0px; | |||
| right: 0px; | |||
| background: rgba(0, 0, 0, 0.8); | |||
| overflow: hidden; | |||
| z-index: 100; | |||
| } | |||
| .con { | |||
| position: absolute; | |||
| top: 35rpx; | |||
| right: 0; | |||
| bottom: 0; | |||
| left: 0; | |||
| margin: auto; | |||
| width: 587rpx; | |||
| } | |||
| .con .image{ | |||
| display: block; | |||
| width: 100%; | |||
| } | |||
| .img { | |||
| margin-top: -50rpx; | |||
| } | |||
| .question { | |||
| display: block; | |||
| width: 587rpx; | |||
| background: #fff; | |||
| border-bottom-left-radius: 22rpx; | |||
| border-bottom-right-radius: 22rpx; | |||
| overflow: hidden; | |||
| } | |||
| .ques { | |||
| display: block; | |||
| width: 511rpx; | |||
| margin: 0 auto; | |||
| height: 95rpx; | |||
| line-height: 95rpx; | |||
| font-size: 30rpx; | |||
| color: #333; | |||
| border-bottom: 1rpx solid #eee; | |||
| } | |||
| .title { | |||
| width: 511rpx; | |||
| display: block; | |||
| text-align: center; | |||
| height: 50rpx; | |||
| margin: 0 auto; | |||
| padding-top:10rpx; | |||
| padding-bottom:20rpx; | |||
| font-size: 32rpx; | |||
| font-weight: bold; | |||
| line-height: 41rpx; | |||
| border-bottom: 1rpx solid #eee; | |||
| } | |||
| .quessss >view:last-child{ | |||
| border-bottom:0; | |||
| } | |||
| .close{ | |||
| position: relative; | |||
| z-index: 10000; | |||
| display: block; | |||
| width: 70rpx; | |||
| } | |||
| .ques_gou{ | |||
| position: absolute; | |||
| width: 20rpx; | |||
| top: 160rpx; | |||
| left: 23rpx; | |||
| } | |||
| .btns{ | |||
| color: #f8755b; | |||
| font-weight: bold; | |||
| font-size: 30rpx!important; | |||
| text-align: center!important; | |||
| } | |||
| @@ -1,6 +1,6 @@ | |||
| var config = { | |||
| // url: "https://ciformall.youlane.cn/C/api", | |||
| url:"https://c.malls.iformall.com/C/api", | |||
| url: "https://ciformall.youlane.cn/C/api", | |||
| // url:"https://c.malls.iformall.com/C/api", | |||
| // url:'https://ctest.malls.iformall.com/C/api', | |||
| api: { | |||
| /** | |||
| @@ -166,7 +166,7 @@ var config = { | |||
| }, | |||
| weapp: { | |||
| AppId: "wx026ee7f6290aa336" | |||
| AppId: "wxea71200db93d756b" | |||
| }, | |||
| ErrorCode: { | |||
| NICK_NOT_AUTH: 11004, | |||
| @@ -23,6 +23,7 @@ Page({ | |||
| id: null, | |||
| result: [], | |||
| end_time: null, | |||
| checked:false, | |||
| clock: "已经截止", | |||
| questionnaire: {}, | |||
| questionId: null, | |||
| @@ -36,7 +37,7 @@ Page({ | |||
| opacity:0, | |||
| queueData:null, | |||
| zIndex:11, | |||
| display:null, | |||
| display:"none", | |||
| showbutton:false | |||
| }, | |||
| phone: function () { | |||
| @@ -51,20 +52,23 @@ Page({ | |||
| * 点击提交问题单选 | |||
| */ | |||
| formSubmit: function (e) { | |||
| console.log(e); | |||
| let that = this; | |||
| /** | |||
| * 多选 | |||
| */ | |||
| console.log(e); | |||
| if (e.currentTarget.dataset.flags == 'multi') { | |||
| if (that.data.anwserId.length == 0) { | |||
| var answserIs = "" | |||
| var answserIs = null | |||
| } else { | |||
| var answserIs = that.data.anwserId.join(","); | |||
| } | |||
| } else { | |||
| var answserIs = e.target.dataset.answerid; | |||
| } | |||
| else if (e.currentTarget.dataset.flags == 'single') { | |||
| var answserIs = e.detail.value; | |||
| } | |||
| console.log(answserIs) | |||
| console.log(e.currentTarget.dataset.questionid) | |||
| Http.post({ | |||
| url: config.api.answerQuestion, | |||
| data: { | |||
| @@ -88,6 +92,7 @@ Page({ | |||
| * 多选 | |||
| */ | |||
| checkboxChange: function (e) { | |||
| console.log(e) | |||
| this.setData({ | |||
| anwserId: e.detail.value | |||
| }) | |||
| @@ -95,13 +100,11 @@ Page({ | |||
| closeQuestion: function () { | |||
| let that = this; | |||
| setTimeout(function(){ | |||
| that.setData({ | |||
| display: "none", | |||
| zIndex: 11, | |||
| opacity: 0 | |||
| }) | |||
| },500) | |||
| that.setData({ | |||
| display: "none", | |||
| zIndex: 11, | |||
| opacity: 0 | |||
| }) | |||
| setTimeout(function () { | |||
| that.orderFunc(); | |||
| }, 500) | |||
| @@ -133,10 +136,11 @@ Page({ | |||
| animation.translate((that.data.widthScreen - that.data.widthScreen), 0).scale(1).opacity(1).step({ | |||
| duration: 500 | |||
| }) | |||
| that.setData({ | |||
| queueData: animation.export(), | |||
| zIndex:9, | |||
| opacity:1, | |||
| display:"block", | |||
| questionnaire: JSON.parse(res.data.content), | |||
| questionId: res.data.id | |||
| }); | |||
| @@ -4,11 +4,10 @@ | |||
| <view class='banner'> | |||
| <image src='{{data.coverImg}}'></image> | |||
| </view> | |||
| <view class='coupons_info' style='position:relative;z-index:{{zIndex}}'> | |||
| <view class='coupons_info' style='position:relative;z-index:9'> | |||
| <view class='fenxiang'> | |||
| <image class="fenxiang" src='./../../../assets/img/fenxiang.png' mode="widthFix"></image> | |||
| <button class='share user-motto' data-id='{{data.id}}' data-couponId='{{data.couponId}}' data-title='{{data.title}}' | |||
| id="shareBtn" open-type="share" hover-class="other-button-hover"></button> | |||
| <button class='share user-motto' data-id='{{data.id}}' data-couponId='{{data.couponId}}' data-title='{{data.title}}' id="shareBtn" open-type="share" hover-class="other-button-hover"></button> | |||
| </view> | |||
| <view> | |||
| <view class='distance' wx:if="{{data.targetAd==2&&data.endTime!=undefined&&data.type!=5}}"> | |||
| @@ -67,7 +66,7 @@ | |||
| <text>{{data.merchantName}}</text> | |||
| <text>{{data.addr}}{{data.buildingName}}{{data.floorName}}</text> | |||
| </view> | |||
| <image style='position:absolute;z-index:{{zIndex}}' bindtap='phone' class="tel" src="./../../../assets/img/tel.jpg" mode="widthFix" /> | |||
| <image bindtap='phone' class="tel" src="./../../../assets/img/tel.jpg" mode="widthFix" /> | |||
| </view> | |||
| </view> | |||
| <view class='notes'> | |||
| @@ -92,7 +91,7 @@ | |||
| <!-- 问卷调查 --> | |||
| <view class="b1" style="opacity:{{opacity}};display: {{display}}" animation="{{queueData}}"> | |||
| <view class="b1" style="opacity:{{opacity}};display: {{display}};" animation="{{queueData}}"> | |||
| <view id='con' class='con'> | |||
| <image class='close' mode='widthFix' src="./../../../assets/img/closed.png" bindtap="closeQuestion"></image> | |||
| <image class='ques_gou' mode='widthFix' src="./../../../assets/img/ques_gou.png"></image> | |||
| @@ -101,12 +100,17 @@ | |||
| <view class='question'> | |||
| <text class='titles'>{{questionnaire.title}}</text> | |||
| <!-- 单选 --> | |||
| <radio-group class="radio-group" wx:if="{{questionnaire.flag=='single'}}" data-flags="sigle" bindtap="formSubmit" | |||
| data-questionId="{{questionId}}"> | |||
| <radio class="radio ques" wx:for="{{questionnaire.answers}}" wx:key="{{index}}" value="{{item.id}}" data-answer="{{item.name}}" | |||
| data-answerId="{{item.id}}"> | |||
| <view>{{item.name}}</view> | |||
| </radio> | |||
| <radio-group class="radio-group" wx:if="{{questionnaire.flag=='single'}}" data-flags="single" bindchange="formSubmit" data-questionId="{{questionId}}"> | |||
| <!-- <label wx:for="{{questionnaire.answers}}" wx:key="{{index}}" data-answer="{{item.name}}" data-answerId="{{item.id}}"> | |||
| <radio class="radio ques" value="{{item.id}}" />{{item.name}} | |||
| </label> --> | |||
| <label class="radios" wx:for="{{questionnaire.answers}}" wx:key="{{index}}"> | |||
| <radio value="{{item.id}}" checked="{{item.checked}}" />{{item.name}} | |||
| </label> | |||
| </radio-group> | |||
| <!-- 多选 --> | |||
| <checkbox-group bindchange="checkboxChange" wx:if="{{questionnaire.flag=='multi'}}" bindchange="checkboxChange"> | |||
| @@ -114,8 +118,7 @@ | |||
| <checkbox value="{{item.id}}" />{{item.name}} | |||
| </label> | |||
| </checkbox-group> | |||
| <view class='ques btns' wx:if="{{questionnaire.flag=='multi'}}" data-flags='multi' bindtap='formSubmit' | |||
| data-questionId="{{questionId}}">确定</view> | |||
| <view class='ques btns' wx:if="{{questionnaire.flag=='multi'}}" data-flags='multi' bindtap='formSubmit' data-questionId="{{questionId}}">确定</view> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| @@ -425,4 +425,12 @@ page { | |||
| font-weight: bold; | |||
| font-size: 30rpx!important; | |||
| text-align: center!important; | |||
| } | |||
| .radios{ | |||
| display: block; | |||
| font-size:28rpx; | |||
| height: 95rpx; | |||
| line-height: 95rpx; | |||
| color: #333; | |||
| text-indent: .5em; | |||
| } | |||
| @@ -12,7 +12,7 @@ | |||
| }, | |||
| "compileType": "miniprogram", | |||
| "libVersion": "2.0.9", | |||
| "appid": "wx026ee7f6290aa336", | |||
| "appid": "wxea71200db93d756b", | |||
| "projectname": "C", | |||
| "isGameTourist": false, | |||
| "condition": { | |||