|
|
|
@ -3,8 +3,9 @@
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
// import { isLogin, setToken, removelogin } from '@/utils/auth';
|
|
|
|
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
|
|
|
// import { getUrl } from '@/api/getway'
|
|
|
|
|
// import { login } from '@/api/user'
|
|
|
|
|
import { loginWithCode } from '@/api/modular/system/loginManage'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
@ -21,34 +22,28 @@ export default {
|
|
|
|
|
methods: {
|
|
|
|
|
webset() {
|
|
|
|
|
console.log(111)
|
|
|
|
|
// const code = this.$route.query.code;
|
|
|
|
|
// const webid = this.$route.query.webid;
|
|
|
|
|
|
|
|
|
|
// if (!webid) {
|
|
|
|
|
// this.msg = '参数webid丢失';
|
|
|
|
|
// this.$message({ message: '参数webid丢失' });
|
|
|
|
|
// } else {
|
|
|
|
|
// if (isLogin()) { // 已经登录状态
|
|
|
|
|
// this.urlgo(webid)
|
|
|
|
|
// } else {
|
|
|
|
|
// if (code) {
|
|
|
|
|
// login({ code: code }).then(res => {
|
|
|
|
|
// setToken(res.data.token);
|
|
|
|
|
|
|
|
|
|
// setTimeout(() => {
|
|
|
|
|
// this.urlgo(webid);
|
|
|
|
|
// }, 100);
|
|
|
|
|
// })
|
|
|
|
|
// } else {
|
|
|
|
|
// this.msg = '授权登录失败,缺少code!';
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
const code = this.$route.query.code;
|
|
|
|
|
const webid = this.$route.query.webid;
|
|
|
|
|
if (!webid) {
|
|
|
|
|
this.msg = '参数webid丢失';
|
|
|
|
|
this.$message({ message: '参数webid丢失' });
|
|
|
|
|
} else {
|
|
|
|
|
if (localStorage.getItem(ACCESS_TOKEN)) { // 已经登录状态
|
|
|
|
|
this.urlgo(webid)
|
|
|
|
|
} else {
|
|
|
|
|
if (code) {
|
|
|
|
|
loginWithCode({ code: code }).then(res => {
|
|
|
|
|
this.$ls.set(ACCESS_TOKEN, res.data, 7 * 24 * 60 * 60 * 1000)
|
|
|
|
|
this.$store.commit('SET_TOKEN', res.data)
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.msg = '授权登录失败,缺少code!';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
urlgo(webid) {
|
|
|
|
|
// getUrl(webid).then(res => {
|
|
|
|
|
// this.$router.push(res.data);
|
|
|
|
|
// });
|
|
|
|
|
this.$router.push(webid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|