master
parent
4ee5ee68d2
commit
79b898afc8
File diff suppressed because it is too large
Load Diff
16
src/main.js
16
src/main.js
|
@ -2,14 +2,22 @@ import { createApp } from 'vue'
|
|||
import App from './App.vue'
|
||||
|
||||
import router from "./router/router.js"
|
||||
// import ElementUI from 'element-ui';
|
||||
// import 'element-ui/lib/theme-chalk/index.css';
|
||||
|
||||
import ElementPlus from 'element-plus';
|
||||
|
||||
import 'element-plus/dist/index.css'
|
||||
import axios from 'axios'
|
||||
import VueAxios from 'vue-axios'
|
||||
axios.defaults.baseURL='https://a99zg89a.xiaomy.net'
|
||||
|
||||
axios.interceptors.request.use(config => {
|
||||
|
||||
config.headers.Authorization = "Basic c2FiZXI6c2FiZXJfc2VjcmV0"
|
||||
|
||||
return config
|
||||
})
|
||||
let app=createApp(App)
|
||||
app.use(router)
|
||||
// app.use(ElementUI);
|
||||
app.use(ElementPlus);
|
||||
app.use(VueAxios,axios)
|
||||
|
||||
app.mount('#app')
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
<div class="input">
|
||||
<div>
|
||||
<label for="name"><img src="../assets/name.png" alt="" /></label>
|
||||
<input type="text" id="name" placeholder="请输入用户名" />
|
||||
<input type="text" v-model="username" id="name" placeholder="请输入用户名" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="pwd"><img src="../assets/pwd.png" alt="" /></label>
|
||||
<input id="pwd" type="password" placeholder="请输入密码" />
|
||||
<input id="pwd" type="password" v-model="password" placeholder="请输入密码" />
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn" @click="login()" type="button">登录</button>
|
||||
|
@ -30,29 +30,34 @@ export default {
|
|||
msg: String,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
return {
|
||||
username:"",
|
||||
password:""
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
login() {
|
||||
let param = new URLSearchParams();
|
||||
param.append("account", "admin");
|
||||
param.append("password", "admin");
|
||||
|
||||
param.append("account", this.username);
|
||||
param.append("password", this.password);
|
||||
let that = this;
|
||||
this.axios
|
||||
.post("/hysc/auth/token", param, {
|
||||
headers: {
|
||||
Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
|
||||
|
||||
},
|
||||
})
|
||||
.post("/hysc/auth/token", param)
|
||||
.then(function (response) {
|
||||
console.log(response);
|
||||
console.log(response.data.code,"登录");
|
||||
if (response.data.code == 200) {
|
||||
that.$router.push("/index");
|
||||
}else{
|
||||
that.$alert(response.data.msg,"登录失败", {
|
||||
confirmButtonText: "确定",
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
// this.$router.push("/index");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue