mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-13 04:46:44 +08:00
Merge branch '20251121-fix-1298' of https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal into 20251121-fix-1298
This commit is contained in:
@@ -52,7 +52,12 @@ const formRequest=axios.create({
|
|||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
//Message({message: msg, type: 'error'});
|
//Message({message: msg, type: 'error'});
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = this.webBaseUrl + ReLoginUrl;
|
if (top !== window) { // 判断当前是否在iframe内
|
||||||
|
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
} else {
|
||||||
|
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
}
|
||||||
|
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
})
|
})
|
||||||
} else if (code === 403) {
|
} else if (code === 403) {
|
||||||
var msg = '当前操作没有权限';
|
var msg = '当前操作没有权限';
|
||||||
|
|||||||
@@ -54,7 +54,12 @@ const formRequest=axios.create({
|
|||||||
} else {
|
} else {
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = this.webBaseUrl + ReLoginUrl;
|
if (top !== window) { // 判断当前是否在iframe内
|
||||||
|
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
} else {
|
||||||
|
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
}
|
||||||
|
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
})
|
})
|
||||||
} else if (code === 403) {
|
} else if (code === 403) {
|
||||||
var msg = '当前操作没有权限';
|
var msg = '当前操作没有权限';
|
||||||
|
|||||||
@@ -53,7 +53,12 @@ jsonRequest.interceptors.response.use(res => {
|
|||||||
} else {
|
} else {
|
||||||
if (code == 6001) { //对方是字符串,所以这里不要使用三个等号
|
if (code == 6001) { //对方是字符串,所以这里不要使用三个等号
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = ReLoginUrl;
|
if (top !== window) { // 判断当前是否在iframe内
|
||||||
|
top.location.href = ReLoginUrl;
|
||||||
|
} else {
|
||||||
|
window.location.href = ReLoginUrl;
|
||||||
|
}
|
||||||
|
// location.href = ReLoginUrl;
|
||||||
})
|
})
|
||||||
} else if (code === 403) {
|
} else if (code === 403) {
|
||||||
var msg = '当前操作没有权限';
|
var msg = '当前操作没有权限';
|
||||||
@@ -117,7 +122,12 @@ formRequest.interceptors.response.use(res => {
|
|||||||
} else {
|
} else {
|
||||||
if (code == 6001) { //对方是字符串,所以这里不要使用三个等号
|
if (code == 6001) { //对方是字符串,所以这里不要使用三个等号
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = ReLoginUrl;
|
if (top !== window) { // 判断当前是否在iframe内
|
||||||
|
top.location.href = ReLoginUrl;
|
||||||
|
} else {
|
||||||
|
window.location.href = ReLoginUrl;
|
||||||
|
}
|
||||||
|
// location.href = ReLoginUrl;
|
||||||
})
|
})
|
||||||
} else if (code === 403) {
|
} else if (code === 403) {
|
||||||
var msg = '当前操作没有权限';
|
var msg = '当前操作没有权限';
|
||||||
|
|||||||
@@ -50,7 +50,12 @@ jsonRequest.interceptors.response.use(res => {
|
|||||||
} else {
|
} else {
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = this.webBaseUrl + ReLoginUrl;
|
if (top !== window) { // 判断当前是否在iframe内
|
||||||
|
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
} else {
|
||||||
|
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
}
|
||||||
|
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
})
|
})
|
||||||
} else if (code === 403) {
|
} else if (code === 403) {
|
||||||
var msg = '当前操作没有权限';
|
var msg = '当前操作没有权限';
|
||||||
@@ -112,7 +117,12 @@ formRequest.interceptors.response.use(res => {
|
|||||||
} else {
|
} else {
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = this.webBaseUrl + ReLoginUrl;
|
if (top !== window) { // 判断当前是否在iframe内
|
||||||
|
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
} else {
|
||||||
|
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
}
|
||||||
|
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
})
|
})
|
||||||
} else if (code === 403) {
|
} else if (code === 403) {
|
||||||
var msg = '当前操作没有权限';
|
var msg = '当前操作没有权限';
|
||||||
|
|||||||
@@ -50,7 +50,12 @@ jsonRequest.interceptors.response.use(res => {
|
|||||||
} else {
|
} else {
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = this.webBaseUrl + ReLoginUrl;
|
if (top !== window) { // 判断当前是否在iframe内
|
||||||
|
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
} else {
|
||||||
|
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
}
|
||||||
|
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
})
|
})
|
||||||
} else if (code === 403) {
|
} else if (code === 403) {
|
||||||
var msg = '当前操作没有权限';
|
var msg = '当前操作没有权限';
|
||||||
@@ -112,7 +117,12 @@ formRequest.interceptors.response.use(res => {
|
|||||||
} else {
|
} else {
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = this.webBaseUrl + ReLoginUrl;
|
if (top !== window) { // 判断当前是否在iframe内
|
||||||
|
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
} else {
|
||||||
|
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
|
}
|
||||||
|
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||||
})
|
})
|
||||||
} else if (code === 403) {
|
} else if (code === 403) {
|
||||||
var msg = '当前操作没有权限';
|
var msg = '当前操作没有权限';
|
||||||
|
|||||||
@@ -86,7 +86,12 @@ router.beforeEach((to, from, next) => {
|
|||||||
//console.log(location.href,'location.href');
|
//console.log(location.href,'location.href');
|
||||||
//let urlPre=window.location.protocol+'//'+window.location.host;
|
//let urlPre=window.location.protocol+'//'+window.location.host;
|
||||||
//let backUrl=location.href.substring(urlPre.length); encodeURIComponent()
|
//let backUrl=location.href.substring(urlPre.length); encodeURIComponent()
|
||||||
location.href=process.env.VUE_APP_LOGIN_URL+"?returnUrl="+encodeURIComponent(location.href);
|
if (top !== window) { // 判断当前是否在iframe内
|
||||||
|
top.location.href = process.env.VUE_APP_LOGIN_URL + "?returnUrl=" + encodeURIComponent(location.href);
|
||||||
|
} else {
|
||||||
|
window.location.href = process.env.VUE_APP_LOGIN_URL + "?returnUrl=" + encodeURIComponent(location.href);
|
||||||
|
}
|
||||||
|
// location.href=process.env.VUE_APP_LOGIN_URL+"?returnUrl="+encodeURIComponent(location.href);
|
||||||
NProgress.done()
|
NProgress.done()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Cookies from 'vue-cookies'
|
import Cookies from "vue-cookies";
|
||||||
import apiLogin from '@/api/login.js'
|
import apiLogin from "@/api/login.js";
|
||||||
import { getToken,setToken } from '@/utils/token'
|
import { getToken, setToken } from "@/utils/token";
|
||||||
export default {
|
export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.toUrl = this.$route.query.returnUrl;
|
this.toUrl = this.$route.query.returnUrl;
|
||||||
@@ -19,11 +19,16 @@
|
|||||||
$this.curToken = getToken();
|
$this.curToken = getToken();
|
||||||
if (!$this.curToken) {
|
if (!$this.curToken) {
|
||||||
//console.log(token,'第二次未获取token');
|
//console.log(token,'第二次未获取token');
|
||||||
location.href = process.env.VUE_APP_LOGIN_URL;
|
if (top !== window) {
|
||||||
|
// 判断当前是否在iframe内
|
||||||
|
top.location.href = process.env.VUE_APP_LOGIN_URL;
|
||||||
|
} else {
|
||||||
|
window.location.href = process.env.VUE_APP_LOGIN_URL;
|
||||||
|
}
|
||||||
|
// location.href = process.env.VUE_APP_LOGIN_URL;
|
||||||
} else {
|
} else {
|
||||||
$this.boeLogin();
|
$this.boeLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 500);
|
}, 500);
|
||||||
} else {
|
} else {
|
||||||
this.curToken = token;
|
this.curToken = token;
|
||||||
@@ -32,29 +37,29 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
curToken:'',
|
curToken: "",
|
||||||
toUrl:''
|
toUrl: "",
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
boeLogin() {
|
boeLogin() {
|
||||||
apiLogin.boeLogin(this.curToken).then(rs=>{
|
apiLogin.boeLogin(this.curToken).then((rs) => {
|
||||||
if (rs.status == 200) {
|
if (rs.status == 200) {
|
||||||
//setToken(rs.result.access_token);
|
//setToken(rs.result.access_token);
|
||||||
localStorage.setItem(this.$xpage.constants.newLoginKey, 1);
|
localStorage.setItem(this.$xpage.constants.newLoginKey, 1);
|
||||||
if (this.toUrl) {
|
if (this.toUrl) {
|
||||||
location.href = this.toUrl;
|
location.href = this.toUrl;
|
||||||
} else {
|
} else {
|
||||||
this.$router.push({ path: "/index" })
|
this.$router.push({ path: "/index" });
|
||||||
}
|
}
|
||||||
//this.$router.push({ path: "/index" })
|
//this.$router.push({ path: "/index" })
|
||||||
} else {
|
} else {
|
||||||
this.$message.error("登录失败:" + rs.message);
|
this.$message.error("登录失败:" + rs.message);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user