上传代码

This commit is contained in:
2025-08-18 14:20:34 +08:00
commit 527fd07910
2408 changed files with 427370 additions and 0 deletions

View File

@ -0,0 +1,147 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
page {
height: 100%;
overflow: hidden;
background-color: #4095e5;
}
.viewport {
padding: 20rpx;
}
.list {
padding: 0 20rpx;
background-color: #fff;
margin-bottom: 20rpx;
border-radius: 10rpx;
}
.list .item {
line-height: 90rpx;
padding-left: 10rpx;
font-size: 30rpx;
color: #333;
border-top: 1rpx solid #ddd;
position: relative;
text-align: left;
border-radius: 0;
background-color: #fff;
}
.list .item::after {
width: auto;
height: auto;
left: auto;
border: none;
}
.list .item:first-child {
border: none;
}
.list .item::after {
right: 5rpx;
}
.action {
text-align: center;
line-height: 90rpx;
margin-top: 40rpx;
font-size: 32rpx;
color: #333;
}
.action .button {
background-color: #fff;
margin-bottom: 20rpx;
border-radius: 10rpx;
}
.logout {
height: 100rpx;
line-height: 100rpx;
font-size: 35rpx;
text-align: center;
}
.profile {
padding-top: 30rpx;
position: relative;
}
.profile .overview {
display: flex;
height: 130rpx;
padding: 0 36rpx;
color: #fff;
}
.profile .avatar {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
background-color: #eee;
}
.profile .gray {
filter: grayscale(100%);
}
.profile .meta {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
line-height: 30rpx;
padding: 16rpx 0;
margin-left: 20rpx;
}
.profile .nickname {
max-width: 350rpx;
margin-bottom: 16rpx;
font-size: 30rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #000;
}
.profile .SchoolCard {
width: 155px;
height: 23px;
}
.profile .extra {
display: float;
}
.profile .tips {
float: left;
padding: 3px 5px 3px 5px;
font-size: 22rpx;
color: #000;
background-color: #fff;
border: 1px solid #000;
border-radius: 14px;
}
.profile .copy {
float: right;
line-height: 23px;
color: #000;
font-size: 13px;
text-decoration: underline;
}
.profile .update {
padding: 3rpx 10rpx 1rpx;
color: rgba(255, 255, 255, 0.8);
border: 1rpx solid rgba(255, 255, 255, 0.8);
margin-right: 10rpx;
border-radius: 30rpx;
}

View File

@ -0,0 +1 @@
<scroll-view class="viewport" scroll-y enable-back-to-top><view class="profile"><view a:if="{{a}}" class="overview" onTap="{{d}}"><navigator hover-class="none"><image class="avatar" mode="aspectFill" src="{{b}}"></image></navigator><view class="meta"><view class="nickname">{{c}}</view></view></view><view a:else class="overview"><navigator hover-class="none"><image class="avatar gray" mode="aspectFill" src="http://39.101.78.35/images/user_avatar/0/LbLTxpMf-image.png"></image></navigator><view class="meta"><navigator hover-class="none" class="nickname"> 未登录 </navigator></view></view></view></scroll-view><order-dateils u-i="2e6e1e3d-0" onVI="__l"></order-dateils><view class="viewport"><view class="list"><navigator url="../collect/collect" hover-class="none" class="item arrow"> 收藏店铺列表 </navigator></view><view class="list"><navigator url="../testAI/testAI" hover-class="none" class="item arrow"> AI </navigator></view><view class="list" onTap="{{f}}"><view class="item arrow">{{e}}</view></view></view>

View File

@ -0,0 +1,172 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const API_api = require("../../API/api.js");
if (!Math) {
common_vendor.unref(orderDateils)();
}
const orderDateils = () => "../orderDetaiols.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "my",
setup(__props) {
const getUserInfo = () => {
my.getOpenUserInfo({
fail: (err) => {
console.error("【授权失败】错误详情:", JSON.stringify(err, null, 2));
},
success: (res) => {
try {
console.log("【原始响应数据】:", res);
const response = typeof res.response === "string" ? JSON.parse(res.response) : res.response;
if (response == null ? void 0 : response.response) {
const userInfo = response.response;
console.log("【用户信息解析成功】", userInfo);
user.value.userName = userInfo.nickName || "普通用户";
user.value.userAvatar = userInfo.avatar || "https://src.pcsoft.com.cn/d/file/soft/wlgj/wlgx/2017-04-27/20fccb4806f44d7bfafc2360b8934768.jpg";
console.table({
nickName: userInfo.nickName,
avatar: userInfo.avatar,
gender: userInfo.gender === "m" ? "男" : "女",
city: userInfo.city,
province: userInfo.province
});
if (true) {
console.log("【完整用户信息】:", JSON.stringify(userInfo, null, 2));
}
} else {
console.warn("【响应格式异常】", response);
}
} catch (e) {
console.error("【解析失败】", e);
console.log("【原始响应内容】:", res.response);
}
}
});
};
common_vendor.onMounted(() => {
getUserInfo();
});
common_vendor.onShow(() => {
console.log("=== 我的页面显示,开始检查登录状态 ===");
const userInfo = common_vendor.index.getStorageSync("userInfo");
const cookie = common_vendor.index.getStorageSync("cookie");
const sessionId = common_vendor.index.getStorageSync("sessionId");
const isLoggedIn = common_vendor.index.getStorageSync("isLoggedIn");
console.log("本地存储检查:");
console.log("userInfo:", userInfo);
console.log("cookie:", cookie);
console.log("sessionId:", sessionId);
console.log("isLoggedIn:", isLoggedIn);
if (!cookie && !sessionId) {
console.log("缺少认证信息,用户可能未登录");
}
getLoginUser();
});
const user = common_vendor.ref({
userAvatar: "",
userName: "",
message: ""
});
const loginButtonText = common_vendor.ref(user.value.message === "ok" ? "退出登录" : "去登录");
const getLoginUser = () => {
const cookie = common_vendor.index.getStorageSync("cookie");
const sessionId = common_vendor.index.getStorageSync("sessionId");
console.log("发送请求前检查认证信息:");
console.log("cookie:", cookie);
console.log("sessionId:", sessionId);
common_vendor.index.request({
url: API_api.apiImageUrl + "/api/user/current",
method: "GET",
header: {
"cookie": cookie || "",
// 修正这里
"sessionId": sessionId || ""
// 添加sessionId作为备选
},
data: {},
success: (res) => {
console.log("获取用户信息响应:", res.data);
user.value.message = res.data.message;
if (user.value.message === "ok") {
user.value.userName = res.data.data.username || user.value.userName;
user.value.userAvatar = res.data.data.avatarUrl || user.value.userAvatar;
loginButtonText.value = "退出登录";
if (!user.value.userName || !user.value.userAvatar) {
getUserInfo();
}
} else {
console.log("用户未登录,原因:", res.data.message);
loginButtonText.value = "去登录";
}
},
fail(err) {
console.log("获取用户信息失败:", err);
}
});
};
const handleLoginLogout = () => {
if (user.value.message === "ok") {
logout();
} else {
goToLogin();
}
};
const goToLogin = () => {
common_vendor.index.navigateTo({
url: "/pages/login/login"
});
};
const logout = () => {
common_vendor.index.request({
url: API_api.apiImageUrl + "/api/user/logout",
method: "POST",
header: {
"cookie": common_vendor.index.getStorageSync("cookie") || ""
},
success(res) {
console.log("退出登录响应:", res);
common_vendor.index.removeStorageSync("identify");
common_vendor.index.removeStorageSync("cookie");
common_vendor.index.removeStorageSync("userInfo");
common_vendor.index.removeStorageSync("isLoggedIn");
common_vendor.index.removeStorageSync("sessionId");
common_vendor.index.removeStorageSync("notPay");
common_vendor.index.removeStorageSync("cartItems");
user.value.message = "未登录";
user.value.userName = "";
user.value.userAvatar = "";
loginButtonText.value = "去登录";
common_vendor.index.reLaunch({
url: "/pages/login/login"
});
common_vendor.index.showToast({
title: "退出成功",
duration: 2e3
});
},
fail(err) {
console.log("退出登录失败:", err);
common_vendor.index.removeStorageSync("identify");
common_vendor.index.removeStorageSync("cookie");
common_vendor.index.removeStorageSync("userInfo");
common_vendor.index.removeStorageSync("isLoggedIn");
common_vendor.index.removeStorageSync("sessionId");
user.value.message = "未登录";
loginButtonText.value = "去登录";
}
});
};
return (_ctx, _cache) => {
return common_vendor.e({
a: user.value.message === "ok"
}, user.value.message === "ok" ? {
b: user.value.userAvatar || "https://默认头像.jpg",
c: common_vendor.t(user.value.userName || "普通用户"),
d: common_vendor.o(getUserInfo)
} : {}, {
e: common_vendor.t(loginButtonText.value),
f: common_vendor.o(handleLoginLogout)
});
};
}
});
my.createPage(_sfc_main);

View File

@ -0,0 +1,6 @@
{
"defaultTitle": "我的",
"usingComponents": {
"order-dateils": "../orderDetaiols"
}
}