更新代码

master
sunzehua 2 years ago
parent 79f2037c6d
commit 07ba08bbd2

@ -26,7 +26,7 @@ export function login (parameter) {
* @author 蛋蛋
* @date 2022/4/13 22:06
*/
export function simulationTenantLogin(parameter){
export function simulationTenantLogin(parameter) {
return axios({
url: '/simulationTenantLogin',
method: 'post',
@ -117,3 +117,17 @@ export function reqCheck(data) {
data
})
}
/**
* 跨平台解码登陆
*
* @author yubaoshan
* @date 2020/6/23 23:09
*/
export function loginWithCode (parameter) {
return axios({
url: '/loginWithCode',
method: 'post',
params: parameter
})
}

@ -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);
}
}
};

Loading…
Cancel
Save