Zhangbw 3 месяцев назад
Родитель
Сommit
6465c2a917

+ 0 - 5
dist/dev/mp-weixin/app.js

@@ -7,7 +7,6 @@ if (!Math) {
   "./pages/strong/strong.js";
   "./pages/rank/rank.js";
   "./pages/mine/mine.js";
-  "./pages/login/login.js";
   "./pages/profile/edit.js";
 }
 const _sfc_main = {
@@ -19,10 +18,6 @@ const _sfc_main = {
     const logs = common_vendor.index.getStorageSync("logs") || [];
     logs.unshift(Date.now());
     common_vendor.index.setStorageSync("logs", logs);
-    common_vendor.index.login({
-      success: (res) => {
-      }
-    });
   },
   onShow: function() {
     console.log("App Show");

+ 0 - 1
dist/dev/mp-weixin/app.json

@@ -5,7 +5,6 @@
     "pages/strong/strong",
     "pages/rank/rank",
     "pages/mine/mine",
-    "pages/login/login",
     "pages/profile/edit"
   ],
   "window": {

+ 6 - 16
dist/dev/mp-weixin/pages/index/index.js

@@ -16,30 +16,20 @@ const _sfc_main = {
     let timer = null;
     common_vendor.onMounted(() => {
       isLoggedIn.value = utils_auth.isLoggedIn();
-      console.log("=== 页面加载 ===");
-      console.log("登录状态:", isLoggedIn.value);
-      console.log("Token:", common_vendor.index.getStorageSync("user_token"));
+      console.log("[首页] 登录状态:", isLoggedIn.value);
+      console.log("[首页] Token:", common_vendor.index.getStorageSync("user_token"));
     });
     common_vendor.onShow(() => {
       isLoggedIn.value = utils_auth.isLoggedIn();
-      console.log("=== 页面显示 ===");
-      console.log("登录状态:", isLoggedIn.value);
+      console.log("[首页] 登录状态:", isLoggedIn.value);
     });
     const handleSearchClick = () => {
       console.log("=== 点击搜索按钮 ===");
       console.log("当前登录状态:", isLoggedIn.value);
       if (!isLoggedIn.value) {
-        console.log("未登录,显示登录提示");
-        common_vendor.index.showModal({
-          title: "提示",
-          content: "查询股票信息需要先登录,是否前往登录?",
-          success: (res) => {
-            if (res.confirm) {
-              common_vendor.index.navigateTo({
-                url: "/pages/login/login"
-              });
-            }
-          }
+        console.log("未登录,显示微信授权弹窗");
+        utils_auth.checkLogin(() => {
+          onSearch();
         });
         return;
       }

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/dev/mp-weixin/pages/index/index.wxml


+ 4 - 20
dist/dev/mp-weixin/pages/index/index.wxss

@@ -72,30 +72,14 @@
   height: 80rpx;
   margin-left: 12rpx;
   border-radius: 999rpx;
-  background: linear-gradient(135deg, #5d55e8, #7568ff);
+  background: #f5f6fb;
   display: flex;
   align-items: center;
   justify-content: center;
-  box-shadow: 0 12rpx 24rpx rgba(93, 85, 232, 0.4);
-}
-.icon-search {
-  width: 0;
-  height: 0;
-  border-radius: 50%;
-  border: 10rpx solid #ffffff;
-  border-color: #ffffff transparent transparent transparent;
-  position: relative;
 }
-.icon-search::after {
-  content: '';
-  position: absolute;
-  width: 24rpx;
-  height: 4rpx;
-  border-radius: 999rpx;
-  background: #ffffff;
-  transform: rotate(45deg);
-  right: -20rpx;
-  bottom: -6rpx;
+.search-icon {
+  width: 48rpx;
+  height: 48rpx;
 }
 .search-tip {
   display: block;

+ 0 - 212
dist/dev/mp-weixin/pages/login/login.js

@@ -1,212 +0,0 @@
-"use strict";
-const common_vendor = require("../../common/vendor.js");
-const utils_api = require("../../utils/api.js");
-const utils_auth = require("../../utils/auth.js");
-const _sfc_main = {
-  data() {
-    return {
-      phone: "",
-      code: "",
-      countdown: 0,
-      agreed: false,
-      canUseWxLogin: true,
-      // 是否支持微信登录
-      timer: null
-    };
-  },
-  onLoad() {
-    this.canUseWxLogin = true;
-  },
-  onUnload() {
-    if (this.timer) {
-      clearInterval(this.timer);
-    }
-  },
-  methods: {
-    /**
-     * 处理微信一键登录
-     */
-    async handleWxLogin() {
-      if (!this.agreed) {
-        common_vendor.index.showToast({
-          title: "请先同意用户协议和隐私政策",
-          icon: "none"
-        });
-        return;
-      }
-      try {
-        common_vendor.index.showLoading({ title: "登录中..." });
-        const loginRes = await common_vendor.index.login();
-        console.log("获取登录code成功:", loginRes.code);
-        const result = await utils_api.wxLogin({
-          code: loginRes.code
-        });
-        console.log("登录成功:", result);
-        utils_auth.setToken(result.data.token);
-        utils_auth.setUserInfo(result.data.userInfo);
-        common_vendor.index.hideLoading();
-        common_vendor.index.showToast({
-          title: "登录成功",
-          icon: "success"
-        });
-        setTimeout(() => {
-          this.navigateBack();
-        }, 1500);
-      } catch (error) {
-        console.error("登录失败:", error);
-        common_vendor.index.hideLoading();
-        common_vendor.index.showToast({
-          title: error.message || "登录失败",
-          icon: "none"
-        });
-      }
-    },
-    /**
-     * 发送验证码
-     */
-    async sendCode() {
-      if (!this.phone) {
-        common_vendor.index.showToast({
-          title: "请输入手机号",
-          icon: "none"
-        });
-        return;
-      }
-      if (!/^1[3-9]\d{9}$/.test(this.phone)) {
-        common_vendor.index.showToast({
-          title: "请输入正确的手机号",
-          icon: "none"
-        });
-        return;
-      }
-      if (!this.agreed) {
-        common_vendor.index.showToast({
-          title: "请先同意用户协议和隐私政策",
-          icon: "none"
-        });
-        return;
-      }
-      try {
-        common_vendor.index.showLoading({ title: "发送中..." });
-        await utils_api.sendSmsCode(this.phone);
-        common_vendor.index.hideLoading();
-        common_vendor.index.showToast({
-          title: "验证码已发送",
-          icon: "success"
-        });
-        this.countdown = 60;
-        this.timer = setInterval(() => {
-          this.countdown--;
-          if (this.countdown <= 0) {
-            clearInterval(this.timer);
-          }
-        }, 1e3);
-      } catch (error) {
-        common_vendor.index.hideLoading();
-        common_vendor.index.showToast({
-          title: error.message || "发送失败",
-          icon: "none"
-        });
-      }
-    },
-    /**
-     * 处理手机号登录
-     */
-    async handlePhoneLogin() {
-      if (!this.phone) {
-        common_vendor.index.showToast({
-          title: "请输入手机号",
-          icon: "none"
-        });
-        return;
-      }
-      if (!/^1[3-9]\d{9}$/.test(this.phone)) {
-        common_vendor.index.showToast({
-          title: "请输入正确的手机号",
-          icon: "none"
-        });
-        return;
-      }
-      if (!this.code) {
-        common_vendor.index.showToast({
-          title: "请输入验证码",
-          icon: "none"
-        });
-        return;
-      }
-      if (!this.agreed) {
-        common_vendor.index.showToast({
-          title: "请先同意用户协议和隐私政策",
-          icon: "none"
-        });
-        return;
-      }
-      try {
-        common_vendor.index.showLoading({ title: "登录中..." });
-        console.log("准备登录,phone:", this.phone, "code:", this.code);
-        const result = await utils_api.phoneLogin(this.phone, this.code);
-        console.log("登录成功,result:", result);
-        utils_auth.setToken(result.data.token);
-        utils_auth.setUserInfo(result.data.userInfo);
-        common_vendor.index.hideLoading();
-        common_vendor.index.showToast({
-          title: "登录成功",
-          icon: "success"
-        });
-        setTimeout(() => {
-          this.navigateBack();
-        }, 1500);
-      } catch (error) {
-        common_vendor.index.hideLoading();
-        common_vendor.index.showToast({
-          title: error.message || "登录失败",
-          icon: "none"
-        });
-      }
-    },
-    /**
-     * 处理协议勾选变化
-     */
-    handleAgreeChange(e) {
-      this.agreed = e.detail.value.length > 0;
-    },
-    /**
-     * 返回上一页或首页
-     */
-    navigateBack() {
-      const pages = getCurrentPages();
-      if (pages.length > 1) {
-        common_vendor.index.navigateBack();
-        const app = getApp();
-        if (app.globalData.loginCallback) {
-          app.globalData.loginCallback();
-          app.globalData.loginCallback = null;
-        }
-      } else {
-        common_vendor.index.switchTab({
-          url: "/pages/index/index"
-        });
-      }
-    }
-  }
-};
-function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
-  return common_vendor.e({
-    a: $data.canUseWxLogin
-  }, $data.canUseWxLogin ? {
-    b: common_vendor.o((...args) => $options.handleWxLogin && $options.handleWxLogin(...args))
-  } : {}, {
-    c: $data.phone,
-    d: common_vendor.o(($event) => $data.phone = $event.detail.value),
-    e: $data.code,
-    f: common_vendor.o(($event) => $data.code = $event.detail.value),
-    g: common_vendor.t($data.countdown > 0 ? `${$data.countdown}秒后重试` : "获取验证码"),
-    h: common_vendor.o((...args) => $options.sendCode && $options.sendCode(...args)),
-    i: $data.countdown > 0,
-    j: common_vendor.o((...args) => $options.handlePhoneLogin && $options.handlePhoneLogin(...args)),
-    k: $data.agreed,
-    l: common_vendor.o((...args) => $options.handleAgreeChange && $options.handleAgreeChange(...args))
-  });
-}
-const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-cdfe2409"], ["__file", "D:/program/gupiao-wx/src/pages/login/login.vue"]]);
-wx.createPage(MiniProgramPage);

+ 0 - 6
dist/dev/mp-weixin/pages/login/login.json

@@ -1,6 +0,0 @@
-{
-  "navigationBarTitleText": "登录",
-  "navigationBarBackgroundColor": "#667eea",
-  "navigationBarTextStyle": "white",
-  "usingComponents": {}
-}

+ 0 - 1
dist/dev/mp-weixin/pages/login/login.wxml

@@ -1 +0,0 @@
-<view class="login-container data-v-cdfe2409"><view class="login-header data-v-cdfe2409"><text class="app-name data-v-cdfe2409">量化选股大师</text><text class="welcome-text data-v-cdfe2409">欢迎登录</text></view><view class="login-form data-v-cdfe2409"><button wx:if="{{a}}" class="wx-login-btn data-v-cdfe2409" bindtap="{{b}}"><image class="wx-icon data-v-cdfe2409" src="/static/images/wechat.png" mode="aspectFit"></image><text class="data-v-cdfe2409">微信一键登录</text></button><view class="divider data-v-cdfe2409"><view class="divider-line data-v-cdfe2409"></view><text class="divider-text data-v-cdfe2409">或</text><view class="divider-line data-v-cdfe2409"></view></view><view class="phone-login data-v-cdfe2409"><view class="input-group data-v-cdfe2409"><input class="input-field data-v-cdfe2409" type="number" placeholder="请输入手机号" maxlength="11" value="{{c}}" bindinput="{{d}}"/></view><view class="input-group code-group data-v-cdfe2409"><input class="input-field code-input data-v-cdfe2409" type="number" placeholder="请输入验证码" maxlength="6" value="{{e}}" bindinput="{{f}}"/><button class="code-btn data-v-cdfe2409" bindtap="{{h}}" disabled="{{i}}">{{g}}</button></view><button class="login-btn data-v-cdfe2409" bindtap="{{j}}">登录</button></view><view class="agreement data-v-cdfe2409"><checkbox-group class="data-v-cdfe2409" bindchange="{{l}}"><label class="data-v-cdfe2409"><checkbox class="data-v-cdfe2409" checked="{{k}}" color="#5d55e8"/><text class="agreement-text data-v-cdfe2409">我已阅读并同意</text><text class="agreement-link data-v-cdfe2409">《用户协议》</text><text class="agreement-text data-v-cdfe2409">和</text><text class="agreement-link data-v-cdfe2409">《隐私政策》</text></label></checkbox-group></view></view></view>

+ 0 - 121
dist/dev/mp-weixin/pages/login/login.wxss

@@ -1,121 +0,0 @@
-
-.login-container.data-v-cdfe2409 {
-  min-height: 100vh;
-  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-  padding: 100rpx 60rpx;
-}
-.login-header.data-v-cdfe2409 {
-  text-align: center;
-  margin-bottom: 100rpx;
-}
-.app-name.data-v-cdfe2409 {
-  display: block;
-  font-size: 48rpx;
-  font-weight: bold;
-  color: #ffffff;
-  margin-bottom: 20rpx;
-}
-.welcome-text.data-v-cdfe2409 {
-  display: block;
-  font-size: 28rpx;
-  color: rgba(255, 255, 255, 0.8);
-}
-.login-form.data-v-cdfe2409 {
-  background: #ffffff;
-  border-radius: 20rpx;
-  padding: 60rpx 40rpx;
-  box-shadow: 0 10rpx 40rpx rgba(0, 0, 0, 0.1);
-}
-.wx-login-btn.data-v-cdfe2409 {
-  width: 100%;
-  height: 90rpx;
-  background: #07c160;
-  color: #ffffff;
-  border-radius: 45rpx;
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  font-size: 32rpx;
-  border: none;
-  margin-bottom: 40rpx;
-}
-.wx-icon.data-v-cdfe2409 {
-  width: 40rpx;
-  height: 40rpx;
-  margin-right: 15rpx;
-}
-.divider.data-v-cdfe2409 {
-  display: flex;
-  align-items: center;
-  margin: 40rpx 0;
-}
-.divider-line.data-v-cdfe2409 {
-  flex: 1;
-  height: 1rpx;
-  background: #e5e5e5;
-}
-.divider-text.data-v-cdfe2409 {
-  padding: 0 20rpx;
-  color: #999999;
-  font-size: 24rpx;
-}
-.phone-login.data-v-cdfe2409 {
-  margin-top: 40rpx;
-}
-.input-group.data-v-cdfe2409 {
-  margin-bottom: 30rpx;
-}
-.input-field.data-v-cdfe2409 {
-  width: 100%;
-  height: 90rpx;
-  background: #f5f6fb;
-  border-radius: 45rpx;
-  padding: 0 30rpx;
-  font-size: 28rpx;
-  box-sizing: border-box;
-}
-.code-group.data-v-cdfe2409 {
-  display: flex;
-  align-items: center;
-}
-.code-input.data-v-cdfe2409 {
-  flex: 1;
-  margin-right: 20rpx;
-}
-.code-btn.data-v-cdfe2409 {
-  width: 200rpx;
-  height: 90rpx;
-  background: #5d55e8;
-  color: #ffffff;
-  border-radius: 45rpx;
-  font-size: 24rpx;
-  border: none;
-  padding: 0;
-  line-height: 90rpx;
-}
-.code-btn[disabled].data-v-cdfe2409 {
-  background: #cccccc;
-}
-.login-btn.data-v-cdfe2409 {
-  width: 100%;
-  height: 90rpx;
-  background: #5d55e8;
-  color: #ffffff;
-  border-radius: 45rpx;
-  font-size: 32rpx;
-  border: none;
-  margin-top: 20rpx;
-}
-.agreement.data-v-cdfe2409 {
-  margin-top: 40rpx;
-  text-align: center;
-}
-.agreement-text.data-v-cdfe2409 {
-  font-size: 24rpx;
-  color: #999999;
-  margin: 0 5rpx;
-}
-.agreement-link.data-v-cdfe2409 {
-  font-size: 24rpx;
-  color: #5d55e8;
-}

+ 5 - 3
dist/dev/mp-weixin/pages/mine/mine.js

@@ -1,6 +1,7 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
 const utils_auth = require("../../utils/auth.js");
+require("../../utils/api.js");
 const _sfc_main = {
   __name: "mine",
   setup(__props) {
@@ -19,11 +20,12 @@ const _sfc_main = {
     });
     const loadUserInfo = () => {
       isLoggedIn.value = utils_auth.isLoggedIn();
+      console.log("[个人中心] 登录状态:", isLoggedIn.value);
       if (isLoggedIn.value) {
         const storedInfo = utils_auth.getUserInfo();
         if (storedInfo) {
           userInfo.value = storedInfo;
-          console.log("加载用户信息:", userInfo.value);
+          console.log("[个人中心] 加载用户信息:", userInfo.value);
         }
       }
     };
@@ -52,8 +54,8 @@ const _sfc_main = {
           }
         });
       } else {
-        common_vendor.index.navigateTo({
-          url: "/pages/login/login"
+        utils_auth.wxAuthLogin(() => {
+          loadUserInfo();
         });
       }
     };

+ 3 - 13
dist/dev/mp-weixin/pages/pool/pool.js

@@ -1,6 +1,7 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
 const utils_auth = require("../../utils/auth.js");
+require("../../utils/api.js");
 const _sfc_main = {
   __name: "pool",
   setup(__props) {
@@ -11,7 +12,7 @@ const _sfc_main = {
     const isLoggedIn = common_vendor.ref(false);
     const checkLogin = () => {
       isLoggedIn.value = utils_auth.isLoggedIn();
-      console.log("超短池 - 登录状态:", isLoggedIn.value);
+      console.log("[超短池] 登录状态:", isLoggedIn.value);
       return isLoggedIn.value;
     };
     const checkPurchaseStatus = () => {
@@ -37,18 +38,7 @@ const _sfc_main = {
     const showPurchaseModal = () => {
       console.log("点击立即解锁");
       if (!checkLogin()) {
-        console.log("未登录,跳转登录页");
-        common_vendor.index.showModal({
-          title: "提示",
-          content: "解锁超短池需要先登录,是否前往登录?",
-          success: (res) => {
-            if (res.confirm) {
-              common_vendor.index.navigateTo({
-                url: "/pages/login/login"
-              });
-            }
-          }
-        });
+        console.log("未登录,显示微信授权弹窗");
         return;
       }
       console.log("已登录,显示购买弹窗");

+ 2 - 0
dist/dev/mp-weixin/pages/profile/edit.js

@@ -13,6 +13,7 @@ const _sfc_main = {
     };
   },
   onLoad() {
+    console.log("[编辑资料] 页面加载");
     this.loadUserInfo();
   },
   methods: {
@@ -21,6 +22,7 @@ const _sfc_main = {
      */
     loadUserInfo() {
       const userInfo = utils_auth.getUserInfo();
+      console.log("[编辑资料] 加载用户信息:", userInfo);
       if (userInfo) {
         this.avatarUrl = userInfo.avatar || "/static/images/head.png";
         this.nickname = userInfo.nickname || "";

+ 33 - 11
dist/dev/mp-weixin/pages/rank/rank.js

@@ -1,10 +1,11 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
 const utils_api = require("../../utils/api.js");
-require("../../utils/auth.js");
+const utils_auth = require("../../utils/auth.js");
 const _sfc_main = {
   __name: "rank",
   setup(__props) {
+    const isLoggedIn = common_vendor.ref(false);
     const portfolio = common_vendor.ref({
       balance: 1e5,
       profit: 0,
@@ -14,11 +15,14 @@ const _sfc_main = {
       rank: 5,
       rate: 0
     });
-    const leaderboard = common_vendor.ref([
-      { rank: 1, name: "量化王者 608", rate: 35.2 },
-      { rank: 2, name: "短线猎手 012", rate: 28.9 },
-      { rank: 3, name: "趋势追踪者", rate: 22.1 }
-    ]);
+    const mockLeaderboard = [
+      { rank: 1, name: "量化王者 ***", rate: 35.2 },
+      { rank: 2, name: "短线猎手 ***", rate: 28.9 },
+      { rank: 3, name: "趋势追踪者 ***", rate: 22.1 },
+      { rank: 4, name: "稳健投资 ***", rate: 18.5 },
+      { rank: 5, name: "价值发现 ***", rate: 15.3 }
+    ];
+    const leaderboard = common_vendor.ref(mockLeaderboard);
     const formatAmount = (amount) => {
       return amount.toLocaleString("zh-CN");
     };
@@ -37,7 +41,21 @@ const _sfc_main = {
         return "rank-third";
       return "";
     };
-    const loadData = async () => {
+    const goToLogin = () => {
+      utils_auth.wxAuthLogin(() => {
+        checkLoginAndLoadData();
+      });
+    };
+    const checkLoginAndLoadData = () => {
+      isLoggedIn.value = utils_auth.isLoggedIn();
+      console.log("[模拟排名] 登录状态:", isLoggedIn.value);
+      if (isLoggedIn.value) {
+        loadRealData();
+      } else {
+        leaderboard.value = mockLeaderboard;
+      }
+    };
+    const loadRealData = async () => {
       try {
         const portfolioRes = await utils_api.getUserPortfolio();
         if (portfolioRes.code === 0 && portfolioRes.data) {
@@ -57,10 +75,10 @@ const _sfc_main = {
       }
     };
     common_vendor.onMounted(() => {
-      loadData();
+      checkLoginAndLoadData();
     });
     return (_ctx, _cache) => {
-      return {
+      return common_vendor.e({
         a: common_vendor.t(formatAmount(portfolio.value.balance)),
         b: common_vendor.t(formatProfit(portfolio.value.profit)),
         c: common_vendor.t(formatRate(portfolio.value.profitRate)),
@@ -79,8 +97,12 @@ const _sfc_main = {
             f: common_vendor.n(item.rate >= 0 ? "rate-positive" : "rate-negative"),
             g: index
           };
-        })
-      };
+        }),
+        j: !isLoggedIn.value ? 1 : "",
+        k: !isLoggedIn.value
+      }, !isLoggedIn.value ? {
+        l: common_vendor.o(goToLogin)
+      } : {});
     };
   }
 };

+ 1 - 1
dist/dev/mp-weixin/pages/rank/rank.wxml

@@ -1 +1 @@
-<view class="page-rank"><view class="page-title-card"><text class="page-title-text">量化选股大师</text></view><scroll-view class="scroll-view" scroll-y><view class="content-wrapper"><view class="portfolio-card"><view class="portfolio-header"><view class="portfolio-icon">💼</view><text class="portfolio-title">我的模拟资产</text></view><view class="portfolio-content"><view class="portfolio-main"><view class="portfolio-label">当前账户余额 (¥)</view><view class="portfolio-amount">{{a}}</view></view><view class="portfolio-profit"><view class="profit-label">总盈亏 / 收益率</view><view class="{{['profit-value', d]}}"> ¥ {{b}} ({{c}}%) </view></view></view></view><view class="leaderboard-section"><view class="section-header"><view class="trophy-icon">🏆</view><text class="section-title">模拟交易排行榜</text></view><view class="my-rank-card"><view class="rank-number">#{{e}}</view><view class="rank-info"><text class="rank-name">您 (本期收益)</text></view><view class="{{['rank-rate', h]}}">{{f}}{{g}}% </view></view><view class="leaderboard-list"><view wx:for="{{i}}" wx:for-item="item" wx:key="g" class="leaderboard-item"><view class="{{['rank-badge', item.b]}}"> #{{item.a}}</view><view class="user-info"><text class="user-name">{{item.c}}</text></view><view class="{{['user-rate', item.f]}}">{{item.d}}{{item.e}}% </view></view></view><view class="leaderboard-note"><text class="note-text">排名每日更新,收益基于系统信号的模拟交易。</text></view></view><view class="bottom-safe-area"></view></view></scroll-view></view>
+<view class="page-rank"><view class="page-title-card"><text class="page-title-text">量化选股大师</text></view><scroll-view class="scroll-view" scroll-y><view class="{{['content-wrapper', j && 'blur-content']}}"><view class="portfolio-card"><view class="portfolio-header"><view class="portfolio-icon">💼</view><text class="portfolio-title">我的模拟资产</text></view><view class="portfolio-content"><view class="portfolio-main"><view class="portfolio-label">当前账户余额 (¥)</view><view class="portfolio-amount">{{a}}</view></view><view class="portfolio-profit"><view class="profit-label">总盈亏 / 收益率</view><view class="{{['profit-value', d]}}"> ¥ {{b}} ({{c}}%) </view></view></view></view><view class="leaderboard-section"><view class="section-header"><view class="trophy-icon">🏆</view><text class="section-title">模拟交易排行榜</text></view><view class="my-rank-card"><view class="rank-number">#{{e}}</view><view class="rank-info"><text class="rank-name">您 (本期收益)</text></view><view class="{{['rank-rate', h]}}">{{f}}{{g}}% </view></view><view class="leaderboard-list"><view wx:for="{{i}}" wx:for-item="item" wx:key="g" class="leaderboard-item"><view class="{{['rank-badge', item.b]}}"> #{{item.a}}</view><view class="user-info"><text class="user-name">{{item.c}}</text></view><view class="{{['user-rate', item.f]}}">{{item.d}}{{item.e}}% </view></view></view><view class="leaderboard-note"><text class="note-text">排名每日更新,收益基于系统信号的模拟交易。</text></view></view><view class="bottom-safe-area"></view></view></scroll-view><view wx:if="{{k}}" class="login-mask"><view class="login-prompt"><view class="lock-icon">🔒</view><text class="prompt-title">登录后查看完整数据</text><text class="prompt-desc">登录后可查看您的模拟资产和完整排行榜</text><button class="login-button" bindtap="{{l}}">立即登录</button></view></view></view>

+ 60 - 0
dist/dev/mp-weixin/pages/rank/rank.wxss

@@ -196,3 +196,63 @@
 .bottom-safe-area {
   height: 80rpx;
 }
+
+/* 模糊效果 */
+.blur-content {
+  filter: blur(8rpx);
+  pointer-events: none;
+}
+
+/* 登录遮罩层 */
+.login-mask {
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background: rgba(0, 0, 0, 0.4);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  z-index: 999;
+}
+.login-prompt {
+  width: 560rpx;
+  max-width: 560rpx;
+  background: #ffffff;
+  border-radius: 24rpx;
+  padding: 50rpx 40rpx;
+  margin: 0 auto;
+  text-align: center;
+  box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.3);
+  box-sizing: border-box;
+}
+.lock-icon {
+  font-size: 72rpx;
+  margin-bottom: 20rpx;
+}
+.prompt-title {
+  display: block;
+  font-size: 32rpx;
+  font-weight: 600;
+  color: #222222;
+  margin-bottom: 12rpx;
+}
+.prompt-desc {
+  display: block;
+  font-size: 24rpx;
+  color: #999999;
+  line-height: 1.5;
+  margin-bottom: 32rpx;
+}
+.login-button {
+  width: 100%;
+  height: 80rpx;
+  background: linear-gradient(135deg, #5d55e8, #7568ff);
+  color: #ffffff;
+  border-radius: 40rpx;
+  font-size: 30rpx;
+  font-weight: 600;
+  border: none;
+  box-shadow: 0 8rpx 24rpx rgba(93, 85, 232, 0.4);
+}

+ 35 - 57
dist/dev/mp-weixin/pages/strong/strong.js

@@ -1,9 +1,11 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
 const utils_auth = require("../../utils/auth.js");
+require("../../utils/api.js");
 const _sfc_main = {
   __name: "strong",
   setup(__props) {
+    const isLoggedIn = common_vendor.ref(false);
     const stockList = common_vendor.ref([
       {
         name: "美的集团",
@@ -24,11 +26,14 @@ const _sfc_main = {
     const currentStock = common_vendor.ref({});
     const buyQuantity = common_vendor.ref("100");
     const sellQuantity = common_vendor.ref("100");
-    const isLoggedIn = common_vendor.ref(false);
     const checkLogin = () => {
       isLoggedIn.value = utils_auth.isLoggedIn();
-      console.log("强势池 - 登录状态:", isLoggedIn.value);
-      return isLoggedIn.value;
+      console.log("[强势池] 登录状态:", isLoggedIn.value);
+    };
+    const goToLogin = () => {
+      utils_auth.wxAuthLogin(() => {
+        checkLogin();
+      });
     };
     const buyTotalAmount = common_vendor.computed(() => {
       const qty = parseInt(buyQuantity.value) || 0;
@@ -42,22 +47,6 @@ const _sfc_main = {
     });
     const showBuyModal = (stock) => {
       console.log("点击买入按钮");
-      if (!checkLogin()) {
-        console.log("未登录,提示登录");
-        common_vendor.index.showModal({
-          title: "提示",
-          content: "模拟交易需要先登录,是否前往登录?",
-          success: (res) => {
-            if (res.confirm) {
-              common_vendor.index.navigateTo({
-                url: "/pages/login/login"
-              });
-            }
-          }
-        });
-        return;
-      }
-      console.log("已登录,显示买入弹窗");
       currentStock.value = { ...stock };
       buyQuantity.value = "100";
       showBuyModalFlag.value = true;
@@ -67,22 +56,6 @@ const _sfc_main = {
     };
     const showSellModal = (stock) => {
       console.log("点击卖出按钮");
-      if (!checkLogin()) {
-        console.log("未登录,提示登录");
-        common_vendor.index.showModal({
-          title: "提示",
-          content: "模拟交易需要先登录,是否前往登录?",
-          success: (res) => {
-            if (res.confirm) {
-              common_vendor.index.navigateTo({
-                url: "/pages/login/login"
-              });
-            }
-          }
-        });
-        return;
-      }
-      console.log("已登录,显示卖出弹窗");
       currentStock.value = { ...stock };
       sellQuantity.value = "100";
       showSellModalFlag.value = true;
@@ -205,33 +178,38 @@ const _sfc_main = {
         c: selectedDate.value,
         d: common_vendor.o(($event) => selectedDate.value = $event.detail.value),
         e: common_vendor.o(onHistorySearch),
-        f: showBuyModalFlag.value
+        f: !isLoggedIn.value ? 1 : "",
+        g: !isLoggedIn.value
+      }, !isLoggedIn.value ? {
+        h: common_vendor.o(goToLogin)
+      } : {}, {
+        i: showBuyModalFlag.value
       }, showBuyModalFlag.value ? {
-        g: common_vendor.o(closeBuyModal),
-        h: common_vendor.t(currentStock.value.name),
-        i: common_vendor.t(currentStock.value.code),
-        j: common_vendor.t(currentStock.value.price),
-        k: common_vendor.o([($event) => buyQuantity.value = $event.detail.value, onBuyQuantityChange]),
-        l: buyQuantity.value,
-        m: common_vendor.t(common_vendor.unref(buyTotalAmount).toFixed(2)),
-        n: common_vendor.o(handleBuy),
-        o: common_vendor.o(() => {
+        j: common_vendor.o(closeBuyModal),
+        k: common_vendor.t(currentStock.value.name),
+        l: common_vendor.t(currentStock.value.code),
+        m: common_vendor.t(currentStock.value.price),
+        n: common_vendor.o([($event) => buyQuantity.value = $event.detail.value, onBuyQuantityChange]),
+        o: buyQuantity.value,
+        p: common_vendor.t(common_vendor.unref(buyTotalAmount).toFixed(2)),
+        q: common_vendor.o(handleBuy),
+        r: common_vendor.o(() => {
         }),
-        p: common_vendor.o(closeBuyModal)
+        s: common_vendor.o(closeBuyModal)
       } : {}, {
-        q: showSellModalFlag.value
+        t: showSellModalFlag.value
       }, showSellModalFlag.value ? {
-        r: common_vendor.o(closeSellModal),
-        s: common_vendor.t(currentStock.value.name),
-        t: common_vendor.t(currentStock.value.code),
-        v: common_vendor.t(currentStock.value.price),
-        w: common_vendor.o([($event) => sellQuantity.value = $event.detail.value, onSellQuantityChange]),
-        x: sellQuantity.value,
-        y: common_vendor.t(common_vendor.unref(sellTotalAmount).toFixed(2)),
-        z: common_vendor.o(handleSell),
-        A: common_vendor.o(() => {
+        v: common_vendor.o(closeSellModal),
+        w: common_vendor.t(currentStock.value.name),
+        x: common_vendor.t(currentStock.value.code),
+        y: common_vendor.t(currentStock.value.price),
+        z: common_vendor.o([($event) => sellQuantity.value = $event.detail.value, onSellQuantityChange]),
+        A: sellQuantity.value,
+        B: common_vendor.t(common_vendor.unref(sellTotalAmount).toFixed(2)),
+        C: common_vendor.o(handleSell),
+        D: common_vendor.o(() => {
         }),
-        B: common_vendor.o(closeSellModal)
+        E: common_vendor.o(closeSellModal)
       } : {});
     };
   }

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/dev/mp-weixin/pages/strong/strong.wxml


+ 60 - 0
dist/dev/mp-weixin/pages/strong/strong.wxss

@@ -376,3 +376,63 @@
 .bottom-safe-area {
   height: 80rpx;
 }
+
+/* 模糊效果 */
+.blur-content {
+  filter: blur(8rpx);
+  pointer-events: none;
+}
+
+/* 登录遮罩层 */
+.login-mask {
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background: rgba(0, 0, 0, 0.4);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  z-index: 999;
+}
+.login-prompt {
+  width: 560rpx;
+  max-width: 560rpx;
+  background: #ffffff;
+  border-radius: 24rpx;
+  padding: 50rpx 40rpx;
+  margin: 0 auto;
+  text-align: center;
+  box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.3);
+  box-sizing: border-box;
+}
+.lock-icon {
+  font-size: 72rpx;
+  margin-bottom: 20rpx;
+}
+.prompt-title {
+  display: block;
+  font-size: 32rpx;
+  font-weight: 600;
+  color: #222222;
+  margin-bottom: 12rpx;
+}
+.prompt-desc {
+  display: block;
+  font-size: 24rpx;
+  color: #999999;
+  line-height: 1.5;
+  margin-bottom: 32rpx;
+}
+.login-button {
+  width: 100%;
+  height: 80rpx;
+  background: linear-gradient(135deg, #5d55e8, #7568ff);
+  color: #ffffff;
+  border-radius: 40rpx;
+  font-size: 30rpx;
+  font-weight: 600;
+  border: none;
+  box-shadow: 0 8rpx 24rpx rgba(93, 85, 232, 0.4);
+}

+ 22 - 29
dist/dev/mp-weixin/utils/api.js

@@ -1,10 +1,12 @@
 "use strict";
 const common_vendor = require("../common/vendor.js");
-const utils_auth = require("./auth.js");
 const BASE_URL = "http://localhost:8080";
+const getToken = () => {
+  return common_vendor.index.getStorageSync("user_token") || null;
+};
 const request = (options) => {
   return new Promise((resolve, reject) => {
-    const token = utils_auth.getToken();
+    const token = getToken();
     const header = options.header || {};
     if (token) {
       header["Authorization"] = `Bearer ${token}`;
@@ -20,12 +22,26 @@ const request = (options) => {
         } else if (res.statusCode === 401) {
           common_vendor.index.showToast({
             title: "登录已过期,请重新登录",
-            icon: "none"
+            icon: "none",
+            duration: 2e3
           });
           common_vendor.index.removeStorageSync("user_token");
-          common_vendor.index.navigateTo({
-            url: "/pages/login/login"
-          });
+          common_vendor.index.removeStorageSync("user_info");
+          setTimeout(() => {
+            common_vendor.index.showModal({
+              title: "登录提示",
+              content: "登录已过期,是否重新登录?",
+              confirmText: "立即登录",
+              cancelText: "暂不登录",
+              success: (modalRes) => {
+                if (modalRes.confirm) {
+                  "./auth.js".then((auth) => {
+                    auth.wxAuthLogin();
+                  });
+                }
+              }
+            });
+          }, 2e3);
           reject(new Error("未授权"));
         } else {
           reject(new Error(res.data.message || "服务暂不可用"));
@@ -47,27 +63,6 @@ const wxLogin = (params) => {
     data: params
   });
 };
-const phoneLogin = (phone, verifyCode) => {
-  console.log("phoneLogin调用参数:", { phone, verifyCode });
-  return request({
-    url: "/v1/auth/phoneLogin",
-    method: "POST",
-    header: {
-      "content-type": "application/json"
-    },
-    data: { phone, verifyCode }
-  });
-};
-const sendSmsCode = (phone) => {
-  return request({
-    url: "/v1/auth/sendCode",
-    method: "POST",
-    header: {
-      "content-type": "application/json"
-    },
-    data: { phone }
-  });
-};
 const updateUserProfile = (data) => {
   return request({
     url: "/v1/user/profile",
@@ -110,8 +105,6 @@ const getLeaderboard = () => {
 exports.getLeaderboard = getLeaderboard;
 exports.getSuggestions = getSuggestions;
 exports.getUserPortfolio = getUserPortfolio;
-exports.phoneLogin = phoneLogin;
 exports.searchStocks = searchStocks;
-exports.sendSmsCode = sendSmsCode;
 exports.updateUserProfile = updateUserProfile;
 exports.wxLogin = wxLogin;

+ 44 - 10
dist/dev/mp-weixin/utils/auth.js

@@ -1,5 +1,7 @@
 "use strict";
+Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
 const common_vendor = require("../common/vendor.js");
+const utils_api = require("./api.js");
 const TOKEN_KEY = "user_token";
 const USER_INFO_KEY = "user_info";
 const setToken = (token) => {
@@ -28,23 +30,52 @@ const logout = () => {
   removeToken();
   removeUserInfo();
 };
+const wxAuthLogin = async (successCallback, failCallback) => {
+  try {
+    const loginRes = await common_vendor.index.login();
+    console.log("[微信登录] 获取code成功:", loginRes.code);
+    const result = await utils_api.wxLogin({
+      code: loginRes.code
+    });
+    console.log("[微信登录] 登录成功:", result);
+    setToken(result.data.token);
+    setUserInfo(result.data.userInfo);
+    common_vendor.index.showToast({
+      title: "登录成功",
+      icon: "success",
+      duration: 1500
+    });
+    if (successCallback) {
+      setTimeout(() => {
+        successCallback();
+      }, 1500);
+    }
+    return true;
+  } catch (error) {
+    console.error("[微信登录] 登录失败:", error);
+    common_vendor.index.showToast({
+      title: error.message || "登录失败",
+      icon: "none",
+      duration: 2e3
+    });
+    if (failCallback) {
+      failCallback(error);
+    }
+    return false;
+  }
+};
 const checkLogin = (callback) => {
   if (isLoggedIn()) {
     return true;
   }
   common_vendor.index.showModal({
-    title: "提示",
-    content: "此操作需要登录,是否前往登录?",
+    title: "登录提示",
+    content: "此功能需要登录后使用,是否立即登录?",
+    confirmText: "立即登录",
+    cancelText: "暂不登录",
     success: (res) => {
       if (res.confirm) {
-        common_vendor.index.navigateTo({
-          url: "/pages/login/login",
-          success: () => {
-            if (callback) {
-              getApp().globalData.loginCallback = callback;
-            }
-          }
-        });
+        wxAuthLogin(callback);
       }
     }
   });
@@ -55,5 +86,8 @@ exports.getToken = getToken;
 exports.getUserInfo = getUserInfo;
 exports.isLoggedIn = isLoggedIn;
 exports.logout = logout;
+exports.removeToken = removeToken;
+exports.removeUserInfo = removeUserInfo;
 exports.setToken = setToken;
 exports.setUserInfo = setUserInfo;
+exports.wxAuthLogin = wxAuthLogin;

+ 0 - 7
src/App.vue

@@ -9,13 +9,6 @@ export default {
     const logs = uni.getStorageSync('logs') || []
     logs.unshift(Date.now())
     uni.setStorageSync('logs', logs)
-
-    // 登录
-    uni.login({
-      success: res => {
-        // 发送 res.code 到后台换取 openId, sessionKey, unionId
-      }
-    })
   },
   onShow: function() {
     console.log('App Show')

+ 5 - 22
src/components/SearchCard.vue

@@ -14,7 +14,7 @@
         @confirm="handleSearch"
       />
       <view class="search-button" @click="handleSearch">
-        <text class="icon-search"></text>
+        <image class="search-icon" src="/static/images/tab_search.png" mode="aspectFit"></image>
       </view>
     </view>
 
@@ -96,32 +96,15 @@ const handleSearch = () => {
   height: 80rpx;
   margin-left: 12rpx;
   border-radius: 999rpx;
-  background: linear-gradient(135deg, #5d55e8, #7568ff);
+  background: #f5f6fb;
   display: flex;
   align-items: center;
   justify-content: center;
-  box-shadow: 0 12rpx 24rpx rgba(93, 85, 232, 0.4);
 }
 
-.icon-search {
-  width: 0;
-  height: 0;
-  border-radius: 50%;
-  border: 10rpx solid #ffffff;
-  border-color: #ffffff transparent transparent transparent;
-  position: relative;
-}
-
-.icon-search::after {
-  content: '';
-  position: absolute;
-  width: 24rpx;
-  height: 4rpx;
-  border-radius: 999rpx;
-  background: #ffffff;
-  transform: rotate(45deg);
-  right: -20rpx;
-  bottom: -6rpx;
+.search-icon {
+  width: 48rpx;
+  height: 48rpx;
 }
 
 .search-tip {

+ 0 - 8
src/pages.json

@@ -30,14 +30,6 @@
         "navigationBarTitleText": "个人中心"
       }
     },
-    {
-      "path": "pages/login/login",
-      "style": {
-        "navigationBarTitleText": "登录",
-        "navigationBarBackgroundColor": "#667eea",
-        "navigationBarTextStyle": "white"
-      }
-    },
     {
       "path": "pages/profile/edit",
       "style": {

+ 13 - 39
src/pages/index/index.vue

@@ -25,7 +25,7 @@
             />
             <!-- 搜索按钮(统一处理登录检查) -->
             <view class="search-button" @click="handleSearchClick">
-              <text class="icon-search"></text>
+              <image class="search-icon" src="/static/images/tab_search.png" mode="aspectFit"></image>
             </view>
           </view>
           
@@ -131,7 +131,7 @@
 <script setup>
 import { ref, onMounted } from 'vue'
 import { getSuggestions, searchStocks } from '../../utils/api.js'
-import { isLoggedIn as checkLoginStatus } from '../../utils/auth.js'
+import { isLoggedIn as checkLoginStatus, checkLogin } from '../../utils/auth.js'
 
 // 引入 onShow 生命周期
 import { onShow } from '@dcloudio/uni-app'
@@ -151,9 +151,8 @@ let timer = null
  */
 onMounted(() => {
   isLoggedIn.value = checkLoginStatus()
-  console.log('=== 页面加载 ===')
-  console.log('登录状态:', isLoggedIn.value)
-  console.log('Token:', uni.getStorageSync('user_token'))
+  console.log('[首页] 登录状态:', isLoggedIn.value)
+  console.log('[首页] Token:', uni.getStorageSync('user_token'))
 })
 
 /**
@@ -161,8 +160,7 @@ onMounted(() => {
  */
 onShow(() => {
   isLoggedIn.value = checkLoginStatus()
-  console.log('=== 页面显示 ===')
-  console.log('登录状态:', isLoggedIn.value)
+  console.log('[首页] 登录状态:', isLoggedIn.value)
 })
 
 /**
@@ -174,17 +172,10 @@ const handleSearchClick = () => {
   
   // 检查登录状态
   if (!isLoggedIn.value) {
-    console.log('未登录,显示登录提示')
-    uni.showModal({
-      title: '提示',
-      content: '查询股票信息需要先登录,是否前往登录?',
-      success: (res) => {
-        if (res.confirm) {
-          uni.navigateTo({
-            url: '/pages/login/login'
-          })
-        }
-      }
+    console.log('未登录,显示微信授权弹窗')
+    checkLogin(() => {
+      // 登录成功后执行搜索
+      onSearch()
     })
     return
   }
@@ -376,32 +367,15 @@ const onInputBlur = () => {
   height: 80rpx;
   margin-left: 12rpx;
   border-radius: 999rpx;
-  background: linear-gradient(135deg, #5d55e8, #7568ff);
+  background: #f5f6fb;
   display: flex;
   align-items: center;
   justify-content: center;
-  box-shadow: 0 12rpx 24rpx rgba(93, 85, 232, 0.4);
 }
 
-.icon-search {
-  width: 0;
-  height: 0;
-  border-radius: 50%;
-  border: 10rpx solid #ffffff;
-  border-color: #ffffff transparent transparent transparent;
-  position: relative;
-}
-
-.icon-search::after {
-  content: '';
-  position: absolute;
-  width: 24rpx;
-  height: 4rpx;
-  border-radius: 999rpx;
-  background: #ffffff;
-  transform: rotate(45deg);
-  right: -20rpx;
-  bottom: -6rpx;
+.search-icon {
+  width: 48rpx;
+  height: 48rpx;
 }
 
 .search-tip {

+ 0 - 458
src/pages/login/login.vue

@@ -1,458 +0,0 @@
-<template>
-  <view class="login-container">
-    <view class="login-header">
-      <text class="app-name">量化选股大师</text>
-      <text class="welcome-text">欢迎登录</text>
-    </view>
-
-    <view class="login-form">
-      <!-- 微信一键登录 -->
-      <button 
-        class="wx-login-btn" 
-        @click="handleWxLogin"
-        v-if="canUseWxLogin"
-      >
-        <image class="wx-icon" src="/static/images/wechat.png" mode="aspectFit"></image>
-        <text>微信一键登录</text>
-      </button>
-
-      <view class="divider">
-        <view class="divider-line"></view>
-        <text class="divider-text">或</text>
-        <view class="divider-line"></view>
-      </view>
-
-      <!-- 手机号登录 -->
-      <view class="phone-login">
-        <view class="input-group">
-          <input 
-            class="input-field" 
-            type="number" 
-            v-model="phone" 
-            placeholder="请输入手机号"
-            maxlength="11"
-          />
-        </view>
-
-        <view class="input-group code-group">
-          <input 
-            class="input-field code-input" 
-            type="number" 
-            v-model="code" 
-            placeholder="请输入验证码"
-            maxlength="6"
-          />
-          <button 
-            class="code-btn" 
-            @click="sendCode" 
-            :disabled="countdown > 0"
-          >
-            {{ countdown > 0 ? `${countdown}秒后重试` : '获取验证码' }}
-          </button>
-        </view>
-
-        <button class="login-btn" @click="handlePhoneLogin">登录</button>
-      </view>
-
-      <view class="agreement">
-        <checkbox-group @change="handleAgreeChange">
-          <label>
-            <checkbox :checked="agreed" color="#5d55e8" />
-            <text class="agreement-text">我已阅读并同意</text>
-            <text class="agreement-link">《用户协议》</text>
-            <text class="agreement-text">和</text>
-            <text class="agreement-link">《隐私政策》</text>
-          </label>
-        </checkbox-group>
-      </view>
-    </view>
-  </view>
-</template>
-
-<script>
-import { wxLogin, phoneLogin, sendSmsCode } from '@/utils/api.js'
-import { setToken, setUserInfo } from '@/utils/auth.js'
-
-export default {
-  data() {
-    return {
-      phone: '',
-      code: '',
-      countdown: 0,
-      agreed: false,
-      canUseWxLogin: true, // 是否支持微信登录
-      timer: null
-    }
-  },
-
-  onLoad() {
-    // 检查是否在微信环境
-    // #ifdef MP-WEIXIN
-    this.canUseWxLogin = true
-    // #endif
-    
-    // #ifndef MP-WEIXIN
-    this.canUseWxLogin = false
-    // #endif
-  },
-
-  onUnload() {
-    // 清除定时器
-    if (this.timer) {
-      clearInterval(this.timer)
-    }
-  },
-
-  methods: {
-    /**
-     * 处理微信一键登录
-     */
-    async handleWxLogin() {
-      if (!this.agreed) {
-        uni.showToast({
-          title: '请先同意用户协议和隐私政策',
-          icon: 'none'
-        })
-        return
-      }
-
-      try {
-        uni.showLoading({ title: '登录中...' })
-        
-        // 获取微信登录code
-        const loginRes = await uni.login()
-        console.log('获取登录code成功:', loginRes.code)
-        
-        // 调用后端登录接口(不传递昵称和头像,后端使用默认值)
-        const result = await wxLogin({
-          code: loginRes.code
-        })
-        
-        console.log('登录成功:', result)
-        
-        // 保存token和用户信息
-        setToken(result.data.token)
-        setUserInfo(result.data.userInfo)
-        
-        uni.hideLoading()
-        uni.showToast({
-          title: '登录成功',
-          icon: 'success'
-        })
-        
-        // 延迟跳转,让用户看到成功提示
-        setTimeout(() => {
-          this.navigateBack()
-        }, 1500)
-        
-      } catch (error) {
-        console.error('登录失败:', error)
-        uni.hideLoading()
-        uni.showToast({
-          title: error.message || '登录失败',
-          icon: 'none'
-        })
-      }
-    },
-
-    /**
-     * 发送验证码
-     */
-    async sendCode() {
-      if (!this.phone) {
-        uni.showToast({
-          title: '请输入手机号',
-          icon: 'none'
-        })
-        return
-      }
-
-      if (!/^1[3-9]\d{9}$/.test(this.phone)) {
-        uni.showToast({
-          title: '请输入正确的手机号',
-          icon: 'none'
-        })
-        return
-      }
-
-      if (!this.agreed) {
-        uni.showToast({
-          title: '请先同意用户协议和隐私政策',
-          icon: 'none'
-        })
-        return
-      }
-
-      try {
-        uni.showLoading({ title: '发送中...' })
-        await sendSmsCode(this.phone)
-        uni.hideLoading()
-        
-        uni.showToast({
-          title: '验证码已发送',
-          icon: 'success'
-        })
-        
-        // 开始倒计时
-        this.countdown = 60
-        this.timer = setInterval(() => {
-          this.countdown--
-          if (this.countdown <= 0) {
-            clearInterval(this.timer)
-          }
-        }, 1000)
-        
-      } catch (error) {
-        uni.hideLoading()
-        uni.showToast({
-          title: error.message || '发送失败',
-          icon: 'none'
-        })
-      }
-    },
-
-    /**
-     * 处理手机号登录
-     */
-    async handlePhoneLogin() {
-      if (!this.phone) {
-        uni.showToast({
-          title: '请输入手机号',
-          icon: 'none'
-        })
-        return
-      }
-
-      if (!/^1[3-9]\d{9}$/.test(this.phone)) {
-        uni.showToast({
-          title: '请输入正确的手机号',
-          icon: 'none'
-        })
-        return
-      }
-
-      if (!this.code) {
-        uni.showToast({
-          title: '请输入验证码',
-          icon: 'none'
-        })
-        return
-      }
-
-      if (!this.agreed) {
-        uni.showToast({
-          title: '请先同意用户协议和隐私政策',
-          icon: 'none'
-        })
-        return
-      }
-
-      try {
-        uni.showLoading({ title: '登录中...' })
-        
-        console.log('准备登录,phone:', this.phone, 'code:', this.code)
-        
-        // 调用后端登录接口(不传递昵称和头像,后端使用默认值)
-        const result = await phoneLogin(this.phone, this.code)
-        
-        console.log('登录成功,result:', result)
-        
-        // 保存token和用户信息
-        setToken(result.data.token)
-        setUserInfo(result.data.userInfo)
-        
-        uni.hideLoading()
-        uni.showToast({
-          title: '登录成功',
-          icon: 'success'
-        })
-        
-        // 延迟跳转
-        setTimeout(() => {
-          this.navigateBack()
-        }, 1500)
-        
-      } catch (error) {
-        uni.hideLoading()
-        uni.showToast({
-          title: error.message || '登录失败',
-          icon: 'none'
-        })
-      }
-    },
-
-    /**
-     * 处理协议勾选变化
-     */
-    handleAgreeChange(e) {
-      this.agreed = e.detail.value.length > 0
-    },
-
-    /**
-     * 返回上一页或首页
-     */
-    navigateBack() {
-      const pages = getCurrentPages()
-      if (pages.length > 1) {
-        // 有上一页,返回上一页
-        uni.navigateBack()
-        
-        // 执行登录后的回调
-        const app = getApp()
-        if (app.globalData.loginCallback) {
-          app.globalData.loginCallback()
-          app.globalData.loginCallback = null
-        }
-      } else {
-        // 没有上一页,跳转到首页
-        uni.switchTab({
-          url: '/pages/index/index'
-        })
-      }
-    }
-  }
-}
-</script>
-
-<style scoped>
-.login-container {
-  min-height: 100vh;
-  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-  padding: 100rpx 60rpx;
-}
-
-.login-header {
-  text-align: center;
-  margin-bottom: 100rpx;
-}
-
-.app-name {
-  display: block;
-  font-size: 48rpx;
-  font-weight: bold;
-  color: #ffffff;
-  margin-bottom: 20rpx;
-}
-
-.welcome-text {
-  display: block;
-  font-size: 28rpx;
-  color: rgba(255, 255, 255, 0.8);
-}
-
-.login-form {
-  background: #ffffff;
-  border-radius: 20rpx;
-  padding: 60rpx 40rpx;
-  box-shadow: 0 10rpx 40rpx rgba(0, 0, 0, 0.1);
-}
-
-.wx-login-btn {
-  width: 100%;
-  height: 90rpx;
-  background: #07c160;
-  color: #ffffff;
-  border-radius: 45rpx;
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  font-size: 32rpx;
-  border: none;
-  margin-bottom: 40rpx;
-}
-
-.wx-icon {
-  width: 40rpx;
-  height: 40rpx;
-  margin-right: 15rpx;
-}
-
-.divider {
-  display: flex;
-  align-items: center;
-  margin: 40rpx 0;
-}
-
-.divider-line {
-  flex: 1;
-  height: 1rpx;
-  background: #e5e5e5;
-}
-
-.divider-text {
-  padding: 0 20rpx;
-  color: #999999;
-  font-size: 24rpx;
-}
-
-.phone-login {
-  margin-top: 40rpx;
-}
-
-.input-group {
-  margin-bottom: 30rpx;
-}
-
-.input-field {
-  width: 100%;
-  height: 90rpx;
-  background: #f5f6fb;
-  border-radius: 45rpx;
-  padding: 0 30rpx;
-  font-size: 28rpx;
-  box-sizing: border-box;
-}
-
-.code-group {
-  display: flex;
-  align-items: center;
-}
-
-.code-input {
-  flex: 1;
-  margin-right: 20rpx;
-}
-
-.code-btn {
-  width: 200rpx;
-  height: 90rpx;
-  background: #5d55e8;
-  color: #ffffff;
-  border-radius: 45rpx;
-  font-size: 24rpx;
-  border: none;
-  padding: 0;
-  line-height: 90rpx;
-}
-
-.code-btn[disabled] {
-  background: #cccccc;
-}
-
-.login-btn {
-  width: 100%;
-  height: 90rpx;
-  background: #5d55e8;
-  color: #ffffff;
-  border-radius: 45rpx;
-  font-size: 32rpx;
-  border: none;
-  margin-top: 20rpx;
-}
-
-.agreement {
-  margin-top: 40rpx;
-  text-align: center;
-}
-
-.agreement-text {
-  font-size: 24rpx;
-  color: #999999;
-  margin: 0 5rpx;
-}
-
-.agreement-link {
-  font-size: 24rpx;
-  color: #5d55e8;
-}
-</style>

+ 1 - 0
src/pages/logs/logs.vue

@@ -14,6 +14,7 @@ import { formatTime } from '../../utils/util.js'
 const logs = ref([])
 
 onLoad(() => {
+  console.log('[日志页] 页面加载')
   const storedLogs = uni.getStorageSync('logs') || []
   logs.value = storedLogs.map(log => {
     return {

+ 7 - 5
src/pages/mine/mine.vue

@@ -60,7 +60,7 @@
 <script setup>
 import { ref, onMounted } from 'vue'
 import { onShow } from '@dcloudio/uni-app'
-import { isLoggedIn as checkLogin, getUserInfo as getStoredUserInfo, logout, checkLogin as requireLogin } from '@/utils/auth.js'
+import { isLoggedIn as checkLogin, getUserInfo as getStoredUserInfo, logout, checkLogin as requireLogin, wxAuthLogin } from '@/utils/auth.js'
 
 const isLoggedIn = ref(false)
 const userInfo = ref({
@@ -89,11 +89,12 @@ onShow(() => {
  */
 const loadUserInfo = () => {
   isLoggedIn.value = checkLogin()
+  console.log('[个人中心] 登录状态:', isLoggedIn.value)
   if (isLoggedIn.value) {
     const storedInfo = getStoredUserInfo()
     if (storedInfo) {
       userInfo.value = storedInfo
-      console.log('加载用户信息:', userInfo.value)
+      console.log('[个人中心] 加载用户信息:', userInfo.value)
     }
   }
 }
@@ -133,9 +134,10 @@ const toggleLogin = () => {
       }
     })
   } else {
-    // 跳转到登录页
-    uni.navigateTo({
-      url: '/pages/login/login'
+    // 使用微信授权登录
+    wxAuthLogin(() => {
+      // 登录成功后重新加载用户信息
+      loadUserInfo()
     })
   }
 }

+ 2 - 13
src/pages/pool/pool.vue

@@ -137,7 +137,7 @@ const isLoggedIn = ref(false)
 // 检查登录状态
 const checkLogin = () => {
   isLoggedIn.value = checkLoginStatus()
-  console.log('超短池 - 登录状态:', isLoggedIn.value)
+  console.log('[超短池] 登录状态:', isLoggedIn.value)
   return isLoggedIn.value
 }
 
@@ -170,18 +170,7 @@ const showPurchaseModal = () => {
   
   // 检查登录状态
   if (!checkLogin()) {
-    console.log('未登录,跳转登录页')
-    uni.showModal({
-      title: '提示',
-      content: '解锁超短池需要先登录,是否前往登录?',
-      success: (res) => {
-        if (res.confirm) {
-          uni.navigateTo({
-            url: '/pages/login/login'
-          })
-        }
-      }
-    })
+    console.log('未登录,显示微信授权弹窗')
     return
   }
   

+ 2 - 0
src/pages/profile/edit.vue

@@ -56,6 +56,7 @@ export default {
   },
 
   onLoad() {
+    console.log('[编辑资料] 页面加载')
     this.loadUserInfo()
   },
 
@@ -65,6 +66,7 @@ export default {
      */
     loadUserInfo() {
       const userInfo = getUserInfo()
+      console.log('[编辑资料] 加载用户信息:', userInfo)
       if (userInfo) {
         this.avatarUrl = userInfo.avatar || '/static/images/head.png'
         this.nickname = userInfo.nickname || ''

+ 114 - 8
src/pages/rank/rank.vue

@@ -6,7 +6,7 @@
     </view>
     
     <scroll-view class="scroll-view" scroll-y>
-      <view class="content-wrapper">
+      <view class="content-wrapper" :class="{ 'blur-content': !isLoggedIn }">
         <!-- 我的模拟资产卡片 -->
         <view class="portfolio-card">
           <view class="portfolio-header">
@@ -74,12 +74,26 @@
         <view class="bottom-safe-area"></view>
       </view>
     </scroll-view>
+
+    <!-- 未登录遮罩层 -->
+    <view v-if="!isLoggedIn" class="login-mask">
+      <view class="login-prompt">
+        <view class="lock-icon">🔒</view>
+        <text class="prompt-title">登录后查看完整数据</text>
+        <text class="prompt-desc">登录后可查看您的模拟资产和完整排行榜</text>
+        <button class="login-button" @click="goToLogin">立即登录</button>
+      </view>
+    </view>
   </view>
 </template>
 
 <script setup>
 import { ref, onMounted } from 'vue'
 import { getUserPortfolio, getLeaderboard } from '../../utils/api.js'
+import { isLoggedIn as checkIsLoggedIn, wxAuthLogin } from '../../utils/auth.js'
+
+// 登录状态
+const isLoggedIn = ref(false)
 
 const portfolio = ref({
   balance: 100000,
@@ -92,11 +106,16 @@ const myRank = ref({
   rate: 0
 })
 
-const leaderboard = ref([
-  { rank: 1, name: '量化王者 608', rate: 35.2 },
-  { rank: 2, name: '短线猎手 012', rate: 28.9 },
-  { rank: 3, name: '趋势追踪者', rate: 22.1 }
-])
+// 模糊数据 - 未登录时显示
+const mockLeaderboard = [
+  { rank: 1, name: '量化王者 ***', rate: 35.2 },
+  { rank: 2, name: '短线猎手 ***', rate: 28.9 },
+  { rank: 3, name: '趋势追踪者 ***', rate: 22.1 },
+  { rank: 4, name: '稳健投资 ***', rate: 18.5 },
+  { rank: 5, name: '价值发现 ***', rate: 15.3 }
+]
+
+const leaderboard = ref(mockLeaderboard)
 
 const formatAmount = (amount) => {
   return amount.toLocaleString('zh-CN')
@@ -117,7 +136,29 @@ const getRankClass = (rank) => {
   return ''
 }
 
-const loadData = async () => {
+// 跳转到登录页
+const goToLogin = () => {
+  wxAuthLogin(() => {
+    // 登录成功后重新检查登录状态并加载数据
+    checkLoginAndLoadData()
+  })
+}
+
+// 检查登录状态并加载数据
+const checkLoginAndLoadData = () => {
+  isLoggedIn.value = checkIsLoggedIn()
+  console.log('[模拟排名] 登录状态:', isLoggedIn.value)
+  
+  if (isLoggedIn.value) {
+    loadRealData()
+  } else {
+    // 未登录,显示模糊数据
+    leaderboard.value = mockLeaderboard
+  }
+}
+
+// 加载真实数据
+const loadRealData = async () => {
   try {
     const portfolioRes = await getUserPortfolio()
     if (portfolioRes.code === 0 && portfolioRes.data) {
@@ -139,7 +180,7 @@ const loadData = async () => {
 }
 
 onMounted(() => {
-  loadData()
+  checkLoginAndLoadData()
 })
 </script>
 
@@ -378,4 +419,69 @@ onMounted(() => {
 .bottom-safe-area {
   height: 80rpx;
 }
+
+/* 模糊效果 */
+.blur-content {
+  filter: blur(8rpx);
+  pointer-events: none;
+}
+
+/* 登录遮罩层 */
+.login-mask {
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background: rgba(0, 0, 0, 0.4);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  z-index: 999;
+}
+
+.login-prompt {
+  width: 560rpx;
+  max-width: 560rpx;
+  background: #ffffff;
+  border-radius: 24rpx;
+  padding: 50rpx 40rpx;
+  margin: 0 auto;
+  text-align: center;
+  box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.3);
+  box-sizing: border-box;
+}
+
+.lock-icon {
+  font-size: 72rpx;
+  margin-bottom: 20rpx;
+}
+
+.prompt-title {
+  display: block;
+  font-size: 32rpx;
+  font-weight: 600;
+  color: #222222;
+  margin-bottom: 12rpx;
+}
+
+.prompt-desc {
+  display: block;
+  font-size: 24rpx;
+  color: #999999;
+  line-height: 1.5;
+  margin-bottom: 32rpx;
+}
+
+.login-button {
+  width: 100%;
+  height: 80rpx;
+  background: linear-gradient(135deg, #5d55e8, #7568ff);
+  color: #ffffff;
+  border-radius: 40rpx;
+  font-size: 30rpx;
+  font-weight: 600;
+  border: none;
+  box-shadow: 0 8rpx 24rpx rgba(93, 85, 232, 0.4);
+}
 </style>

+ 91 - 45
src/pages/strong/strong.vue

@@ -5,7 +5,7 @@
       <text class="page-title-text">量化选股大师</text>
     </view>
     <scroll-view class="scroll-view" scroll-y>
-      <view class="content-wrapper">
+      <view class="content-wrapper" :class="{ 'blur-content': !isLoggedIn }">
         <!-- 强势趋势池标题 -->
         <view class="pool-header-section">
           <view class="pool-header">
@@ -91,6 +91,16 @@
       </view>
     </scroll-view>
 
+    <!-- 未登录遮罩层 -->
+    <view v-if="!isLoggedIn" class="login-mask">
+      <view class="login-prompt">
+        <view class="lock-icon">🔒</view>
+        <text class="prompt-title">登录后进行模拟交易</text>
+        <text class="prompt-desc">登录后可进行模拟买卖操作,记录您的交易数据</text>
+        <button class="login-button" @click="goToLogin">立即登录</button>
+      </view>
+    </view>
+
     <!-- 买入弹窗 -->
     <view v-if="showBuyModalFlag" class="modal-overlay" @click="closeBuyModal">
       <view class="modal-content" @click.stop>
@@ -178,7 +188,10 @@
 <script setup>
 import { ref, computed } from 'vue'
 import { onLoad, onShow } from '@dcloudio/uni-app'
-import { isLoggedIn as checkLoginStatus } from '../../utils/auth.js'
+import { isLoggedIn as checkLoginStatus, wxAuthLogin } from '../../utils/auth.js'
+
+// 登录状态
+const isLoggedIn = ref(false)
 
 // 股票列表数据
 const stockList = ref([
@@ -202,13 +215,19 @@ const showSellModalFlag = ref(false)
 const currentStock = ref({})
 const buyQuantity = ref('100')
 const sellQuantity = ref('100')
-const isLoggedIn = ref(false)
 
 // 检查登录状态
 const checkLogin = () => {
   isLoggedIn.value = checkLoginStatus()
-  console.log('强势池 - 登录状态:', isLoggedIn.value)
-  return isLoggedIn.value
+  console.log('[强势池] 登录状态:', isLoggedIn.value)
+}
+
+// 跳转到登录页
+const goToLogin = () => {
+  wxAuthLogin(() => {
+    // 登录成功后重新检查登录状态
+    checkLogin()
+  })
 }
 
 // 计算买入总金额
@@ -225,28 +244,9 @@ const sellTotalAmount = computed(() => {
   return qty * price
 })
 
-// 显示买入弹窗(需要登录)
+// 显示买入弹窗
 const showBuyModal = (stock) => {
   console.log('点击买入按钮')
-  
-  // 检查登录状态
-  if (!checkLogin()) {
-    console.log('未登录,提示登录')
-    uni.showModal({
-      title: '提示',
-      content: '模拟交易需要先登录,是否前往登录?',
-      success: (res) => {
-        if (res.confirm) {
-          uni.navigateTo({
-            url: '/pages/login/login'
-          })
-        }
-      }
-    })
-    return
-  }
-  
-  console.log('已登录,显示买入弹窗')
   currentStock.value = { ...stock }
   buyQuantity.value = '100'
   showBuyModalFlag.value = true
@@ -257,28 +257,9 @@ const closeBuyModal = () => {
   showBuyModalFlag.value = false
 }
 
-// 显示卖出弹窗(需要登录)
+// 显示卖出弹窗
 const showSellModal = (stock) => {
   console.log('点击卖出按钮')
-  
-  // 检查登录状态
-  if (!checkLogin()) {
-    console.log('未登录,提示登录')
-    uni.showModal({
-      title: '提示',
-      content: '模拟交易需要先登录,是否前往登录?',
-      success: (res) => {
-        if (res.confirm) {
-          uni.navigateTo({
-            url: '/pages/login/login'
-          })
-        }
-      }
-    })
-    return
-  }
-  
-  console.log('已登录,显示卖出弹窗')
   currentStock.value = { ...stock }
   sellQuantity.value = '100'
   showSellModalFlag.value = true
@@ -867,4 +848,69 @@ onShow(() => {
 .bottom-safe-area {
   height: 80rpx;
 }
+
+/* 模糊效果 */
+.blur-content {
+  filter: blur(8rpx);
+  pointer-events: none;
+}
+
+/* 登录遮罩层 */
+.login-mask {
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background: rgba(0, 0, 0, 0.4);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  z-index: 999;
+}
+
+.login-prompt {
+  width: 560rpx;
+  max-width: 560rpx;
+  background: #ffffff;
+  border-radius: 24rpx;
+  padding: 50rpx 40rpx;
+  margin: 0 auto;
+  text-align: center;
+  box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.3);
+  box-sizing: border-box;
+}
+
+.lock-icon {
+  font-size: 72rpx;
+  margin-bottom: 20rpx;
+}
+
+.prompt-title {
+  display: block;
+  font-size: 32rpx;
+  font-weight: 600;
+  color: #222222;
+  margin-bottom: 12rpx;
+}
+
+.prompt-desc {
+  display: block;
+  font-size: 24rpx;
+  color: #999999;
+  line-height: 1.5;
+  margin-bottom: 32rpx;
+}
+
+.login-button {
+  width: 100%;
+  height: 80rpx;
+  background: linear-gradient(135deg, #5d55e8, #7568ff);
+  color: #ffffff;
+  border-radius: 40rpx;
+  font-size: 30rpx;
+  font-weight: 600;
+  border: none;
+  box-shadow: 0 8rpx 24rpx rgba(93, 85, 232, 0.4);
+}
 </style>

+ 33 - 40
src/utils/api.js

@@ -1,7 +1,16 @@
-import { getToken } from './auth.js'
+/**
+ * API请求工具类
+ */
 
 const BASE_URL = 'http://localhost:8080'
 
+/**
+ * 获取本地存储的token(避免循环依赖)
+ */
+const getToken = () => {
+  return uni.getStorageSync('user_token') || null
+}
+
 /**
  * 统一请求封装
  * 自动添加token到请求头
@@ -30,13 +39,31 @@ const request = (options) => {
           // token过期或未登录
           uni.showToast({
             title: '登录已过期,请重新登录',
-            icon: 'none'
+            icon: 'none',
+            duration: 2000
           })
-          // 清除token并跳转到登录页
+          // 清除token
           uni.removeStorageSync('user_token')
-          uni.navigateTo({
-            url: '/pages/login/login'
-          })
+          uni.removeStorageSync('user_info')
+          
+          // 延迟后显示登录弹窗
+          setTimeout(() => {
+            uni.showModal({
+              title: '登录提示',
+              content: '登录已过期,是否重新登录?',
+              confirmText: '立即登录',
+              cancelText: '暂不登录',
+              success: (modalRes) => {
+                if (modalRes.confirm) {
+                  // 导入并调用微信授权登录
+                  import('./auth.js').then(auth => {
+                    auth.wxAuthLogin()
+                  })
+                }
+              }
+            })
+          }, 2000)
+          
           reject(new Error('未授权'))
         } else {
           reject(new Error(res.data.message || '服务暂不可用'))
@@ -66,40 +93,6 @@ export const wxLogin = (params) => {
   })
 }
 
-/**
- * 手机号登录接口
- * @param {string} phone - 手机号
- * @param {string} verifyCode - 验证码
- * @returns {Promise} 返回登录结果,包含token和用户信息
- */
-export const phoneLogin = (phone, verifyCode) => {
-  console.log('phoneLogin调用参数:', { phone, verifyCode })
-  return request({
-    url: '/v1/auth/phoneLogin',
-    method: 'POST',
-    header: {
-      'content-type': 'application/json'
-    },
-    data: { phone, verifyCode }
-  })
-}
-
-/**
- * 发送验证码接口
- * @param {string} phone - 手机号
- * @returns {Promise} 返回发送结果
- */
-export const sendSmsCode = (phone) => {
-  return request({
-    url: '/v1/auth/sendCode',
-    method: 'POST',
-    header: {
-      'content-type': 'application/json'
-    },
-    data: { phone }
-  })
-}
-
 /**
  * 获取用户信息接口
  * @returns {Promise} 返回用户信息

+ 65 - 13
src/utils/auth.js

@@ -1,8 +1,11 @@
 /**
  * 认证工具类
  * 用于管理用户登录状态、token存储和登录检查
+ * 使用微信自带弹窗登录
  */
 
+import { wxLogin } from './api.js'
+
 const TOKEN_KEY = 'user_token'
 const USER_INFO_KEY = 'user_info'
 
@@ -70,7 +73,61 @@ export const logout = () => {
 }
 
 /**
- * 检查登录状态,未登录则跳转到登录页
+ * 使用微信授权弹窗登录
+ * @param {function} successCallback - 登录成功后的回调函数
+ * @param {function} failCallback - 登录失败后的回调函数
+ */
+export const wxAuthLogin = async (successCallback, failCallback) => {
+  try {
+    // 1. 获取微信登录code
+    const loginRes = await uni.login()
+    console.log('[微信登录] 获取code成功:', loginRes.code)
+    
+    // 2. 调用后端登录接口
+    const result = await wxLogin({
+      code: loginRes.code
+    })
+    
+    console.log('[微信登录] 登录成功:', result)
+    
+    // 3. 保存token和用户信息
+    setToken(result.data.token)
+    setUserInfo(result.data.userInfo)
+    
+    // 4. 显示成功提示
+    uni.showToast({
+      title: '登录成功',
+      icon: 'success',
+      duration: 1500
+    })
+    
+    // 5. 执行成功回调
+    if (successCallback) {
+      setTimeout(() => {
+        successCallback()
+      }, 1500)
+    }
+    
+    return true
+  } catch (error) {
+    console.error('[微信登录] 登录失败:', error)
+    
+    uni.showToast({
+      title: error.message || '登录失败',
+      icon: 'none',
+      duration: 2000
+    })
+    
+    if (failCallback) {
+      failCallback(error)
+    }
+    
+    return false
+  }
+}
+
+/**
+ * 检查登录状态,未登录则显示微信授权弹窗
  * @param {function} callback - 登录成功后的回调函数
  * @returns {boolean} 是否已登录
  */
@@ -79,21 +136,16 @@ export const checkLogin = (callback) => {
     return true
   }
   
-  // 未登录,显示提示并跳转到登录页
+  // 未登录,显示微信授权弹窗
   uni.showModal({
-    title: '提示',
-    content: '此操作需要登录,是否前往登录?',
+    title: '登录提示',
+    content: '此功能需要登录后使用,是否立即登录?',
+    confirmText: '立即登录',
+    cancelText: '暂不登录',
     success: (res) => {
       if (res.confirm) {
-        uni.navigateTo({
-          url: '/pages/login/login',
-          success: () => {
-            // 登录成功后的回调可以通过事件总线或全局变量传递
-            if (callback) {
-              getApp().globalData.loginCallback = callback
-            }
-          }
-        })
+        // 用户点击确认,执行微信登录
+        wxAuthLogin(callback)
       }
     }
   })

Некоторые файлы не были показаны из-за большого количества измененных файлов