This commit is contained in:
parent
fb48f88069
commit
61694fc119
|
@ -1,4 +1,4 @@
|
|||
VITE_NOW_TYPE = 'dist'
|
||||
|
||||
# VITE_BASE_URL = 'http://192.168.1.7:8324'
|
||||
VITE_BASE_URL = 'https://crmeb-test.shop.lihaink.cn'
|
||||
VITE_BASE_URL = 'http://192.168.1.10:8546'
|
||||
# VITE_BASE_URL = 'https://erp.lihaink.cn'
|
|
@ -10,7 +10,7 @@ export function captchaApi() {
|
|||
* @description 登录
|
||||
*/
|
||||
export function login(data) {
|
||||
return request.post(`auth/login`, data)
|
||||
return request.post(`/login/account`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,15 +8,7 @@ import { useRouter } from 'vue-router'
|
|||
const userStore = useUserStore();
|
||||
|
||||
const merInfo = ref({});
|
||||
merInfo.value = userStore.userInfo.mer_info;
|
||||
const service = ref({});
|
||||
service.value = userStore.userInfo.service;
|
||||
|
||||
const getInfo = () => {
|
||||
info().then((res) => {
|
||||
merInfo.value = res.data;
|
||||
});
|
||||
};
|
||||
merInfo.value = userStore.userInfo;
|
||||
|
||||
const router = useRouter();
|
||||
const onLogout = () => {
|
||||
|
@ -32,7 +24,6 @@ const onLogout = () => {
|
|||
});
|
||||
}
|
||||
|
||||
// getInfo();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -48,13 +39,12 @@ const onLogout = () => {
|
|||
<div class="card-body">
|
||||
<el-dropdown trigger="hover">
|
||||
<div class="el-dropdown-link">
|
||||
<el-avatar :src="service.avatar" icon="user-filled"/>
|
||||
<el-avatar :src="merInfo.avatar" icon="user-filled"/>
|
||||
<div class="info">
|
||||
<div>
|
||||
{{ service.nickname }}
|
||||
<span style="margin-left: 0.3rem;">({{ merInfo.company_name || merInfo.mer_name }})</span>
|
||||
{{ merInfo.nickname }}
|
||||
</div>
|
||||
<div>{{ userStore.userInfo.account }}</div>
|
||||
<div>{{ merInfo.account }}</div>
|
||||
</div>
|
||||
<el-icon class="el-icon--right">
|
||||
<arrow-down />
|
||||
|
|
|
@ -16,7 +16,7 @@ request.interceptors.request.use(
|
|||
// 在发送请求之前做些什么,例如添加token、修改请求头等
|
||||
const token = localStorage.getItem('Token');
|
||||
if (token) {
|
||||
config.headers['X-Token'] = 'Bearer ' + token;
|
||||
config.headers['token'] = token;
|
||||
}
|
||||
|
||||
return config;
|
||||
|
|
|
@ -12,26 +12,12 @@ const accRef = ref(null);
|
|||
const pwdRef = ref(null);
|
||||
|
||||
const formLogin = ref({
|
||||
account: "",
|
||||
password: "",
|
||||
key: "",
|
||||
captchaVerification: "",
|
||||
code: "",
|
||||
account: "xiao123",
|
||||
password: "123456",
|
||||
terminal: 3,
|
||||
scene: 1,
|
||||
});
|
||||
|
||||
const getCaptchaApi = () => {
|
||||
captchaApi()
|
||||
.then((res) => {
|
||||
formLogin.value.key = res.data.key;
|
||||
})
|
||||
.catch((err) => {
|
||||
ElMessage({
|
||||
message: err.message,
|
||||
type: "error",
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const onLogin = () => {
|
||||
if (!formLogin.value.account)
|
||||
return ElMessage({
|
||||
|
@ -46,27 +32,16 @@ const onLogin = () => {
|
|||
login(formLogin.value)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
if(res.data){
|
||||
if (res.data?.token) {
|
||||
userStore.setToken(res.data.token);
|
||||
info().then(({data}) => {
|
||||
if(!data.service){
|
||||
return ElMessage({
|
||||
message: "请联系管理员开通服务",
|
||||
type: "error",
|
||||
})
|
||||
}
|
||||
userStore.setUserInfo(data);
|
||||
router.push("/");
|
||||
});
|
||||
userStore.setUserInfo(res.data);
|
||||
router.push("/");
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
});
|
||||
.catch((err) => {});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// getCaptchaApi();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -76,7 +51,13 @@ onMounted(() => {
|
|||
<div class="title">里海收银系统 - 登录</div>
|
||||
<el-form>
|
||||
<el-form-item>
|
||||
<el-input ref="accRef" v-model="formLogin.account" placeholder="请输入账号" :autofocus="true" @keydown.enter="pwdRef.focus()">
|
||||
<el-input
|
||||
ref="accRef"
|
||||
v-model="formLogin.account"
|
||||
placeholder="请输入账号"
|
||||
:autofocus="true"
|
||||
@keydown.enter="pwdRef.focus()"
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon><User /></el-icon>
|
||||
</template>
|
||||
|
|
|
@ -9,7 +9,7 @@ export default ({ mode }) => defineConfig({
|
|||
outDir: loadEnv(mode, process.cwd()).VITE_NOW_TYPE
|
||||
},
|
||||
server: {
|
||||
port: '5175',
|
||||
port: '5178',
|
||||
host: '0.0.0.0',
|
||||
},
|
||||
resolve: {
|
||||
|
|
Loading…
Reference in New Issue