Browse Source

重复填写

old
jiangyy 4 years ago
parent
commit
222cf20dfb
  1. 6
      src/components/parser/Parser.vue
  2. 163
      src/views/form/setting/index.vue
  3. 102
      src/views/form/write/index.vue

6
src/components/parser/Parser.vue

@ -260,14 +260,12 @@ function setValueLabel (event, config, scheme) {
console.log(scheme) console.log(scheme)
// input // input
let tagOptionKey = processType[config.tag] let tagOptionKey = processType[config.tag]
debugger
if (tagOptionKey) { if (tagOptionKey) {
if (event instanceof Array) { if (event instanceof Array) {
//
//
if (!event.includes(0) && config.tag != 'el-cascader') { if (!event.includes(0) && config.tag != 'el-cascader') {
// other // other
this.$set(this[this.formConf.labelFormModel], `${scheme.__vModel__}other`, '') this.$set(this[this.formConf.labelFormModel], `${scheme.__vModel__}other`, '')

163
src/views/form/setting/index.vue

@ -1,41 +1,34 @@
<template> <template>
<el-form ref="setting" <el-form ref="setting"
:model="userProjectSettingData" :model="userProjectSettingData"
:rules="settingRules" :rules="settingRules">
>
<el-row align="top" <el-row align="top"
class="project-setting-container" class="project-setting-container"
justify="center" justify="center"
type="flex" type="flex">
>
<el-col :offset="3" <el-col :offset="3"
:span="5" :span="5"
class="project-setting-view" class="project-setting-view">
>
<p class="project-setting-title"> <p class="project-setting-title">
提交设置 提交设置
</p> </p>
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="12"> <el-col :span="12">
<p class="project-setting-label">显示提示图片</p> <p class="project-setting-label">显示提示图片</p>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-switch v-model="projectSetting.showPromptImg" <el-switch v-model="projectSetting.showPromptImg"
@change="()=>{this.userProjectSettingData.submitPromptImg=''}" @change="()=>{this.userProjectSettingData.submitPromptImg=''}" />
/>
</el-col> </el-col>
</el-row> </el-row>
<div v-if="projectSetting.showPromptImg"> <div v-if="projectSetting.showPromptImg">
<div class="block"> <div class="block">
<el-image :src="userProjectSettingData.submitPromptImg" <el-image :src="userProjectSettingData.submitPromptImg"
class="submit-prompt-img" class="submit-prompt-img"
fit="cover " fit="cover ">
>
<div slot="error" <div slot="error"
class="image-slot" class="image-slot">
>
<i class="el-icon-picture-outline" /> <i class="el-icon-picture-outline" />
</div> </div>
</el-image> </el-image>
@ -45,19 +38,16 @@
:headers="getUploadHeader" :headers="getUploadHeader"
:on-success="uploadSubmitPromptHandle" :on-success="uploadSubmitPromptHandle"
:show-file-list="false" :show-file-list="false"
accept=".jpg,.jpeg,.png,.gif,.bmp,.JPG,.JPEG,.PBG,.GIF,.BMP" accept=".jpg,.jpeg,.png,.gif,.bmp,.JPG,.JPEG,.PBG,.GIF,.BMP">
>
<el-button slot="trigger" <el-button slot="trigger"
size="small" size="small"
type="text" type="text">
>
请上传提示图片 * 请上传提示图片 *
</el-button> </el-button>
</el-upload> </el-upload>
</div> </div>
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="12"> <el-col :span="12">
<p class="project-setting-label">显示提示文字</p> <p class="project-setting-label">显示提示文字</p>
</el-col> </el-col>
@ -66,19 +56,16 @@
@change="()=>{ @change="()=>{
this.userProjectSettingData.submitPromptText='' this.userProjectSettingData.submitPromptText=''
this.saveUserProjectSetting() this.saveUserProjectSetting()
}" }" />
/>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="projectSetting.showPromptText"> <el-row v-if="projectSetting.showPromptText">
<el-col :span="20" <el-col :span="20"
class="setting-input" class="setting-input">
>
<el-input v-model="userProjectSettingData.submitPromptText" <el-input v-model="userProjectSettingData.submitPromptText"
:maxlength="50" :maxlength="50"
:show-word-limit="true" :show-word-limit="true"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
<!-- <el-row align="middle" <!-- <el-row align="middle"
@ -118,8 +105,7 @@
</el-row> --> </el-row> -->
</el-col> </el-col>
<el-col :span="6" <el-col :span="6"
class="project-setting-view text-center" class="project-setting-view text-center">
>
<p class="project-setting-title"> <p class="project-setting-title">
回收设置 回收设置
</p> </p>
@ -134,8 +120,7 @@
</el-col> </el-col>
</el-row> --> </el-row> -->
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="12"> <el-col :span="12">
<p class="project-setting-label">定时收集表单</p> <p class="project-setting-label">定时收集表单</p>
</el-col> </el-col>
@ -146,14 +131,12 @@
this.clearFieldHandle(['timedCollectionBeginTime','timedCollectionEndTime' this.clearFieldHandle(['timedCollectionBeginTime','timedCollectionEndTime'
,'timedNotEnabledPromptText','timedDeactivatePromptText']) ,'timedNotEnabledPromptText','timedDeactivatePromptText'])
this.saveUserProjectSetting() this.saveUserProjectSetting()
}" }" />
/>
</el-col> </el-col>
</el-row> </el-row>
<div v-if="projectSetting.timingCollectForm"> <div v-if="projectSetting.timingCollectForm">
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="5"> <el-col :span="5">
<p class="project-setting-sub-label">收集时间</p> <p class="project-setting-sub-label">收集时间</p>
</el-col> </el-col>
@ -165,8 +148,7 @@
style="width: 100%; border: none;" style="width: 100%; border: none;"
type="datetime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
<el-col :span="1"><span> </span></el-col> <el-col :span="1"><span> </span></el-col>
<el-col :span="8"> <el-col :span="8">
@ -177,13 +159,11 @@
style="width: 100%; border: none;" style="width: 100%; border: none;"
type="datetime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="8"> <el-col :span="8">
<p class="project-setting-sub-label">未启用提示语</p> <p class="project-setting-sub-label">未启用提示语</p>
</el-col> </el-col>
@ -193,13 +173,11 @@
:show-word-limit="true" :show-word-limit="true"
class="setting-input" class="setting-input"
style="width: 80%;" style="width: 80%;"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="8"> <el-col :span="8">
<p class="project-setting-sub-label">停用后提示语</p> <p class="project-setting-sub-label">停用后提示语</p>
</el-col> </el-col>
@ -209,14 +187,12 @@
:show-word-limit="true" :show-word-limit="true"
class="setting-input" class="setting-input"
style="width: 80%;" style="width: 80%;"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="12"> <el-col :span="12">
<p class="project-setting-label">定时定量表单</p> <p class="project-setting-label">定时定量表单</p>
</el-col> </el-col>
@ -227,14 +203,12 @@
this.clearFieldHandle(['timedCollectionBeginTime','timedCollectionEndTime' this.clearFieldHandle(['timedCollectionBeginTime','timedCollectionEndTime'
,'timedNotEnabledPromptText','timedDeactivatePromptText','timedQuantitativeQuantity','timedEndPromptText']) ,'timedNotEnabledPromptText','timedDeactivatePromptText','timedQuantitativeQuantity','timedEndPromptText'])
this.saveUserProjectSetting() this.saveUserProjectSetting()
}" }" />
/>
</el-col> </el-col>
</el-row> </el-row>
<div v-if="projectSetting.timingQuantitativeForm"> <div v-if="projectSetting.timingQuantitativeForm">
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="5"> <el-col :span="5">
<p class="project-setting-sub-label">收集时间</p> <p class="project-setting-sub-label">收集时间</p>
</el-col> </el-col>
@ -246,8 +220,7 @@
style="width: 100%; border: none;" style="width: 100%; border: none;"
type="datetime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
<el-col :span="1"><span> </span></el-col> <el-col :span="1"><span> </span></el-col>
<el-col :span="8"> <el-col :span="8">
@ -258,13 +231,11 @@
style="width: 100%; border: none;" style="width: 100%; border: none;"
type="datetime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="8"> <el-col :span="8">
<p class="project-setting-sub-label">未启用提示语</p> <p class="project-setting-sub-label">未启用提示语</p>
</el-col> </el-col>
@ -274,13 +245,11 @@
:show-word-limit="true" :show-word-limit="true"
class="setting-input" class="setting-input"
style="width: 80%;" style="width: 80%;"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="8"> <el-col :span="8">
<p class="project-setting-sub-label">停用后提示语</p> <p class="project-setting-sub-label">停用后提示语</p>
</el-col> </el-col>
@ -290,14 +259,12 @@
:show-word-limit="true" :show-word-limit="true"
class="setting-input" class="setting-input"
style="width: 80%;" style="width: 80%;"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="projectSetting.timingQuantitativeForm" <el-row v-if="projectSetting.timingQuantitativeForm"
align="middle" align="middle"
type="flex" type="flex">
>
<el-col :span="8"> <el-col :span="8">
<p class="project-setting-sub-label">定量表单填写数量</p> <p class="project-setting-sub-label">定量表单填写数量</p>
</el-col> </el-col>
@ -306,15 +273,13 @@
class="setting-input" class="setting-input"
oninput="value=value.replace(/[^\d]/g,'')" oninput="value=value.replace(/[^\d]/g,'')"
style="width: 80%;" style="width: 80%;"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<div v-if="projectSetting.timingQuantitativeForm"> <div v-if="projectSetting.timingQuantitativeForm">
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="8"> <el-col :span="8">
<p class="project-setting-sub-label">收集完成后提示</p> <p class="project-setting-sub-label">收集完成后提示</p>
</el-col> </el-col>
@ -324,8 +289,7 @@
:show-word-limit="true" :show-word-limit="true"
class="setting-input" class="setting-input"
style="width: 80%;" style="width: 80%;"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -346,24 +310,21 @@
</el-col> </el-col>
</el-row> --> </el-row> -->
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="12"> <el-col :span="12">
<p class="project-setting-label "> <p class="project-setting-label ">
每人限制填写1次用户id 每人限制填写1次用户id
<el-tooltip class="item" <el-tooltip class="item"
content="根据用户ID限制填写" content="根据用户ID限制填写"
effect="dark" effect="dark"
placement="top-start" placement="top-start">
>
<i class="el-icon-warning" /> <i class="el-icon-warning" />
</el-tooltip> </el-tooltip>
</p> </p>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-switch v-model="userProjectSettingData.everyoneWriteOnceByUId" <el-switch v-model="userProjectSettingData.everyoneWriteOnceByUId"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
<!-- <el-row align="middle" <!-- <el-row align="middle"
@ -385,18 +346,16 @@
</el-col> </el-col>
</el-row> --> </el-row> -->
<el-row align="middle" <el-row align="middle"
type="flex" type="flex">
>
<el-col :span="12"> <el-col :span="12">
<p class="project-setting-label">每人每天限制填写1次</p> <p class="project-setting-label">每人每天限制填写1次</p>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-switch v-model="userProjectSettingData.everyoneDayWriteOnce" <el-switch v-model="userProjectSettingData.everyoneDayWriteOnce"
@change="saveUserProjectSetting" @change="saveUserProjectSetting" />
/>
</el-col> </el-col>
</el-row> </el-row>
<!-- <el-row v-if="userProjectSettingData.everyoneWriteOnceByUId||userProjectSettingData.everyoneWriteOnceByIp||userProjectSettingData.everyoneWriteOnce" <el-row v-if="userProjectSettingData.everyoneWriteOnceByUId||userProjectSettingData.everyoneWriteOnceByIp||userProjectSettingData.everyoneWriteOnce"
align="middle" align="middle"
type="flex"> type="flex">
<el-col :span="8"> <el-col :span="8">
@ -410,7 +369,7 @@
style="width: 80%;" style="width: 80%;"
@change="saveUserProjectSetting" /> @change="saveUserProjectSetting" />
</el-col> </el-col>
</el-row> --> </el-row>
<!-- <el-row align="middle" <!-- <el-row align="middle"
type="flex"> type="flex">
<el-col :span="12"> <el-col :span="12">
@ -491,12 +450,10 @@
</div> --> </div> -->
<el-dialog :visible.sync="dialogSubNotifyVisible" <el-dialog :visible.sync="dialogSubNotifyVisible"
title="微信扫描二维码订阅" title="微信扫描二维码订阅"
width="400px" width="400px">
>
<el-image :src="subNotifyWxQrCode" <el-image :src="subNotifyWxQrCode"
fit="fill" fit="fill"
style="width: 150px; height: 150px;" style="width: 150px; height: 150px;" />
/>
</el-dialog> </el-dialog>
<!-- <el-row align="middle" <!-- <el-row align="middle"
type="flex"> type="flex">
@ -647,7 +604,7 @@
export default { export default {
name: 'ProjectSetting', name: 'ProjectSetting',
data() { data () {
return { return {
projectKey: null, projectKey: null,
settingRules: { settingRules: {
@ -703,36 +660,36 @@ export default {
} }
}, },
computed: { computed: {
getUploadHeader() { getUploadHeader () {
return { return {
'token': this.$store.getters['user/isLogin'] 'token': this.$store.getters['user/isLogin']
} }
}, },
getUploadUrl() { getUploadUrl () {
return `${process.env.VUE_APP_API_ROOT}/user/file/upload` return `${process.env.VUE_APP_API_ROOT}/user/file/upload`
}, },
getUserInfo() { getUserInfo () {
return JSON.parse(this.$store.getters['user/userInfo']) return JSON.parse(this.$store.getters['user/userInfo'])
} }
}, },
mounted() { mounted () {
this.projectKey = this.$route.query.key this.projectKey = this.$route.query.key
this.queryUserProjectSetting() this.queryUserProjectSetting()
this.getSubNotifyWxQrCode() this.getSubNotifyWxQrCode()
}, },
destroyed() { destroyed () {
clearInterval(this.subNotifyUserTimer) clearInterval(this.subNotifyUserTimer)
}, },
methods: { methods: {
uploadSubmitPromptHandle(response) { uploadSubmitPromptHandle (response) {
this.userProjectSettingData.submitPromptImg = response.data this.userProjectSettingData.submitPromptImg = response.data
this.saveUserProjectSetting() this.saveUserProjectSetting()
}, },
uploadShareImgHandle(response) { uploadShareImgHandle (response) {
this.userProjectSettingData.shareImg = response.data this.userProjectSettingData.shareImg = response.data
this.saveUserProjectSetting() this.saveUserProjectSetting()
}, },
queryUserProjectSetting() { queryUserProjectSetting () {
this.userProjectSettingData.projectKey = this.projectKey this.userProjectSettingData.projectKey = this.projectKey
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/setting/${this.projectKey}`).then(res => { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/setting/${this.projectKey}`).then(res => {
if (res.data) { if (res.data) {
@ -761,20 +718,20 @@ export default {
} }
}) })
}, },
saveUserProjectSetting() { saveUserProjectSetting () {
this.userProjectSettingData.projectKey = this.projectKey this.userProjectSettingData.projectKey = this.projectKey
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/setting/save`, this.userProjectSettingData).then(() => { this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/setting/save`, this.userProjectSettingData).then(() => {
}) })
}, },
openSubNotifyWxDialogHandle() { openSubNotifyWxDialogHandle () {
this.dialogSubNotifyVisible = true this.dialogSubNotifyVisible = true
this.projectSetting.newFeedbackRemindWx = true this.projectSetting.newFeedbackRemindWx = true
this.subNotifyUserTimer = setInterval(() => { this.subNotifyUserTimer = setInterval(() => {
this.querySubNotifyWxUser() this.querySubNotifyWxUser()
}, 5 * 1000) }, 5 * 1000)
}, },
querySubNotifyWxUser(openIdStr) { querySubNotifyWxUser (openIdStr) {
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/wx/notify-user`, { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/wx/notify-user`, {
params: { params: {
key: this.projectKey, key: this.projectKey,
@ -791,12 +748,12 @@ export default {
} }
}) })
}, },
getSubNotifyWxQrCode() { getSubNotifyWxQrCode () {
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/wx/notify-qrcode`, { params: { key: this.projectKey } }).then(res => { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/wx/notify-qrcode`, { params: { key: this.projectKey } }).then(res => {
this.subNotifyWxQrCode = res.data this.subNotifyWxQrCode = res.data
}) })
}, },
deleteSubNotifyUserHandle(i) { deleteSubNotifyUserHandle (i) {
if (this.subNotifyWxUserList) { if (this.subNotifyWxUserList) {
let openId = this.subNotifyWxUserList[i].openId let openId = this.subNotifyWxUserList[i].openId
let key = this.projectKey let key = this.projectKey
@ -807,7 +764,7 @@ export default {
}) })
} }
}, },
clearFieldHandle(fields) { clearFieldHandle (fields) {
fields.forEach(field => { fields.forEach(field => {
this.$set(this.userProjectSettingData, field, '') this.$set(this.userProjectSettingData, field, '')
}) })

102
src/views/form/write/index.vue

@ -1,22 +1,24 @@
<template> <template>
<div class="write-container"> <div class="write-container">
<h1 id="inActiveTime" style="display: none;" /> <h1 id="inActiveTime"
<div v-if="writeStatus==0" class="title-icon-view"> style="display: none;" />
<div v-if="writeStatus==0"
class="title-icon-view">
<div class="icon-view"> <div class="icon-view">
<i class="el-icon-check success-icon" /> <i class="el-icon-check success-icon" />
</div> </div>
<p v-if="writeNotStartPrompt" style="text-align: center;"> <p v-if="writeNotStartPrompt"
style="text-align: center;">
<span v-if="writeNotStartPrompt">{{ writeNotStartPrompt }}</span> <span v-if="writeNotStartPrompt">{{ writeNotStartPrompt }}</span>
</p> </p>
</div> </div>
<div v-if="writeStatus==1"> <div v-if="writeStatus==1">
<project-form <project-form v-if="projectConfig.projectKey"
v-if="projectConfig.projectKey"
:project-config="projectConfig" :project-config="projectConfig"
@submit="submitForm" @submit="submitForm" />
/>
</div> </div>
<div v-if="writeStatus==2" class="title-icon-view"> <div v-if="writeStatus==2"
class="title-icon-view">
<div class="icon-view"> <div class="icon-view">
<i class="el-icon-check success-icon" /> <i class="el-icon-check success-icon" />
</div> </div>
@ -25,13 +27,13 @@
<span v-else>{{ globalDefaultValue.projectSubmitPromptText }}</span> <span v-else>{{ globalDefaultValue.projectSubmitPromptText }}</span>
</p> </p>
<div> <div>
<el-image <el-image v-if="userProjectSetting.submitPromptImg"
v-if="userProjectSetting.submitPromptImg"
:src="userProjectSetting.submitPromptImg" :src="userProjectSetting.submitPromptImg"
fit="cover" fit="cover" />
/>
</div> </div>
<el-button v-if="userProjectSetting.publicResult" type="primary" @click="openPublicResultHandle"> <el-button v-if="userProjectSetting.publicResult"
type="primary"
@click="openPublicResultHandle">
查看数据 查看数据
</el-button> </el-button>
</div> </div>
@ -42,7 +44,7 @@
import ProjectForm from '../preview/ProjectForm' import ProjectForm from '../preview/ProjectForm'
import loadWXJs from '@/utils/loadWxSdk' import loadWXJs from '@/utils/loadWxSdk'
import defaultValue from '@/utils/defaultValue' import defaultValue from '@/utils/defaultValue'
import {getQueryString} from '@/utils' import { getQueryString } from '@/utils'
import constants from '@/utils/constants' import constants from '@/utils/constants'
const uaParser = require('ua-parser-js') const uaParser = require('ua-parser-js')
@ -55,7 +57,7 @@ export default {
ProjectForm ProjectForm
}, },
props: {}, props: {},
data() { data () {
return { return {
inActiveTime: 0, inActiveTime: 0,
projectConfig: { projectConfig: {
@ -73,7 +75,14 @@ export default {
wxAuthorizationUrl: '', wxAuthorizationUrl: '',
wxAuthorizationCode: '', wxAuthorizationCode: '',
wxUserInfo: {}, wxUserInfo: {},
wxSignature: {} wxSignature: {},
//
clientType: '',//:gov:resi:oper
orgId: '',//Id(agencyId;deptId;gridId)
orgName: '',//---
orgType: '',//(:agency;:dept;:grid)
realName: '',//
} }
}, },
metaInfo: { metaInfo: {
@ -84,7 +93,13 @@ export default {
} }
] ]
}, },
async created() { async created () {
this.clientType = this.$route.query.clientType
this.orgId = this.$route.query.orgId
this.orgName = this.$route.query.orgName
this.orgType = this.$route.query.orgType
this.realName = this.$route.query.realName
let key = this.$route.query.key || this.$route.params.key let key = this.$route.query.key || this.$route.params.key
this.projectConfig.projectKey = key this.projectConfig.projectKey = key
let wxCode = getQueryString('code') let wxCode = getQueryString('code')
@ -97,23 +112,23 @@ export default {
this.queryProjectSetting() this.queryProjectSetting()
if (constants.enableWx) { if (constants.enableWx) {
// //
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/wx/jsapi/signature`, {params: {url: window.location.href}}).then(res => { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/wx/jsapi/signature`, { params: { url: window.location.href } }).then(res => {
this.wxSignature = res.data this.wxSignature = res.data
this.setWxConfig() this.setWxConfig()
}) })
} }
}, },
mounted() { mounted () {
this.viewProjectHandle() this.viewProjectHandle()
}, methods: { }, methods: {
viewProjectHandle() { viewProjectHandle () {
// //
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/view/${this.projectConfig.projectKey}`, {params: {projectKey: this.projectConfig.projectKey}}).then(() => { this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/view/${this.projectConfig.projectKey}`, { params: { projectKey: this.projectConfig.projectKey } }).then(() => {
}) })
}, },
queryProjectSettingStatus() { queryProjectSettingStatus () {
// //
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/setting-status`, { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/setting-status`, {
params: { params: {
@ -127,7 +142,7 @@ export default {
} }
}) })
}, },
getWxAuthorizationUserInfo() { getWxAuthorizationUserInfo () {
let wxAuthorizationCode = this.wxAuthorizationCode let wxAuthorizationCode = this.wxAuthorizationCode
// code // code
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/wx/jsapi/authorization/user/info`, { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/wx/jsapi/authorization/user/info`, {
@ -141,15 +156,15 @@ export default {
}) })
}, },
getWxAuthorizationUrl() { getWxAuthorizationUrl () {
// url // url
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/wx/jsapi/authorization/url`, {params: {url: window.location.href}}).then(res => { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/wx/jsapi/authorization/url`, { params: { url: window.location.href } }).then(res => {
if (res.data) { if (res.data) {
this.wxAuthorizationUrl = res.data this.wxAuthorizationUrl = res.data
} }
}) })
}, },
setWxConfig() { setWxConfig () {
let that = this let that = this
let signature = this.wxSignature let signature = this.wxSignature
loadWXJs(wx => { loadWXJs(wx => {
@ -170,7 +185,7 @@ export default {
] // 使JS ] // 使JS
}) })
// sdk // sdk
wx.ready(function() { wx.ready(function () {
// //
console.log('ready') console.log('ready')
that.setWxProjectShare(wx) that.setWxProjectShare(wx)
@ -180,18 +195,18 @@ export default {
/** /**
* 微信分享 * 微信分享
*/ */
setWxProjectShare(wx) { setWxProjectShare (wx) {
let {shareImg, shareTitle, shareDesc} = this.userProjectSetting let { shareImg, shareTitle, shareDesc } = this.userProjectSetting
wx.updateAppMessageShareData({ wx.updateAppMessageShareData({
title: shareTitle || defaultValue.projectShareTitle, // title: shareTitle || defaultValue.projectShareTitle, //
desc: shareDesc || defaultValue.projectShareDesc, // desc: shareDesc || defaultValue.projectShareDesc, //
link: window.location.href, // JS link: window.location.href, // JS
imgUrl: shareImg || defaultValue.projectShareImg, // imgUrl: shareImg || defaultValue.projectShareImg, //
success: function() { success: function () {
// //
console.log('succcess') console.log('succcess')
}, },
fail: function() { fail: function () {
console.log('fail') console.log('fail')
} }
}) })
@ -200,11 +215,11 @@ export default {
desc: shareDesc || defaultValue.projectShareDesc, // desc: shareDesc || defaultValue.projectShareDesc, //
link: window.location.href, // JS link: window.location.href, // JS
imgUrl: shareImg || defaultValue.projectShareImg, // imgUrl: shareImg || defaultValue.projectShareImg, //
success: function() { success: function () {
// //
console.log('succcess') console.log('succcess')
}, },
fail: function() { fail: function () {
console.log('fail') console.log('fail')
} }
}) })
@ -213,7 +228,7 @@ export default {
desc: shareDesc || defaultValue.projectShareDesc, // desc: shareDesc || defaultValue.projectShareDesc, //
link: window.location.href, // JS link: window.location.href, // JS
imgUrl: shareImg || defaultValue.projectShareImg, // imgUrl: shareImg || defaultValue.projectShareImg, //
success: function() { success: function () {
// //
console.log('succcess') console.log('succcess')
} }
@ -223,13 +238,13 @@ export default {
desc: shareDesc || defaultValue.projectShareDesc, // desc: shareDesc || defaultValue.projectShareDesc, //
link: window.location.href, // JS link: window.location.href, // JS
imgUrl: shareImg || defaultValue.projectShareImg, // imgUrl: shareImg || defaultValue.projectShareImg, //
success: function() { success: function () {
// //
console.log('succcess') console.log('succcess')
} }
}) })
}, },
queryProjectSetting() { queryProjectSetting () {
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/setting/${this.projectConfig.projectKey}`).then(res => { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/setting/${this.projectConfig.projectKey}`).then(res => {
if (res.data) { if (res.data) {
this.userProjectSetting = res.data this.userProjectSetting = res.data
@ -248,7 +263,7 @@ export default {
/** /**
* 仅在微信打开 * 仅在微信打开
*/ */
onlyWxOpenHandle() { onlyWxOpenHandle () {
let wxUa = navigator.userAgent.toLowerCase() let wxUa = navigator.userAgent.toLowerCase()
let isWeixin = wxUa.indexOf('micromessenger') != -1 let isWeixin = wxUa.indexOf('micromessenger') != -1
if (!isWeixin) { if (!isWeixin) {
@ -256,11 +271,11 @@ export default {
document.body.innerHTML = '<div class="weui_msg"><div class="weui_icon_area"><i class="weui_icon_info weui_icon_msg"></i></div><div class="weui_text_area"><h4 class="weui_msg_title">请在微信客户端打开链接</h4></div></div>' document.body.innerHTML = '<div class="weui_msg"><div class="weui_icon_area"><i class="weui_icon_info weui_icon_msg"></i></div><div class="weui_text_area"><h4 class="weui_msg_title">请在微信客户端打开链接</h4></div></div>'
} }
}, },
openPublicResultHandle() { openPublicResultHandle () {
let projectKey = this.projectConfig.projectKey let projectKey = this.projectConfig.projectKey
this.$router.replace({path: '/project/public/result', query: {projectKey}}) this.$router.replace({ path: '/project/public/result', query: { projectKey } })
}, },
submitForm(data) { submitForm (data) {
// //
let inActiveTime = document.getElementById('inActiveTime').innerText let inActiveTime = document.getElementById('inActiveTime').innerText
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/create`, { this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/create`, {
@ -272,7 +287,12 @@ export default {
'wxUserInfo': this.wxUserInfo, 'wxUserInfo': this.wxUserInfo,
'wxOpenId': this.wxUserInfo ? this.wxUserInfo.openid : '', 'wxOpenId': this.wxUserInfo ? this.wxUserInfo.openid : '',
'originalData': data.formModel, 'originalData': data.formModel,
'processData': data.labelFormModel 'processData': data.labelFormModel,
'clientType': this.clientType,//:gov:resi:oper
'orgId': this.orgId,//Id(agencyId;deptId;gridId)
'orgName': this.orgName,//---
'orgType': this.orgType,//(:agency;:dept;:grid)
'realName': this.realName,//
}).then(() => { }).then(() => {
this.writeStatus = 2 this.writeStatus = 2
if (this.userProjectSetting.submitJumpUrl) { if (this.userProjectSetting.submitJumpUrl) {

Loading…
Cancel
Save