From f6c2ee7043e8d8ae39b1fd5d17f0e8f687fe5aa6 Mon Sep 17 00:00:00 2001 From: xuesinan <1404152492@qq.com> Date: Thu, 17 Mar 2022 14:52:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=A1=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 6 +++--- .env.production | 6 +++--- src/App.vue | 14 ++++++++++---- src/config/api.js | 10 +++++----- src/plugins/axios.js | 2 ++ src/store/modules/home/mutations.js | 9 +++++++++ src/store/modules/home/state.js | 1 + 7 files changed, 33 insertions(+), 15 deletions(-) diff --git a/.env.development b/.env.development index 3de6ca6..bc53377 100644 --- a/.env.development +++ b/.env.development @@ -1,10 +1,10 @@ VUE_APP_MODE=development VUE_APP_NODE_ENV=development VUE_APP_SCENE=checkwork -VUE_APP_BASE_URL=https://test.tall.wiki -VUE_APP_API_URL=https://test.tall.wiki/checkwork/gateway +VUE_APP_BASE_URL=http://101.201.226.163 +VUE_APP_API_URL=http://101.201.226.163/checkwork/gateway VUE_APP_PROXY_URL=/gateway VUE_APP_PUBLIC_PATH=/checkwork -VUE_APP_MSG_URL=wss://test.tall.wiki/websocket/message/v4.0/ws +VUE_APP_MSG_URL=wss://101.201.226.163/websocket/message/v4.0/ws VUE_APP_TITLE=考勤管理 VUE_APP_DESCRIPTION=考勤管理 diff --git a/.env.production b/.env.production index 1ec1010..cab4ecb 100644 --- a/.env.production +++ b/.env.production @@ -1,10 +1,10 @@ VUE_APP_MODE=production VUE_APP_NODE_ENV=production VUE_APP_SCENE=checkwork -VUE_APP_BASE_URL=https://www.tall.wiki -VUE_APP_API_URL=https://www.tall.wiki/checkwork/gateway +VUE_APP_BASE_URL=http://101.201.226.163 +VUE_APP_API_URL=http://101.201.226.163//checkwork/gateway VUE_APP_PROXY_URL=/gateway VUE_APP_PUBLIC_PATH=/checkwork -VUE_APP_MSG_URL=wss://www.tall.wiki/websocket/message/v4.0/ws +VUE_APP_MSG_URL=wss://101.201.226.163/websocket/message/v4.0/ws VUE_APP_TITLE=考勤管理 VUE_APP_DESCRIPTION=考勤管理 diff --git a/src/App.vue b/src/App.vue index 54a70d2..c003d18 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,17 +20,23 @@ export default { this.$router.onReady(async () => { const userId = this.$route.query.uid; const roleId = this.$route.query.rid; - const params = { userId }; - await this.getUserId(params); + const token = this.$route.query.token; + const url = this.$route.query.url; + // const params = { userId }; + // await this.getUserId(params); + + await this.sign(token); await this.setRoleId(roleId); + await this.setUrl(url); await this.getAllMembers({ projectId: this.$route.query.pid }); this.setProjectId(this.$route.query.pid); }); }, methods: { - ...mapMutations('home', ['setProjectId', 'setMembers', 'setRoleId']), - ...mapActions('user', ['getUserId']), + ...mapMutations('home', ['setProjectId', 'setMembers', 'setRoleId', 'setUrl']), + ...mapMutations('user', ['sign']), + // ...mapActions('user', ['getUserId']), ...mapActions('home', ['getAllMembers']), }, }; diff --git a/src/config/api.js b/src/config/api.js index d9bad09..c638829 100644 --- a/src/config/api.js +++ b/src/config/api.js @@ -4,19 +4,19 @@ const baseUrl = process.env.VUE_APP_BASE_URL; const defaultwbs = `${baseUrl}/gateway/defaultwbs`; // 查询考勤信息 -export const clockQuery = params => axios.post(`${defaultwbs}/clock/query`, params); +export const clockQuery = params => axios.post(`clock/query`, params); // 查询考勤信息 -export const clockPunch = params => axios.post(`${defaultwbs}/clock/punch`, params); +export const clockPunch = params => axios.post(`clock/punch`, params); // 查询所有成员 -export const queryChecker = params => axios.post(`${defaultwbs}/deliver/queryChecker`, params); +export const queryChecker = params => axios.post(`deliver/queryChecker`, params); // 查询所有成员 -export const clockAudit = params => axios.post(`${defaultwbs}/clock/audit`, params); +export const clockAudit = params => axios.post(`clock/audit`, params); // 导出考勤excel -export const clockExport = params => axios.post(`${defaultwbs}/clock/export`, params); +export const clockExport = params => axios.post(`clock/export`, params); // 查询所有成员工资信息 export const queryMemberSalary = params => axios.post(`${defaultwbs}/salary/queryMemberSalary`, params); diff --git a/src/plugins/axios.js b/src/plugins/axios.js index 61fb864..e0879a0 100644 --- a/src/plugins/axios.js +++ b/src/plugins/axios.js @@ -19,6 +19,8 @@ const _axios = axios.create(config); axios.interceptors.request.use( function(config) { let token = store.state.anyringToken || sessionStorage.getItem('anyringToken'); + config.url = store.state.home.url + '/' + config.url; + console.log(config) if (token) { config.headers.Authorization = `Bearer ${token}`; diff --git a/src/store/modules/home/mutations.js b/src/store/modules/home/mutations.js index 22a16d4..58cdd52 100644 --- a/src/store/modules/home/mutations.js +++ b/src/store/modules/home/mutations.js @@ -69,6 +69,15 @@ const mutations = { setRoleId(state, data) { state.roleId = data; }, + + /** + * 设置url信息 + * @param {object} state + * @param {String} data + */ + setUrl(state, data) { + state.url = data; + }, }; export default mutations; diff --git a/src/store/modules/home/state.js b/src/store/modules/home/state.js index 85a3d5d..acced4c 100644 --- a/src/store/modules/home/state.js +++ b/src/store/modules/home/state.js @@ -14,6 +14,7 @@ const state = { memberIdList: [], roleId: '', checkers: [], // 审核人列表 + url: '' }; export default state;