diff --git a/src/store/State.js b/src/store/State.js index 09986b3..3ebb231 100644 --- a/src/store/State.js +++ b/src/store/State.js @@ -1,3 +1,4 @@ export default { - token: '' + token: '', + referrer: '' } \ No newline at end of file diff --git a/src/store/mutations.js b/src/store/mutations.js index 7e61eca..f2ff34e 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -2,7 +2,8 @@ export default { sethtname(state, payload) { state.htname = payload.htname; }, - setToken(state, token) { - state.token = token + setParam(state, payload) { + state.token = payload.token + state.referrer = payload.referrer }, } \ No newline at end of file diff --git a/src/utils/api.js b/src/utils/api.js index a701773..3a2baeb 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -6,11 +6,11 @@ if(isKd){ }else{ // 职站中台接口切换 if(location.host.includes('liuwanr.cn')){ - host = 'http://www.liuwanr.cn' + host = 'http://www.liuwanr.cn'// 职站测试服 }else if(location.host.includes('occupationlab.com')){ - host = 'http://www.occupationlab.com' + host = 'http://www.occupationlab.com'// 职站正式服 }else{ - host = 'http://39.108.250.202' + host = 'http://39.108.250.202'// 中台 } } diff --git a/src/utils/http.js b/src/utils/http.js index aed6401..c6d1c98 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -100,6 +100,17 @@ axios.interceptors.request.use(config => { // } // ); + +function logouts(){ + let referrer = store.state.referrer + store.replaceState({}) + sessionStorage.removeItem('kd_client_username') + location.href = referrer +} +let tokenStatus = { + 0: '用户未登录,请登录后操作!', + 1: 'token错误,请重新登录!' +} /** * get方法,对应get请求 */ @@ -109,6 +120,11 @@ export function get(url, params){ params: params }) .then(res => { + if(typeof res.data == 'number'){ + this.$message.error(tokenStatus[res.data]) + setTimeout(logouts,1500) + return false + } if (res.data.status) { switch (res.data.status) { case 200: @@ -169,6 +185,11 @@ export function post(url, params) { return new Promise((resolve, reject) => { axios.post(url,params) .then(res => { + if(typeof res.data == 'number'){ + this.$message.error(tokenStatus[res.data]) + setTimeout(logouts,1500) + return false + } if (res.data.status) { switch (res.data.status) { case 200: @@ -227,6 +248,11 @@ export function post(url, params) { params: params }) .then(res => { + if(typeof res.data == 'number'){ + this.$message.error(tokenStatus[res.data]) + setTimeout(logouts,1500) + return false + } if (res.data.status) { switch (res.data.status) { case 200: @@ -289,6 +315,11 @@ export function put(url, params){ return new Promise((resolve, reject) =>{ axios.put(url, params) .then(res => { + if(typeof res.data == 'number'){ + this.$message.error(tokenStatus[res.data]) + setTimeout(logouts,1500) + return false + } if (res.data.status) { switch (res.data.status) { case 200: diff --git a/src/views/Home.vue b/src/views/Home.vue index cb3e43b..c2d44fb 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -90,10 +90,9 @@ export default { pageNo: 1, pageSize: 10, currentPage: 1, - systemId: "", - userId: "", - systemName: "", - host: location.host.includes('liuwanr.cn') ? 'http://www.liuwanr.cn' : 'http://www.occupationlab.com' + systemId: this.$route.query.systemId, + userId: this.$route.query.userId, + systemName: this.$route.query.systemName, }; }, components: {quill}, @@ -106,6 +105,8 @@ export default { }, }, mounted() { + console.log(11,this.$route.query.token) + this.$route.query.token && this.$store.commit('setParam',{token: atob(decodeURI(this.$route.query.token)),referrer: atob(decodeURI(this.$route.query.referrer))}) this.handleCurrentChange(this.pageNo); }, methods: { @@ -126,14 +127,9 @@ export default { handleCurrentChange(val) { this.$get(`${this.api.queryUserIds}`).then(res => { this.pageNo = val; - this.systemId = this.getCookie("systemId"); - this.systemId = this.systemId ? this.systemId : 1 - this.systemName = this.getCookie("systemName"); - this.userId = this.getCookie("userId"); this.$get(this.api.QueryPointOfJudgement, { systemId: this.systemId, userId: this.userId, - // systemId: 1, pageNum: this.pageNo, pageSize: this.pageSize, queryName: this.keyword, @@ -172,7 +168,7 @@ export default { // this.setCookie("judgmentPointsId", ""); // console.log(this.getCookie("judgmentPointsId")); // this.$router.push({ path: "/program" }); - this.$router.push({ path: "/program" }); + this.$router.push(`program?systemId=${this.systemId}&userId=${this.userId}`); }, // 表头样式设置 headClass() { @@ -237,10 +233,7 @@ export default { }, // 编辑 handleClick(res) { - this.$router.push({ - path: "/program", - query: { judgmentPointsId: res.judgmentPointsId } - }); + this.$router.push(`program?judgmentPointsId=${res.judgmentPointsId}&systemId=${this.systemId}&userId=${this.userId}`) } } }; diff --git a/src/views/List.vue b/src/views/List.vue index fef3987..2364fdc 100644 --- a/src/views/List.vue +++ b/src/views/List.vue @@ -84,7 +84,8 @@ export default { pattern: this.$route.query.pattern, systemName: "", searchTimer: null, - host: this.$route.query.host == 1 ? 'http://122.9.154.146' : 'http://116.63.168.79' + host: this.$route.query.host == 1 ? 'http://122.9.154.146' : 'http://116.63.168.79', + referrer: atob(decodeURI(this.$route.query.referrer)) }; }, components: {quill}, @@ -97,7 +98,7 @@ export default { }, }, mounted() { - this.$route.query.token && this.$store.commit('setToken',this.$route.query.token) + this.$route.query.token && this.$store.commit('setParam',{token: atob(decodeURI(this.$route.query.token)),referrer: this.referrer}) this.handleCurrentChange(this.pageNo); }, methods: { diff --git a/src/views/Program.vue b/src/views/Program.vue index 583c28a..59892c3 100644 --- a/src/views/Program.vue +++ b/src/views/Program.vue @@ -159,8 +159,8 @@ export default { ] }, decisionPointRule: "", - systemId: "", - userId: "", + systemId: this.$route.query.systemId, + userId: this.$route.query.userId, ruleIds: [], jRP: "", jRR: "", @@ -171,6 +171,7 @@ export default { }, components: {quill,quill1}, mounted () { + this.$route.query.token && this.$store.commit('setParam',{token: atob(decodeURI(this.$route.query.token)),referrer: atob(decodeURI(this.$route.query.referrer))}) this.getMesg(); }, @@ -246,9 +247,6 @@ export default { console.log(err); }); } else { - this.systemId = this.getCookie("systemId"); - this.systemId = this.systemId ? this.systemId : 1 - this.userId = this.getCookie("userId"); // 新增判分点基本信息 this.$post(this.api.AddPfdInformation, { points: { diff --git a/src/views/ProgramOption.vue b/src/views/ProgramOption.vue index ecbd9cf..750ef1d 100644 --- a/src/views/ProgramOption.vue +++ b/src/views/ProgramOption.vue @@ -335,7 +335,6 @@ export default { experimentalRequirements: "", }, tableData: [], - id: this.$route.query.id, rules: { judgmentPointsName: [ { required: true, message: "判分点名称不能为空", trigger: "blur" }, @@ -345,6 +344,7 @@ export default { ], }, decisionPointRule: "", + id: this.$route.query.id, systemId: this.$route.query.systemId, userId: this.$route.query.userId, projectId: this.$route.query.projectId, diff --git a/src/views/ProgramOptions.vue b/src/views/ProgramOptions.vue index b27bb46..730405f 100644 --- a/src/views/ProgramOptions.vue +++ b/src/views/ProgramOptions.vue @@ -406,7 +406,7 @@ export default { }, components: {quill}, mounted() { - this.$route.query.token && this.$store.commit('setToken',this.$route.query.token) + this.$route.query.token && this.$store.commit('setParam',{token: atob(decodeURI(this.$route.query.token)),referrer: atob(decodeURI(this.$route.query.referrer))}) this.getData() }, methods: { diff --git a/vue.config.js b/vue.config.js index 4697131..5c5be6d 100644 --- a/vue.config.js +++ b/vue.config.js @@ -22,5 +22,8 @@ module.exports = { publicPath: './', outputDir: 'dist', - assetsDir: 'static' + assetsDir: 'static', + devServer: { + port: 8087 + } } \ No newline at end of file