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. 41
      src/views/form/write/index.vue

2
.env.development

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

1
.gitignore

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

7
src/store/modules/user.js

@ -54,6 +54,10 @@ const actions = {
setTokens(context, token) { setTokens(context, token) {
console.log('setToekns', token) console.log('setToekns', token)
context.commit('setToken', 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) { setToken(state, token) {
state.token = token state.token = token
},
setAgencyId(state, token) {
state.agencyId = token
} }
} }

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

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

41
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> <template>
<div class="write-container"> <div class="write-container">
<h1 id="inActiveTime" <h1 id="inActiveTime"
@ -85,7 +94,8 @@ export default {
orgName: '',//--- orgName: '',//---
orgType: '',//(:agency;:dept;:grid) orgType: '',//(:agency;:dept;:grid)
realName: '',// realName: '',//
accessKey: '' accessKey: '',
anonymous:''
} }
}, },
metaInfo: { metaInfo: {
@ -107,8 +117,12 @@ export default {
console.log('微信传入token') console.log('微信传入token')
const token = this.$route.query.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) { if (token) {
this.$store.dispatch('user/setTokens', token) this.$store.dispatch('user/setTokens', token)
this.$store.dispatch('user/setAgencyId', agencyId)
} }
@ -297,10 +311,11 @@ export default {
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(255, 255, 255, 0.5)' background: 'rgba(255, 255, 255, 0.5)'
}) })
console.log('提交获取agencyId',this.$store.state.agencyId);
// //
let inActiveTime = document.getElementById('inActiveTime').innerText 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, 'completeTime': inActiveTime,
'projectKey': this.projectConfig.projectKey, 'projectKey': this.projectConfig.projectKey,
'submitOs': ua.os.name, 'submitOs': ua.os.name,
@ -317,8 +332,18 @@ export default {
'realName': this.realName,// 'realName': this.realName,//
//'accessKey':this.accessKey //'accessKey':this.accessKey
}).then((res) => { }).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) { if (this.userProjectSetting.submitJumpUrl) {
setTimeout(() => { setTimeout(() => {
window.location.replace(this.userProjectSetting.submitJumpUrl) window.location.replace(this.userProjectSetting.submitJumpUrl)
@ -326,8 +351,14 @@ export default {
} }
}, },
(msg) => { (err) => {
// debugger // debugger
this.$message(
{
message: err.msg,
type: 'warning'
}
)
}) })
// debugger // debugger
loading.close() loading.close()

Loading…
Cancel
Save