|
- 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,
- },
- methods:{
- close:function(){
- this.alphaClick();
- this.queueClick();
- // 子组件向父组件传值
- // 传值到 coupon=>detail页面
- var myEvent = "questions1";
- this.triggerEvent('myevent', myEvent);
- },
- /**
- * 点击提交问题单选
- */
- formSubmit:function(e){
- let that = this;
- console.log(e);
- /**
- * 多选
- */
- 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 => {
- console.log(res);
- this.alphaClick();
- this.queueClick();
- })
- // 子组件向父组件传值
- // 传值到 coupon=>detail页面
- var myEvent1 = "questions2";
- this.triggerEvent('myevent', myEvent1);
- },
- /**
- * 多选
- */
- checkboxChange:function(e){
- console.log(e);
- this.setData({
- anwserId:e.detail.value
- })
- },
-
- queueClick: function () {
- let that = this;
- var animation = wx.createAnimation({});
- animation.translate((this.data.widthScreen - 0), 0).scale(0).opacity(0.5).step({ duration: 1500 })
- that.setData({ queueData: animation.export()})
- },
- alphaClick: function (even) {
- let that = this;
- var animation = wx.createAnimation({})
- animation.opacity(0).step({ duration: 1500 })
- that.setData({ alphaData: animation.export()});
- }
- },
- });
|