|
@@ -87,6 +87,8 @@
|
|
|
import { setToken,returnJSEncrypt } from '@/utils/auth';
|
|
|
import pastDue from '@/components/pastDue.vue';
|
|
|
import axios from 'axios';
|
|
|
+import {getAdminTokenId} from '@/course/api'
|
|
|
+import { setCourseToken, setCourseId, _debounce } from "@/utils/auth";
|
|
|
import qs from 'qs';
|
|
|
import { validateTel,validatePassword } from '@/utils/validate';
|
|
|
export default {
|
|
@@ -230,8 +232,22 @@ export default {
|
|
|
this.loading = false
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- wxLogin(type) {
|
|
|
+ courseWxLogin(token){
|
|
|
+ getAdminTokenId(token).then(res=>{
|
|
|
+ setCourseToken(res.auToken);
|
|
|
+ setCourseId(res.adminUserId);
|
|
|
+ localStorage.setItem("Course-Token", res.auToken);
|
|
|
+ localStorage.setItem("Course-Id", res.adminUserId);
|
|
|
+ this.$message({
|
|
|
+ message: "登陆成功!",
|
|
|
+ type: "success",
|
|
|
+ showClose: true,
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ this.$router.push("/course");
|
|
|
+ })
|
|
|
+ },
|
|
|
+ wxLogin() {
|
|
|
axios({
|
|
|
method: 'get',
|
|
|
url: 'https://oa.g107.com/api/pro/wo/oui',
|
|
@@ -241,7 +257,7 @@ export default {
|
|
|
'A-TOKEN': this.$route.query.secret
|
|
|
}
|
|
|
}).then(res => {
|
|
|
- if (res.data.code == 1&&type==1) {
|
|
|
+ if (res.data.code == 1) {
|
|
|
let data=res.data.data
|
|
|
this.account_site = data.account_site;
|
|
|
this.wo_token=data.wo_token
|
|
@@ -254,19 +270,6 @@ export default {
|
|
|
//等待用户输入手机号验证
|
|
|
// this.isShowSelect = true;
|
|
|
}
|
|
|
- }else if (res.data.code == 1&&type==2) {
|
|
|
- let data=res.data.data
|
|
|
- this.account_site = data.account_site;
|
|
|
- this.course_wo_token=data.wo_token
|
|
|
- this.$setCache('course_account', data.account);
|
|
|
- if (data.account_id !== 0) {
|
|
|
- this.$setCache('courseAccountToken',data.wo_token);
|
|
|
- // 已绑定平台账号
|
|
|
- // this.openUrl(this.account_site);
|
|
|
- } else {
|
|
|
- //等待用户输入手机号验证
|
|
|
- // this.isShowSelect = true;
|
|
|
- }
|
|
|
} else {
|
|
|
this.$message.error(res.data.msg);
|
|
|
}
|
|
@@ -293,10 +296,10 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
- if (this.$route.query.secret&&this.$route.query.ct !== 1) {
|
|
|
- this.wxLogin(1);
|
|
|
+ if (this.$route.query.secret&&this.$route.query.ct != 1) {
|
|
|
+ this.wxLogin();
|
|
|
}else{
|
|
|
- this.wxLogin(2);
|
|
|
+ this.courseWxLogin(this.$route.query.secret);
|
|
|
}
|
|
|
}
|
|
|
};
|