diff --git a/src/api/index.js b/src/api/index.js index 9d5901b..da911b7 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -85,14 +85,20 @@ api.interceptors.response.use( duration: 5 * 1000 }) } else if (res.code === 401) { - // to re-login - MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { - confirmButtonText: '重新登录', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - toLogin() - }) + // 有一个接口进入该方法 其他接口则不在进入 + let reLogin = store.getters['global/isReLogin'] + if (!reLogin) { + store.dispatch('global/loginExpired', true).then(() => { + // to re-login + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { + confirmButtonText: '重新登录', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + toLogin() + }) + }) + } } return Promise.reject(res) }, diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue index e8e6178..1f936b1 100644 --- a/src/components/SvgIcon/index.vue +++ b/src/components/SvgIcon/index.vue @@ -1,6 +1,6 @@ diff --git a/src/store/modules/global.js b/src/store/modules/global.js index 05cc453..d691cbc 100644 --- a/src/store/modules/global.js +++ b/src/store/modules/global.js @@ -2,13 +2,32 @@ * 存放全局公用状态 */ -const state = {} +const state = { + reLogin: false +} -const getters = {} +const getters = { + isReLogin: state => { + return state.reLogin + } +} -const actions = {} +const actions = { + loginExpired(context, status) { + return new Promise(resolve => { + context.commit('setReLogin', { + status: status + }) + resolve() + }) + } +} -const mutations = {} +const mutations = { + setReLogin(state, data) { + state.reLogin = data.status + } +} export default { namespaced: true, diff --git a/src/utils/defaultValue.js b/src/utils/defaultValue.js index be90aee..55c00b1 100644 --- a/src/utils/defaultValue.js +++ b/src/utils/defaultValue.js @@ -1,5 +1,6 @@ export default { projectShareTitle: '填鸭表单', projectShareDesc: '快来填写吧', - projectShareImg: 'https://qiniu.smileyi.top/c4ca4238a0b923820dcc509a6f75849b/4b2c7071f3f543549907b9e3b41df1ed.png' + projectShareImg: 'https://qiniu.smileyi.top/c4ca4238a0b923820dcc509a6f75849b/4b2c7071f3f543549907b9e3b41df1ed.png', + projectSubmitPromptText: '您已完成本次填写,感谢您的帮助与支持' } diff --git a/src/utils/index.js b/src/utils/index.js index aeeba82..9104055 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -176,3 +176,7 @@ export function getQueryString(name) { r = null return context == null || context == '' || context == 'undefined' ? '' : context } + +export function getCurrentDomain() { + return window.location.protocol + '//' + window.location.host +} diff --git a/src/views/404.vue b/src/views/404.vue index 6c5f495..94076c5 100644 --- a/src/views/404.vue +++ b/src/views/404.vue @@ -1,6 +1,8 @@ + diff --git a/src/views/account/login.vue b/src/views/account/login.vue index cd62aa6..b3e9171 100644 --- a/src/views/account/login.vue +++ b/src/views/account/login.vue @@ -11,7 +11,15 @@
- +
@@ -99,7 +109,9 @@ @@ -175,6 +187,9 @@
- diff --git a/src/views/form/write.vue b/src/views/form/write.vue index ced5400..6a2d8db 100644 --- a/src/views/form/write.vue +++ b/src/views/form/write.vue @@ -19,9 +19,10 @@ :src="userProjectSetting.submitPromptImg" fit="cover">
-

+

{{ userProjectSetting.submitPromptText }} + {{globalDefaultValue.projectSubmitPromptText}}

@@ -50,6 +51,7 @@ export default { userProjectSetting: { submitPromptText: '' }, + globalDefaultValue: defaultValue, //微信授权地址 wxAuthorizationUrl: '', wxAuthorizationCode: '', @@ -64,7 +66,6 @@ export default { let key = this.$route.query.key this.projectConfig.projectKey = key let wxCode = getQueryString('code') - alert(wxCode) if (wxCode) { alert(wxCode) this.wxAuthorizationCode = wxCode @@ -206,7 +207,7 @@ export default { 'projectKey': this.projectConfig.projectKey, 'collectData': data }).then(res => { - this.formState = true + this.writeStatus = 2 }) } } diff --git a/src/views/home/index.vue b/src/views/home/index.vue index a91e1a6..2fdbd94 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -58,7 +58,7 @@ export default { menuRouters: [ { routerPath: '/proposal', - title: '提出建议' + title: '免费模板' }, { routerPath: '/sources', diff --git a/vue.config.js b/vue.config.js index 907d2e1..8be63b1 100644 --- a/vue.config.js +++ b/vue.config.js @@ -59,7 +59,7 @@ module.exports = { // 开发环境默认开启反向代理,如果不需要请自行注释 proxy: { '/tduck-api': { - target: 'http://localhost:8999/', + target: 'http://smalljop.test.utools.club', changeOrigin: true } } diff --git a/yarn.lock b/yarn.lock index 71a5310..aada797 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8701,11 +8701,6 @@ q@^1.1.2: resolved "https://registry.npm.taobao.org/q/download/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= -qrcodejs2@^0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/qrcodejs2/-/qrcodejs2-0.0.2.tgz#465afe5e39f19facecb932c11f7a186109146ae1" - integrity sha1-Rlr+Xjnxn6zsuTLBH3oYYQkUauE= - qs@6.7.0: version "6.7.0" resolved "https://registry.npm.taobao.org/qs/download/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"