初始化参股

This commit is contained in:
2026-01-27 18:06:04 +08:00
commit 2774a539bf
254 changed files with 33255 additions and 0 deletions

View File

@@ -0,0 +1,228 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_config = require("../../utils/config.js");
class UserInfo extends UTS.UTSType {
static get$UTSMetadata$() {
return {
kind: 2,
get fields() {
return {
id: { type: String, optional: false },
nickName: { type: String, optional: false },
avatar: { type: String, optional: false },
phone: { type: String, optional: false }
};
},
name: "UserInfo"
};
}
constructor(options, metadata = UserInfo.get$UTSMetadata$(), isJSONParse = false) {
super();
this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse);
this.id = this.__props__.id;
this.nickName = this.__props__.nickName;
this.avatar = this.__props__.avatar;
this.phone = this.__props__.phone;
delete this.__props__;
}
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "index",
setup(__props) {
const userInfo = common_vendor.ref(new UserInfo({
id: "",
nickName: "",
avatar: "",
phone: ""
}));
const isLoggedIn = common_vendor.ref(false);
const bookingCount = common_vendor.ref(0);
const favoriteCount = common_vendor.ref(0);
const cacheSize = common_vendor.ref("0KB");
const checkLoginStatus = () => {
var _a, _b, _c, _d;
const token = common_vendor.index.getStorageSync(utils_config.STORAGE_KEYS.TOKEN);
isLoggedIn.value = token != "";
if (isLoggedIn.value) {
const info = common_vendor.index.getStorageSync(utils_config.STORAGE_KEYS.USER_INFO);
if (info != null) {
userInfo.value = new UserInfo({
id: (_a = info["id"]) !== null && _a !== void 0 ? _a : "",
nickName: (_b = info["nickName"]) !== null && _b !== void 0 ? _b : "",
avatar: (_c = info["avatar"]) !== null && _c !== void 0 ? _c : "",
phone: (_d = info["phone"]) !== null && _d !== void 0 ? _d : ""
});
}
}
};
const getCacheSize = () => {
common_vendor.index.getStorageInfo(new UTSJSONObject({
success: (res) => {
const size = res.currentSize;
if (size < 1024) {
cacheSize.value = `${size}KB`;
} else {
cacheSize.value = `${(size / 1024).toFixed(2)}MB`;
}
}
}));
};
const handleLogin = () => {
common_vendor.index.getUserProfile(new UTSJSONObject({
desc: "用于完善用户资料",
success: (res = null) => {
userInfo.value = new UserInfo(
{
id: "",
nickName: res.userInfo.nickName,
avatar: res.userInfo.avatarUrl,
phone: ""
}
// 保存用户信息
);
common_vendor.index.setStorageSync(utils_config.STORAGE_KEYS.USER_INFO, new UTSJSONObject({
nickName: res.userInfo.nickName,
avatar: res.userInfo.avatarUrl
}));
common_vendor.index.setStorageSync(utils_config.STORAGE_KEYS.TOKEN, "mock_token_" + Date.now().toString());
isLoggedIn.value = true;
common_vendor.index.showToast({
title: "登录成功",
icon: "success"
});
},
fail: () => {
common_vendor.index.showToast({
title: "登录失败",
icon: "none"
});
}
}));
};
const handleLogout = () => {
common_vendor.index.showModal(new UTSJSONObject({
title: "提示",
content: "确定要退出登录吗?",
success: (res) => {
if (res.confirm) {
common_vendor.index.removeStorageSync(utils_config.STORAGE_KEYS.TOKEN);
common_vendor.index.removeStorageSync(utils_config.STORAGE_KEYS.USER_INFO);
isLoggedIn.value = false;
userInfo.value = new UserInfo({
id: "",
nickName: "",
avatar: "",
phone: ""
});
common_vendor.index.showToast({
title: "已退出登录",
icon: "success"
});
}
}
}));
};
const goToBookingList = () => {
common_vendor.index.showToast({
title: "功能开发中",
icon: "none"
});
};
const goToFavorites = () => {
common_vendor.index.showToast({
title: "功能开发中",
icon: "none"
});
};
const goToAbout = () => {
common_vendor.index.navigateTo({
url: "/pages/about/index"
});
};
const callService = () => {
common_vendor.index.makePhoneCall({
phoneNumber: "400-888-8888",
fail: () => {
common_vendor.index.showToast({
title: "拨打电话失败",
icon: "none"
});
}
});
};
const openFeedback = () => {
common_vendor.index.showToast({
title: "功能开发中",
icon: "none"
});
};
const checkUpdate = () => {
common_vendor.index.showToast({
title: "已是最新版本",
icon: "success"
});
};
const clearCache = () => {
common_vendor.index.showModal(new UTSJSONObject({
title: "提示",
content: "确定要清除缓存吗?",
success: (res) => {
if (res.confirm) {
common_vendor.index.clearStorage(new UTSJSONObject({
success: () => {
cacheSize.value = "0KB";
common_vendor.index.showToast({
title: "清除成功",
icon: "success"
});
}
}));
}
}
}));
};
common_vendor.onShow(() => {
checkLoginStatus();
getCacheSize();
});
return (_ctx, _cache) => {
"raw js";
const __returned__ = common_vendor.e({
a: common_vendor.unref(userInfo).avatar || "/static/images/default-avatar.png",
b: common_vendor.t(common_vendor.unref(userInfo).nickName || "点击登录"),
c: common_vendor.unref(userInfo).phone
}, common_vendor.unref(userInfo).phone ? {
d: common_vendor.t(common_vendor.unref(userInfo).phone)
} : {}, {
e: !common_vendor.unref(isLoggedIn)
}, !common_vendor.unref(isLoggedIn) ? {
f: common_vendor.o(handleLogin)
} : {}, {
g: common_vendor.unref(bookingCount) > 0
}, common_vendor.unref(bookingCount) > 0 ? {
h: common_vendor.t(common_vendor.unref(bookingCount))
} : {}, {
i: common_vendor.o(goToBookingList),
j: common_vendor.unref(favoriteCount) > 0
}, common_vendor.unref(favoriteCount) > 0 ? {
k: common_vendor.t(common_vendor.unref(favoriteCount))
} : {}, {
l: common_vendor.o(goToFavorites),
m: common_vendor.o(goToAbout),
n: common_vendor.o(callService),
o: common_vendor.o(openFeedback),
p: common_vendor.o(checkUpdate),
q: common_vendor.t(common_vendor.unref(cacheSize)),
r: common_vendor.o(clearCache),
s: common_vendor.unref(isLoggedIn)
}, common_vendor.unref(isLoggedIn) ? {
t: common_vendor.o(handleLogout)
} : {}, {
v: common_vendor.sei(common_vendor.gei(_ctx, ""), "view")
});
return __returned__;
};
}
});
wx.createPage(_sfc_main);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/user/index.js.map

View File

@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "我的",
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view id="{{v}}" change:eS="{{uV.sS}}" eS="{{$eS[v]}}" change:eA="{{uV.sA}}" eA="{{$eA[v]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><scroll-view class="page-scroll" scroll-y enable-flex="true" enhanced="true"><view class="user-section"><view class="user-card"><view class="avatar-wrapper"><image class="user-avatar" src="{{a}}" mode="aspectFill"></image></view><view class="user-info"><text class="user-name">{{b}}</text><text wx:if="{{c}}" class="user-phone">{{d}}</text></view><view wx:if="{{e}}" class="user-action" bindtap="{{f}}"><text class="action-text">登录</text></view></view></view><view class="menu-section"><view class="menu-group"><view class="menu-item" bindtap="{{i}}"><view class="menu-left"><text class="menu-icon">📋</text><text class="menu-text">我的预约</text></view><view class="menu-right"><text wx:if="{{g}}" class="menu-badge">{{h}}</text><text class="menu-arrow"></text></view></view><view class="menu-item" bindtap="{{l}}"><view class="menu-left"><text class="menu-icon">❤️</text><text class="menu-text">我的收藏</text></view><view class="menu-right"><text wx:if="{{j}}" class="menu-badge">{{k}}</text><text class="menu-arrow"></text></view></view></view><view class="menu-group"><view class="menu-item" bindtap="{{m}}"><view class="menu-left"><text class="menu-icon">🏠</text><text class="menu-text">关于我们</text></view><view class="menu-right"><text class="menu-arrow"></text></view></view><view class="menu-item" bindtap="{{n}}"><view class="menu-left"><text class="menu-icon">📞</text><text class="menu-text">联系客服</text></view><view class="menu-right"><text class="menu-value">400-888-8888</text><text class="menu-arrow"></text></view></view><view class="menu-item" bindtap="{{o}}"><view class="menu-left"><text class="menu-icon">💬</text><text class="menu-text">意见反馈</text></view><view class="menu-right"><text class="menu-arrow"></text></view></view></view><view class="menu-group"><view class="menu-item" bindtap="{{p}}"><view class="menu-left"><text class="menu-icon">🔄</text><text class="menu-text">检查更新</text></view><view class="menu-right"><text class="menu-value">v1.0.0</text><text class="menu-arrow"></text></view></view><view class="menu-item" bindtap="{{r}}"><view class="menu-left"><text class="menu-icon">🧹</text><text class="menu-text">清除缓存</text></view><view class="menu-right"><text class="menu-value">{{q}}</text><text class="menu-arrow"></text></view></view></view></view><view wx:if="{{s}}" class="logout-section"><view class="logout-btn" bindtap="{{t}}"><text class="logout-text">退出登录</text></view></view><view class="bottom-space"></view></scroll-view></view><wxs src="/common/uniView.wxs" module="uV"/>

View File

@@ -0,0 +1,156 @@
@import "../../uvue.wxss";
:host{display:flex;flex-direction:column}
/**
* 优艺家沙发翻新 - 全局样式变量
*/
/* ========== 项目主题色 ========== */
/* 辅助色 */
/* 文字颜色 */
/* 背景色 */
/* 边框颜色 */
/* 间距 */
/* 圆角 */
/* 阴影 */
/* ========== uni-app 内置变量 ========== */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page {
flex: 1;
background-color: #f5f5f5;
}
.page-scroll {
flex: 1;
}
/* 用户信息 */
.user-section {
background: linear-gradient(135deg, #D4A574 0%, #B8895A 100%);
padding: 48rpx 32rpx 64rpx;
}
.user-card {
flex-direction: row;
align-items: center;
}
.avatar-wrapper {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
overflow: hidden;
border-width: 4rpx;
border-style: solid;
border-color: rgba(255, 255, 255, 0.5);
}
.user-avatar {
width: 100%;
height: 100%;
}
.user-info {
flex: 1;
margin-left: 24rpx;
}
.user-name {
font-size: 36rpx;
font-weight: 600;
color: #ffffff;
}
.user-phone {
font-size: 26rpx;
color: rgba(255, 255, 255, 0.8);
margin-top: 8rpx;
}
.user-action {
background-color: rgba(255, 255, 255, 0.2);
padding: 16rpx 32rpx;
border-radius: 999rpx;
}
.action-text {
font-size: 28rpx;
color: #ffffff;
}
/* 菜单区域 */
.menu-section {
margin-top: -32rpx;
padding: 0 24rpx;
}
.menu-group {
background-color: #ffffff;
border-radius: 16rpx;
margin-bottom: 24rpx;
overflow: hidden;
}
.menu-item {
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 32rpx;
border-bottom-width: 1rpx;
border-bottom-style: solid;
border-bottom-color: #EBEEF5;
}
.menu-item:last-child {
border-bottom-width: 0;
}
.menu-left {
flex-direction: row;
align-items: center;
}
.menu-icon {
font-size: 40rpx;
margin-right: 24rpx;
}
.menu-text {
font-size: 30rpx;
color: #333333;
}
.menu-right {
flex-direction: row;
align-items: center;
}
.menu-value {
font-size: 26rpx;
color: #909399;
margin-right: 8rpx;
}
.menu-badge {
background-color: #F56C6C;
color: #ffffff;
font-size: 22rpx;
padding: 4rpx 12rpx;
border-radius: 999rpx;
margin-right: 8rpx;
}
.menu-arrow {
font-size: 32rpx;
color: #909399;
}
/* 退出登录 */
.logout-section {
padding: 24rpx;
}
.logout-btn {
background-color: #ffffff;
border-radius: 16rpx;
padding: 28rpx 0;
align-items: center;
}
.logout-text {
font-size: 30rpx;
color: #F56C6C;
}
/* 底部间距 */
.bottom-space {
height: 120rpx;
}