页面美化修改

This commit is contained in:
Strange 2024-05-13 23:44:22 +08:00
parent d42bb76129
commit 56a86e74b3
4 changed files with 19 additions and 11 deletions

View File

@ -6,6 +6,8 @@ import { Message } from 'element-ui';
import router from '@/router';
let path = ''
export const baseURL = "http://127.0.0.1:8080"
// export const baseURL = "https://9miao.fun:6838/prod-api/api/"
const server = axios.create({
// 设置端口前缀
// baseURL: 'https://9miao.fun:6838/prod-api/api/',
@ -82,11 +84,16 @@ export function postData(url, method, data) {
// 封装get
export function getData(url, method, data) {
return new Promise(resolve => {
console.log(localStorage.getItem('token'))
// 调用自定义的axios
server({
method,
url,
params: data
params: data,
headers: {
"Content-Type": "application/json",
"saToken" : localStorage.getItem('token')
}
})
.then(res => {
resolve(res,"resHttps");

View File

@ -110,7 +110,7 @@ export default {
this.$router.push({ path: "/desc", query: { id: id } });
},
searchUser() {
apiServe.Cllist(this.cdata).then((res) => {
apiServe.Cllist().then((res) => {
console.log(res, "resVueIndex");
this.list = res.data.data;
});

View File

@ -33,7 +33,6 @@ export default {
},
mounted() {
this.cdata.token = localStorage.getItem("token");
let token = localStorage.getItem("token");
console.log(token);
if (!token) {
@ -61,7 +60,7 @@ export default {
methods: {
searchUser() {
apiServe.shoplist(this.cdata).then((res) => {
apiServe.shoplist().then((res) => {
console.log(res);
this.list = res.data.data;
});

View File

@ -73,21 +73,23 @@ export default {
password: this.ruleForm.passWord,
}
let res = await apiServe.login(data);
console.log(res,"LoginRes")
if (res.data.code == 200) {
console.log(res.data)
if (res.data.token) {
console.log(res,"res");
localStorage.setItem('token', res?.data?.token?.data);
localStorage.setItem('token', res.data.token.data);
this.$message({
message: '登陆成功',
type: 'success'
})
this.$router.push('/')
}
}else{
this.$message({
message: res.msg,
message: res.data.msg,
type: 'error'
})
}
} else {
console.log('表单验证失败');
}
})