ソースを参照

订单检查修改

Zhangbw 2 ヶ月 前
コミット
80b7b98689

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

@@ -48,7 +48,7 @@
       },
       {
         "pagePath": "pages/rank/rank",
-        "text": "我的股票",
+        "text": "我的自选",
         "iconPath": "/static/images/tab_rank.png",
         "selectedIconPath": "/static/images/tab_rank_active.png"
       },

+ 1 - 1
dist/dev/mp-weixin/components/HistorySearchCard.js

@@ -110,7 +110,7 @@ const _sfc_main = {
     };
     const onSearch = () => {
       if (!props.canSearch) {
-        common_vendor.index.showToast({ title: "请先订阅该股票池", icon: "none" });
+        common_vendor.index.showToast({ title: "请先订阅该标的池", icon: "none" });
         return;
       }
       if (!startDate.value || !endDate.value) {

ファイルの差分が大きいため隠しています
+ 0 - 0
dist/dev/mp-weixin/components/HistorySearchCard.wxml


+ 4 - 1
dist/dev/mp-weixin/pages/admin/shortPool.js

@@ -59,7 +59,10 @@ const _sfc_main = {
       const userInfo = await utils_auth.refreshUserInfo();
       if (!userInfo || userInfo.status !== 2) {
         common_vendor.index.showToast({ title: "无权限访问", icon: "none" });
-        setTimeout(() => common_vendor.index.navigateBack(), 1500);
+        setTimeout(() => {
+          const pages = getCurrentPages();
+          pages.length > 1 ? common_vendor.index.navigateBack() : common_vendor.index.switchTab({ url: "/pages/mine/mine" });
+        }, 1500);
       }
     };
     const loadStockList = async (silent = false) => {

+ 2 - 2
dist/dev/mp-weixin/pages/index/index.js

@@ -87,7 +87,7 @@ const _sfc_main = {
       const kw = (keyword.value || "").trim();
       if (!kw) {
         common_vendor.index.showToast({
-          title: "请输入股票代码或名称",
+          title: "请输入市场代码或名称",
           icon: "none"
         });
         return;
@@ -115,7 +115,7 @@ const _sfc_main = {
         if (stockRes.code === 200 && stockRes.data) {
           result.value = stockRes.data;
         } else {
-          errorMsg.value = stockRes.message || "未查询到相关股票数据";
+          errorMsg.value = stockRes.message || "未查询到相关市场数据";
         }
         if (historyRes.code === 200 && historyRes.data && historyRes.data.found) {
           historyData.value = historyRes.data;

ファイルの差分が大きいため隠しています
+ 0 - 0
dist/dev/mp-weixin/pages/index/index.wxml


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

@@ -213,11 +213,9 @@ const _sfc_main = {
             if (uploadedUrl) {
               const updateResult = await utils_api.updateUserProfile({ avatar: uploadedUrl });
               console.log("[登录] updateUserProfile返回:", updateResult);
-              const userInfoLocal = common_vendor.index.getStorageSync("user_info");
-              if (userInfoLocal) {
-                const parsed = JSON.parse(userInfoLocal);
-                parsed.avatar = uploadedUrl;
-                common_vendor.index.setStorageSync("user_info", JSON.stringify(parsed));
+              if (updateResult && updateResult.code === 200 && updateResult.data) {
+                common_vendor.index.setStorageSync("user_info", JSON.stringify(updateResult.data));
+                console.log("[登录] 本地用户信息已更新");
               }
             }
           } catch (uploadErr) {

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

@@ -23,11 +23,14 @@ const _sfc_main = {
         if (storedInfo) {
           userInfo.value = storedInfo;
           isAdmin.value = storedInfo.status === 2;
+          console.log("[我的] 本地缓存头像:", storedInfo.avatar);
         }
         const latestInfo = await utils_auth.refreshUserInfo();
         if (latestInfo) {
           userInfo.value = latestInfo;
           isAdmin.value = latestInfo.status === 2;
+          console.log("[我的] 后端返回头像:", latestInfo.avatar);
+          console.log("[我的] 处理后头像URL:", latestInfo.avatar ? utils_api.getImageUrl(latestInfo.avatar) : "无");
         }
       } else {
         isAdmin.value = false;

+ 4 - 4
dist/dev/mp-weixin/pages/pool/pool.js

@@ -103,7 +103,7 @@ const _sfc_main = {
           stockList.value = res.data;
         }
       } catch (e) {
-        console.error("加载股票池失败:", e);
+        console.error("加载标的池失败:", e);
       }
     };
     const loadAndStartRefresh = async () => {
@@ -185,7 +185,7 @@ const _sfc_main = {
       if (!checkLogin()) {
         common_vendor.index.showModal({
           title: "登录提示",
-          content: "添加自选股票需要登录,是否前往登录?",
+          content: "添加自选需要登录,是否前往登录?",
           confirmText: "去登录",
           cancelText: "取消",
           success: (res) => {
@@ -218,13 +218,13 @@ const _sfc_main = {
         if (addRes.code === 200 && addRes.data === true) {
           common_vendor.index.showToast({ title: "添加成功", icon: "success" });
         } else if (addRes.code === 200 && addRes.data === false) {
-          common_vendor.index.showToast({ title: "股票已存在", icon: "none" });
+          common_vendor.index.showToast({ title: "标的已存在", icon: "none" });
         } else {
           common_vendor.index.showToast({ title: addRes.message || "添加失败", icon: "none" });
         }
       } catch (e) {
         common_vendor.index.hideLoading();
-        console.error("添加股票失败:", e);
+        console.error("添加标的失败:", e);
         common_vendor.index.showToast({ title: "添加失败", icon: "none" });
       }
     };

+ 12 - 4
dist/dev/mp-weixin/pages/profile/edit.js

@@ -93,12 +93,19 @@ const _sfc_main = {
       common_vendor.index.showLoading({ title: "保存中..." });
       try {
         let uploadedAvatarUrl = currentAvatarPath;
-        if (currentAvatarPath !== originalAvatar.value && !avatarUrl.value.startsWith("/static/") && !avatarUrl.value.startsWith("http")) {
+        const isTempPath = avatarUrl.value.startsWith("http://tmp/") || avatarUrl.value.startsWith("wxfile://") || avatarUrl.value.includes("/tmp/wx");
+        const needUpload = currentAvatarPath !== originalAvatar.value && !avatarUrl.value.startsWith("/static/") && (!avatarUrl.value.startsWith("http") || isTempPath);
+        if (needUpload) {
           try {
+            console.log("[编辑资料] 开始上传头像:", avatarUrl.value);
             uploadedAvatarUrl = await uploadAvatar(avatarUrl.value);
+            console.log("[编辑资料] 头像上传成功:", uploadedAvatarUrl);
           } catch (e) {
-            console.warn("头像上传失败,使用默认头像:", e.message);
-            uploadedAvatarUrl = "/static/images/head.png";
+            console.error("[编辑资料] 头像上传失败:", e.message);
+            common_vendor.index.hideLoading();
+            common_vendor.index.showToast({ title: "头像上传失败", icon: "none" });
+            saving.value = false;
+            return;
           }
         }
         await utils_api.updateUserProfile({
@@ -112,7 +119,8 @@ const _sfc_main = {
         common_vendor.index.hideLoading();
         common_vendor.index.showToast({ title: "保存成功", icon: "success" });
         setTimeout(() => {
-          common_vendor.index.navigateBack();
+          const pages = getCurrentPages();
+          pages.length > 1 ? common_vendor.index.navigateBack() : common_vendor.index.switchTab({ url: "/pages/mine/mine" });
         }, 1500);
       } catch (error) {
         console.error("保存失败:", error);

ファイルの差分が大きいため隠しています
+ 0 - 0
dist/dev/mp-weixin/pages/rank/rank.wxml


+ 4 - 4
dist/dev/mp-weixin/pages/strong/strong.js

@@ -76,7 +76,7 @@ const _sfc_main = {
           stockList.value = res.data;
         }
       } catch (e) {
-        console.error("加载股票池失败:", e);
+        console.error("加载标的池失败:", e);
       }
     };
     const loadAndStartRefresh = async () => {
@@ -161,7 +161,7 @@ const _sfc_main = {
       if (!utils_auth.isLoggedIn()) {
         common_vendor.index.showModal({
           title: "登录提示",
-          content: "添加自选股票需要登录,是否前往登录?",
+          content: "添加自选需要登录,是否前往登录?",
           confirmText: "去登录",
           cancelText: "取消",
           success: (res) => {
@@ -194,13 +194,13 @@ const _sfc_main = {
         if (addRes.code === 200 && addRes.data === true) {
           common_vendor.index.showToast({ title: "添加成功", icon: "success" });
         } else if (addRes.code === 200 && addRes.data === false) {
-          common_vendor.index.showToast({ title: "股票已存在", icon: "none" });
+          common_vendor.index.showToast({ title: "标的已存在", icon: "none" });
         } else {
           common_vendor.index.showToast({ title: addRes.message || "添加失败", icon: "none" });
         }
       } catch (e) {
         common_vendor.index.hideLoading();
-        console.error("添加股票失败:", e);
+        console.error("添加标的失败:", e);
         common_vendor.index.showToast({ title: "添加失败", icon: "none" });
       }
     };

+ 3 - 2
dist/dev/mp-weixin/project.config.json

@@ -9,11 +9,12 @@
     "postcss": false,
     "minified": false,
     "newFeature": true,
-    "bigPackageSizeSupport": true
+    "bigPackageSizeSupport": true,
+    "minifyWXML": true
   },
   "compileType": "miniprogram",
   "libVersion": "",
-  "appid": "touristappid",
+  "appid": "wx9d7e6e3592830447",
   "projectname": "miniprogram-1",
   "condition": {
     "search": {

+ 7 - 3
dist/dev/mp-weixin/utils/api.js

@@ -1,17 +1,21 @@
 "use strict";
 const common_vendor = require("../common/vendor.js");
-const ENV = "local";
+const ENV = "prod";
 const CONFIG = {
-  dev: "http://localhost:8081",
+  dev: "http://192.168.1.171:8081",
   // 开发环境
   local: "http://10.167.44.71:8081",
-  prod: "http://192.168.1.2:8081"
+  prod: "https://www.whzhangsheng.cn/applet-api"
   // 生产环境
 };
 const BASE_URL = CONFIG[ENV];
 const getImageUrl = (url) => {
   if (!url)
     return "";
+  if (url.startsWith("wxfile://") || url.startsWith("http://tmp/") || url.includes("/tmp/wx")) {
+    console.warn("[getImageUrl] 检测到微信临时路径,无法显示:", url);
+    return "";
+  }
   if (url.startsWith("http") || url.startsWith("/static/")) {
     return url;
   }

+ 4 - 1
src/pages/admin/shortPool.vue

@@ -184,7 +184,10 @@ const checkAdminPermission = async () => {
   const userInfo = await refreshUserInfo()
   if (!userInfo || userInfo.status !== 2) {
     uni.showToast({ title: '无权限访问', icon: 'none' })
-    setTimeout(() => uni.navigateBack(), 1500)
+    setTimeout(() => {
+      const pages = getCurrentPages()
+      pages.length > 1 ? uni.navigateBack() : uni.switchTab({ url: '/pages/mine/mine' })
+    }, 1500)
   }
 }
 

+ 2 - 1
src/pages/history/history.vue

@@ -133,7 +133,8 @@ const formatTrend = (trend) => {
 
 // 返回上一页
 const goBack = () => {
-  uni.navigateBack()
+  const pages = getCurrentPages()
+  pages.length > 1 ? uni.navigateBack() : uni.switchTab({ url: '/pages/index/index' })
 }
 
 // 加载历史数据

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

@@ -343,13 +343,11 @@ export default {
               // 更新用户头像为服务器URL
               const updateResult = await updateUserProfile({ avatar: uploadedUrl })
               console.log('[登录] updateUserProfile返回:', updateResult)
-              
-              // 更新本地存储的用户信息
-              const userInfoLocal = uni.getStorageSync('user_info')
-              if (userInfoLocal) {
-                const parsed = JSON.parse(userInfoLocal)
-                parsed.avatar = uploadedUrl
-                uni.setStorageSync('user_info', JSON.stringify(parsed))
+
+              // 更新本地存储的用户信息(使用后端返回的最新数据)
+              if (updateResult && updateResult.code === 200 && updateResult.data) {
+                uni.setStorageSync('user_info', JSON.stringify(updateResult.data))
+                console.log('[登录] 本地用户信息已更新')
               }
             }
           } catch (uploadErr) {

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

@@ -78,20 +78,23 @@ onShow(() => {
  */
 const loadUserInfo = async () => {
   isLoggedIn.value = checkLogin()
-  
+
   if (isLoggedIn.value) {
     // 先显示本地缓存
     const storedInfo = getStoredUserInfo()
     if (storedInfo) {
       userInfo.value = storedInfo
       isAdmin.value = storedInfo.status === 2
+      console.log('[我的] 本地缓存头像:', storedInfo.avatar)
     }
-    
+
     // 从后端刷新最新状态
     const latestInfo = await refreshUserInfo()
     if (latestInfo) {
       userInfo.value = latestInfo
       isAdmin.value = latestInfo.status === 2
+      console.log('[我的] 后端返回头像:', latestInfo.avatar)
+      console.log('[我的] 处理后头像URL:', latestInfo.avatar ? getImageUrl(latestInfo.avatar) : '无')
     }
   } else {
     isAdmin.value = false

+ 18 - 6
src/pages/profile/edit.vue

@@ -168,14 +168,25 @@ const handleSave = async () => {
     let uploadedAvatarUrl = currentAvatarPath
 
     // 如果头像是临时文件路径,需要上传
-    if (currentAvatarPath !== originalAvatar.value && 
-        !avatarUrl.value.startsWith('/static/') && 
-        !avatarUrl.value.startsWith('http')) {
+    // 注意:微信临时路径如 http://tmp/xxx 或 wxfile://xxx 也需要上传
+    const isTempPath = avatarUrl.value.startsWith('http://tmp/') ||
+                       avatarUrl.value.startsWith('wxfile://') ||
+                       avatarUrl.value.includes('/tmp/wx')
+    const needUpload = currentAvatarPath !== originalAvatar.value &&
+                       !avatarUrl.value.startsWith('/static/') &&
+                       (!avatarUrl.value.startsWith('http') || isTempPath)
+
+    if (needUpload) {
       try {
+        console.log('[编辑资料] 开始上传头像:', avatarUrl.value)
         uploadedAvatarUrl = await uploadAvatar(avatarUrl.value)
+        console.log('[编辑资料] 头像上传成功:', uploadedAvatarUrl)
       } catch (e) {
-        console.warn('头像上传失败,使用默认头像:', e.message)
-        uploadedAvatarUrl = '/static/images/head.png'
+        console.error('[编辑资料] 头像上传失败:', e.message)
+        uni.hideLoading()
+        uni.showToast({ title: '头像上传失败', icon: 'none' })
+        saving.value = false
+        return
       }
     }
 
@@ -195,7 +206,8 @@ const handleSave = async () => {
     uni.showToast({ title: '保存成功', icon: 'success' })
 
     setTimeout(() => {
-      uni.navigateBack()
+      const pages = getCurrentPages()
+      pages.length > 1 ? uni.navigateBack() : uni.switchTab({ url: '/pages/mine/mine' })
     }, 1500)
 
   } catch (error) {

+ 9 - 2
src/utils/api.js

@@ -4,12 +4,12 @@
 
 // ============ 配置区域 ============
 
-const ENV = 'local' // 'dev' | 'prod'
+const ENV = 'prod' // 'dev' | 'prod'
 
 const CONFIG = {
   dev: 'http://localhost:8081',      // 开发环境
   local:'http://10.167.44.71:8081',
-  prod: 'http://192.168.1.2:8081'    // 生产环境
+  prod: 'https://www.whzhangsheng.cn/applet-api'    // 生产环境
 }
 
 const BASE_URL = CONFIG[ENV]
@@ -23,6 +23,13 @@ const BASE_URL = CONFIG[ENV]
  */
 export const getImageUrl = (url) => {
   if (!url) return ''
+
+  // 检测微信临时路径,这些路径在真机上无法访问,返回空让前端显示默认头像
+  if (url.startsWith('wxfile://') || url.startsWith('http://tmp/') || url.includes('/tmp/wx')) {
+    console.warn('[getImageUrl] 检测到微信临时路径,无法显示:', url)
+    return ''
+  }
+
   // 已经是完整URL或本地静态资源,直接返回
   if (url.startsWith('http') || url.startsWith('/static/')) {
     return url

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません