|
@@ -189,8 +189,8 @@ export default {
|
|
|
this.$message.error(this.errorMessage)
|
|
|
// 如果授权失败,跳转到登录页面
|
|
|
// setTimeout( async () => {
|
|
|
- await this.getLogin();
|
|
|
- setTimeout( async () => {
|
|
|
+ await this.getLogin()
|
|
|
+ setTimeout(async () => {
|
|
|
this.$router.replace('/login2')
|
|
|
}, 2000)
|
|
|
}
|
|
@@ -264,7 +264,7 @@ export default {
|
|
|
},
|
|
|
async getLogin() {
|
|
|
this.loading = true
|
|
|
- try{
|
|
|
+ try {
|
|
|
const userid = await this.login()
|
|
|
let redirect_uri = Cookies.get('redirectUri')
|
|
|
if (!redirect_uri || redirect_uri === 'undefined') {
|
|
@@ -272,15 +272,40 @@ export default {
|
|
|
}
|
|
|
this.Loading = false
|
|
|
console.log(redirect_uri)
|
|
|
+ const courseId = this.$store.getters.courseId
|
|
|
+ const testId = this.$store.getters.testId
|
|
|
+ const shareCourseId = this.$store.getters.shareCourseId
|
|
|
+ this.$store.commit('SET_TESTID', '')
|
|
|
+ this.$store.commit('SET_COURSEID', '')
|
|
|
+ this.$store.commit('SET_SHARECOURSEID', '')
|
|
|
+
|
|
|
if (userid) {
|
|
|
if (redirect_uri) {
|
|
|
// Cookies.remove('redirectUri')
|
|
|
window.location.href = redirect_uri
|
|
|
+ } else if (courseId) {
|
|
|
+ this.$router.replace({
|
|
|
+ path: '/courseDetail',
|
|
|
+ query: { courseid: courseId, userid: userid },
|
|
|
+ replace: true
|
|
|
+ })
|
|
|
+ } else if (testId) {
|
|
|
+ this.$router.replace({
|
|
|
+ path: '/testDetail',
|
|
|
+ query: { courseid: testId, userid: userid },
|
|
|
+ replace: true
|
|
|
+ })
|
|
|
+ } else if (shareCourseId) {
|
|
|
+ this.$router.replace({
|
|
|
+ path: '/courseDetail',
|
|
|
+ query: { courseid: shareCourseId, urlType: 1, userid: userid },
|
|
|
+ replace: true
|
|
|
+ })
|
|
|
} else {
|
|
|
this.$router.replace('/appStoreCopy')
|
|
|
}
|
|
|
}
|
|
|
- }catch(e){
|
|
|
+ } catch (e) {
|
|
|
console.log(e)
|
|
|
}
|
|
|
// eduGet().then(res => {})
|
|
@@ -295,10 +320,10 @@ export default {
|
|
|
Cookies.set('isWeChat', '1')
|
|
|
this.$router.replace('/login2')
|
|
|
return
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
Cookies.set('isWeChat', '2')
|
|
|
}
|
|
|
- await this.getLogin();
|
|
|
+ await this.getLogin()
|
|
|
|
|
|
// 如果有code参数,说明是从微信授权回调过来的
|
|
|
if (this.code) {
|