chroe: add demo mode

This commit is contained in:
engigu
2024-01-23 23:07:21 +08:00
parent 7040031253
commit 3e1e2dd7f8
7 changed files with 110 additions and 1 deletions
+9
View File
@@ -48,12 +48,21 @@ export default {
});
onMounted(() => {
demoSiteSet();
// 加载站点信息
setTimeout(() => {
LocalStieConfigUtils.getLatestLocalConfig();
}, 100)
});
// 站点演示模式
const demoSiteSet = () => {
if (import.meta.env.VITE_RUN_MODE === 'demo') {
state.account = 'admin';
state.passwd = '123456';
}
}
// 登录
const clickLogin = async () => {
const rspe = await request.post('/auth', { username: state.account, passwd: state.passwd });
@@ -28,11 +28,16 @@ export default defineComponent({
});
const handleChange = async () => {
if (import.meta.env.VITE_RUN_MODE === 'demo') {
ElMessage({ message: '演示模式不会重置密码', type: 'success' });
return
}
let postData = { old_passwd: state.oldPasswd, new_passwd: state.newPasswd };
const rsp = await request.post('/settings/setpasswd', postData);
if (await rsp.data.code == 200) {
let msg = await rsp.data.msg;
ElMessage({ message: msg, type: 'success' })
ElMessage({ message: msg, type: 'success' });
}
}
return {