与中台链接,鉴权等

master
yujialong 4 years ago
parent dd696fd2e2
commit eebdd7c4db
  1. 3
      src/store/State.js
  2. 5
      src/store/mutations.js
  3. 6
      src/utils/api.js
  4. 31
      src/utils/http.js
  5. 21
      src/views/Home.vue
  6. 5
      src/views/List.vue
  7. 8
      src/views/Program.vue
  8. 2
      src/views/ProgramOption.vue
  9. 2
      src/views/ProgramOptions.vue
  10. 5
      vue.config.js

@ -1,3 +1,4 @@
export default {
token: ''
token: '',
referrer: ''
}

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

@ -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'// 中台
}
}

@ -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:

@ -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}`)
}
}
};

@ -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: {

@ -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: {

@ -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,

@ -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: {

@ -22,5 +22,8 @@ module.exports = {
publicPath: './',
outputDir: 'dist',
assetsDir: 'static'
assetsDir: 'static',
devServer: {
port: 8087
}
}
Loading…
Cancel
Save