增加uniapp
This commit is contained in:
@@ -132,7 +132,7 @@ func (c *BackendAuthController) GetCurrentUser() {
|
|||||||
c.serveJSON(map[string]interface{}{"code": 401, "msg": "无效的token"})
|
c.serveJSON(map[string]interface{}{"code": 401, "msg": "无效的token"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if claims.UserType != "backend" {
|
if claims.UserType != "backend" && claims.UserType != "app" {
|
||||||
c.serveJSON(map[string]interface{}{"code": 403, "msg": "无权访问"})
|
c.serveJSON(map[string]interface{}{"code": 403, "msg": "无权访问"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"server/controllers"
|
||||||
|
|
||||||
|
beego "github.com/beego/beego/v2/server/web"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Register 注册移动端(app)路由。
|
||||||
|
func Register() {
|
||||||
|
// 登录相关(复用 BackendAuthController)
|
||||||
|
beego.Router("/app/login", &controllers.BackendAuthController{}, "post:LoginBackend")
|
||||||
|
beego.Router("/app/sendLoginCode", &controllers.BackendAuthController{}, "post:SendLoginCode")
|
||||||
|
beego.Router("/app/loginBySms", &controllers.BackendAuthController{}, "post:LoginBySms")
|
||||||
|
beego.Router("/app/logout", &controllers.BackendAuthController{}, "post:Logout")
|
||||||
|
|
||||||
|
// 当前用户信息
|
||||||
|
beego.Router("/app/currentUser", &controllers.BackendAuthController{}, "get:GetCurrentUser")
|
||||||
|
|
||||||
|
// 极验与登录验证配置
|
||||||
|
beego.Router("/app/login/getGeetest3Infos", &controllers.BackendAuthController{}, "get:GetGeetest3Infos")
|
||||||
|
beego.Router("/app/login/getGeetest4Infos", &controllers.BackendAuthController{}, "get:GetGeetest4Infos")
|
||||||
|
beego.Router("/app/login/getOpenVerify", &controllers.BackendAuthController{}, "get:GetOpenVerify")
|
||||||
|
|
||||||
|
// 找回密码
|
||||||
|
beego.Router("/app/resetPassword", &controllers.BackendAuthController{}, "post:ResetPassword")
|
||||||
|
beego.Router("/app/sendResetCode", &controllers.BackendAuthController{}, "post:SendResetCode")
|
||||||
|
|
||||||
|
// 注册
|
||||||
|
beego.Router("/app/register", &controllers.BackendAuthController{}, "post:Register")
|
||||||
|
beego.Router("/app/sendRegisterCode", &controllers.BackendAuthController{}, "post:SendRegisterCode")
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"server/middleware"
|
"server/middleware"
|
||||||
"server/routers/api"
|
"server/routers/api"
|
||||||
|
"server/routers/app"
|
||||||
"server/routers/backend"
|
"server/routers/backend"
|
||||||
"server/routers/index"
|
"server/routers/index"
|
||||||
"server/routers/platform"
|
"server/routers/platform"
|
||||||
@@ -49,21 +50,28 @@ func init() {
|
|||||||
switch mode {
|
switch mode {
|
||||||
case "platform":
|
case "platform":
|
||||||
platform.Register()
|
platform.Register()
|
||||||
|
app.Register()
|
||||||
// 在 platform 模式下,仍保留 backend 登录相关路由,避免后台登录 404
|
// 在 platform 模式下,仍保留 backend 登录相关路由,避免后台登录 404
|
||||||
backend.RegisterAuthRoutes()
|
backend.RegisterAuthRoutes()
|
||||||
case "backend":
|
case "backend":
|
||||||
backend.Register()
|
backend.Register()
|
||||||
|
app.Register()
|
||||||
case "index":
|
case "index":
|
||||||
index.Register()
|
index.Register()
|
||||||
|
app.Register()
|
||||||
case "api":
|
case "api":
|
||||||
api.Register()
|
api.Register()
|
||||||
|
case "app":
|
||||||
|
app.Register()
|
||||||
case "all":
|
case "all":
|
||||||
platform.Register()
|
platform.Register()
|
||||||
backend.Register()
|
backend.Register()
|
||||||
index.Register()
|
index.Register()
|
||||||
api.Register()
|
api.Register()
|
||||||
|
app.Register()
|
||||||
default:
|
default:
|
||||||
// 未知模式时,退回到只启用平台端,避免启动失败
|
// 未知模式时,退回到只启用平台端,避免启动失败
|
||||||
platform.Register()
|
platform.Register()
|
||||||
|
app.Register()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
onLaunch: function() {
|
||||||
|
console.log('App Launch')
|
||||||
|
},
|
||||||
|
onShow: function() {
|
||||||
|
console.log('App Show')
|
||||||
|
},
|
||||||
|
onHide: function() {
|
||||||
|
console.log('App Hide')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* 全局样式 */
|
||||||
|
page {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 主题色变量 */
|
||||||
|
:root {
|
||||||
|
--primary-color: #1989fa;
|
||||||
|
--primary-light: #e8f4fd;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
# 云泽网站综合管理平台 (yunzerwebsiteallinone)
|
||||||
|
|
||||||
|
基于 UniApp 开发的跨平台综合管理系统
|
||||||
|
|
||||||
|
## 项目结构
|
||||||
|
|
||||||
|
```
|
||||||
|
uniapp/
|
||||||
|
├── pages/ # 页面目录
|
||||||
|
│ ├── login/ # 登录页
|
||||||
|
│ │ └── login.vue
|
||||||
|
│ ├── dashboard/ # 仪表盘(首页)
|
||||||
|
│ │ └── dashboard.vue
|
||||||
|
│ ├── functions/ # 功能页
|
||||||
|
│ │ └── functions.vue
|
||||||
|
│ └── mine/ # 我的页面
|
||||||
|
│ └── mine.vue
|
||||||
|
├── static/ # 静态资源
|
||||||
|
│ └── tabbar/ # TabBar 图标
|
||||||
|
├── App.vue # 应用根组件
|
||||||
|
├── main.js # 入口文件
|
||||||
|
├── pages.json # 页面配置
|
||||||
|
├── manifest.json # 应用配置
|
||||||
|
├── uni.scss # 全局样式变量
|
||||||
|
└── index.html # H5 入口页面
|
||||||
|
```
|
||||||
|
|
||||||
|
## 页面说明
|
||||||
|
|
||||||
|
### 1. 登录页 (pages/login/login.vue)
|
||||||
|
- 支持验证码登录和密码登录切换
|
||||||
|
- 手机号 + 验证码 / 账号密码 双模式
|
||||||
|
- 主题色:#1989fa
|
||||||
|
- 登录成功后跳转到仪表盘
|
||||||
|
|
||||||
|
### 2. 仪表盘 (pages/dashboard/dashboard.vue)
|
||||||
|
- 欢迎信息(根据时间动态显示问候语)
|
||||||
|
- 数据概览卡片(访问量、用户数、订单数、收入)
|
||||||
|
- 快捷操作入口
|
||||||
|
- 最近动态列表
|
||||||
|
|
||||||
|
### 3. 功能页 (pages/functions/functions.vue)
|
||||||
|
- 搜索功能
|
||||||
|
- 常用功能网格(8个快捷入口)
|
||||||
|
- 管理工具列表
|
||||||
|
- 数据服务列表
|
||||||
|
- 系统工具列表
|
||||||
|
|
||||||
|
### 4. 我的 (pages/mine/mine.vue)
|
||||||
|
- 用户头像/昵称/手机号展示
|
||||||
|
- 统计数据(文章/粉丝/关注/获赞)
|
||||||
|
- 订单状态入口
|
||||||
|
- 功能菜单列表
|
||||||
|
- 退出登录功能
|
||||||
|
|
||||||
|
## TabBar 配置
|
||||||
|
|
||||||
|
底部三菜单:
|
||||||
|
- 仪表盘 (首页)
|
||||||
|
- 功能
|
||||||
|
- 我的
|
||||||
|
|
||||||
|
登录页不在 TabBar 中,通过页面跳转访问。
|
||||||
|
|
||||||
|
## 开发说明
|
||||||
|
|
||||||
|
1. 使用 HBuilderX 打开本项目目录即可运行
|
||||||
|
2. 支持 H5 / 微信小程序 / APP 等多端运行
|
||||||
|
3. 主题色变量定义在 `uni.scss` 中:`$primary-color: #1989fa`
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
- 请在 `static/tabbar/` 目录下放置 TabBar 图标(详见该目录下的 README.md)
|
||||||
|
- 登录状态使用 `uni.storage` 本地存储
|
||||||
|
- 所有接口调用处标注了 TODO,需根据实际后端接口对接
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<script>
|
||||||
|
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
||||||
|
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||||
|
</script>
|
||||||
|
<title>云泽网站综合管理平台</title>
|
||||||
|
<!--preload-links-->
|
||||||
|
<!--app-context-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"><!--app-html--></div>
|
||||||
|
<script type="module" src="/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import App from './App'
|
||||||
|
|
||||||
|
// #ifndef VUE3
|
||||||
|
import Vue from 'vue'
|
||||||
|
Vue.config.productionTip = false
|
||||||
|
App.mpType = 'app'
|
||||||
|
const app = new Vue({
|
||||||
|
...App
|
||||||
|
})
|
||||||
|
app.$mount()
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef VUE3
|
||||||
|
import { createSSRApp } from 'vue'
|
||||||
|
export function createApp() {
|
||||||
|
const app = createSSRApp(App)
|
||||||
|
return { app }
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"name": "yunzerwebsiteallinone", "appid": "", "description": "云泽网站综合管理平台", "versionName": "1.0.0", "versionCode": "100", "transformPx": false, "app-plus": {"usingComponents": true, "splashscreen": {"alwaysShowBeforeRender": true, "waiting": true, "autoclose": true, "delay": 0}, "modules": {}, "distribute": {"android": {"permissions": ["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.VIBRATE\"/>", "<uses-permission android:name=\"android.permission.READ_LOGS\"/>", "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CAMERA\"/>", "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"]}, "ios": {}, "sdkConfigs": {}}}, "quickapp": {}, "mp-weixin": {"appid": "", "setting": {"urlCheck": false}, "usingComponents": true}, "mp-alipay": {"usingComponents": true}, "mp-baidu": {"usingComponents": true}, "mp-toutiao": {"usingComponents": true}, "uniStatistics": {"enable": false}, "h5": {"devServer": {"port": 8080, "disableHostCheck": true}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"dependencies": {}, "devDependencies": {}}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"path": "pages/dashboard/dashboard",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "仪表盘"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/functions/functions",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "功能"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/mine/mine",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "我的"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/login/login",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "登录",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tabBar": {
|
||||||
|
"color": "#999999",
|
||||||
|
"selectedColor": "#1989fa",
|
||||||
|
"borderStyle": "black",
|
||||||
|
"backgroundColor": "#ffffff",
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"pagePath": "pages/dashboard/dashboard",
|
||||||
|
"text": "仪表盘",
|
||||||
|
"iconPath": "static/tab/dashboard.png",
|
||||||
|
"selectedIconPath": "static/tab/dashboard-active.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/functions/functions",
|
||||||
|
"text": "功能",
|
||||||
|
"iconPath": "static/tab/functions.png",
|
||||||
|
"selectedIconPath": "static/tab/functions-active.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/mine/mine",
|
||||||
|
"text": "我的",
|
||||||
|
"iconPath": "static/tab/mine.png",
|
||||||
|
"selectedIconPath": "static/tab/mine-active.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"globalStyle": {
|
||||||
|
"navigationBarTextStyle": "white",
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"navigationBarBackgroundColor": "#1989fa",
|
||||||
|
"backgroundColor": "#f5f5f5"
|
||||||
|
},
|
||||||
|
"easycom": {
|
||||||
|
"autoscan": true,
|
||||||
|
"custom": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,382 @@
|
|||||||
|
<template>
|
||||||
|
<view class="dashboard-container">
|
||||||
|
<!-- 顶部欢迎区域 -->
|
||||||
|
<view class="header">
|
||||||
|
<view class="user-info">
|
||||||
|
<view class="avatar">
|
||||||
|
<text class="avatar-text">云</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<text class="greeting">{{ greeting }},{{ userName }}</text>
|
||||||
|
<text class="date">{{ currentDate }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="notice-icon" @click="goToNotice">
|
||||||
|
<text class="iconfont">🔔</text>
|
||||||
|
<view class="badge" v-if="unreadCount > 0">
|
||||||
|
<text>{{ unreadCount > 99 ? '99+' : unreadCount }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 数据概览卡片 -->
|
||||||
|
<view class="section">
|
||||||
|
<view class="section-title">
|
||||||
|
<text>数据概览</text>
|
||||||
|
</view>
|
||||||
|
<view class="stats-grid">
|
||||||
|
<view class="stat-card" v-for="(item, index) in statsData" :key="index">
|
||||||
|
<text class="stat-value" :style="{ color: item.color }">{{ item.value }}</text>
|
||||||
|
<text class="stat-label">{{ item.label }}</text>
|
||||||
|
<view class="trend" :class="item.trend > 0 ? 'up' : 'down'">
|
||||||
|
<text>{{ item.trend > 0 ? '↑' : '↓' }} {{ Math.abs(item.trend) }}%</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 快捷操作 -->
|
||||||
|
<view class="section">
|
||||||
|
<view class="section-title">
|
||||||
|
<text>快捷操作</text>
|
||||||
|
</view>
|
||||||
|
<view class="quick-actions">
|
||||||
|
<view class="action-item" v-for="(action, index) in quickActions" :key="index" @click="handleAction(action)">
|
||||||
|
<view class="action-icon" :style="{ backgroundColor: action.bgColor }">
|
||||||
|
<text>{{ action.icon }}</text>
|
||||||
|
</view>
|
||||||
|
<text class="action-name">{{ action.name }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 最近动态 -->
|
||||||
|
<view class="section">
|
||||||
|
<view class="section-title-row">
|
||||||
|
<text class="section-title">最近动态</text>
|
||||||
|
<text class="more" @click="viewMore">查看更多 ></text>
|
||||||
|
</view>
|
||||||
|
<view class="activity-list">
|
||||||
|
<view class="activity-item" v-for="(item, index) in recentActivities" :key="index">
|
||||||
|
<view class="activity-dot" :style="{ backgroundColor: item.color }"></view>
|
||||||
|
<view class="activity-content">
|
||||||
|
<text class="activity-title">{{ item.title }}</text>
|
||||||
|
<text class="activity-time">{{ item.time }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
userName: '用户',
|
||||||
|
unreadCount: 3,
|
||||||
|
statsData: [
|
||||||
|
{ label: '今日访问', value: '1,234', color: '#1989fa', trend: 12.5 },
|
||||||
|
{ label: '总用户数', value: '5,678', color: '#07c160', trend: 8.3 },
|
||||||
|
{ label: '订单数量', value: '892', color: '#fa9d3b', trend: -2.1 },
|
||||||
|
{ label: '收入金额', value: '¥12.5w', color: '#ff6b6b', trend: 15.7 }
|
||||||
|
],
|
||||||
|
quickActions: [
|
||||||
|
{ name: '数据报表', icon: '📊', bgColor: '#e8f4fd', path: '' },
|
||||||
|
{ name: '内容管理', icon: '📝', bgColor: '#e8faef', path: '' },
|
||||||
|
{ name: '用户管理', icon: '👥', bgColor: '#fef3e8', path: '' },
|
||||||
|
{ name: '系统设置', icon: '⚙️', bgColor: '#fce8ec', path: '' }
|
||||||
|
],
|
||||||
|
recentActivities: [
|
||||||
|
{ title: '新用户 张三 完成注册', time: '10分钟前', color: '#1989fa' },
|
||||||
|
{ title: '订单 #20240115001 已完成', time: '30分钟前', color: '#07c160' },
|
||||||
|
{ title: '系统已完成自动备份', time: '1小时前', color: '#fa9d3b' },
|
||||||
|
{ title: '内容《新手指南》已发布', time: '2小时前', color: '#ff6b6b' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
greeting() {
|
||||||
|
const hour = new Date().getHours()
|
||||||
|
if (hour < 6) return '凌晨好'
|
||||||
|
if (hour < 9) return '早上好'
|
||||||
|
if (hour < 12) return '上午好'
|
||||||
|
if (hour < 14) return '中午好'
|
||||||
|
if (hour < 17) return '下午好'
|
||||||
|
if (hour < 19) return '傍晚好'
|
||||||
|
return '晚上好'
|
||||||
|
},
|
||||||
|
currentDate() {
|
||||||
|
const now = new Date()
|
||||||
|
const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
|
||||||
|
const month = now.getMonth() + 1
|
||||||
|
const day = now.getDate()
|
||||||
|
const weekDay = weekDays[now.getDay()]
|
||||||
|
return `${month}月${day}日 ${weekDay}`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.checkLoginStatus()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
checkLoginStatus() {
|
||||||
|
const isLoggedIn = uni.getStorageSync('isLoggedIn')
|
||||||
|
if (!isLoggedIn) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
|
if (userInfo && userInfo.phone) {
|
||||||
|
this.userName = userInfo.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
goToNotice() {
|
||||||
|
uni.showToast({ title: '消息中心开发中', icon: 'none' })
|
||||||
|
},
|
||||||
|
handleAction(action) {
|
||||||
|
uni.showToast({ title: action.name + ' 功能开发中', icon: 'none' })
|
||||||
|
},
|
||||||
|
viewMore() {
|
||||||
|
uni.showToast({ title: '查看更多动态', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.dashboard-container {
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
padding-bottom: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background: linear-gradient(135deg, #1989fa 0%, #0d7ed9 100%);
|
||||||
|
padding: 32rpx 32rpx 48rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 96rpx;
|
||||||
|
height: 96rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: rgba(255, 255, 255, 0.25);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-text {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.greeting {
|
||||||
|
font-size: 34rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.date {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-icon {
|
||||||
|
position: relative;
|
||||||
|
width: 64rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconfont {
|
||||||
|
font-size: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
min-width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
background-color: #ff4d4f;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge text {
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
margin: 24rpx 24rpx 0;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 32rpx;
|
||||||
|
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title-row .section-title {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.more {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card {
|
||||||
|
background-color: #fafafa;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 28rpx 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
font-size: 44rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #666;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trend {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 22rpx;
|
||||||
|
padding: 4rpx 12rpx;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trend.up {
|
||||||
|
color: #07c160;
|
||||||
|
background-color: rgba(7, 193, 96, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.trend.down {
|
||||||
|
color: #ff4d4f;
|
||||||
|
background-color: rgba(255, 77, 79, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-actions {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-icon {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-icon text {
|
||||||
|
font-size: 44rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-name {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-item:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-dot {
|
||||||
|
width: 16rpx;
|
||||||
|
height: 16rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-content {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-title {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-time {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-left: 24rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,290 @@
|
|||||||
|
<template>
|
||||||
|
<view class="functions-container">
|
||||||
|
<!-- 搜索栏 -->
|
||||||
|
<view class="search-bar">
|
||||||
|
<view class="search-input">
|
||||||
|
<text class="search-icon">🔍</text>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="searchKeyword"
|
||||||
|
placeholder="搜索功能..."
|
||||||
|
@confirm="handleSearch"
|
||||||
|
class="input"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 常用功能 -->
|
||||||
|
<view class="section">
|
||||||
|
<view class="section-title">
|
||||||
|
<text>常用功能</text>
|
||||||
|
</view>
|
||||||
|
<view class="function-grid">
|
||||||
|
<view
|
||||||
|
class="function-item"
|
||||||
|
v-for="(func, index) in commonFunctions"
|
||||||
|
:key="index"
|
||||||
|
@click="handleFunction(func)"
|
||||||
|
>
|
||||||
|
<view class="func-icon" :style="{ backgroundColor: func.bgColor }">
|
||||||
|
<text>{{ func.icon }}</text>
|
||||||
|
</view>
|
||||||
|
<text class="func-name">{{ func.name }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 管理工具 -->
|
||||||
|
<view class="section">
|
||||||
|
<view class="section-title">
|
||||||
|
<text>管理工具</text>
|
||||||
|
</view>
|
||||||
|
<view class="function-list">
|
||||||
|
<view
|
||||||
|
class="list-item"
|
||||||
|
v-for="(item, index) in manageTools"
|
||||||
|
:key="index"
|
||||||
|
@click="handleFunction(item)"
|
||||||
|
>
|
||||||
|
<view class="list-icon" :style="{ backgroundColor: item.bgColor }">
|
||||||
|
<text>{{ item.icon }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="list-info">
|
||||||
|
<text class="list-name">{{ item.name }}</text>
|
||||||
|
<text class="list-desc">{{ item.desc }}</text>
|
||||||
|
</view>
|
||||||
|
<text class="arrow">></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 数据服务 -->
|
||||||
|
<view class="section">
|
||||||
|
<view class="section-title">
|
||||||
|
<text>数据服务</text>
|
||||||
|
</view>
|
||||||
|
<view class="function-list">
|
||||||
|
<view
|
||||||
|
class="list-item"
|
||||||
|
v-for="(item, index) in dataServices"
|
||||||
|
:key="index"
|
||||||
|
@click="handleFunction(item)"
|
||||||
|
>
|
||||||
|
<view class="list-icon" :style="{ backgroundColor: item.bgColor }">
|
||||||
|
<text>{{ item.icon }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="list-info">
|
||||||
|
<text class="list-name">{{ item.name }}</text>
|
||||||
|
<text class="list-desc">{{ item.desc }}</text>
|
||||||
|
</view>
|
||||||
|
<text class="arrow">></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 系统工具 -->
|
||||||
|
<view class="section">
|
||||||
|
<view class="section-title">
|
||||||
|
<text>系统工具</text>
|
||||||
|
</view>
|
||||||
|
<view class="function-list">
|
||||||
|
<view
|
||||||
|
class="list-item"
|
||||||
|
v-for="(item, index) in systemTools"
|
||||||
|
:key="index"
|
||||||
|
@click="handleFunction(item)"
|
||||||
|
>
|
||||||
|
<view class="list-icon" :style="{ backgroundColor: item.bgColor }">
|
||||||
|
<text>{{ item.icon }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="list-info">
|
||||||
|
<text class="list-name">{{ item.name }}</text>
|
||||||
|
<text class="list-desc">{{ item.desc }}</text>
|
||||||
|
</view>
|
||||||
|
<text class="arrow">></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
searchKeyword: '',
|
||||||
|
commonFunctions: [
|
||||||
|
{ name: '文章管理', icon: '📄', bgColor: '#e8f4fd', path: '', type: 'common' },
|
||||||
|
{ name: '图片管理', icon: '🖼️', bgColor: '#fef3e8', path: '', type: 'common' },
|
||||||
|
{ name: '文件管理', icon: '📁', bgColor: '#e8faef', path: '', type: 'common' },
|
||||||
|
{ name: '评论审核', icon: '💬', bgColor: '#fce8ec', path: '', type: 'common' },
|
||||||
|
{ name: '用户反馈', icon: '📮', bgColor: '#f3e8fd', path: '', type: 'common' },
|
||||||
|
{ name: '数据统计', icon: '📊', bgColor: '#e8f0fe', path: '', type: 'common' },
|
||||||
|
{ name: '公告通知', icon: '📢', bgColor: '#fff4e8', path: '', type: 'common' },
|
||||||
|
{ name: '日志查看', icon: '📋', bgColor: '#e8fcf4', path: '', type: 'common' }
|
||||||
|
],
|
||||||
|
manageTools: [
|
||||||
|
{ name: '内容发布', desc: '发布文章、图片等内容', icon: '✏️', bgColor: '#e8f4fd', path: '' },
|
||||||
|
{ name: '分类管理', desc: '管理内容分类标签', icon: '🏷️', bgColor: '#fef3e8', path: '' },
|
||||||
|
{ name: '权限设置', desc: '配置用户角色权限', icon: '🔐', bgColor: '#e8faef', path: '' },
|
||||||
|
{ name: '站点配置', desc: '网站基本设置项', icon: '⚙️', bgColor: '#fce8ec', path: '' }
|
||||||
|
],
|
||||||
|
dataServices: [
|
||||||
|
{ name: '数据备份', desc: '一键备份所有数据', icon: '💾', bgColor: '#e8f4fd', path: '' },
|
||||||
|
{ name: '数据恢复', desc: '从备份中恢复数据', icon: '♻️', bgColor: '#fef3e8', path: '' },
|
||||||
|
{ name: '数据导出', desc: '导出为Excel/CSV', icon: '📤', bgColor: '#e8faef', path: '' },
|
||||||
|
{ name: '数据清理', desc: '清理冗余临时数据', icon: '🧹', bgColor: '#fce8ec', path: '' }
|
||||||
|
],
|
||||||
|
systemTools: [
|
||||||
|
{ name: '缓存管理', desc: '清除系统缓存加速访问', icon: '🚀', bgColor: '#e8f4fd', path: '' },
|
||||||
|
{ name: '安全检测', desc: '扫描系统安全隐患', icon: '🛡️', bgColor: '#e8faef', path: '' },
|
||||||
|
{ name: '版本更新', desc: '检查并更新系统版本', icon: '🔄', bgColor: '#fef3e8', path: '' },
|
||||||
|
{ name: '关于系统', desc: '系统信息与帮助文档', icon: 'ℹ️', bgColor: '#f3e8fd', path: '' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSearch() {
|
||||||
|
if (this.searchKeyword.trim()) {
|
||||||
|
uni.showToast({ title: '搜索:' + this.searchKeyword, icon: 'none' })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleFunction(func) {
|
||||||
|
uni.showToast({ title: func.name + ' 功能开发中', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.functions-container {
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
padding-bottom: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-bar {
|
||||||
|
padding: 24rpx 24rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 48rpx;
|
||||||
|
padding: 16rpx 32rpx;
|
||||||
|
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon {
|
||||||
|
font-size: 32rpx;
|
||||||
|
margin-right: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
margin: 24rpx 24rpx 0;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 32rpx;
|
||||||
|
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.func-icon {
|
||||||
|
width: 96rpx;
|
||||||
|
height: 96rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.func-icon text {
|
||||||
|
font-size: 42rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.func-name {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 24rpx 0;
|
||||||
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-item:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-icon {
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 24rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-icon text {
|
||||||
|
font-size: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-name {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-desc {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #ccc;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,403 @@
|
|||||||
|
<template>
|
||||||
|
<view class="login-container">
|
||||||
|
<view class="login-header">
|
||||||
|
<text class="welcome-text">欢迎登录</text>
|
||||||
|
<text class="sub-text">云泽网站综合管理平台</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="login-form">
|
||||||
|
<!-- 登录方式切换 -->
|
||||||
|
<view class="tab-switch">
|
||||||
|
<view
|
||||||
|
class="tab-item"
|
||||||
|
:class="{ active: loginType === 'phone' }"
|
||||||
|
@click="switchLoginType('phone')"
|
||||||
|
>
|
||||||
|
<text>验证码登录</text>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="tab-item"
|
||||||
|
:class="{ active: loginType === 'account' }"
|
||||||
|
@click="switchLoginType('account')"
|
||||||
|
>
|
||||||
|
<text>密码登录</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 手机号输入 -->
|
||||||
|
<view class="input-group">
|
||||||
|
<view class="input-item">
|
||||||
|
<text class="icon">+86</text>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
v-model="phoneNumber"
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
maxlength="11"
|
||||||
|
class="input-field"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 验证码/密码输入 -->
|
||||||
|
<view class="input-group" v-if="loginType === 'phone'">
|
||||||
|
<view class="input-item">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
v-model="verifyCode"
|
||||||
|
placeholder="请输入验证码"
|
||||||
|
maxlength="6"
|
||||||
|
class="input-field code-input"
|
||||||
|
/>
|
||||||
|
<view
|
||||||
|
class="code-btn"
|
||||||
|
:class="{ disabled: countdown > 0 }"
|
||||||
|
@click="sendCode"
|
||||||
|
>
|
||||||
|
<text>{{ countdown > 0 ? countdown + 's后重发' : '获取验证码' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="input-group" v-else>
|
||||||
|
<view class="input-item">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="password"
|
||||||
|
placeholder="请输入密码"
|
||||||
|
:password="!showPassword"
|
||||||
|
class="input-field"
|
||||||
|
/>
|
||||||
|
<text class="eye-icon" @click="togglePassword">{{ showPassword ? '隐藏' : '显示' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 登录按钮 -->
|
||||||
|
<button class="login-btn" @click="handleLogin" :disabled="isLoading">
|
||||||
|
<text>{{ isLoading ? '登录中...' : '登 录' }}</text>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- 其他选项 -->
|
||||||
|
<view class="options">
|
||||||
|
<text class="link" @click="goToRegister">新用户注册</text>
|
||||||
|
<text class="link" @click="forgetPassword">忘记密码?</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 协议 -->
|
||||||
|
<view class="agreement">
|
||||||
|
<checkbox :checked="agreed" @click="toggleAgree" color="#1989fa" />
|
||||||
|
<text class="agree-text">
|
||||||
|
我已阅读并同意
|
||||||
|
<text class="link">《用户协议》</text>
|
||||||
|
和
|
||||||
|
<text class="link">《隐私政策》</text>
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loginType: 'phone', // phone | account
|
||||||
|
phoneNumber: '',
|
||||||
|
verifyCode: '',
|
||||||
|
password: '',
|
||||||
|
showPassword: false,
|
||||||
|
countdown: 0,
|
||||||
|
isLoading: false,
|
||||||
|
agreed: false,
|
||||||
|
timer: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
if (this.timer) {
|
||||||
|
clearInterval(this.timer)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
switchLoginType(type) {
|
||||||
|
this.loginType = type
|
||||||
|
},
|
||||||
|
togglePassword() {
|
||||||
|
this.showPassword = !this.showPassword
|
||||||
|
},
|
||||||
|
sendCode() {
|
||||||
|
if (this.countdown > 0) return
|
||||||
|
if (!this.phoneNumber || this.phoneNumber.length !== 11) {
|
||||||
|
uni.showToast({ title: '请输入正确的手机号', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: 调用发送验证码接口
|
||||||
|
uni.showToast({ title: '验证码已发送', icon: 'success' })
|
||||||
|
|
||||||
|
this.countdown = 60
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
this.countdown--
|
||||||
|
if (this.countdown <= 0) {
|
||||||
|
clearInterval(this.timer)
|
||||||
|
this.timer = null
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
handleLogin() {
|
||||||
|
if (!this.agreed) {
|
||||||
|
uni.showToast({ title: '请先同意用户协议', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!this.phoneNumber || this.phoneNumber.length !== 11) {
|
||||||
|
uni.showToast({ title: '请输入正确的手机号', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.loginType === 'phone') {
|
||||||
|
if (!this.verifyCode) {
|
||||||
|
uni.showToast({ title: '请输入验证码', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!this.password) {
|
||||||
|
uni.showToast({ title: '请输入密码', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isLoading = true
|
||||||
|
|
||||||
|
// TODO: 调用登录接口
|
||||||
|
setTimeout(() => {
|
||||||
|
this.isLoading = false
|
||||||
|
uni.showToast({ title: '登录成功', icon: 'success' })
|
||||||
|
|
||||||
|
// 存储登录状态
|
||||||
|
uni.setStorageSync('isLoggedIn', true)
|
||||||
|
uni.setStorageSync('userInfo', {
|
||||||
|
phone: this.phoneNumber,
|
||||||
|
loginTime: new Date().getTime()
|
||||||
|
})
|
||||||
|
|
||||||
|
// 跳转到仪表盘
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/dashboard/dashboard'
|
||||||
|
})
|
||||||
|
}, 1500)
|
||||||
|
}, 1500)
|
||||||
|
},
|
||||||
|
toggleAgree() {
|
||||||
|
this.agreed = !this.agreed
|
||||||
|
},
|
||||||
|
goToRegister() {
|
||||||
|
uni.showToast({ title: '注册功能开发中', icon: 'none' })
|
||||||
|
},
|
||||||
|
forgetPassword() {
|
||||||
|
uni.showToast({ title: '密码找回功能开发中', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.login-container {
|
||||||
|
min-height: 100vh;
|
||||||
|
background: linear-gradient(180deg, #1989fa 0%, #e8f4fd 40%, #f5f5f5 40%);
|
||||||
|
padding: 0 48rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-header {
|
||||||
|
padding-top: 120rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
width: 140rpx;
|
||||||
|
height: 140rpx;
|
||||||
|
border-radius: 28rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin: 0 auto 32rpx;
|
||||||
|
box-shadow: 0 8rpx 24rpx rgba(25, 137, 250, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-text {
|
||||||
|
font-size: 56rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #1989fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-text {
|
||||||
|
display: block;
|
||||||
|
font-size: 44rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #fff;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-text {
|
||||||
|
display: block;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 48rpx 40rpx;
|
||||||
|
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-switch {
|
||||||
|
display: flex;
|
||||||
|
border-bottom: 1rpx solid #eee;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item {
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item text {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item.active text {
|
||||||
|
color: #1989fa;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item.active::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
bottom: -1rpx;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
width: 80rpx;
|
||||||
|
height: 4rpx;
|
||||||
|
background-color: #1989fa;
|
||||||
|
border-radius: 2rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group {
|
||||||
|
margin-bottom: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border: 2rpx solid #e5e5e5;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
height: 96rpx;
|
||||||
|
background-color: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-item:focus-within {
|
||||||
|
border-color: #1989fa;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
margin-right: 16rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-field {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-input {
|
||||||
|
padding-right: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-btn {
|
||||||
|
padding: 16rpx 24rpx;
|
||||||
|
background-color: #1989fa;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-btn text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #fff;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-btn.disabled {
|
||||||
|
background-color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.eye-icon {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #1989fa;
|
||||||
|
padding: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-btn {
|
||||||
|
width: 100%;
|
||||||
|
height: 92rpx;
|
||||||
|
background: linear-gradient(135deg, #1989fa 0%, #0d7ed9 100%);
|
||||||
|
border-radius: 46rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-btn text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 4rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-btn[disabled] {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.options {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
padding: 0 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.options .link {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #1989fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-top: 48rpx;
|
||||||
|
padding: 0 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agree-text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-left: 12rpx;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agree-text .link {
|
||||||
|
color: #1989fa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,474 @@
|
|||||||
|
<template>
|
||||||
|
<view class="mine-container">
|
||||||
|
<!-- 用户信息卡片 -->
|
||||||
|
<view class="user-card">
|
||||||
|
<view class="user-profile">
|
||||||
|
<view class="avatar">
|
||||||
|
<text class="avatar-text">云</text>
|
||||||
|
</view>
|
||||||
|
<view class="user-detail">
|
||||||
|
<view class="name-row">
|
||||||
|
<text class="nickname">{{ userInfo.nickname || '未设置昵称' }}</text>
|
||||||
|
<view class="vip-badge" v-if="userInfo.isVip">
|
||||||
|
<text>VIP</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<text class="phone">{{ maskedPhone }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="edit-btn" @click="editProfile">
|
||||||
|
<text>编辑</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 统计信息 -->
|
||||||
|
<view class="stats-row">
|
||||||
|
<view class="stat-item" @click="goToPage('articles')">
|
||||||
|
<text class="stat-num">{{ userStats.articles }}</text>
|
||||||
|
<text class="stat-label">文章</text>
|
||||||
|
</view>
|
||||||
|
<view class="stat-divider"></view>
|
||||||
|
<view class="stat-item" @click="goToPage('followers')">
|
||||||
|
<text class="stat-num">{{ userStats.followers }}</text>
|
||||||
|
<text class="stat-label">粉丝</text>
|
||||||
|
</view>
|
||||||
|
<view class="stat-divider"></view>
|
||||||
|
<view class="stat-item" @click="goToPage('following')">
|
||||||
|
<text class="stat-num">{{ userStats.following }}</text>
|
||||||
|
<text class="stat-label">关注</text>
|
||||||
|
</view>
|
||||||
|
<view class="stat-divider"></view>
|
||||||
|
<view class="stat-item" @click="goToPage('likes')">
|
||||||
|
<text class="stat-num">{{ userStats.likes }}</text>
|
||||||
|
<text class="stat-label">获赞</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 订单/资产入口 -->
|
||||||
|
<view class="section order-section">
|
||||||
|
<view class="order-header">
|
||||||
|
<text class="section-title">我的订单</text>
|
||||||
|
<text class="more" @click="viewAllOrders">全部订单 ></text>
|
||||||
|
</view>
|
||||||
|
<view class="order-grid">
|
||||||
|
<view class="order-item" v-for="(item, index) in orderTypes" :key="index" @click="goToOrder(item.type)">
|
||||||
|
<view class="order-icon-wrap">
|
||||||
|
<text class="order-icon">{{ item.icon }}</text>
|
||||||
|
<view class="order-badge" v-if="item.count > 0">
|
||||||
|
<text>{{ item.count }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<text class="order-name">{{ item.name }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 功能列表 -->
|
||||||
|
<view class="section menu-section">
|
||||||
|
<view class="menu-list">
|
||||||
|
<view
|
||||||
|
class="menu-item"
|
||||||
|
v-for="(menu, index) in menuList"
|
||||||
|
:key="index"
|
||||||
|
@click="handleMenu(menu)"
|
||||||
|
>
|
||||||
|
<view class="menu-icon" :style="{ backgroundColor: menu.bgColor }">
|
||||||
|
<text>{{ menu.icon }}</text>
|
||||||
|
</view>
|
||||||
|
<text class="menu-name">{{ menu.name }}</text>
|
||||||
|
<view class="menu-right">
|
||||||
|
<text class="menu-desc" v-if="menu.desc">{{ menu.desc }}</text>
|
||||||
|
<text class="arrow">></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 退出登录按钮 -->
|
||||||
|
<view class="logout-wrapper">
|
||||||
|
<button class="logout-btn" @click="handleLogout">
|
||||||
|
<text>退出登录</text>
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 版本信息 -->
|
||||||
|
<view class="version-info">
|
||||||
|
<text>云泽网站综合管理平台 v1.0.0</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
userInfo: {
|
||||||
|
nickname: '',
|
||||||
|
phone: '',
|
||||||
|
avatar: '',
|
||||||
|
isVip: false
|
||||||
|
},
|
||||||
|
userStats: {
|
||||||
|
articles: 12,
|
||||||
|
followers: 256,
|
||||||
|
following: 89,
|
||||||
|
likes: 1024
|
||||||
|
},
|
||||||
|
orderTypes: [
|
||||||
|
{ name: '待付款', icon: '💰', type: 'pending', count: 0 },
|
||||||
|
{ name: '进行中', icon: '⏳', type: 'processing', count: 2 },
|
||||||
|
{ name: '已完成', icon: '✅', type: 'completed', count: 8 },
|
||||||
|
{ name: '已取消', icon: '❌', type: 'cancelled', count: 1 }
|
||||||
|
],
|
||||||
|
menuList: [
|
||||||
|
{ name: '我的收藏', icon: '⭐', bgColor: '#fff4e8', desc: '', action: 'favorites' },
|
||||||
|
{ name: '浏览历史', icon: '🕐', bgColor: '#e8f4fd', desc: '', action: 'history' },
|
||||||
|
{ name: '地址管理', icon: '📍', bgColor: '#e8faef', desc: '', action: 'address' },
|
||||||
|
{ name: '账号安全', icon: '🔒', bgColor: '#fce8ec', desc: '', action: 'security' },
|
||||||
|
{ name: '消息通知', icon: '🔔', bgColor: '#f3e8fd', desc: '3条未读', action: 'notice' },
|
||||||
|
{ name: '帮助中心', icon: '❓', bgColor: '#e8f0fe', desc: '', action: 'help' },
|
||||||
|
{ name: '关于我们', icon: 'ℹ️', bgColor: '#e8fcf4', desc: '', action: 'about' },
|
||||||
|
{ name: '意见反馈', icon: '💬', bgColor: '#fef3e8', desc: '', action: 'feedback' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
maskedPhone() {
|
||||||
|
if (this.userInfo.phone) {
|
||||||
|
return this.userInfo.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
|
||||||
|
}
|
||||||
|
return '未绑定手机号'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.loadUserInfo()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
loadUserInfo() {
|
||||||
|
const isLoggedIn = uni.getStorageSync('isLoggedIn')
|
||||||
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
|
|
||||||
|
if (isLoggedIn && userInfo) {
|
||||||
|
this.userInfo.phone = userInfo.phone || ''
|
||||||
|
this.userInfo.nickname = userInfo.nickname || ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
editProfile() {
|
||||||
|
uni.showToast({ title: '个人信息编辑开发中', icon: 'none' })
|
||||||
|
},
|
||||||
|
goToPage(type) {
|
||||||
|
const pageMap = {
|
||||||
|
articles: '我的文章',
|
||||||
|
followers: '粉丝列表',
|
||||||
|
following: '关注列表',
|
||||||
|
likes: '获赞记录'
|
||||||
|
}
|
||||||
|
uni.showToast({ title: pageMap[type] + ' 开发中', icon: 'none' })
|
||||||
|
},
|
||||||
|
viewAllOrders() {
|
||||||
|
uni.showToast({ title: '全部订单开发中', icon: 'none' })
|
||||||
|
},
|
||||||
|
goToOrder(type) {
|
||||||
|
uni.showToast({ title: '订单详情开发中', icon: 'none' })
|
||||||
|
},
|
||||||
|
handleMenu(menu) {
|
||||||
|
uni.showToast({ title: menu.name + ' 功能开发中', icon: 'none' })
|
||||||
|
},
|
||||||
|
handleLogout() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要退出登录吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 清除登录状态
|
||||||
|
uni.removeStorageSync('isLoggedIn')
|
||||||
|
uni.removeStorageSync('userInfo')
|
||||||
|
|
||||||
|
uni.showToast({ title: '已退出登录', icon: 'success' })
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.mine-container {
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
padding-bottom: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-card {
|
||||||
|
background: linear-gradient(135deg, #1989fa 0%, #0d7ed9 100%);
|
||||||
|
margin: 24rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 40rpx 32rpx 32rpx;
|
||||||
|
box-shadow: 0 8rpx 32rpx rgba(25, 137, 250, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-profile {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: rgba(255, 255, 255, 0.25);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 28rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-text {
|
||||||
|
font-size: 48rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-detail {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nickname {
|
||||||
|
font-size: 38rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-right: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vip-badge {
|
||||||
|
background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
|
||||||
|
padding: 4rpx 16rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vip-badge text {
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phone {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-btn {
|
||||||
|
padding: 12rpx 28rpx;
|
||||||
|
border: 2rpx solid rgba(255, 255, 255, 0.6);
|
||||||
|
border-radius: 28rpx;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-btn text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: rgba(255, 255, 255, 0.15);
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 24rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-item {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-num {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-divider {
|
||||||
|
width: 1rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
background-color: rgba(255, 255, 255, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
margin: 24rpx 24rpx 0;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 32rpx;
|
||||||
|
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-section .section-title {
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.more {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-icon-wrap {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-icon {
|
||||||
|
font-size: 44rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: -8rpx;
|
||||||
|
right: -16rpx;
|
||||||
|
min-width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
background-color: #ff4d4f;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-badge text {
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-name {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 28rpx 0;
|
||||||
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-icon {
|
||||||
|
width: 72rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 24rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-icon text {
|
||||||
|
font-size: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-name {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-desc {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-right: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-wrapper {
|
||||||
|
padding: 48rpx 48rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-btn {
|
||||||
|
width: 100%;
|
||||||
|
height: 88rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 2rpx solid #ff4d4f;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-btn text {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #ff4d4f;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-info {
|
||||||
|
text-align: center;
|
||||||
|
padding-top: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-info text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# TabBar 图标说明
|
||||||
|
|
||||||
|
请将以下 PNG 图标放入此目录(建议尺寸 81x81px):
|
||||||
|
|
||||||
|
## 必需图标文件:
|
||||||
|
|
||||||
|
1. **dashboard.png** - 仪表盘图标(未选中状态)
|
||||||
|
2. **dashboard-active.png** - 仪表盘图标(选中状态,主题色 #1989fa)
|
||||||
|
3. **functions.png** - 功能图标(未选中状态)
|
||||||
|
4. **functions-active.png** - 功能图标(选中状态,主题色 #1989fa)
|
||||||
|
5. **mine.png** - 我的图标(未选中状态)
|
||||||
|
6. **mine-active.png** - 我的图标(选中状态,主题色 #1989fa)
|
||||||
|
|
||||||
|
## 图标要求:
|
||||||
|
- 格式:PNG
|
||||||
|
- 尺寸:81x81 像素(推荐)
|
||||||
|
- 未选中颜色:#999999
|
||||||
|
- 选中颜色:#1989fa
|
||||||
|
|
||||||
|
## 临时方案:
|
||||||
|
如暂无图标资源,可从 iconfont 等图标库下载对应图标,或暂时注释掉 pages.json 中的 iconPath 配置项。
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* SVG 图标 - 仪表盘(选中状态)
|
||||||
|
* 使用时请替换为实际的 PNG 图标文件
|
||||||
|
* 尺寸建议: 81x81 px
|
||||||
|
*/
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="81" height="81" viewBox="0 0 81 81">
|
||||||
|
<rect width="81" height="81" rx="16" fill="#1989fa"/>
|
||||||
|
<path d="M40.5 20v25l15 8" stroke="#fff" stroke-width="3" fill="none" stroke-linecap="round"/>
|
||||||
|
<circle cx="40.5" cy="40.5" r="18" stroke="#fff" stroke-width="3" fill="none"/>
|
||||||
|
</svg>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* SVG 图标 - 仪表盘(默认状态)
|
||||||
|
* 使用时请替换为实际的 PNG 图标文件
|
||||||
|
* 尺寸建议: 81x81 px
|
||||||
|
*/
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="81" height="81" viewBox="0 0 81 81">
|
||||||
|
<rect width="81" height="81" rx="16" fill="#999999"/>
|
||||||
|
<path d="M40.5 20v25l15 8" stroke="#fff" stroke-width="3" fill="none" stroke-linecap="round"/>
|
||||||
|
<circle cx="40.5" cy="40.5" r="18" stroke="#fff" stroke-width="3" fill="none"/>
|
||||||
|
</svg>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* SVG 图标 - 功能(选中状态)
|
||||||
|
* 使用时请替换为实际的 PNG 图标文件
|
||||||
|
* 尺寸建议: 81x81 px
|
||||||
|
*/
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="81" height="81" viewBox="0 0 81 81">
|
||||||
|
<rect width="81" height="81" rx="16" fill="#1989fa"/>
|
||||||
|
<rect x="20" y="20" width="18" height="18" rx="4" fill="#fff"/>
|
||||||
|
<rect x="43" y="20" width="18" height="18" rx="4" fill="#fff"/>
|
||||||
|
<rect x="20" y="43" width="18" height="18" rx="4" fill="#fff"/>
|
||||||
|
<rect x="43" y="43" width="18" height="18" rx="4" fill="#fff"/>
|
||||||
|
</svg>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* SVG 图标 - 功能(默认状态)
|
||||||
|
* 使用时请替换为实际的 PNG 图标文件
|
||||||
|
* 尺寸建议: 81x81 px
|
||||||
|
*/
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="81" height="81" viewBox="0 0 81 81">
|
||||||
|
<rect width="81" height="81" rx="16" fill="#999999"/>
|
||||||
|
<rect x="20" y="20" width="18" height="18" rx="4" fill="#fff"/>
|
||||||
|
<rect x="43" y="20" width="18" height="18" rx="4" fill="#fff"/>
|
||||||
|
<rect x="20" y="43" width="18" height="18" rx="4" fill="#fff"/>
|
||||||
|
<rect x="43" y="43" width="18" height="18" rx="4" fill="#fff"/>
|
||||||
|
</svg>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* SVG 图标 - 我的(选中状态)
|
||||||
|
* 使用时请替换为实际的 PNG 图标文件
|
||||||
|
* 尺寸建议: 81x81 px
|
||||||
|
*/
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="81" height="81" viewBox="0 0 81 81">
|
||||||
|
<rect width="81" height="81" rx="16" fill="#1989fa"/>
|
||||||
|
<circle cx="40.5" cy="30" r="11" fill="#fff"/>
|
||||||
|
<path d="M20 62c0-11.3 9.2-20.5 20.5-20.5S61 50.7 61 62" stroke="#fff" stroke-width="4" fill="none" stroke-linecap="round"/>
|
||||||
|
</svg>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* SVG 图标 - 我的(默认状态)
|
||||||
|
* 使用时请替换为实际的 PNG 图标文件
|
||||||
|
* 尺寸建议: 81x81 px
|
||||||
|
*/
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="81" height="81" viewBox="0 0 81 81">
|
||||||
|
<rect width="81" height="81" rx="16" fill="#999999"/>
|
||||||
|
<circle cx="40.5" cy="30" r="11" fill="#fff"/>
|
||||||
|
<path d="M20 62c0-11.3 9.2-20.5 20.5-20.5S61 50.7 61 62" stroke="#fff" stroke-width="4" fill="none" stroke-linecap="round"/>
|
||||||
|
</svg>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"compilerOptions": {"types": ["@dcloudio/types", "miniprogram-api-typings", "@uni-helper/uni-app-types"]}, "include": ["**/*.ts", "**/*.vue", "**/*.js"], "exclude": ["node_modules", "unpackage", "src/**/*.nvue"]}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/* uni.scss - 全局SCSS变量 */
|
||||||
|
$primary-color: #1989fa;
|
||||||
|
$primary-light: #e8f4fd;
|
||||||
|
$text-color: #333333;
|
||||||
|
$text-secondary: #666666;
|
||||||
|
$text-placeholder: #999999;
|
||||||
|
$bg-color: #f5f5f5;
|
||||||
|
$border-color: #eeeeee;
|
||||||
|
|
||||||
|
/* 尺寸变量 */
|
||||||
|
$uni-border-radius: 8rpx;
|
||||||
|
$uni-spacing-sm: 16rpx;
|
||||||
|
$uni-spacing-md: 24rpx;
|
||||||
|
$uni-spacing-lg: 32rpx;
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
/**
|
||||||
|
* API 请求封装
|
||||||
|
* baseURL 前缀: /app
|
||||||
|
* 统一 token 拦截器
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 基础配置
|
||||||
|
const BASE_URL = '/app'
|
||||||
|
const TIMEOUT = 30000
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用请求方法
|
||||||
|
* @param {string} url - 请求路径(会自动拼接 /app 前缀)
|
||||||
|
* @param {object} data - 请求数据
|
||||||
|
* @param {string} method - 请求方法 GET/POST/PUT/DELETE
|
||||||
|
* @param {object} header - 自定义请求头
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export function request(url, data = {}, method = 'GET', header = {}) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
// 获取 token
|
||||||
|
const token = uni.getStorageSync('token')
|
||||||
|
|
||||||
|
// 合并请求头
|
||||||
|
const headers = {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
...header
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加 token
|
||||||
|
if (token) {
|
||||||
|
headers['Authorization'] = `Bearer ${token}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 完整 URL
|
||||||
|
const fullUrl = `${BASE_URL}${url}`
|
||||||
|
|
||||||
|
uni.request({
|
||||||
|
url: fullUrl,
|
||||||
|
data,
|
||||||
|
method,
|
||||||
|
header: headers,
|
||||||
|
timeout: TIMEOUT,
|
||||||
|
success: (res) => {
|
||||||
|
const { statusCode, data } = res
|
||||||
|
|
||||||
|
// HTTP 状态码判断
|
||||||
|
if (statusCode === 200) {
|
||||||
|
// 业务状态码判断(假设后端返回格式为 { code: 0, data, message })
|
||||||
|
if (data.code === 0 || data.code === 200) {
|
||||||
|
resolve(data)
|
||||||
|
} else if (data.code === 401) {
|
||||||
|
// token 过期或未授权
|
||||||
|
handleUnauthorized()
|
||||||
|
reject(new Error(data.message || '登录已过期,请重新登录'))
|
||||||
|
} else {
|
||||||
|
// 其他业务错误
|
||||||
|
uni.showToast({
|
||||||
|
title: data.message || '请求失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
reject(new Error(data.message || '请求失败'))
|
||||||
|
}
|
||||||
|
} else if (statusCode === 401) {
|
||||||
|
handleUnauthorized()
|
||||||
|
reject(new Error('登录已过期,请重新登录'))
|
||||||
|
} else if (statusCode === 403) {
|
||||||
|
reject(new Error('没有权限访问'))
|
||||||
|
} else if (statusCode === 404) {
|
||||||
|
reject(new Error('请求的资源不存在'))
|
||||||
|
} else if (statusCode >= 500) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '服务器错误,请稍后重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
reject(new Error('服务器错误'))
|
||||||
|
} else {
|
||||||
|
reject(new Error(`请求失败(${statusCode})`))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('Request failed:', err)
|
||||||
|
|
||||||
|
let errorMsg = '网络异常,请检查网络连接'
|
||||||
|
|
||||||
|
if (err.errMsg.includes('timeout')) {
|
||||||
|
errorMsg = '请求超时,请稍后重试'
|
||||||
|
} else if (err.errMsg.includes('abort')) {
|
||||||
|
errorMsg = '请求已取消'
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.showToast({
|
||||||
|
title: errorMsg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
|
||||||
|
reject(new Error(errorMsg))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理未授权(token 失效)
|
||||||
|
*/
|
||||||
|
function handleUnauthorized() {
|
||||||
|
// 清除本地存储
|
||||||
|
uni.removeStorageSync('token')
|
||||||
|
uni.removeStorageSync('userInfo')
|
||||||
|
|
||||||
|
// 提示用户
|
||||||
|
uni.showToast({
|
||||||
|
title: '登录已过期,请重新登录',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
})
|
||||||
|
|
||||||
|
// 跳转到登录页
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET 请求
|
||||||
|
*/
|
||||||
|
export function get(url, data = {}, header = {}) {
|
||||||
|
return request(url, data, 'GET', header)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST 请求
|
||||||
|
*/
|
||||||
|
export function post(url, data = {}, header = {}) {
|
||||||
|
return request(url, data, 'POST', header)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PUT 请求
|
||||||
|
*/
|
||||||
|
export function put(url, data = {}, header = {}) {
|
||||||
|
return request(url, data, 'PUT', header)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DELETE 请求
|
||||||
|
*/
|
||||||
|
export function del(url, data = {}, header = {}) {
|
||||||
|
return request(url, data, 'DELETE', header)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传
|
||||||
|
* @param {string} url - 上传接口路径
|
||||||
|
* @param {string} filePath - 本地文件路径
|
||||||
|
* @param {object} formData - 额外表单数据
|
||||||
|
*/
|
||||||
|
export function upload(url, filePath, formData = {}) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const token = uni.getStorageSync('token')
|
||||||
|
|
||||||
|
const header = {}
|
||||||
|
if (token) {
|
||||||
|
header['Authorization'] = `Bearer ${token}`
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.uploadFile({
|
||||||
|
url: `${BASE_URL}${url}`,
|
||||||
|
filePath,
|
||||||
|
name: 'file',
|
||||||
|
formData,
|
||||||
|
header,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
const data = JSON.parse(res.data)
|
||||||
|
if (data.code === 0 || data.code === 200) {
|
||||||
|
resolve(data)
|
||||||
|
} else {
|
||||||
|
reject(new Error(data.message || '上传失败'))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reject(new Error('上传失败'))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('Upload failed:', err)
|
||||||
|
reject(new Error('上传失败'))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 具体业务 API ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送短信验证码
|
||||||
|
*/
|
||||||
|
export function sendSmsCode(data) {
|
||||||
|
return post('/sms/send', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号验证码登录
|
||||||
|
*/
|
||||||
|
export function phoneCodeLogin(data) {
|
||||||
|
return post('/login/phone', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账号密码登录
|
||||||
|
*/
|
||||||
|
export function passwordLogin(data) {
|
||||||
|
return post('/login/password', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录
|
||||||
|
*/
|
||||||
|
export function logout() {
|
||||||
|
return post('/logout').finally(() => {
|
||||||
|
uni.removeStorageSync('token')
|
||||||
|
uni.removeStorageSync('userInfo')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
request,
|
||||||
|
get,
|
||||||
|
post,
|
||||||
|
put,
|
||||||
|
del,
|
||||||
|
upload,
|
||||||
|
sendSmsCode,
|
||||||
|
phoneCodeLogin,
|
||||||
|
passwordLogin,
|
||||||
|
logout
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user