Browse Source

Merge branch 'dev_ljj' of http://git.elinkit.com.cn:7070/r/tduck-front into dev_ljj

old
13176889840 4 years ago
parent
commit
6bb0a39fbd
  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)
// input
let tagOptionKey = processType[config.tag]
debugger
if (tagOptionKey) {
if (event instanceof Array) {
//
//
if (!event.includes(0) && config.tag != 'el-cascader') {
// other
this.$set(this[this.formConf.labelFormModel], `${scheme.__vModel__}other`, '')

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

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

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

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

Loading…
Cancel
Save