rt-sim-training-client/src/views/authorization/index.vue

54 lines
1.5 KiB
Vue
Raw Normal View History

2020-10-16 19:06:24 +08:00
<template>
2021-04-21 17:19:25 +08:00
<div class="authorization">
<el-input v-model="license" type="textarea" rows="5" placeholder="请输入授权码" style="width: 300px; margin-bottom: 30px;" />
<el-button @click="verifyLicense">授权确认</el-button>
2020-10-16 19:06:24 +08:00
</div>
</template>
<script>
import { postLicenseValidate, postLicenseLocal } from '@/api/pushMessage';
export default {
2021-04-21 17:19:25 +08:00
name: 'Authorization',
2020-10-16 19:06:24 +08:00
data() {
return {
license: ''
};
},
methods: {
async verifyLicense() {
try {
const params = {
secretKey: 'joylink',
license: this.license
};
const res = await postLicenseValidate(params);
if (res.code == 200 && res.data) {
const resLocal = await postLicenseLocal(params);
if (resLocal.code == 200) {
this.$router.push({ path: `/login` });
} else {
this.$messageBox('license无效');
}
} else {
this.$messageBox('license无效');
}
} catch (error) {
console.log(error);
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
2021-04-21 17:19:25 +08:00
.authorization{
2020-10-16 19:06:24 +08:00
width: 100%;
position: absolute;
top: 30%;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
}
</style>