This commit is contained in:
oneao committed 2025-10-08 19:41:13 +08:00
1 parent b03e2c1e69
commit 8770e4fddc
9 files changed
+217 -116

No files matched your search

@@ -13,8 +13,6 @@ dist-ssr
*.local *.local
# Editor directories and files # Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea .idea
.DS_Store .DS_Store
*.suo *.suo
@@ -0,0 +1,51 @@
{
"editor.cursorSmoothCaretAnimation": "on",
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,
// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true },
{ "rule": "*-spaces", "severity": "off", "fixable": true },
{ "rule": "*-order", "severity": "off", "fixable": true },
{ "rule": "*-dangle", "severity": "off", "fixable": true },
{ "rule": "*-newline", "severity": "off", "fixable": true },
{ "rule": "*quotes", "severity": "off", "fixable": true },
{ "rule": "*semi", "severity": "off", "fixable": true }
],
// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
]
}
@@ -8,7 +8,7 @@ onLaunch(() => {
console.log('App Launch') console.log('App Launch')
}) })
onShow(() => { onShow(() => {
userStore.requireLogin() // userStore.requireLogin()
console.log('App Show') console.log('App Show')
}) })
@@ -34,9 +34,9 @@ export const navigateToInterceptor = {
export const routeInterceptor = { export const routeInterceptor = {
install() { install() {
uni.addInterceptor('navigateTo', navigateToInterceptor) // uni.addInterceptor('navigateTo', navigateToInterceptor)
uni.addInterceptor('reLaunch', navigateToInterceptor) // uni.addInterceptor('reLaunch', navigateToInterceptor)
uni.addInterceptor('redirectTo', navigateToInterceptor) // uni.addInterceptor('redirectTo', navigateToInterceptor)
uni.addInterceptor('switchTab', navigateToInterceptor) // uni.addInterceptor('switchTab', navigateToInterceptor)
}, },
} }
@@ -34,35 +34,47 @@ function onSubmit() {
formRef.value formRef.value
?.validate() ?.validate()
.then(() => { .then(() => {
_loading.value = true userStore.userInfo.orgid = formModel.orgid
loginOrgApi({ userStore.userInfo.userid = formModel.userid
orgid: formModel.orgid, userStore.userInfo.token = '123'
userid: formModel.userid,
password: formModel.password,
}).then((res) => {
if (res.data) {
userStore.userInfo.orgid = formModel.orgid
userStore.userInfo.userid = formModel.userid
userStore.userInfo.token = res.data
uni.showToast({ uni.showToast({
title: '登录成功', title: '登录成功',
icon: 'success', icon: 'success',
})
uni.switchTab({
url: '/pages/home/index',
})
}
else {
uni.showToast({
title: '登录失败,请稍后再试',
icon: 'error',
})
}
}).finally(() => {
_loading.value = false
}) })
uni.switchTab({
url: '/pages/home/index',
})
// _loading.value = true
// loginOrgApi({
// orgid: formModel.orgid,
// userid: formModel.userid,
// password: formModel.password,
// }).then((res) => {
// if (res.data) {
// userStore.userInfo.orgid = formModel.orgid
// userStore.userInfo.userid = formModel.userid
// userStore.userInfo.token = res.data
// uni.showToast({
// title: '登录成功',
// icon: 'success',
// })
// uni.switchTab({
// url: '/pages/home/index',
// })
// }
// else {
// uni.showToast({
// title: '登录失败,请稍后再试',
// icon: 'error',
// })
// }
// }).finally(() => {
// _loading.value = false
// })
}) })
.catch((error: FieldValidateError[]) => { .catch((error: FieldValidateError[]) => {
toast.fail(error[0].message) toast.fail(error[0].message)
@@ -2,8 +2,8 @@
"globalStyle": { "globalStyle": {
"navigationStyle": "default", "navigationStyle": "default",
"navigationBarTitleText": "App", "navigationBarTitleText": "App",
"navigationBarBackgroundColor": "#fff", "navigationBarBackgroundColor": "#2c3e50",
"navigationBarTextStyle": "black", "navigationBarTextStyle": "white",
"backgroundColor": "#FFFFFF" "backgroundColor": "#FFFFFF"
}, },
"easycom": { "easycom": {
@@ -11,6 +11,10 @@ function handleLoginOut() {
onConfirm() { onConfirm() {
toast.success('退出成功') toast.success('退出成功')
userStore.reset() userStore.reset()
uni.navigateTo({
url: '/pages-sub/login/index',
})
}, },
}) })
} }
@@ -4,7 +4,7 @@
page, page,
.sar-portal { .sar-portal {
--sar-input-border-color: #ddd; --sar-input-border-color: #ddd;
--sar-primary: #0064fa; --sar-primary: #34495E;
--sar-rounded: 4rpx; --sar-rounded: 4rpx;
} }
+115 -79
View File
@@ -1,92 +1,128 @@
<!DOCTYPE html> <!doctype html>
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>个人中心</title> <title>个人中心</title>
<style> <style>
body { body {
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background: #f4f5f7; background: #f2f3f5;
color: #333; color: #2c3e50;
} }
.header { .profile-container {
background: linear-gradient(135deg, #2f3e46, #354f52); max-width: 420px;
color: white; margin: 20px auto;
padding: 20px; padding: 16px;
} }
.header h2 { /* 用户信息头部 */
margin: 0 0 6px; .profile-header {
font-size: 18px; display: flex;
font-weight: 600; align-items: center;
} background: #fff;
padding: 16px;
border: 1px solid #dfe4ea;
border-radius: 4px; /* 小圆角,偏工业 */
}
.header p { .avatar {
margin: 4px 0; width: 70px;
font-size: 14px; height: 70px;
color: #d9d9d9; background: #95a5a6;
} color: #fff;
font-size: 28px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 16px;
}
.list { .user-info {
margin: 16px; display: flex;
background: #fff; flex-direction: column;
border-radius: 10px; justify-content: center;
box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
overflow: hidden;
}
.list-item { .user-name {
display: flex; font-size: 18px;
justify-content: space-between; font-weight: 600;
align-items: center; margin-bottom: 6px;
padding: 14px 16px; color: #2c3e50;
font-size: 15px; }
border-bottom: 1px solid #eee;
cursor: pointer;
}
.list-item:last-child { .status {
border-bottom: none; display: flex;
} align-items: center;
font-size: 14px;
color: #2c3e50;
}
.list-item span { .status-dot {
color: #666; width: 8px;
} height: 8px;
border-radius: 50%;
margin-right: 6px;
background-color: #27ae60; /* 在线:绿色 */
}
.list-item.danger { /* 下方信息块 */
color: #d9534f; .info-list {
font-weight: 500; margin-top: 20px;
} background: #fff;
border: 1px solid #dfe4ea;
border-radius: 4px;
}
.footer { .info-item {
text-align: center; display: flex;
padding: 12px; justify-content: space-between;
font-size: 12px; padding: 14px 16px;
color: #aaa; font-size: 15px;
} border-bottom: 1px solid #e0e0e0;
</style> }
</head>
<body>
<div class="header">
<h2>个人中心</h2>
<p>机构码:123456</p>
<p>账户:zhangsan</p>
</div>
<div class="list"> .info-item:last-child {
<div class="list-item"> border-bottom: none;
<span>修改密码</span> }
.info-label {
color: #7f8c8d;
}
.info-value {
font-weight: 500;
color: #2c3e50;
}
</style>
</head>
<body>
<div class="profile-container">
<!-- 顶部用户信息 -->
<div class="profile-header">
<div class="avatar">U</div>
<div class="user-info">
<div class="user-name">张三</div>
<div class="status">
<div class="status-dot"></div>
在线
</div>
</div>
</div>
<!-- 下方账号和机构码 -->
<div class="info-list">
<div class="info-item">
<span class="info-label">账号</span>
<span class="info-value">zhangsan</span>
</div>
<div class="info-item">
<span class="info-label">机构码</span>
<span class="info-value">123456</span>
</div>
</div>
</div> </div>
<div class="list-item danger"> </body>
<span>退出登录</span>
</div>
</div>
<div class="footer">
© 2025 MyApp
</div>
</body>
</html> </html>