页面美化修改

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

View File

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

View File

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

View File

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