Merge branch 'feature/GFRS-615【待确定】问卷' into dev

# Conflicts:
#	src/assets/js/utils/request.js
#	src/router/ebiz/index.js
#	src/views/app/Home.vue
This commit is contained in:
阳华祥
2020-02-23 20:11:24 +08:00
14 changed files with 662 additions and 4 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.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

View File

@@ -58,7 +58,16 @@ let sale = [
'/sale/insure/selfToHuman', '/sale/insure/selfToHuman',
'/sale/insure/orderPayStatusQuery' '/sale/insure/orderPayStatusQuery'
] ]
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]
// let whiteList = ['/customer/agent/getCustomersList', ...proposal, ...sale] // let whiteList = ['/customer/agent/getCustomersList', ...proposal, ...sale]

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 product from './product'
import serve from './serve' import serve from './serve'
import common from './common' import common from './common'
import survey from './survey'
const mockBaseUrl = 'http://rap2api.taobao.org/app/mock' const mockBaseUrl = 'http://rap2api.taobao.org/app/mock'
let baseObj = { let baseObj = {
@@ -17,6 +18,6 @@ let baseObj = {
'/user/info': mockBaseUrl + '/223948/info', '/user/info': mockBaseUrl + '/223948/info',
'/user/logout': mockBaseUrl + '/223948/logout' '/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 export default baseObj

View File

@@ -12,6 +12,7 @@ import poster from './poster'
import claims from './claims' import claims from './claims'
import report from './report' import report from './report'
import nbs from './nbs' import nbs from './nbs'
import survey from './survey'
export default [ export default [
...proposal, ...proposal,
...sale, ...sale,
@@ -25,5 +26,6 @@ export default [
...poster, ...poster,
...claims, ...claims,
...report, ...report,
...nbs ...nbs,
...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

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

View File

@@ -0,0 +1,228 @@
<template>
<div class="policy-list-container">
<!--封面-->
<div v-if="showType == 'Cover'" class="mt30 mr2 ml2 mb50">
<img style="width: 100%;" src="@/assets/images/gf_wjdc.png" />
<div class="mt30 mr2 ml2">
<van-button type="warning" style="width: 100%;" @click="showType = 'Detail'">立即参加</van-button>
</div>
</div>
<!-- 数据提交页 -->
<div v-if="showType == 'Detail'" style="margin-top: 10px;" class="mb50">
<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" maxlength="4" 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="warning" style="width: 100%;" @click="submitForm()">提交</van-button>
</div>
</div>
<!--提交结果页-->
<div v-if="showType == 'Result'" class="mt30 mr2 ml2">
<img style="width: 100%;" src="@/assets/images/shareSurveyResult.png" />
<div class="mt30 mr2 ml2">
<van-button type="warning" style="width: 100%;" @click="showType = 'Detail'">返回</van-button>
</div>
</div>
<!-- 底部透明 -->
<div v-if="showType != 'Result'" class="fix_bottom">
<div class="fix_bottom_sub">
<img src="@/assets/images/sharePeople.png" />
<div>{{ agentInfo.name }}</div>
</div>
<div class="fix_bottom_sub">
<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'
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 {
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
},
userModel: {
id: null
}
}
}
},
created() {
let tableId = this.getQueryString('code')
this.surveyDetailReqDTO.tableId = tableId
this.surveyAgentInfoReqDTO.tableId = tableId
// 获取代理人信息
this.getSurveyAgentInfo()
// 获取表单列表
this.getSurveyQuestionInfo()
},
methods: {
// 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
} else {
that.$toast(res.resultMessage)
}
})
},
// 获取代理人信息
getSurveyAgentInfo() {
let that = this
getSurveyAgentInfo(that.surveyAgentInfoReqDTO).then(res => {
if (res.result == '0') {
that.agentInfo = res.content
} 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 (!/1\d{10}/.test(that.anwerJson['7'])) {
that.$toast('手机号格式错误')
}
if (!returnFlag) {
return
}
// 初始化请求数据
that.surveyAnswerReqDTO.customerInfo.name = that.anwerJson['7']
that.surveyAnswerReqDTO.customerInfo.mobile = that.anwerJson['8']
that.surveyAnswerReqDTO.answer = JSON.stringify(this.anwerJson)
that.surveyAnswerReqDTO.userModel.id = that.agentInfo.agentCode
saveSurveyAnswer(that.surveyAnswerReqDTO).then(res => {
if (res.result == '0') {
//跳转结果页面
that.showType = 'Result'
} else {
that.$toast(res.resultMessage)
}
})
//跳转结果页面
that.showType = 'Result'
},
getQueryString(name) {
var url = location.href.split('?') //获取url中"?"符后的字串
var theRequest = new Object()
if (url.length > 1) {
var str = url[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]
}
}
}
</script>
<style lang="scss" scoped>
@import '@/assets/sass/variables.scss';
.policy-list-container {
width: 100%;
font-size: small;
}
.fix_bottom {
position: fixed;
height: 40px;
width: 100%;
left: 0;
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: 30px;
height: 30px;
}
.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,219 @@
<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"
@click="toSelect('0')"
/>
</van-cell-group>
<van-row class="row-tes bg-white" style="margin-top: 0.1em;" type="flex" justify="center">
<van-col span="4" class="text-center red">状态</van-col>
<van-col span="7" class="text-center red">问卷状态</van-col>
<van-col span="7" class="text-center red">分享时间</van-col>
<van-col span="6" class="text-center red">客户姓名</van-col>
</van-row>
<van-list class="bg-white" style="margin-top: 0.5em;" v-model="surveyShow.loading" :finished="surveyShow.finished" finished-text="没有更多了">
<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="4" class="text-center">{{ index + 1 }}</van-col>
<van-col span="7" class="text-center">{{ item.isSubmit | submitStatusFormat }}</van-col>
<van-col span="7" class="text-center">{{ item.shareTime | shareDateFormat }}</van-col>
<van-col span="6" class="text-center">{{ item.customerName ? item.customerName : '---' }}</van-col>
</van-row>
</van-list>
<!-- 问卷状态-->
<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%;">
<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)
}
},
created() {
// 获取表单列表
this.getSurveyList()
},
methods: {
// 分享到朋友圈
async shareFriends() {
let that = this
// 获取tableId
await that.getSurveyTableId()
// 调用原生分享
this.callApp()
// 回调 保存分享
this.saveShareInfo()
},
// 获取代理人下问卷调查信息
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) {
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() {
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('bridge', {
flag: 'share',
extra: {
title: `国富免费送父母健康体检`,
content: '“共同抗击新冠,国富免费送父母健康体检”',
url: location.origin + '/#/survey/ShareCover?code=' + this.tableId,
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 => {
if (res.result == '0') {
that.surveyShow.list = res.content
} else {
that.$toast(res.resultMessage)
}
})
}
}
}
</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>