123
parent
2b38ec4a7a
commit
82f524b3b6
Binary file not shown.
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 9.8 KiB |
|
@ -17,14 +17,15 @@ axios.defaults.headers = getNeedToken();
|
|||
|
||||
|
||||
function getNeedToken() {
|
||||
console.log(333, localGet("token"));
|
||||
const ret_token = localGet("token");
|
||||
if (ret_token) {
|
||||
if (ret_token && ret_token.timestamp) {
|
||||
ret_token.timestamp = new Date().getTime();
|
||||
const tokenInfo = token.encode(ret_token).finish();
|
||||
// 直接转换为string丢到header里,header的key为"cdcm"
|
||||
const cdcm = tokenInfo.slice(0, tokenInfo.length).toString()
|
||||
return { cdcm };
|
||||
} else {
|
||||
localRemove("token");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="middle-bottom"></div>
|
||||
<div class="right-bottom">
|
||||
<div class="title">数据控制器</div>
|
||||
<div class="s-title">登录LOGIN</div>
|
||||
<!-- <div class="s-title">登录LOGIN</div> -->
|
||||
<el-form label-position="top" :rules="rules" :model="ruleForm" ref="loginForm" class="login-form" size="large">
|
||||
<el-form-item prop="username">
|
||||
<el-input type="text" v-model.trim="ruleForm.username" autocomplete="off" placeholder="请输入账号">
|
||||
|
@ -37,13 +37,15 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { reactive, ref, toRefs } from "vue";
|
||||
import { reactive, ref, toRefs, onMounted } from "vue";
|
||||
import { localSet, localGet } from "@/utils";
|
||||
import myApi from "@/api/myApi.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { user, token, response } from '../proto/data/pd'
|
||||
import axios from "axios";
|
||||
import md5 from 'js-md5'
|
||||
import { localRemove, pathMap } from "@/utils";
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
setup() {
|
||||
|
@ -63,6 +65,9 @@ export default {
|
|||
],
|
||||
},
|
||||
});
|
||||
onMounted(() => {
|
||||
localRemove("token");
|
||||
});
|
||||
const submitForm = async () => {
|
||||
loginForm.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
|
|
Loading…
Reference in New Issue