Compare commits

...

2 Commits

Author SHA1 Message Date
zwt13703 c700fa8cf2 Merge branch 'main' of https://git.yitisheng.vip/zhouwentao/wz-uniapp
# Conflicts:
#	src/pages/login/index.vue
#	src/pages/my/index.vue
#	src/styles/common.scss
2026-03-23 19:13:29 +08:00
zwt13703 0ebbf7cc3c updates
Signed-off-by: zwt13703 <zwt13703@gmail.com>
2026-03-23 19:09:09 +08:00
7 changed files with 144 additions and 32 deletions

View File

@ -5,6 +5,7 @@ export const ENV = {
APP_NAME: '领航专昇本志愿通', APP_NAME: '领航专昇本志愿通',
APP_SUBTITLE: '这里填写副标题', APP_SUBTITLE: '这里填写副标题',
PROJECT_CODE: 'UNIAPP_ZSB', PROJECT_CODE: 'UNIAPP_ZSB',
TENANT_ID: '000000',
SECURITY_ENABLE: false, SECURITY_ENABLE: false,
SECURITY_SECRET_KEY: '' SECURITY_SECRET_KEY: ''
}; };

View File

@ -37,6 +37,7 @@ function request(method, url, data = {}, options = {}) {
header['X-App-Timestamp'] = timestamp; header['X-App-Timestamp'] = timestamp;
header['X-App-Sign'] = md5(timestamp + ENV.SECURITY_SECRET_KEY); header['X-App-Sign'] = md5(timestamp + ENV.SECURITY_SECRET_KEY);
} }
header['X-Tenant-Id'] = ENV.TENANT_ID; // 租户 ID
const token = uni.getStorageSync(STORAGE_KEYS.TOKEN); const token = uni.getStorageSync(STORAGE_KEYS.TOKEN);
if (token) { if (token) {

View File

@ -417,11 +417,13 @@ export default {
.field-input { .field-input {
margin-top: 12rpx; margin-top: 12rpx;
padding: 20rpx; padding: 0 20rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: #f5f6fa; background: #f5f6fa;
font-size: 28rpx; font-size: 28rpx;
color: #1f2d3d; color: #1f2d3d;
height: 96rpx;
line-height: 96rpx;
} }
.link { .link {

View File

@ -5,10 +5,13 @@
<text class="header-title">个人中心</text> <text class="header-title">个人中心</text>
<view class="header-actions"> <view class="header-actions">
<view class="action-item" @click="onAction('设置')"> <view class="action-item" @click="onAction('设置')">
<uni-icons type="settings-filled" :size="20" color="#6b7280" /> <image src="@/static/icons/icon-setting.png" class="icon icon-3" />
</view> </view>
<view class="action-item" @click="onAction('通知')"> <view class="action-item" @click="onAction('通知')">
<uni-icons type="notification-filled" :size="20" color="#6b7280" /> <image
src="@/static/icons/icon-notification.png"
class="icon icon-3"
/>
</view> </view>
</view> </view>
</view> </view>
@ -17,35 +20,51 @@
<view class="user-left"> <view class="user-left">
<view class="avatar-wrap"> <view class="avatar-wrap">
<view class="avatar"> <view class="avatar">
<image :src="user.avatar" class="avatar-image" /> <image
<!-- <uni-icons type="person-filled" :size="44" color="#8ca0be" /> --> v-if="isLoggedIn && user.avatar"
:src="user.avatar"
class="avatar-image"
/>
<uni-icons v-else type="person-filled" :size="44" color="#8ca0be" />
</view> </view>
<view class="verified"> <view class="verified" v-if="isLoggedIn">
<uni-icons type="medal-filled" :size="12" color="#ffffff" /> <uni-icons type="medal-filled" :size="12" color="#ffffff" />
</view> </view>
</view> </view>
<view class="user-info"> <view
<text class="user-name">{{ user.name }}</text> class="user-info"
<view class="user-tags"> @click="isLoggedIn ? onAction('') : handleLogin"
>
<text class="user-name">{{ isLoggedIn ? user.name : "未登录" }}</text>
<view class="user-tags" v-if="isLoggedIn">
<text class="tag">{{ user.role }}</text> <text class="tag">{{ user.role }}</text>
<view class="vip-tag"> <view class="vip-tag">
<uni-icons type="vip-filled" :size="12" color="#4a7c59" /> <uni-icons type="vip-filled" :size="12" color="#4a7c59" />
<text class="vip-text">{{ user.vipStatus }}</text> <text class="vip-text">{{ user.vipStatus }}</text>
</view> </view>
</view> </view>
<view class="login-tip" v-else @click="handleLogin">
<text class="login-text">请先登录查看个人信息</text>
</view> </view>
</view> </view>
<view class="primary-btn" @click="onAction('激活会员')">立即激活</view> </view>
<view class="primary-btn" @click="handlePrimaryAction">
{{ isLoggedIn ? "立即激活" : "去登录" }}
</view>
</view> </view>
<view class="stats-card"> <view class="stats-card" v-if="isLoggedIn">
<view class="stat-item" v-for="stat in stats" :key="stat.label"> <view class="stat-item" v-for="stat in stats" :key="stat.label">
<text class="stat-value">{{ stat.value }}</text> <text class="stat-value">{{ stat.value }}</text>
<text class="stat-label">{{ stat.label }}</text> <text class="stat-label">{{ stat.label }}</text>
</view> </view>
</view> </view>
<view class="section" v-for="section in sections" :key="section.title"> <view
class="section"
v-for="section in visibleSections"
:key="section.title"
>
<text class="section-title">{{ section.title }}</text> <text class="section-title">{{ section.title }}</text>
<view class="section-body"> <view class="section-body">
<view <view
@ -66,7 +85,9 @@
</view> </view>
<view class="logout-wrap"> <view class="logout-wrap">
<view class="logout-btn" @click="handleLogout">退出登录</view> <view class="logout-btn" v-if="isLoggedIn" @click="handleLogout">
退出登录
</view>
<text class="version">Version 2.4.1 (Build 20241021)</text> <text class="version">Version 2.4.1 (Build 20241021)</text>
</view> </view>
</view> </view>
@ -75,15 +96,17 @@
<script> <script>
import { STORAGE_KEYS } from "@/common/env"; import { STORAGE_KEYS } from "@/common/env";
const app = getApp(); const app = getApp();
export default { const DEFAULT_USER = {
data() {
return {
user: {
avatar: "", avatar: "",
name: "领航学子", name: "领航学子",
role: "普通用户", role: "普通用户",
vipStatus: "未激活会员", vipStatus: "未激活会员",
}, };
export default {
data() {
return {
isLoggedIn: false,
user: { ...DEFAULT_USER },
stats: [ stats: [
{ label: "志愿数量", value: "12" }, { label: "志愿数量", value: "12" },
{ label: "全省排名", value: "342" }, { label: "全省排名", value: "342" },
@ -93,20 +116,41 @@ export default {
{ {
title: "核心服务", title: "核心服务",
items: [ items: [
{ title: "我的志愿表", icon: "folder-add-filled", bg: "#4a7c59" }, {
title: "我的志愿表",
icon: "folder-add-filled",
bg: "#4a7c59",
requiresLogin: true,
},
{ {
title: "我的订单/缴费记录", title: "我的订单/缴费记录",
icon: "wallet-filled", icon: "wallet-filled",
bg: "#3e8be4", bg: "#3e8be4",
requiresLogin: true,
},
{
title: "成绩/排名记录",
icon: "medal-filled",
bg: "#f08a24",
requiresLogin: true,
},
{
title: "打印设置",
icon: "compose",
bg: "#7b6fe4",
requiresLogin: true,
}, },
{ title: "成绩/排名记录", icon: "medal-filled", bg: "#f08a24" },
{ title: "打印设置", icon: "compose", bg: "#7b6fe4" },
], ],
}, },
{ {
title: "更多功能", title: "更多功能",
items: [ items: [
{ title: "激活会员卡", icon: "vip-filled", bg: "#ff8a33" }, {
title: "激活会员卡",
icon: "vip-filled",
bg: "#ff8a33",
requiresLogin: true,
},
{ title: "商务合作", icon: "shop-filled", bg: "#4b9ce2" }, { title: "商务合作", icon: "shop-filled", bg: "#4b9ce2" },
{ title: "填报指南/教程", icon: "compose", bg: "#6e7a8c" }, { title: "填报指南/教程", icon: "compose", bg: "#6e7a8c" },
{ {
@ -125,18 +169,32 @@ export default {
], ],
}; };
}, },
onShow() { computed: {
const userInfo = app.globalData.UserStorage.getUserInfo(); visibleSections() {
if (userInfo) { if (this.isLoggedIn) {
this.user.avatar = userInfo.avatarUrl; return this.sections;
this.user.name = userInfo.nickName || userInfo.name || this.user.name;
} }
return this.sections
.map((section) => {
const items = section.items.filter((item) => !item.requiresLogin);
return { ...section, items };
})
.filter((section) => section.items.length > 0);
},
},
onShow() {
const token = uni.getStorageSync(STORAGE_KEYS.TOKEN); const token = uni.getStorageSync(STORAGE_KEYS.TOKEN);
if (!token) { this.isLoggedIn = Boolean(token);
uni.navigateTo({ url: "/pages/login/login" }); if (!this.isLoggedIn) {
this.user = { ...DEFAULT_USER };
return; return;
} }
const userInfo = app.globalData.UserStorage.getUserInfo();
console.warn(userInfo);
if (userInfo) {
this.user.avatar = userInfo.avatarUrl || DEFAULT_USER.avatar;
this.user.name = userInfo.nickname || userInfo.name || this.user.name;
}
}, },
methods: { methods: {
onAction(label) { onAction(label) {
@ -146,6 +204,14 @@ export default {
}); });
}, },
onMenuTap(item) { onMenuTap(item) {
if (item.requiresLogin && !this.isLoggedIn) {
uni.showToast({
title: "请先登录",
icon: "none",
});
this.handleLogin();
return;
}
if (item.path) { if (item.path) {
// #ifdef H5 || APP-PLUS // #ifdef H5 || APP-PLUS
uni.navigateTo({ url: item.path }); uni.navigateTo({ url: item.path });
@ -163,6 +229,16 @@ export default {
icon: "none", icon: "none",
}); });
}, },
handlePrimaryAction() {
if (this.isLoggedIn) {
this.onAction("激活会员");
return;
}
this.handleLogin();
},
handleLogin() {
uni.navigateTo({ url: "/pages/login/index" });
},
handleLogout() { handleLogout() {
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
@ -211,7 +287,7 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 8rpx 0 16rpx; padding: 16rpx 0 16rpx;
} }
.header-title { .header-title {
@ -298,6 +374,15 @@ export default {
align-items: center; align-items: center;
} }
.login-tip {
margin-top: 10rpx;
}
.login-text {
font-size: 22rpx;
color: #94a3b8;
}
.tag { .tag {
padding: 4rpx 12rpx; padding: 4rpx 12rpx;
background: #f1f5f9; background: #f1f5f9;

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -179,6 +179,29 @@
overflow: hidden; overflow: hidden;
} }
/* 图标 */
.icon {
display: inline-block;
vertical-align: middle;
flex-shrink: 0;
}
.icon-2 {
width: 32rpx;
height: 32rpx;
}
.icon-3 {
width: 48rpx;
height: 48rpx;
}
.icon-4 {
width: 64rpx;
height: 64rpx;
}
.avatar-image { .avatar-image {
width: 3rem; width: 3rem;
height: 3rem; height: 3rem;