Compare commits

...

9 Commits
master ... dev

  1. 4
      .env.development
  2. 14
      .env.preview
  3. 3
      .gitignore
  4. 6
      doc/动态问卷表单.mx
  5. 1
      package.json
  6. 32
      src/components/parser/Parser.vue
  7. 7
      src/store/modules/user.js
  8. 13
      src/views/form/preview/ProjectForm.vue
  9. 2
      src/views/form/publish/index.vue
  10. 53
      src/views/form/write/index.vue

4
.env.development

@ -1,9 +1,9 @@
# 页面标题
VUE_APP_TITLE = 问卷调查开发环境
VUE_APP_TITLE = 问卷调查
# 接口请求地址,会设置到 axios 的 baseURL 参数上
VUE_APP_API_ROOT_TDUCK = /tduck-api
#VUE_APP_API_ROOT = http://localhost:8116/
VUE_APP_API_ROOT = http://192.168.1.140/api
VUE_APP_API_ROOT = http://192.168.1.144/api
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
VUE_APP_DEBUG_TOOL =
# 高德地图key 暂时没有用到

14
.env.preview

@ -0,0 +1,14 @@
# 页面标题
VUE_APP_TITLE = 问卷调查
# 接口请求地址,会设置到 axios 的 baseURL 参数上
VUE_APP_API_ROOT_TDUCK = /tduck-api
#VUE_APP_API_ROOT = http://localhost:8116/
VUE_APP_API_ROOT = https://epmet-preview.elinkservice.cn/api
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
VUE_APP_DEBUG_TOOL =
# 高德地图key 暂时没有用到
VUE_APP_MAP_KEY = f2200337d0d08538e78729572749882d
# 微信功能开关 开启设置 ON,关闭设置 OFF
VUE_APP_WX = OFF
#项目根路径
VUE_APP_PUBLIC_PATH=questionnaire

3
.gitignore

@ -4,7 +4,7 @@ node_modules
/dist-dev
/src/assets/sprites/*.*
!/src/assets/sprites/.gitkeep
/questionnaire
# local env files
.env.local
.env.*.local
@ -22,3 +22,4 @@ yarn-error.log*
*.njsproj
*.sln
*.sw*
*.zip

6
doc/动态问卷表单.mx

@ -0,0 +1,6 @@
## 逻辑控制题目显示与否
Parser.vue:187 line
## 如何初始化表单项
Parser:48

1
package.json

@ -6,6 +6,7 @@
"dev": "vue-cli-service serve",
"serve": "vue-cli-service serve",
"build:dev": "vue-cli-service build --mode development --dest questionnaire",
"build:preview": "vue-cli-service build --mode preview --dest questionnaire",
"build:test": "vue-cli-service build --mode test --dest questionnaire",
"preview": "node build/index.js --preview",
"build:prod": "vue-cli-service build --mode production --dest questionnaire",

32
src/components/parser/Parser.vue

@ -72,7 +72,6 @@ const layouts = {
function renderFrom (h) {
const { formConfCopy } = this
return (
<el-row gutter={formConfCopy.gutter}>
<el-form
@ -515,6 +514,7 @@ export default {
this.$refs[this.formConf.formRef].resetFields()
},
submitForm () {
// debugger
this.$refs[this.formConf.formRef].validate(valid => {
if (!valid) {
//
@ -527,6 +527,23 @@ export default {
}, 100)
return false
}
//
//
let checkRules = {}
this.formConf.fields.forEach(f => {
checkRules[f.__vModel__] = {
"fieldLabel":f.__config__.label,
"required":f.__config__.required
}
})
for (let fieldName in this.formData) {
if (!this.requiredFieldCheck(checkRules, fieldName, this.formData[fieldName])) {
return;
}
}
// sumit
this.$emit('submit', {
formModel: this[this.formConf.formModel],
@ -534,8 +551,19 @@ export default {
})
return true
})
}
},
requiredFieldCheck(checkRules, fieldName, fieldValue) {
let fieldCheckRule = checkRules[fieldName]
let fieldShowed = document.querySelector(`div[cid="${fieldName.replace('field', '')}"]`).style.display != 'none'
if (fieldShowed && fieldCheckRule && fieldCheckRule.required && !fieldValue) {
this.$message.error("请填写:" + fieldCheckRule.fieldLabel)
return false;
}
return true;
},
},
render (h) {
return renderFrom.call(this, h)
}

7
src/store/modules/user.js

@ -54,6 +54,10 @@ const actions = {
setTokens(context, token) {
console.log('setToekns', token)
context.commit('setToken', token)
},
setAgencyId(context, agencyId) {
console.log('setAgencyId', agencyId)
context.commit('AgencyId', agencyId)
}
}
@ -72,6 +76,9 @@ const mutations = {
},
setToken(state, token) {
state.token = token
},
setAgencyId(state, token) {
state.agencyId = token
}
}

13
src/views/form/preview/ProjectForm.vue

@ -140,6 +140,19 @@ export default {
},
async mounted () {
// wxz test
// let test = {
// "a":"11",
// "b":"22",
// }
// console.info('------');
// for (let f in test) {
// console.info(test[f]);
// }
// console.info('------');
let url = `${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/details/${this.formConf.projectKey}`
if (this.formConf.projectKind == 2) {
url = `${process.env.VUE_APP_API_ROOT_TDUCK}/project/template/details/${this.formConf.projectKey}`

2
src/views/form/publish/index.vue

@ -133,7 +133,9 @@ export default {
},
mounted () {
this.projectKey = this.$route.query.key
this.agencyId = this.$route.query.agencyId
let url = window.location.protocol + '//' + window.location.host
console.log(this.agencyId);
this.writeLink = `${url}/${process.env.VUE_APP_PUBLIC_PATH}/s/${this.projectKey}`
this.getProjectStatus()
},

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

@ -1,3 +1,12 @@
<!--
* @Author: mk 2403457699@qq.com
* @Date: 2023-09-05 19:39:02
* @LastEditors: mk 2403457699@qq.com
* @LastEditTime: 2023-09-06 13:35:51
* @Description: 介绍一下改动了什么
*
*
-->
<template>
<div class="write-container">
<h1 id="inActiveTime"
@ -85,7 +94,9 @@ export default {
orgName: '',//---
orgType: '',//(:agency;:dept;:grid)
realName: '',//
accessKey: ''
accessKey: '',
anonymous:'',
agencyId: ''
}
},
metaInfo: {
@ -107,8 +118,15 @@ export default {
console.log('微信传入token')
const token = this.$route.query.token
const agencyId = this.$route.query.agencyId
this.anonymous = this.$route.query.anonymous
this.agencyId = agencyId;
console.log('anonymous',this.anonymous);
if (token) {
this.$store.dispatch('user/setTokens', token)
this.$store.dispatch('user/setAgencyId', agencyId)
}
@ -297,10 +315,14 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(255, 255, 255, 0.5)'
})
console.log('提交获取agencyId',this.$store.state.agencyId);
//
let inActiveTime = document.getElementById('inActiveTime').innerText
await this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/create?access_key=${this.accessKey}`, {
let url = this.anonymous == '1'?`/user/project/result/createAnonymously`:`/user/project/result/create?access_key=${this.accessKey}&`
// debugger
await this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}${url}`, {
'completeTime': inActiveTime,
'projectKey': this.projectConfig.projectKey,
'submitOs': ua.os.name,
@ -315,19 +337,36 @@ export default {
'orgName': this.orgName,//---
'orgType': this.orgType,//(:agency;:dept;:grid)
'realName': this.realName,//
'agencyId': this.agencyId
//'accessKey':this.accessKey
}).then((res) => {
if(res.code==0){
this.writeStatus = 2
this.writeStatus = 2
}else{
console.log('不等于0',res.msg);
this.$message(
{
message: res.msg,
type: 'warning'
}
)
}
if (this.userProjectSetting.submitJumpUrl) {
setTimeout(() => {
window.location.replace(this.userProjectSetting.submitJumpUrl)
}, 1000)
window.location.replace(this.userProjectSetting.submitJumpUrl)
}, 1000)
}
},
(msg) => {
(err) => {
// debugger
this.$message(
{
message: err.msg,
type: 'warning'
}
)
})
// debugger
loading.close()

Loading…
Cancel
Save