Authored by 毕凯

Merge branch 'master' into release/5.7.1

  1 +'use strict';
  2 +
  3 +const questionModel = require('../models/question');
  4 +const headerModel = require('../../../doraemon/models/header'); // 头部model
  5 +
  6 +exports.list = (req, res, next) => {
  7 + req.ctx(questionModel).getQuestionList().then(result => {
  8 + res.render('question/list', {
  9 + title: '调研中心',
  10 + module: '3party',
  11 + page: 'question-list',
  12 + pageHeader: headerModel.setNav({
  13 + navTitle: '调研中心'
  14 + }),
  15 + list: result,
  16 + isApp: req.yoho.isApp,
  17 + localCss: true
  18 + });
  19 + }).catch(next);
  20 +};
  21 +
  22 +exports.check = (req, res, next) => {
  23 + let params = req.body;
  24 +
  25 + params.uid = req.user.uid || params.uid;
  26 +
  27 + if (!params.uid) {
  28 + return res.send({code: 400, message: '请先登录!'});
  29 + }
  30 +
  31 + req.ctx(questionModel).getQuestionStatus(params).then(result => {
  32 + res.send(result);
  33 + }).catch(next);
  34 +};
  35 +
  36 +exports.submit = (req, res, next) => {
  37 + let params = req.body;
  38 +
  39 + params.uid = req.user.uid || params.uid;
  40 +
  41 + if (!params.uid) {
  42 + return res.send({code: 400, message: '请先登录!'});
  43 + }
  44 +
  45 + // 标识问卷来源
  46 + if (req.yoho.isApp) {
  47 + params.sourceType = 'APP';
  48 + } else if (req.yoho.mobile) {
  49 + params.sourceType = 'H5';
  50 + } else {
  51 + params.sourceType = 'PC';
  52 + }
  53 +
  54 + req.ctx(questionModel).submitQuestion(params).then(result => {
  55 + res.send(result);
  56 + }).catch(next);
  57 +};
  58 +
  59 +
  60 +
  61 +exports.detail = (req, res, next) => {
  62 + let id = parseInt(`0${req.params.id}`, 10);
  63 +
  64 + req.ctx(questionModel).getQuestionDetail(id, req.user.uid).then(result => {
  65 + if (result && result.detail && req.yoho.isApp) {
  66 + result.detail.uid = req.user.uid;
  67 + }
  68 +
  69 + res.render('question/detail', Object.assign(result, {
  70 + title: 'YOHOBUY!潮流大调查',
  71 + module: '3party',
  72 + page: 'question-detail',
  73 + pageHeader: headerModel.setNav({
  74 + navTitle: 'YOHOBUY!潮流大调查'
  75 + }),
  76 + isApp: req.yoho.isApp,
  77 + localCss: true
  78 + }));
  79 + }).catch(next);
  80 +};
  1 +/**
  2 + * question model
  3 + * @author: yyq<yanqing.yang@yoho.cn>
  4 + * @date: 2017/05/23
  5 + */
  6 +
  7 +const _ = require('lodash');
  8 +
  9 +module.exports = class extends global.yoho.BaseModel {
  10 + constructor(ctx) {
  11 + super(ctx);
  12 + }
  13 + getQuestionList() {
  14 + return this.get({
  15 + url: 'activity/question/questionList',
  16 + api: global.yoho.ServiceAPI
  17 + }).then(result => {
  18 + let list = _.get(result, 'data.rows', []);
  19 +
  20 + _.forEach(list, (value, key) => {
  21 + value.index = key + 1;
  22 +
  23 + if (!_.get(value, 'share.imgUrl', '')) {
  24 + _.set(value, 'share.imgUrl', 'http://img11.static.yhbimg.com/sns/2017/05/25/14/0177e28a98f73417ae1a2a146aa2670dd2.png'); // eslint-disable-line
  25 + }
  26 + });
  27 +
  28 + return list;
  29 + });
  30 + }
  31 + getQuestionStatus(params) {
  32 + return this.get({
  33 + url: '/activity/question/questionValidate',
  34 + data: params,
  35 + api: global.yoho.ServiceAPI
  36 + });
  37 + }
  38 + getQuestionDetail(id, uid) {
  39 + return Promise.all([
  40 + this.get({
  41 + url: '/activity/question/questionValidate',
  42 + data: {id: id, uid: uid},
  43 + api: global.yoho.ServiceAPI
  44 + }),
  45 + this.get({
  46 + url: 'activity/question/questionDetail',
  47 + data: {id: id},
  48 + api: global.yoho.ServiceAPI
  49 + })
  50 + ]).then(result => {
  51 + let resData = {};
  52 +
  53 + if (_.get(result, '[0].code', '') === 200) {
  54 + let data = _.get(result, '[1].data', {});
  55 +
  56 + if (data.questions) {
  57 + _.forEach(data.questions, value => {
  58 + if (+value.questionType === 3) {
  59 + value.questionContents = _.fill(Array(value.fillBlankNum || 1), true);
  60 + }
  61 + });
  62 + }
  63 +
  64 + if (!_.isEmpty(data)) {
  65 + resData.detail = data;
  66 + }
  67 + } else {
  68 + resData.errText = _.get(result, '[0].message', '哟,本次调研已经飞走了,请移步其他调研呗!');
  69 + }
  70 +
  71 + return resData;
  72 + });
  73 + }
  74 + submitQuestion(info) {
  75 + return this.post({
  76 + url: '/activity/question/submitQuestions',
  77 + data: info,
  78 + api: global.yoho.ServiceAPI
  79 + });
  80 + }
  81 +};
@@ -10,7 +10,9 @@ const router = require('express').Router(); // eslint-disable-line @@ -10,7 +10,9 @@ const router = require('express').Router(); // eslint-disable-line
10 const cRoot = './controllers'; 10 const cRoot = './controllers';
11 const ads = require(`${cRoot}/ads`); 11 const ads = require(`${cRoot}/ads`);
12 const check = require(`${cRoot}/check`); 12 const check = require(`${cRoot}/check`);
  13 +const question = require(`${cRoot}/question`);
13 const validateCode = require('../passport/controllers/validateCode'); 14 const validateCode = require('../passport/controllers/validateCode');
  15 +const auth = require('../../doraemon/middleware/auth');
14 16
15 // routers 17 // routers
16 18
@@ -18,4 +20,10 @@ router.get('/ads', ads.index); @@ -18,4 +20,10 @@ router.get('/ads', ads.index);
18 router.get('/check', validateCode.load, check.index); 20 router.get('/check', validateCode.load, check.index);
19 router.post('/check/submit', validateCode.check, check.submit); 21 router.post('/check/submit', validateCode.check, check.submit);
20 22
  23 +
  24 +router.get('/questionnaire', auth, question.list);
  25 +router.post('/questionnaire/check', question.check);
  26 +router.post('/questionnaire/submit', question.submit);
  27 +router.get('/questionnaire/:id', auth, question.detail);
  28 +
21 module.exports = router; 29 module.exports = router;
  1 +<div class="qs-detail-page">
  2 + {{# detail}}
  3 + <div class="error-tip"></div>
  4 + <div class="detail-wrap">
  5 + <p class="sub-title">{{title}}</p>
  6 + <p class="guide-tip">{{description}}</p>
  7 +
  8 + <div id="qs-wrap" class="qs-wrap" data-id="{{id}}" data-cid="{{uid}}" data-title="{{share.title}}" data-desc="{{share.subtitle}}" data-img="{{share.imgUrl}}">
  9 + {{# questions}}
  10 + <dl class="qs-item" data-index="{{questionIndex}}" data-type="{{questionType}}">
  11 + <dt>{{questionTitle}}</dt>
  12 + {{#isEqualOr questionType 1}}
  13 + {{# questionContents}}
  14 + <dd class="radio-option" data-index="{{@index}}">
  15 + <span class="iconfont">&#xe6ea;</span>
  16 + <div class="option-box">{{{option}}}</div>
  17 + {{#if addon}}
  18 + <input type="text">
  19 + {{/if}}
  20 + </dd>
  21 + {{/ questionContents}}
  22 + {{/isEqualOr}}
  23 +
  24 + {{#isEqualOr questionType 2}}
  25 + {{# questionContents}}
  26 + <dd class="check-option" data-index="{{@index}}">
  27 + <span class="iconfont">&#xe6ea;</span>
  28 + <div class="option-box">{{{option}}}</div>
  29 + {{#if addon}}
  30 + <input type="text">
  31 + {{/if}}
  32 + </dd>
  33 + {{/ questionContents}}
  34 + {{/isEqualOr}}
  35 +
  36 + {{#isEqualOr questionType 3}}
  37 + {{# questionContents}}
  38 + <dd><textarea class="text-input"></textarea></dd>
  39 + {{/ questionContents}}
  40 + {{/isEqualOr}}
  41 + </dl>
  42 + {{/ questions}}
  43 + </div>
  44 +
  45 + <div class="submit">
  46 + <button class="submit-btn">提交</button>
  47 + </div>
  48 + </div>
  49 + {{/ detail}}
  50 +
  51 + <div class="qs-err">
  52 + <p class="err-text">{{{errText}}}</p>
  53 + <a href="/3party/questionnaire">去做问卷</a>
  54 + </div>
  55 +
  56 + <div id="tip-dialog" class="tip-dialog hide">
  57 + <div class="dg-wrap">
  58 + <div class="dg-content"><p>您的问卷还没有成功提交哦!<br>是否立刻返回!</p></div>
  59 + <div class="dg-btns clearfix">
  60 + <span class="back-btn">返回</span>
  61 + <span class="close-btn continue-btn">继续填写</span>
  62 + </div>
  63 + </div>
  64 + </div>
  65 +</div>
  1 +<div class="qs-list-page">
  2 + {{#if list}}
  3 + <ul id="qs-list" class="qs-list">
  4 + {{#each list}}
  5 + <li data-id="{{id}}" data-title="{{title}}" data-desc="{{share.subtitle}}" data-img="{{share.imgUrl}}">{{index}}.{{title}}</li>
  6 + {{/each}}
  7 + </ul>
  8 + {{/if}}
  9 +
  10 + <div id="tip-dialog" class="tip-dialog hide">
  11 + <div class="dg-wrap">
  12 + <div class="dg-content"></div>
  13 + <div class="dg-btns sure-btns clearfix hide">
  14 + <span class="close-btn sure-btn">确定</span>
  15 + </div>
  16 + <div class="dg-btns share-btns clearfix">
  17 + <span class="close-btn cancel-btn">取消</span>
  18 + <span class="share-btn">分享问卷</span>
  19 + </div>
  20 + </div>
  21 + </div>
  22 +</div>
@@ -2,6 +2,9 @@ @@ -2,6 +2,9 @@
2 const model = require('../models/feature'); 2 const model = require('../models/feature');
3 3
4 exports.index = function(req, res, next) { 4 exports.index = function(req, res, next) {
  5 + // 唤起 APP 的路径
  6 + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"param":{"share_id":"${req.query.share_id}"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"${req.query.share_id}"},"url":"https://activity.yoho.cn/feature/${req.params.code}.html"}}`;
  7 +
5 model.index({ 8 model.index({
6 code: req.params.code, 9 code: req.params.code,
7 type: req.query.type 10 type: req.query.type
@@ -28,4 +28,12 @@ @@ -28,4 +28,12 @@
28 <span>400-889-9646</span> 28 <span>400-889-9646</span>
29 <i class="arr-ico iconfont">&#xe604;</i> 29 <i class="arr-ico iconfont">&#xe604;</i>
30 </a> 30 </a>
  31 + <a class="list clearfix" href="/3party/questionnaire">
  32 + <i class="questionnaire-ico icon"></i>
  33 + <div>
  34 + <p class="title">调研中心</p>
  35 + <p class="tip">一起来参与,赢取更多惊喜!</p>
  36 + </div>
  37 + <i class="arr-ico iconfont">&#xe604;</i>
  38 + </a>
31 </div> 39 </div>
@@ -51,6 +51,7 @@ module.exports = () => { @@ -51,6 +51,7 @@ module.exports = () => {
51 yoho.isApp = (req.query.app_version && req.query.app_version !== 'false') || 51 yoho.isApp = (req.query.app_version && req.query.app_version !== 'false') ||
52 (req.query.appVersion && req.query.appVersion !== 'false') || 52 (req.query.appVersion && req.query.appVersion !== 'false') ||
53 req.cookies.app_version || /YohoBuy/i.test(req.get('User-Agent') || ''); 53 req.cookies.app_version || /YohoBuy/i.test(req.get('User-Agent') || '');
  54 + yoho.isMobile = /(nokia|iphone|android|ipad|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220)/i.test(req.get('User-Agent') || ''); // eslint-disable-line
54 yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || ''); 55 yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || '');
55 yoho.isWeibo = ua.indexOf('weibo') !== -1; 56 yoho.isWeibo = ua.indexOf('weibo') !== -1;
56 yoho.isqq = /MQQBrowser/i.test(req.get('User-Agent') || ''); 57 yoho.isqq = /MQQBrowser/i.test(req.get('User-Agent') || '');
@@ -4,7 +4,7 @@ const path = require('path'); @@ -4,7 +4,7 @@ const path = require('path');
4 const info = { 4 const info = {
5 host: '127.0.0.1', 5 host: '127.0.0.1',
6 port: 5001, 6 port: 5001,
7 - publicPath: 'http://127.0.0.1:5001' 7 + publicPath: 'http://127.0.0.1:5001/'
8 }; 8 };
9 9
10 try { 10 try {
  1 +require('3party/question-detail.page.css');
  2 +
  3 +let $ = require('yoho-jquery'),
  4 + yoho = require('yoho-app'),
  5 + tipDg = require('plugin/tip'),
  6 + share = require('common/share');
  7 +
  8 +let question = {
  9 + $base: $('#qs-wrap'),
  10 + init: function() {
  11 + let that = this;
  12 +
  13 + this.$errTip = $('.error-tip');
  14 + this.$item = $('.qs-item', this.$base);
  15 + this.startTime = Date.parse(new Date()) / 1000;
  16 +
  17 + if (this.$base.length) {
  18 + let data = this.$base.data();
  19 +
  20 + this.shareInfo = {
  21 + title: data.title,
  22 + link: 'http://m.yohobuy.com/3party/questionnaire/' + data.id,
  23 + desc: data.desc,
  24 + imgUrl: data.img
  25 + };
  26 +
  27 + // 设置分享信息
  28 + share(this.shareInfo);
  29 +
  30 + // 设置app页面信息及分享信息
  31 + if (yoho.isApp) {
  32 + yoho.ready(function() {
  33 + yoho.invokeMethod('get.pageType', {
  34 + pageType: 'questionnaire'
  35 + });
  36 + yoho.invokeMethod('set.shareInfo', that.shareInfo);
  37 + });
  38 + }
  39 + }
  40 +
  41 + this.bindEvent();
  42 + },
  43 + bindEvent: function() {
  44 + let that = this;
  45 +
  46 + this.$base.on('click', '.radio-option', function() {
  47 + let $this = $(this);
  48 +
  49 + if (!$this.hasClass('on')) {
  50 + $this.siblings('.on').removeClass('on');
  51 + $this.addClass('on');
  52 + }
  53 + }).on('click', '.check-option', function() {
  54 + let $this = $(this);
  55 +
  56 + if ($this.hasClass('on')) {
  57 + $this.removeClass('on');
  58 + } else {
  59 + $this.addClass('on');
  60 + }
  61 + }).on('click', 'input', function(e) {
  62 + if (e && e.stopPropagation) {
  63 + e.stopPropagation();
  64 + } else {
  65 + window.event.cancelBubble = true;
  66 + }
  67 + });
  68 + $('.submit-btn').click(function() {
  69 + that.saveAnswers(that.packAnswersInfo());
  70 + });
  71 + },
  72 + packAnswersInfo: function() {
  73 + let that = this;
  74 + let answer = [];
  75 + let $errDom;
  76 +
  77 + this.$item.each(function() {
  78 + if ($errDom) {
  79 + return;
  80 + }
  81 +
  82 + let $this = $(this);
  83 + let data = $this.data();
  84 + let ans = [];
  85 + let errText = '';
  86 +
  87 + if (+data.type === 3) {
  88 + $this.find('.text-input').each(function() {
  89 + let val = $.trim($(this).val());
  90 +
  91 + if (val) {
  92 + ans.push({
  93 + questionIndex: data.index,
  94 + answerIndex: ans.length,
  95 + addon: val
  96 + });
  97 + }
  98 +
  99 + if (val.length > 400) {
  100 + errText = '输入内容过长';
  101 + }
  102 +
  103 +
  104 + });
  105 + } else {
  106 + $this.find('.on').each(function() {
  107 + let $that = $(this),
  108 + $input = $that.find('input'),
  109 + a = {
  110 + questionIndex: data.index,
  111 + answerIndex: $that.data('index')
  112 + };
  113 +
  114 + if ($input && $input.length) {
  115 + a.addon = $input.val();
  116 + }
  117 +
  118 + ans.push(a);
  119 + });
  120 +
  121 + if (data.type === '1') {
  122 + ans.length = 1;
  123 + }
  124 + }
  125 +
  126 + if (errText || !ans.length) {
  127 + $errDom = $this;
  128 +
  129 + if (!errText) {
  130 + errText = +data.type === 3 ? '请填写一条回答' : '请选择一个选项';
  131 + }
  132 +
  133 + that.showError(errText, $errDom);
  134 + } else {
  135 + answer = $.merge(answer, ans);
  136 + }
  137 + });
  138 +
  139 + if ($errDom) {
  140 + return [];
  141 + } else {
  142 + return answer;
  143 + }
  144 + },
  145 + showError: function(tip, $errDom) {
  146 + let that = this;
  147 +
  148 + this.$errTip.html(tip);
  149 +
  150 + if (this.timer) {
  151 + clearTimeout(this.timer);
  152 + }
  153 +
  154 + this.timer = setTimeout(function() {
  155 + that.$errTip.empty();
  156 + }, 5000);
  157 +
  158 + if ($errDom) {
  159 + let offTop = $errDom.offset().top,
  160 + errHeight = this.$errTip.outerHeight();
  161 +
  162 + $('html,body').animate({scrollTop: offTop - errHeight}, 500);
  163 + }
  164 + },
  165 + saveAnswers: function(info) {
  166 + if (!info || !info.length) {
  167 + return;
  168 + }
  169 +
  170 + $.ajax({
  171 + type: 'POST',
  172 + url: '/3party/questionnaire/submit',
  173 + data: {
  174 + id: this.$base.data('id'),
  175 + uid: this.$base.data('cid'),
  176 + startTime: this.startTime,
  177 + endTime: Date.parse(new Date()) / 1000,
  178 + frontAnswers: JSON.stringify(info)
  179 + }
  180 + }).then(function(data) {
  181 + if (data.code === 200) {
  182 + tipDg.show('调查问卷已成功提交,感谢您的帮助!');
  183 +
  184 + setTimeout(function() {
  185 + if (yoho.isApp) {
  186 + yoho.invokeMethod('go.back');
  187 + } else {
  188 + window.history.go(-1);
  189 + }
  190 + }, 2000);
  191 + } else {
  192 + tipDg.show(data.message || '网络出了点问题~');
  193 + }
  194 + });
  195 + }
  196 +};
  197 +
  198 +let tipDialog = {
  199 + $base: $('#tip-dialog'),
  200 + init: function() {
  201 + var that = this;
  202 +
  203 + this.$base.on('click', '.close-btn', function() {
  204 + that.hide();
  205 + });
  206 + this.$base.on('click', '.back-btn', function() {
  207 + window.history.go(-1);
  208 + });
  209 + },
  210 + show: function() {
  211 + this.$base.removeClass('hide');
  212 + },
  213 + hide: function() {
  214 + this.$base.addClass('hide');
  215 + }
  216 +};
  217 +
  218 +tipDialog.init();
  219 +question.init();
  220 +
  221 +if (question.$base.length) {
  222 + $('.nav-back').removeAttr('href').click(function() {
  223 + tipDialog.show();
  224 + });
  225 +} else if (yoho.isApp) {
  226 + $('.qs-err a').removeAttr('href').click(function() {
  227 + yoho.invokeMethod('go.back');
  228 + });
  229 +}
  230 +
  1 +'use strict';
  2 +require('3party/question-list.page.css');
  3 +
  4 +let $ = require('yoho-jquery'),
  5 + yoho = require('yoho-app');
  6 +
  7 +const DETAIL_URI = 'http://m.yohobuy.com/3party/questionnaire';
  8 +
  9 +require('../common');
  10 +
  11 +let qs = window.queryString;
  12 +
  13 +function getQuestionStatus(reqData, cb) {
  14 + if (qs.uid) {
  15 + reqData.uid = qs.uid;
  16 + }
  17 +
  18 + $.ajax({
  19 + type: 'POST',
  20 + url: '/3party/questionnaire/check',
  21 + data: reqData
  22 + }).then(function(data) {
  23 + if (cb && typeof cb === 'function') {
  24 + return cb(data);
  25 + }
  26 + });
  27 +}
  28 +
  29 +function jumpQuestionDetail(data) {
  30 + let href;
  31 +
  32 + if (qs && qs.uid && yoho.isApp) {
  33 + href = DETAIL_URI + '/' + data.id + '?uid=' + qs.uid;
  34 + } else {
  35 + href = DETAIL_URI + '/' + data.id;
  36 + }
  37 +
  38 + if (yoho && yoho.isApp) {
  39 + let link = yoho.parseUrl(href);
  40 +
  41 + yoho.goH5(href, JSON.stringify({
  42 + action: 'go.h5',
  43 + params: {
  44 + islogin: 'N',
  45 + type: 14,
  46 + updateflag: Date.now() + '',
  47 + url: link.path,
  48 + param: link.query
  49 + }
  50 + }));
  51 + } else {
  52 + window.location.href = href;
  53 + }
  54 +}
  55 +
  56 +let tipDialog = {
  57 + $base: $('#tip-dialog'),
  58 + init: function() {
  59 + let that = this;
  60 +
  61 + this.$content = $('.dg-content', this.$base);
  62 + this.$sureBtns = $('.sure-btns', this.$base);
  63 + this.$shareBtns = $('.share-btns', this.$base);
  64 +
  65 + this.$base.on('click', '.close-btn', function() {
  66 + that.hide();
  67 + });
  68 + this.$base.on('click', '.share-btn', function() {
  69 + if (that.share && typeof that.share === 'function') {
  70 + that.share();
  71 + } else {
  72 + that.hide();
  73 + }
  74 + });
  75 + },
  76 + show: function(info) {
  77 + this.share = false;
  78 +
  79 + if (typeof info === 'object') {
  80 + this.$content.html(info.content);
  81 + this.$sureBtns.addClass('hide');
  82 + this.$shareBtns.removeClass('hide');
  83 + } else if (typeof info === 'string') {
  84 + this.$content.html('<p>' + info + '</p>');
  85 + this.$sureBtns.removeClass('hide');
  86 + this.$shareBtns.addClass('hide');
  87 + } else {
  88 + return;
  89 + }
  90 +
  91 + this.$base.removeClass('hide');
  92 + },
  93 + hide: function() {
  94 + this.$base.addClass('hide');
  95 + }
  96 +};
  97 +
  98 +tipDialog.init();
  99 +
  100 +let $list = $('#qs-list');
  101 +
  102 +$list.on('click', 'li', function() {
  103 + let data = $(this).data();
  104 +
  105 + if (!data.id) {
  106 + return;
  107 + }
  108 +
  109 + getQuestionStatus({uid: qs.uid, id: data.id}, function(resData) {
  110 + if (resData.code === 200) {
  111 + jumpQuestionDetail(data);
  112 + } else if (resData.code === 206) {
  113 + if (yoho && yoho.isApp) {
  114 + yoho.invokeMethod('go.showShareAlert', {
  115 + title: data.title,
  116 + link: 'http://m.yohobuy.com/3party/questionnaire/' + data.id,
  117 + desc: data.desc,
  118 + imgUrl: data.img
  119 + });
  120 + } else {
  121 + tipDialog.show('调查问卷已成功提交,<br>感谢您的帮助!');
  122 + }
  123 + } else if (resData.message) {
  124 + if (yoho && yoho.isApp) {
  125 + yoho.goH5(DETAIL_URI + '/0');
  126 + } else {
  127 + window.location.href = DETAIL_URI + '/0';
  128 + }
  129 + }
  130 + });
  131 +});
  132 +
  133 +if ($list.children().length === 1) {
  134 + let data = $list.children().first().data();
  135 +
  136 + getQuestionStatus({uid: qs.uid, id: data.id}, function(resData) {
  137 + if (resData.code === 200) {
  138 + jumpQuestionDetail(data);
  139 + }
  140 + });
  141 +}
  1 +body {
  2 + background: #f0f0f0;
  3 +}
  4 +
  5 +.nav-home {
  6 + display: none !important;
  7 +}
  8 +
  9 +.qs-detail-page {
  10 + font-size: 28px;
  11 + $borderColor: #ececec;
  12 +
  13 + .error-tip {
  14 + width: 100%;
  15 + background-color: #ff7e82;
  16 + color: #fff;
  17 + padding-left: 30px;
  18 + line-height: 50px;
  19 + position: fixed;
  20 + top: 0;
  21 + left: 0;
  22 + z-index: 1;
  23 + }
  24 +
  25 + .sub-title {
  26 + line-height: 2;
  27 + padding: 14px 20px;
  28 + background: #fff;
  29 + border-bottom: 1px solid $borderColor;
  30 + text-align: center;
  31 + }
  32 +
  33 + .guide-tip {
  34 + line-height: 2;
  35 + padding: 0 30px;
  36 + color: #555;
  37 + }
  38 +
  39 + .qs-item {
  40 + background: #fff;
  41 + margin-bottom: 30px;
  42 + padding-left: 30px;
  43 + border-top: 1px solid $borderColor;
  44 + border-bottom: 1px solid $borderColor;
  45 +
  46 + > * {
  47 + line-height: 60px;
  48 + padding: 10px 0;
  49 + }
  50 +
  51 + > dd {
  52 + border-top: 1px solid $borderColor;
  53 + color: #b4b4b4;
  54 +
  55 + input {
  56 + width: calc(100% - 60px);
  57 + height: 50px;
  58 + margin-left: 34px;
  59 + border: 0;
  60 + border: 1px solid $borderColor;
  61 + color: #444;
  62 + }
  63 +
  64 + &.on {
  65 + color: #444;
  66 + }
  67 + }
  68 +
  69 + textarea {
  70 + width: calc(100% - 26px);
  71 + height: 100px;
  72 + resize: none;
  73 + border: 1px solid #ddd;
  74 + display: block;
  75 + color: #444;
  76 + }
  77 +
  78 + .iconfont {
  79 + display: inline-block;
  80 + width: 34px;
  81 + height: 34px;
  82 + line-height: 34px;
  83 + border: 1px solid #b4b4b4;
  84 + vertical-align: middle;
  85 + font-size: 18px;
  86 + text-align: center;
  87 + color: #fff;
  88 + position: absolute;
  89 + margin-top: 13px;
  90 + }
  91 +
  92 + .option-box {
  93 + padding-left: 40px;
  94 +
  95 + img {
  96 + display: inline-block;
  97 + vertical-align: middle;
  98 + }
  99 + }
  100 +
  101 + .radio-option .iconfont {
  102 + border-radius: 17px;
  103 + overflow: hidden;
  104 + }
  105 +
  106 + .on .iconfont {
  107 + border-color: #444;
  108 + background-color: #444;
  109 + }
  110 + }
  111 +
  112 + .submit {
  113 + padding: 0 20px;
  114 +
  115 + .submit-btn {
  116 + width: 100%;
  117 + height: 80px;
  118 + background: #3e3e3e;
  119 + color: #fff;
  120 + border: 0;
  121 + border-radius: 4px;
  122 + margin-bottom: 20px;
  123 + outline: none;
  124 + }
  125 + }
  126 +
  127 + .detail-wrap + .qs-err {
  128 + display: none;
  129 + }
  130 +
  131 + .qs-err {
  132 + &:before {
  133 + content: "";
  134 + width: 300px;
  135 + height: 190px;
  136 + background: resolve("3party/qs-lose.jpg") no-repeat;
  137 + display: block;
  138 + margin: 120px auto 0;
  139 + background-size: 100%;
  140 + }
  141 +
  142 + .err-text {
  143 + width: 56%;
  144 + line-height: 1.5;
  145 + color: #444;
  146 + margin: 0 auto;
  147 + padding-bottom: 50px;
  148 + display: block;
  149 + text-align: center;
  150 + }
  151 +
  152 + a {
  153 + width: 60%;
  154 + height: 80px;
  155 + line-height: 80px;
  156 + margin: 0 auto;
  157 + background: #3e3e3e;
  158 + color: #fff;
  159 + display: block;
  160 + text-align: center;
  161 + border-radius: 4px;
  162 + }
  163 + }
  164 +
  165 + .tip-dialog {
  166 + width: 100%;
  167 + height: 100%;
  168 + position: fixed;
  169 + left: 0;
  170 + top: 0;
  171 + z-index: 10;
  172 +
  173 + &:before {
  174 + content: "";
  175 + position: absolute;
  176 + width: 100%;
  177 + height: 100%;
  178 + background-color: rgba(0, 0, 0, 0.4);
  179 + z-index: -1;
  180 + }
  181 +
  182 + .dg-wrap {
  183 + width: 70%;
  184 + background: #fff;
  185 + border-radius: 6px;
  186 + position: absolute;
  187 + left: 15%;
  188 + top: 50%;
  189 + margin-top: -95px;
  190 + }
  191 +
  192 + .dg-content {
  193 + height: 140px;
  194 + line-height: 140px;
  195 +
  196 + > p {
  197 + width: 100%;
  198 + line-height: 1.4;
  199 + display: inline-block;
  200 + text-align: center;
  201 + vertical-align: middle;
  202 + }
  203 + }
  204 +
  205 + .dg-btns {
  206 + border-top: 1px solid #efefef;
  207 +
  208 + > * {
  209 + width: 50%;
  210 + line-height: 60px;
  211 + text-align: center;
  212 + display: block;
  213 + float: left;
  214 + cursor: pointer;
  215 + box-sizing: border-box;
  216 + }
  217 + }
  218 +
  219 + .continue-btn {
  220 + border-left: 1px solid #efefef;
  221 + box-sizing: border-box;
  222 + color: #d90005;
  223 + }
  224 + }
  225 +}
  1 +.nav-home {
  2 + display: none !important;
  3 +}
  4 +
  5 +.qs-list-page {
  6 + font-size: 28px;
  7 + $borderColor: #ececec;
  8 +
  9 + .qs-list {
  10 + line-height: 90px;
  11 + color: #444;
  12 + padding-left: 30px;
  13 + border-bottom: 1px solid $borderColor;
  14 +
  15 + > li {
  16 + border-top: 1px solid $borderColor;
  17 + }
  18 + }
  19 +
  20 + .tip-dialog {
  21 + width: 100%;
  22 + height: 100%;
  23 + position: fixed;
  24 + left: 0;
  25 + top: 0;
  26 + z-index: 10;
  27 +
  28 + &:before {
  29 + content: "";
  30 + position: absolute;
  31 + width: 100%;
  32 + height: 100%;
  33 + background-color: rgba(0, 0, 0, 0.4);
  34 + z-index: -1;
  35 + }
  36 +
  37 + .dg-wrap {
  38 + width: 70%;
  39 + background: #fff;
  40 + border-radius: 6px;
  41 + position: absolute;
  42 + left: 15%;
  43 + top: 50%;
  44 + margin-top: -95px;
  45 + }
  46 +
  47 + .dg-content {
  48 + height: 140px;
  49 + line-height: 140px;
  50 +
  51 + > p {
  52 + width: 100%;
  53 + line-height: 1.4;
  54 + display: inline-block;
  55 + text-align: center;
  56 + vertical-align: middle;
  57 + }
  58 + }
  59 +
  60 + .dg-btns {
  61 + border-top: 1px solid #efefef;
  62 +
  63 + > * {
  64 + width: 50%;
  65 + line-height: 60px;
  66 + text-align: center;
  67 + display: block;
  68 + float: left;
  69 + cursor: pointer;
  70 + }
  71 + }
  72 +
  73 + .dg-btns .sure-btn {
  74 + width: 100%;
  75 + }
  76 +
  77 + .share-btn {
  78 + border-left: 1px solid #efefef;
  79 + box-sizing: border-box;
  80 + color: #d90005;
  81 + }
  82 + }
  83 +}
@@ -124,6 +124,13 @@ @@ -124,6 +124,13 @@
124 margin: 30px 20px; 124 margin: 30px 20px;
125 } 125 }
126 126
  127 + .questionnaire-ico {
  128 + background-image: url("/service/chat/questionnaire-ico.png");
  129 + width: 60px;
  130 + height: 60px;
  131 + margin: 30px 20px;
  132 + }
  133 +
127 .arr-ico { 134 .arr-ico {
128 line-height: 120px; 135 line-height: 120px;
129 color: #e1e1e1; 136 color: #e1e1e1;