Merge remote-tracking branch 'origin/feature/GFRS-615【待确定】问卷' into release/GFRS-615【待确定】问卷

# Conflicts:
#	src/assets/js/utils/request.js
#	src/views/app/Home.vue
This commit is contained in:
阳华祥
2020-02-26 18:48:56 +08:00
16 changed files with 739 additions and 6 deletions

View File

@@ -0,0 +1,56 @@
import request from '@/assets/js/utils/request'
import getUrl from '@/assets/js/utils/get-url'
// 问卷列表查询
export function getSurveyList(data) {
return request({
url: getUrl('/customer/question/getQuestionnaire', 1),
method: 'post',
data
})
}
// 问卷题库查询
export function getSurveyQuestion(data) {
return request({
url: getUrl('/customer/question/getQuestion', 1),
method: 'post',
data
})
}
// 问卷答案提交
export function saveSurveyAnswer(data) {
return request({
url: getUrl('/customer/question/submit', 1),
method: 'post',
data
})
}
// 问卷分享提交
export function saveSurveyShareDate(data) {
return request({
url: getUrl('/customer/question/shareSubmit', 1),
method: 'post',
data
})
}
// 问卷分享唯一标识获取
export function getSurveyTableId(data) {
return request({
url: getUrl('/customer/question/getTableId', 1),
method: 'post',
data
})
}
// 获取问卷代理人信息
export function getSurveyAgentInfo(data) {
return request({
url: getUrl('/customer/question/getAgentInfo', 1),
method: 'post',
data
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 KiB

View File

@@ -54,7 +54,15 @@ let claims = [
`/claim/claimApply/query`,
`/claim/claimApply/delete`
]
let whiteList = ['/customer/agent/getCustomersList', ...proposal, ...sale, ...agentEnter, ...claims]
let survey = [
//'/customer/question/getQuestionnaire', // 代理人下问卷查询 --ok
'/customer/question/getQuestion', // 问卷题库查询
'/customer/question/submit', // 问卷提交
//'/customer/question/shareSubmit', //问卷分享 --ok
//'/customer/question/getTableId', // id 查询 -- ok
'/customer/question/getAgentInfo' // 代理人详情
]
let whiteList = ['/customer/agent/getCustomersList', ...proposal, ...sale, ...agentEnter, ...claims, ...survey]
// 创建axios实例
const service = axios.create({

View File

@@ -18,9 +18,9 @@ export function weixinShare(options) {
wx.config({
//debug: true,
appId: data.appId,
appId: data.appid,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
nonceStr: data.noncestr,
signature: data.signature,
jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareWeibo']
})
@@ -47,3 +47,7 @@ export function weixinShare(options) {
}
})
}
export function closeWindow() {
wx.closeWindow()
}

11
src/config/survey.js Normal file
View File

@@ -0,0 +1,11 @@
// 服务类
let mockBaseUrl = 'http://mock-api.com/LwnaDLg1.mock'
export default {
// 获取保单列表
'/customer/question/getQuestionnaire': mockBaseUrl + '/customer/question/getQuestionnaire',
'/customer/question/getQuestion': mockBaseUrl + '/customer/question/getQuestion',
'/customer/question/submit': mockBaseUrl + '/customer/question/submit',
'/customer/question/shareSubmit': mockBaseUrl + '/customer/question/shareSubmit',
'/customer/question/getTableId': mockBaseUrl + '/customer/question/getTableId',
'/customer/question/getAgentInfo': mockBaseUrl + '/customer/question/getAgentInfo'
}

View File

@@ -10,6 +10,7 @@ import my from './my'
import product from './product'
import serve from './serve'
import common from './common'
import survey from './survey'
const mockBaseUrl = 'http://rap2api.taobao.org/app/mock'
let baseObj = {
@@ -17,6 +18,6 @@ let baseObj = {
'/user/info': mockBaseUrl + '/223948/info',
'/user/logout': mockBaseUrl + '/223948/logout'
}
Object.assign(baseObj, proposal, sale, customer, my, product, serve, common)
Object.assign(baseObj, proposal, sale, customer, my, product, serve, common, survey)
export default baseObj

View File

@@ -9,5 +9,6 @@ import product from './product'
import agentEenter from './agentEenter.js'
import milestone from './milestone'
import poster from './poster'
import report from "./report"
export default [...proposal, ...sale, ...customer, ...my, ...serve, ...common, ...product, ...agentEenter, ...milestone, ...poster, ...report] //根据需要进行删减
import report from './report'
import survey from './survey'
export default [...proposal, ...sale, ...customer, ...my, ...serve, ...common, ...product, ...agentEenter, ...milestone, ...poster, ...report, ...survey] //根据需要进行删减

37
src/router/ebiz/survey.js Normal file
View File

@@ -0,0 +1,37 @@
//服务 定义相关组件
const surveyList = () => import('@/views/ebiz/survey/SurveyList')
const surveyDetail = () => import('@/views/ebiz/survey/SurveyDetail')
const shareCover = () => import('@/views/ebiz/survey/ShareCover')
export default [
{
// 问卷列表
path: '/survey/surveyList',
name: 'surveyList',
component: surveyList,
meta: {
title: '问卷调查',
index: 1
}
},
{
// 问卷详情
path: '/survey/surveyDetail',
name: 'surveyDetail',
component: surveyDetail,
meta: {
title: '问卷调查',
index: 1
}
},
{
// 问卷分享封面
path: '/survey/shareCover',
name: 'shareCover',
component: shareCover,
meta: {
title: '问卷调查',
index: 1
}
}
]

View File

@@ -27,6 +27,7 @@
<li><router-link to="/serve/list">保单列表</router-link></li>
<li><router-link to="/agentEenter/agentEenterBasicInfor">自助入司</router-link></li>
<li><router-link to="/agentEenter/approve/ApproveList">入司审批列表</router-link></li>
<li><router-link to="/survey/surveyList">问卷调查</router-link></li>
</ul>
</li>
</ul>

View File

@@ -0,0 +1,266 @@
<template>
<div class="policy-list-container">
<!--封面-->
<div v-if="showType == 'Cover'" class="mr2 ml2 mb60">
<img style="width: 100%;" src="@/assets/images/gf_wjdc.png" />
<div class="mt30 mr2 ml2">
<van-button type="danger" style="width: 100%;" @click="clickEnter" :disabled="enterFlag">立即参加</van-button>
</div>
</div>
<!-- 数据提交页 -->
<div v-if="showType == 'Detail'" style="margin-top: 10px;" class="mb60">
<van-row v-for="(item, index) in questionList" :key="index">
<div v-if="item.options">
<van-col span="24" class="pb10 pt10 pl10 pr10 bg-white"> {{ item.orderCode }}.{{ item.title }} </van-col>
<van-col span="24" class="bg-white" style="margin-bottom: 10px;">
<van-radio-group v-model="anwerJson[item.orderCode]" class="flex pb10 pt10 pl10 pr10 justify-content-fs">
<van-radio
icon-size="20px"
checked-color="#07c160"
class="pr10"
v-for="(optionsItem, itemIndex) in item.options.split(',')"
:key="itemIndex"
:name="optionsItem"
>
{{ optionsItem }}
</van-radio>
</van-radio-group>
</van-col>
</div>
<div v-else-if="!item.options">
<van-col span="24">
<van-field v-if="item.orderCode == '7'" :label="item.title" maxlength="11" input-align="right" v-model="anwerJson[item.orderCode]" />
<van-field v-if="item.orderCode == '6'" :label="item.title" input-align="right" v-model="anwerJson[item.orderCode]" />
<van-field v-if="item.orderCode == '8'" :label="item.title" maxlength="3" input-align="right" v-model="anwerJson[item.orderCode]" />
</van-col>
<van-col span="24" class="pl10 pr10 bg-white" style="height:2px;"><div style="width: 100%;height: 100%;background-color: #f5f5f5;"></div></van-col>
</div>
</van-row>
<div class="mt10 mr2 ml2">
<van-button type="danger" style="width: 100%;" @click="submitForm()">提交</van-button>
</div>
</div>
<!--提交结果页-->
<div v-if="showType == 'Result'" class="mr2 ml2">
<img v-show="resultImgUrl == 'PHYSICAL'" style="width: 100%;" src="@/assets/images/shareSurveyResult.png" />
<img v-show="resultImgUrl != 'PHYSICAL'" style="width: 100%;" src="@/assets/images/shareSurveyResult_1.png" />
<div class="mt30 mr2 ml2">
<van-button type="danger" style="width: 100%;" @click="closeWXWindow">返回</van-button>
</div>
</div>
<!-- 底部透明 -->
<div v-if="showType != 'Result' && !!surveyAgentInfoReqDTO.tableId" class="fix_bottom">
<div class="fix_bottom_sub">
<img src="@/assets/images/sharePeople.png" />
<div>{{ agentInfo.name }}</div>
</div>
<div class="fix_bottom_sub" @click="callPhone">
<img src="@/assets/images/sharePhone.png" />
<div>{{ agentInfo.mobile }}</div>
</div>
</div>
</div>
</template>
<script>
import { Field, CellGroup, Popup, Picker, List, Cell, Row, Col, RadioGroup, Radio, Button } from 'vant'
import { getSurveyQuestion, saveSurveyAnswer, getSurveyAgentInfo } from '@/api/ebiz/survey/survey'
import { weixinShare, closeWindow } from '@/assets/js/utils/wxShare.js'
export default {
components: {
[Field.name]: Field,
[CellGroup.name]: CellGroup,
[Popup.name]: Popup,
[Picker.name]: Picker,
[List.name]: List,
[Cell.name]: Cell,
[Row.name]: Row,
[Col.name]: Col,
[RadioGroup.name]: RadioGroup,
[Radio.name]: Radio,
[Button.name]: Button
},
data() {
return {
resultImgUrl: '',
enterFlag: true,
anwerJson: {},
showType: 'Cover', //false 显示封面 true显示提交表格
value: '',
questionList: [],
surveyAgentInfoReqDTO: {
tableId: null
},
agentInfo: {
name: null,
mobile: null,
agentCode: null
},
surveyDetailReqDTO: {
tableCode: 'HEALTH',
tableId: null
},
surveyAnswerReqDTO: {
answer: null,
tableId: null,
customerInfo: {
name: null,
mobile: null
},
agentCode: null,
agentName: null
},
tableId: null
}
},
created() {
// 微信分享设置
weixinShare({
title: '国富送爱心',
imgUrl: this.$assetsUrl + 'images/logo.png',
desc: '“共同抗击新冠,国富免费送爱心”'
})
// 页面初始化
let token = this.getQueryString('token')
window.localStorage.setItem('token', token)
let tableId = this.getQueryString('code')
if (!tableId) {
this.$toast('链接异常,请代理人重新分享')
return
}
this.surveyDetailReqDTO.tableId = tableId
this.surveyAgentInfoReqDTO.tableId = tableId
this.tableId = tableId
// 获取代理人信息
this.getSurveyAgentInfo()
},
methods: {
clickEnter() {
// 获取题库信息
this.getSurveyQuestionInfo()
},
// detail 页面
getSurveyQuestionInfo() {
let that = this
getSurveyQuestion(that.surveyDetailReqDTO).then(res => {
if (res.result == '0') {
that.questionList.map(item => {
that.anwerJson[item.orderCode + ''] = ''
})
that.questionList = res.content.questionList
that.showType = 'Detail'
} else {
that.$toast(res.resultMessage)
}
})
},
// 获取代理人信息
getSurveyAgentInfo() {
let that = this
getSurveyAgentInfo(that.surveyAgentInfoReqDTO).then(res => {
if (res.result == '0') {
that.agentInfo = res.content
that.enterFlag = false
} else {
that.$toast(res.resultMessage)
}
})
},
submitForm() {
// 校验是否选择
let that = this
let returnFlag = true
that.questionList.map(item => {
if (!that.anwerJson[item.orderCode + '']) {
that.$toast('请认真填写问卷的全部内容!')
returnFlag = false
}
})
if (!returnFlag) {
return
}
// 手机号格式错误校验
if (!/1\d{10}/.test(that.anwerJson['7'])) {
that.$toast('手机号格式错误')
return
}
// 年龄格式校验
if (!/^[1-9]\d{0,2}$/.test(that.anwerJson['8'])) {
that.$toast('年龄格式错误')
return
}
// 初始化请求数据
that.surveyAnswerReqDTO.customerInfo.name = that.anwerJson['6']
that.surveyAnswerReqDTO.customerInfo.mobile = that.anwerJson['7']
that.surveyAnswerReqDTO.answer = JSON.stringify(this.anwerJson)
that.surveyAnswerReqDTO.agentCode = that.agentInfo.agentCode
that.surveyAnswerReqDTO.agentName = that.agentInfo.name
that.surveyAnswerReqDTO.tableId = that.tableId
saveSurveyAnswer(that.surveyAnswerReqDTO).then(res => {
if (res.result == '0') {
//跳转结果页面
that.resultImgUrl = res.content
that.showType = 'Result'
} else {
that.$toast(res.resultMessage)
}
})
},
getQueryString(name) {
var url = location.href.split('?') //获取url中"?"符后的字串
var theRequest = new Object()
if (url.length > 1) {
var str = url[url.length - 1]
var strs = str.split('&')
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split('=')[0]] = strs[i].split('=')[1]
}
}
return theRequest[name]
},
callPhone() {
console.log('callPhone')
window.location.href = 'tel://' + this.agentInfo.mobile
},
closeWXWindow() {
closeWindow()
}
}
}
</script>
<style lang="scss" scoped>
@import '@/assets/sass/variables.scss';
.policy-list-container {
width: 100%;
font-size: small;
}
.fix_bottom {
position: fixed;
height: 50px;
width: 98%;
margin: auto;
left: 1%;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
color: white;
display: flex;
justify-content: space-between;
align-items: center;
}
.fix_bottom_sub {
display: flex;
justify-content: flex-start;
align-items: center;
margin: 0 10px;
}
.fix_bottom_sub img {
width: 25px;
height: 25px;
}
.fix_bottom_sub div {
padding-left: 10px;
}
</style>

View File

@@ -0,0 +1,94 @@
<template>
<div class="policy-list-container" style="padding-top: 10px;">
<van-row v-for="(item, index) in questionList" :key="index">
<div v-if="item.options">
<van-col span="24" class="pb10 pt10 pl10 pr10 bg-white"> {{ item.orderCode }}.{{ item.title }} </van-col>
<van-col span="24" class="bg-white" style="margin-bottom: 10px;">
<van-radio-group :value="anwerJson[item.orderCode]" class="flex pb10 pt10 pl10 pr10 justify-content-fs bg-white" disabled>
<van-radio
icon-size="20px"
checked-color="#07c160"
class="pr10"
v-for="(optionsItem, itemIndex) in item.options.split(',')"
:key="itemIndex"
:name="optionsItem"
>
{{ optionsItem }}
</van-radio>
</van-radio-group>
</van-col>
</div>
<div v-else-if="!item.options">
<van-col span="24">
<van-field :label="item.title" :value="anwerJson[item.orderCode]" placeholder="请输入用户名" input-align="right" readonly />
</van-col>
<van-col span="24" class="pl10 pr10 bg-white" style="height:2px;"><div style="width: 100%;height: 100%;background-color: #f5f5f5;"></div></van-col>
</div>
</van-row>
<div class="mt10 mr2 ml2">
<van-button disabled type="info" style="width: 100%;background-color: #7d7e80;border: 0;">提交</van-button>
</div>
</div>
</template>
<script>
import { Field, CellGroup, Popup, Picker, List, Cell, Row, Col, RadioGroup, Radio } from 'vant'
import { getSurveyQuestion } from '@/api/ebiz/survey/survey'
export default {
components: {
[Field.name]: Field,
[CellGroup.name]: CellGroup,
[Popup.name]: Popup,
[Picker.name]: Picker,
[List.name]: List,
[Cell.name]: Cell,
[Row.name]: Row,
[Col.name]: Col,
[RadioGroup.name]: RadioGroup,
[Radio.name]: Radio
},
data() {
return {
anwerJson: {},
questionList: [],
surveyDetail: {
radio: '是',
isSubmit: null,
tableCode: null,
tableName: null
},
surveyDetailReqDTO: {
tableCode: 'HEALTH',
tableId: null
},
customerNumber: localStorage.getItem('customerNumber')
}
},
created() {
// 获取表单列表
let that = this
this.surveyDetailReqDTO.tableId = localStorage.getItem('surveyTableId')
getSurveyQuestion(that.surveyDetailReqDTO).then(res => {
if (res.result == '0') {
console.log(res.content.answerInfo.answer)
that.anwerJson = JSON.parse(res.content.answerInfo.answer)
console.log(that.anwerJson)
that.questionList = res.content.questionList
} else {
that.$toast(res.resultMessage)
}
})
},
methods: {}
}
</script>
<style lang="scss" scoped>
@import '@/assets/sass/variables.scss';
.policy-list-container {
width: 100%;
font-size: small;
}
</style>

View File

@@ -0,0 +1,254 @@
<template>
<div class="policy-list-container">
<van-cell-group style="padding-top: 0.8em;">
<van-field
:value="surveyShow.isSubmitText"
right-icon="arrow"
label="问卷状态"
name="问卷状态"
placeholder="请选择"
input-align="right"
readonly
@click="toSelect('0')"
/>
</van-cell-group>
<van-row class="row-tes bg-white" style="margin-top: 0.5em;" type="flex" justify="center">
<van-col span="3" class="text-center red">状态</van-col>
<van-col span="5" class="text-center red">问卷状态</van-col>
<van-col span="6" class="text-center red">分享时间</van-col>
<van-col span="5" class="text-center red">客户姓名</van-col>
<van-col span="5" class="text-center red">奖品内容</van-col>
</van-row>
<van-list class="bg-white" v-model="surveyShow.loading" :finished="surveyShow.finished">
<van-row class="row-tes x-large" type="flex" justify="center" v-for="(item, index) in surveyShow.list" :key="index" @click="getItemDetail(item, index)">
<van-col span="3" class="text-center">{{ index + 1 }}</van-col>
<van-col span="5" class="text-center">{{ item.isSubmit | submitStatusFormat }}</van-col>
<van-col span="6" class="text-center">{{ item.shareTime | shareDateFormat }}</van-col>
<van-col span="5" class="text-center">{{ item.customerName ? item.customerName : '---' }}</van-col>
<van-col span="5" class="text-center">{{ item.prizeCode | prizeCodeFormat }}</van-col>
</van-row>
</van-list>
<div style="width: 100%;margin-bottom: 80px;background-color: #f5f5f5;height: 1px;"></div>
<!-- 问卷状态-->
<van-popup v-model="popupShow" position="bottom">
<van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="popupShow = false" />
</van-popup>
<div style="position: fixed;left: 0;bottom: 0;width: 100%;">
<div class="pb10 pt10 pl10" style="font-size: 12px;background-color: #f5f5f5;">:本次收集的信息可在客户管理模块查看</div>
<van-button type="danger" style="width: 100%;" size="large" @click="shareFriends" v-if="!isWeixin">分享给客户</van-button>
</div>
</div>
</template>
<script>
import { Field, CellGroup, Popup, Picker, List, Cell, Row, Col } from 'vant'
import { getSurveyList, getSurveyTableId, saveSurveyShareDate } from '@/api/ebiz/survey/survey'
import dateUtils from '@/assets/js/utils/date-utils'
export default {
components: {
[Field.name]: Field,
[CellGroup.name]: CellGroup,
[Popup.name]: Popup,
[Picker.name]: Picker,
[List.name]: List,
[Cell.name]: Cell,
[Row.name]: Row,
[Col.name]: Col
},
data() {
let isWeixin = this.$utils.device().isWeixin //判断环境
return {
isWeixin,
// 弹框显示
valueKey: 'text',
popupShow: false,
pickerType: '0',
columns: [{ id: '1', text: '已提交' }, { id: '0', text: '未提交' }],
surveyShow: {
isSubmitText: null,
list: [],
loading: false,
finished: true
},
surveyLstReqDTO: {
id: null,
isSubmit: null,
tableCode: 'HEALTH',
tableName: '健康问卷'
},
saveSurveyShareReqDTO: {
tableCode: 'HEALTH',
tableName: '健康问卷',
shareTime: '',
tableId: null
},
tableId: null,
customerNumber: localStorage.getItem('customerNumber')
}
},
filters: {
submitStatusFormat(status) {
let text
switch (status + '') {
case '1':
text = '已提交'
break
case '0':
text = '未提交'
break
}
return text
},
shareDateFormat(dateStr) {
return dateStr.substr(0, 10)
},
prizeCodeFormat(prizeCode) {
let text = '---'
if (!prizeCode) {
return text
}
switch (prizeCode + '') {
case 'UMBRELLA':
text = '雨伞'
break
case 'PHYSICAL':
text = '体检套餐'
break
}
return text
}
},
created() {
// 初始化
window['appCallBack'] = this.appCallBack
// 获取表单列表
this.getSurveyList()
},
methods: {
appCallBack(data) {
if (data.trigger == 'weixin_share') {
console.log('点击了分享')
// 回调 保存分享
this.saveShareInfo()
}
},
// 分享到朋友圈
async shareFriends() {
let that = this
// 获取tableId
await that.getSurveyTableId()
// 调用原生分享
this.callApp()
},
// 获取代理人下问卷调查信息
getSurveyList() {
let that = this
getSurveyList(that.surveyLstReqDTO).then(res => {
if (res.result == '0') {
that.surveyShow.list = []
that.surveyShow.list = res.content
} else {
that.$toast(res.resultMessage)
}
})
},
// 页面跳转
getItemDetail(item) {
let that = this
if (item.isSubmit + '' == '0') {
that.$toast('抱歉,系统不支持查看该状态的问卷信息!')
return
}
window.localStorage.setItem('surveyTableId', item.tableId)
this.$jump({
flag: 'h5',
extra: {
url: location.origin + `/#/survey/surveyDetail`
},
routerInfo: {
path: `/survey/surveyDetail`
//path: `/survey/shareCover`
}
})
},
//弹框选择
toSelect(pickerType, valueKey) {
//pickerType 1、出险人关系 2、证件类型 3、出险原因 4、申请类型
;[this.popupShow, this.pickerType] = [true, pickerType]
if (valueKey) {
this.valueKey = valueKey
}
},
//确认选择字段
onConfirm(value) {
this.popupShow = false
;[this.surveyLstReqDTO.isSubmit, this.surveyShow.isSubmitText] = [value.id, value.text]
this.getSurveyList()
},
// 获取唯一tableID
async getSurveyTableId() {
return new Promise((resolve, reject) => {
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
getSurveyTableId({}).then(res => {
if (res.result == '0') {
this.tableId = res.content
resolve()
} else {
reject()
this.$toast(res.resultMessage)
}
})
})
},
callApp() {
let url = location.origin + '/#/survey/ShareCover?token=' + localStorage.getItem('token') + '&code=' + this.tableId
console.log(url)
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('bridge', {
flag: 'share',
extra: {
title: `国富送爱心`,
content: '“共同抗击新冠,国富免费送爱心”',
url: url,
img: this.$assetsUrl + 'images/logo.png'
}
})
},
saveShareInfo() {
let that = this
that.saveSurveyShareReqDTO.shareTime = dateUtils.formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss')
that.saveSurveyShareReqDTO.tableId = that.tableId
saveSurveyShareDate(that.saveSurveyShareReqDTO).then(res => {
// eslint-disable-next-line no-empty
if (res.result != '0') {
that.$toast(res.resultMessage)
} else {
that.getSurveyList()
}
})
}
}
}
</script>
<style lang="scss" scoped>
@import '@/assets/sass/variables.scss';
.policy-list-container {
width: 100%;
line-height: 1.2em;
}
.row-tes {
padding: 0.4em 0.1em;
font-size: small;
border-bottom: 0.1em solid #f5f5f5;
}
</style>