...
|
...
|
@@ -3,29 +3,13 @@ require('3party/question-detail.page.css'); |
|
|
let $ = require('yoho-jquery'),
|
|
|
yoho = require('yoho-app'),
|
|
|
tipDg = require('plugin/tip'),
|
|
|
share = require('common/share'),
|
|
|
Validate = require('plugin/validata');
|
|
|
|
|
|
let validate = {
|
|
|
getResults: () => {
|
|
|
return Promise.resolve({});
|
|
|
}
|
|
|
};
|
|
|
share = require('common/share');
|
|
|
|
|
|
let question = {
|
|
|
$base: $('#qs-wrap'),
|
|
|
init: function() {
|
|
|
let that = this;
|
|
|
|
|
|
if ($('#js-img-check').length) {
|
|
|
validate = new Validate('#js-img-check', {
|
|
|
useREM: {
|
|
|
rootFontSize: 40,
|
|
|
picWidth: 150
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
this.$errTip = $('.error-tip');
|
|
|
this.$mobile = $('.user-mobile > input');
|
|
|
this.$item = $('.qs-item, .sub-qs-item', this.$base);
|
...
|
...
|
@@ -230,49 +214,39 @@ let question = { |
|
|
return;
|
|
|
}
|
|
|
|
|
|
return validate.getResults().then(result => {
|
|
|
if (typeof result === 'undefined') {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let params = {
|
|
|
id: this.$base.data('id'),
|
|
|
uid: this.$base.data('cid'),
|
|
|
startTime: this.startTime,
|
|
|
endTime: Date.parse(new Date()) / 1000,
|
|
|
frontAnswers: JSON.stringify(info),
|
|
|
mobile: this.$mobile.val()
|
|
|
};
|
|
|
|
|
|
$.extend(params, result);
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/3party/questionnaire/submit',
|
|
|
data: params
|
|
|
}).then(function(data) {
|
|
|
validate.type === 2 && validate.refresh();
|
|
|
let params = {
|
|
|
id: this.$base.data('id'),
|
|
|
uid: this.$base.data('cid'),
|
|
|
startTime: this.startTime,
|
|
|
endTime: Date.parse(new Date()) / 1000,
|
|
|
frontAnswers: JSON.stringify(info),
|
|
|
mobile: this.$mobile.val()
|
|
|
};
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/3party/questionnaire/submit',
|
|
|
data: params
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200 || data.code === 206) {
|
|
|
let tip = '调查问卷已成功提交,感谢您的帮助!';
|
|
|
|
|
|
if (data.code === 206 && data.message) {
|
|
|
tip = data.message;
|
|
|
}
|
|
|
|
|
|
if (data.code === 200 || data.code === 206) {
|
|
|
let tip = '调查问卷已成功提交,感谢您的帮助!';
|
|
|
tipDg.show(tip);
|
|
|
|
|
|
if (data.code === 206 && data.message) {
|
|
|
tip = data.message;
|
|
|
setTimeout(function() {
|
|
|
if (yoho.isApp) {
|
|
|
yoho.invokeMethod('go.back');
|
|
|
} else {
|
|
|
window.history.go(-1);
|
|
|
}
|
|
|
|
|
|
tipDg.show(tip);
|
|
|
|
|
|
setTimeout(function() {
|
|
|
if (yoho.isApp) {
|
|
|
yoho.invokeMethod('go.back');
|
|
|
} else {
|
|
|
window.history.go(-1);
|
|
|
}
|
|
|
}, 2000);
|
|
|
} else {
|
|
|
tipDg.show(data.message || '网络出了点问题~');
|
|
|
}
|
|
|
});
|
|
|
}, 2000);
|
|
|
} else {
|
|
|
tipDg.show(data.message || '网络出了点问题~');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
...
|
...
|
|