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
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.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')
})
onShow(() => {
userStore.requireLogin()
// userStore.requireLogin()
console.log('App Show')
})
@@ -34,9 +34,9 @@ export const navigateToInterceptor = {
export const routeInterceptor = {
install() {
uni.addInterceptor('navigateTo', navigateToInterceptor)
uni.addInterceptor('reLaunch', navigateToInterceptor)
uni.addInterceptor('redirectTo', navigateToInterceptor)
uni.addInterceptor('switchTab', navigateToInterceptor)
// uni.addInterceptor('navigateTo', navigateToInterceptor)
// uni.addInterceptor('reLaunch', navigateToInterceptor)
// uni.addInterceptor('redirectTo', navigateToInterceptor)
// uni.addInterceptor('switchTab', navigateToInterceptor)
},
}
@@ -34,35 +34,47 @@ function onSubmit() {
formRef.value
?.validate()
.then(() => {
_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
userStore.userInfo.orgid = formModel.orgid
userStore.userInfo.userid = formModel.userid
userStore.userInfo.token = '123'
uni.showToast({
title: '登录成功',
icon: 'success',
})
uni.switchTab({
url: '/pages/home/index',
})
}
else {
uni.showToast({
title: '登录失败,请稍后再试',
icon: 'error',
})
}
}).finally(() => {
_loading.value = false
uni.showToast({
title: '登录成功',
icon: 'success',
})
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[]) => {
toast.fail(error[0].message)
@@ -2,8 +2,8 @@
"globalStyle": {
"navigationStyle": "default",
"navigationBarTitleText": "App",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#2c3e50",
"navigationBarTextStyle": "white",
"backgroundColor": "#FFFFFF"
},
"easycom": {
@@ -11,6 +11,10 @@ function handleLoginOut() {
onConfirm() {
toast.success('退出成功')
userStore.reset()
uni.navigateTo({
url: '/pages-sub/login/index',
})
},
})
}
@@ -4,7 +4,7 @@
page,
.sar-portal {
--sar-input-border-color: #ddd;
--sar-primary: #0064fa;
--sar-primary: #34495E;
--sar-rounded: 4rpx;
}
+115 -79
View File
@@ -1,92 +1,128 @@
<!DOCTYPE html>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>个人中心</title>
<style>
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: #f4f5f7;
color: #333;
}
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>个人中心</title>
<style>
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background: #f2f3f5;
color: #2c3e50;
}
.header {
background: linear-gradient(135deg, #2f3e46, #354f52);
color: white;
padding: 20px;
}
.profile-container {
max-width: 420px;
margin: 20px auto;
padding: 16px;
}
.header h2 {
margin: 0 0 6px;
font-size: 18px;
font-weight: 600;
}
/* 用户信息头部 */
.profile-header {
display: flex;
align-items: center;
background: #fff;
padding: 16px;
border: 1px solid #dfe4ea;
border-radius: 4px; /* 小圆角,偏工业 */
}
.header p {
margin: 4px 0;
font-size: 14px;
color: #d9d9d9;
}
.avatar {
width: 70px;
height: 70px;
background: #95a5a6;
color: #fff;
font-size: 28px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 16px;
}
.list {
margin: 16px;
background: #fff;
border-radius: 10px;
box-shadow: 0 2px 6px rgba(0,0,0,0.05);
overflow: hidden;
}
.user-info {
display: flex;
flex-direction: column;
justify-content: center;
}
.list-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 14px 16px;
font-size: 15px;
border-bottom: 1px solid #eee;
cursor: pointer;
}
.user-name {
font-size: 18px;
font-weight: 600;
margin-bottom: 6px;
color: #2c3e50;
}
.list-item:last-child {
border-bottom: none;
}
.status {
display: flex;
align-items: center;
font-size: 14px;
color: #2c3e50;
}
.list-item span {
color: #666;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 6px;
background-color: #27ae60; /* 在线:绿色 */
}
.list-item.danger {
color: #d9534f;
font-weight: 500;
}
/* 下方信息块 */
.info-list {
margin-top: 20px;
background: #fff;
border: 1px solid #dfe4ea;
border-radius: 4px;
}
.footer {
text-align: center;
padding: 12px;
font-size: 12px;
color: #aaa;
}
</style>
</head>
<body>
<div class="header">
<h2>个人中心</h2>
<p>机构码:123456</p>
<p>账户:zhangsan</p>
</div>
.info-item {
display: flex;
justify-content: space-between;
padding: 14px 16px;
font-size: 15px;
border-bottom: 1px solid #e0e0e0;
}
<div class="list">
<div class="list-item">
<span>修改密码</span>
.info-item:last-child {
border-bottom: none;
}
.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 class="list-item danger">
<span>退出登录</span>
</div>
</div>
<div class="footer">
© 2025 MyApp
</div>
</body>
</body>
</html>