与中台链接,鉴权等

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 { export default {
token: '' token: '',
referrer: ''
} }

@ -2,7 +2,8 @@ export default {
sethtname(state, payload) { sethtname(state, payload) {
state.htname = payload.htname; state.htname = payload.htname;
}, },
setToken(state, token) { setParam(state, payload) {
state.token = token state.token = payload.token
state.referrer = payload.referrer
}, },
} }

@ -6,11 +6,11 @@ if(isKd){
}else{ }else{
// 职站中台接口切换 // 职站中台接口切换
if(location.host.includes('liuwanr.cn')){ if(location.host.includes('liuwanr.cn')){
host = 'http://www.liuwanr.cn' host = 'http://www.liuwanr.cn'// 职站测试服
}else if(location.host.includes('occupationlab.com')){ }else if(location.host.includes('occupationlab.com')){
host = 'http://www.occupationlab.com' host = 'http://www.occupationlab.com'// 职站正式服
}else{ }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请求 * get方法对应get请求
*/ */
@ -109,6 +120,11 @@ export function get(url, params){
params: params params: params
}) })
.then(res => { .then(res => {
if(typeof res.data == 'number'){
this.$message.error(tokenStatus[res.data])
setTimeout(logouts,1500)
return false
}
if (res.data.status) { if (res.data.status) {
switch (res.data.status) { switch (res.data.status) {
case 200: case 200:
@ -169,6 +185,11 @@ export function post(url, params) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.post(url,params) axios.post(url,params)
.then(res => { .then(res => {
if(typeof res.data == 'number'){
this.$message.error(tokenStatus[res.data])
setTimeout(logouts,1500)
return false
}
if (res.data.status) { if (res.data.status) {
switch (res.data.status) { switch (res.data.status) {
case 200: case 200:
@ -227,6 +248,11 @@ export function post(url, params) {
params: params params: params
}) })
.then(res => { .then(res => {
if(typeof res.data == 'number'){
this.$message.error(tokenStatus[res.data])
setTimeout(logouts,1500)
return false
}
if (res.data.status) { if (res.data.status) {
switch (res.data.status) { switch (res.data.status) {
case 200: case 200:
@ -289,6 +315,11 @@ export function put(url, params){
return new Promise((resolve, reject) =>{ return new Promise((resolve, reject) =>{
axios.put(url, params) axios.put(url, params)
.then(res => { .then(res => {
if(typeof res.data == 'number'){
this.$message.error(tokenStatus[res.data])
setTimeout(logouts,1500)
return false
}
if (res.data.status) { if (res.data.status) {
switch (res.data.status) { switch (res.data.status) {
case 200: case 200:

@ -90,10 +90,9 @@ export default {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
systemId: "", systemId: this.$route.query.systemId,
userId: "", userId: this.$route.query.userId,
systemName: "", systemName: this.$route.query.systemName,
host: location.host.includes('liuwanr.cn') ? 'http://www.liuwanr.cn' : 'http://www.occupationlab.com'
}; };
}, },
components: {quill}, components: {quill},
@ -106,6 +105,8 @@ export default {
}, },
}, },
mounted() { 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); this.handleCurrentChange(this.pageNo);
}, },
methods: { methods: {
@ -126,14 +127,9 @@ export default {
handleCurrentChange(val) { handleCurrentChange(val) {
this.$get(`${this.api.queryUserIds}`).then(res => { this.$get(`${this.api.queryUserIds}`).then(res => {
this.pageNo = val; 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, { this.$get(this.api.QueryPointOfJudgement, {
systemId: this.systemId, systemId: this.systemId,
userId: this.userId, userId: this.userId,
// systemId: 1,
pageNum: this.pageNo, pageNum: this.pageNo,
pageSize: this.pageSize, pageSize: this.pageSize,
queryName: this.keyword, queryName: this.keyword,
@ -172,7 +168,7 @@ export default {
// this.setCookie("judgmentPointsId", ""); // this.setCookie("judgmentPointsId", "");
// console.log(this.getCookie("judgmentPointsId")); // console.log(this.getCookie("judgmentPointsId"));
// this.$router.push({ path: "/program" }); // this.$router.push({ path: "/program" });
this.$router.push({ path: "/program" }); this.$router.push(`program?systemId=${this.systemId}&userId=${this.userId}`);
}, },
// //
headClass() { headClass() {
@ -237,10 +233,7 @@ export default {
}, },
// //
handleClick(res) { handleClick(res) {
this.$router.push({ this.$router.push(`program?judgmentPointsId=${res.judgmentPointsId}&systemId=${this.systemId}&userId=${this.userId}`)
path: "/program",
query: { judgmentPointsId: res.judgmentPointsId }
});
} }
} }
}; };

@ -84,7 +84,8 @@ export default {
pattern: this.$route.query.pattern, pattern: this.$route.query.pattern,
systemName: "", systemName: "",
searchTimer: null, 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}, components: {quill},
@ -97,7 +98,7 @@ export default {
}, },
}, },
mounted() { 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); this.handleCurrentChange(this.pageNo);
}, },
methods: { methods: {

@ -159,8 +159,8 @@ export default {
] ]
}, },
decisionPointRule: "", decisionPointRule: "",
systemId: "", systemId: this.$route.query.systemId,
userId: "", userId: this.$route.query.userId,
ruleIds: [], ruleIds: [],
jRP: "", jRP: "",
jRR: "", jRR: "",
@ -171,6 +171,7 @@ export default {
}, },
components: {quill,quill1}, components: {quill,quill1},
mounted () { 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(); this.getMesg();
}, },
@ -246,9 +247,6 @@ export default {
console.log(err); console.log(err);
}); });
} else { } else {
this.systemId = this.getCookie("systemId");
this.systemId = this.systemId ? this.systemId : 1
this.userId = this.getCookie("userId");
// //
this.$post(this.api.AddPfdInformation, { this.$post(this.api.AddPfdInformation, {
points: { points: {

@ -335,7 +335,6 @@ export default {
experimentalRequirements: "", experimentalRequirements: "",
}, },
tableData: [], tableData: [],
id: this.$route.query.id,
rules: { rules: {
judgmentPointsName: [ judgmentPointsName: [
{ required: true, message: "判分点名称不能为空", trigger: "blur" }, { required: true, message: "判分点名称不能为空", trigger: "blur" },
@ -345,6 +344,7 @@ export default {
], ],
}, },
decisionPointRule: "", decisionPointRule: "",
id: this.$route.query.id,
systemId: this.$route.query.systemId, systemId: this.$route.query.systemId,
userId: this.$route.query.userId, userId: this.$route.query.userId,
projectId: this.$route.query.projectId, projectId: this.$route.query.projectId,

@ -406,7 +406,7 @@ export default {
}, },
components: {quill}, components: {quill},
mounted() { 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() this.getData()
}, },
methods: { methods: {

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