Browse Source

收query参数

dev_itemshow_fix
mk 2 years ago
parent
commit
c08e182cb4
  1. 2
      .env.development
  2. 1
      .gitignore
  3. 7
      src/store/modules/user.js
  4. 2
      src/views/form/publish/index.vue
  5. 49
      src/views/form/write/index.vue

2
.env.development

@ -3,7 +3,7 @@ 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 暂时没有用到

1
.gitignore

@ -5,7 +5,6 @@ node_modules
/src/assets/sprites/*.*
!/src/assets/sprites/.gitkeep
/questionnaire
# local env files
.env.local
.env.*.local

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
}
}

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()
},

49
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,8 @@ export default {
orgName: '',//---
orgType: '',//(:agency;:dept;:grid)
realName: '',//
accessKey: ''
accessKey: '',
anonymous:''
}
},
metaInfo: {
@ -107,8 +117,12 @@ export default {
console.log('微信传入token')
const token = this.$route.query.token
const agencyId = this.$route.query.agencyId
this.anonymous = this.$route.query.anonymous
console.log('anonymous',this.anonymous);
if (token) {
this.$store.dispatch('user/setTokens', token)
this.$store.dispatch('user/setAgencyId', agencyId)
}
@ -297,10 +311,11 @@ 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}&`
await this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}${url}agencyId=${this.$route.query.agencyId}`, {
'completeTime': inActiveTime,
'projectKey': this.projectConfig.projectKey,
'submitOs': ua.os.name,
@ -317,17 +332,33 @@ export default {
'realName': this.realName,//
//'accessKey':this.accessKey
}).then((res) => {
this.writeStatus = 2
if(res.code==0){
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