Zhangbw 1 mese fa
parent
commit
b79d114866

+ 11 - 1
index.html

@@ -2,7 +2,17 @@
 <html lang="zh-CN">
   <head>
     <meta charset="UTF-8" />
-    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
+    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+    <meta name="renderer" content="webkit" />
+    <meta name="force-rendering" content="webkit" />
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Expires" content="0" />
+    <!-- 针对微信浏览器X5内核的配置 -->
+    <meta name="x5-orientation" content="portrait" />
+    <meta name="x5-fullscreen" content="true" />
+    <meta name="x5-page-mode" content="app" />
     <title>量化交易大师</title>
     <!-- 微信 JS-SDK -->
     <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>

+ 2 - 1
src/App.vue

@@ -71,8 +71,9 @@ export default {
     // #endif
   },
   onShow: function() {
+	  //fakecheck
 	  const accountInfo = wx.getAccountInfoSync();
-	  // this.globalData.envVersion = accountInfo.miniProgram.envVersion
+	  this.globalData.envVersion = accountInfo.miniProgram.envVersion
     console.log('App Show')
     // 确保导航栏标题正确显示
     uni.setNavigationBarTitle({

+ 2 - 1
src/components/DateSelector.vue

@@ -334,7 +334,8 @@ const clearDate = () => {
 }
 
 .day-item {
-  aspect-ratio: 1;
+  width: 80rpx;
+  height: 80rpx;
   display: flex;
   align-items: center;
   justify-content: center;

+ 1 - 1
src/components/HistorySearchCard.vue

@@ -435,7 +435,7 @@ onMounted(() => {
 
 .day-item {
   width: 14.28%;
-  aspect-ratio: 1;
+  height: 80rpx;
   display: flex;
   align-items: center;
   justify-content: center;

+ 124 - 0
src/main.js

@@ -2,6 +2,130 @@ import { createSSRApp } from 'vue'
 import App from './App.vue'
 import VConsole from 'vconsole'
 
+// Polyfill for String.prototype.startsWith (for older browsers)
+if (!String.prototype.startsWith) {
+  String.prototype.startsWith = function(search, pos) {
+    pos = !pos || pos < 0 ? 0 : +pos
+    return this.substring(pos, pos + search.length) === search
+  }
+}
+
+// Polyfill for String.prototype.endsWith (for older browsers)
+if (!String.prototype.endsWith) {
+  String.prototype.endsWith = function(search, this_len) {
+    if (this_len === undefined || this_len > this.length) {
+      this_len = this.length
+    }
+    return this.substring(this_len - search.length, this_len) === search
+  }
+}
+
+// Polyfill for String.prototype.includes (for older browsers)
+if (!String.prototype.includes) {
+  String.prototype.includes = function(search, start) {
+    if (typeof start !== 'number') {
+      start = 0
+    }
+    if (start + search.length > this.length) {
+      return false
+    } else {
+      return this.indexOf(search, start) !== -1
+    }
+  }
+}
+
+// Polyfill for Array.prototype.includes (for older browsers)
+if (!Array.prototype.includes) {
+  Array.prototype.includes = function(searchElement, fromIndex) {
+    if (this == null) {
+      throw new TypeError('"this" is null or not defined')
+    }
+    var o = Object(this)
+    var len = o.length >>> 0
+    if (len === 0) {
+      return false
+    }
+    var n = fromIndex | 0
+    var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0)
+    while (k < len) {
+      if (o[k] === searchElement) {
+        return true
+      }
+      k++
+    }
+    return false
+  }
+}
+
+// Polyfill for String.prototype.repeat (for older browsers)
+if (!String.prototype.repeat) {
+  String.prototype.repeat = function(count) {
+    if (this == null) {
+      throw new TypeError("can't convert " + this + ' to object')
+    }
+    var str = '' + this
+    count = +count
+    if (count != count) {
+      count = 0
+    }
+    if (count < 0) {
+      throw new RangeError('repeat count must be non-negative')
+    }
+    if (count == Infinity) {
+      throw new RangeError('repeat count must be less than infinity')
+    }
+    count = Math.floor(count)
+    if (str.length == 0 || count == 0) {
+      return ''
+    }
+    if (str.length * count >= 1 << 28) {
+      throw new RangeError('repeat count must not overflow maximum string size')
+    }
+    var maxCount = str.length * count
+    count = Math.floor(Math.log(count) / Math.log(2))
+    while (count) {
+      str += str
+      count--
+    }
+    str += str.substring(0, maxCount - str.length)
+    return str
+  }
+}
+
+// Polyfill for String.prototype.padStart (for older browsers)
+if (!String.prototype.padStart) {
+  String.prototype.padStart = function padStart(targetLength, padString) {
+    targetLength = targetLength >> 0
+    padString = String(typeof padString !== 'undefined' ? padString : ' ')
+    if (this.length >= targetLength) {
+      return String(this)
+    } else {
+      targetLength = targetLength - this.length
+      if (targetLength > padString.length) {
+        padString += padString.repeat(targetLength / padString.length)
+      }
+      return padString.slice(0, targetLength) + String(this)
+    }
+  }
+}
+
+// Polyfill for String.prototype.padEnd (for older browsers)
+if (!String.prototype.padEnd) {
+  String.prototype.padEnd = function padEnd(targetLength, padString) {
+    targetLength = targetLength >> 0
+    padString = String(typeof padString !== 'undefined' ? padString : ' ')
+    if (this.length >= targetLength) {
+      return String(this)
+    } else {
+      targetLength = targetLength - this.length
+      if (targetLength > padString.length) {
+        padString += padString.repeat(targetLength / padString.length)
+      }
+      return String(this) + padString.slice(0, targetLength)
+    }
+  }
+}
+
 // 初始化vConsole用于移动端调试
 // #ifdef H5
 new VConsole()

+ 9 - 1
src/manifest.json

@@ -46,6 +46,7 @@
         "setting" : {
             "urlCheck" : false,
             "es6" : true,
+            "enhance" : true,
             "postcss" : true,
             "minified" : true
         },
@@ -54,6 +55,10 @@
             "scope.userLocation" : {
                 "desc" : "提供更好的门店体验"
             }
+        },
+        "navigationBarTitleText" : "掌升科技",
+        "optimization" : {
+            "subPackages" : true
         }
     },
     "h5" : {
@@ -65,7 +70,10 @@
                 "enable" : true
             }
         },
-        "template" : "index.html"
+        "template" : "index.html",
+        "devServer" : {
+            "https" : false
+        }
     },
     "vueVersion" : "3"
 }

+ 5 - 15
src/pages.json

@@ -2,9 +2,7 @@
   "pages": [
     {
       "path": "pages/index/index",
-      "style": {
-        "navigationBarTitleText": "量化交易大师"
-      }
+      "style": {}
     },
     {
       "path": "pages/login/login",
@@ -14,27 +12,19 @@
     },
     {
       "path": "pages/pool/pool",
-      "style": {
-        "navigationBarTitleText": "量化交易大师"
-      }
+      "style": {}
     },
     {
       "path": "pages/strong/strong",
-      "style": {
-        "navigationBarTitleText": "量化交易大师"
-      }
+      "style": {}
     },
     {
       "path": "pages/rank/rank",
-      "style": {
-        "navigationBarTitleText": "量化交易大师"
-      }
+      "style": {}
     },
     {
       "path": "pages/mine/mine",
-      "style": {
-        "navigationBarTitleText": "量化交易大师"
-      }
+      "style": {}
     },
     {
       "path": "pages/profile/edit",

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

@@ -137,7 +137,7 @@ const request = (options) => {
       method: options.method || 'GET',
       data: options.data || {},
       header,
-      success: (res) => res.statusCode === 200 ? resolve(res.data) : reject(new Error(res.data?.message || '请求失败')),
+      success: (res) => res.statusCode === 200 ? resolve(res.data) : reject(new Error((res.data && res.data.message) || '请求失败')),
       fail: () => reject(new Error('网络异常'))
     })
   })

+ 27 - 22
src/pages/login/login.vue

@@ -326,16 +326,8 @@ export default {
         }
 
         if (this.isLogin) {
-          if (isRegistered) {
-            this.currentStep = 'input'
-          } else {
-            uni.showToast({
-              title: '该微信未注册,请先注册',
-              icon: 'none',
-              duration: 2000
-            })
-            this.currentStep = 'initial'
-          }
+          // 登录流程:直接显示输入框,支持小程序注册的用户在H5登录
+          this.currentStep = 'input'
         } else {
           if (!isRegistered) {
             this.currentStep = 'input'
@@ -460,9 +452,9 @@ export default {
           console.log('[登录] 老用户登录成功')
           this.handleLoginSuccess()
         } else if (result && result.isSign === 'false') {
-          console.log('[登录] 新用户,需要先获取头像昵称')
+          console.log('[登录] 新用户,直接显示手机号授权(支持H5注册用户)')
           this.showOneClickLogin = false
-          this.showPhoneAuth = false
+          this.showPhoneAuth = true  // 直接显示手机号授权按钮
         } else if (result && result.code === 103) {
           uni.showModal({
             title: '账号异常',
@@ -506,13 +498,19 @@ export default {
         tempAvatarPath: userInfo.tempAvatarPath
       }
 
-      this.showPhoneAuth = true
-
-      uni.showToast({
-        title: '请继续授权手机号',
-        icon: 'none',
-        duration: 2000
-      })
+      // 如果已经有手机号(从手机号授权来的),直接提交注册
+      if (this.tempUserData && this.tempUserData.phoneNumber) {
+        console.log('[登录] 已有手机号,直接提交注册')
+        this.submitRegistration()
+      } else {
+        // 否则显示手机号授权按钮
+        this.showPhoneAuth = true
+        uni.showToast({
+          title: '请继续授权手机号',
+          icon: 'none',
+          duration: 2000
+        })
+      }
     },
 
     async handleGetPhoneNumber(e) {
@@ -554,15 +552,21 @@ export default {
         uni.hideLoading()
 
         if (result && result.isSign === 'false') {
-          console.log('[登录] 需要完成注册')
+          console.log('[登录] 未注册用户,需要完善头像昵称')
           this.tempUserData = {
             openid: result.openid,
             unionid: result.unionid,
             phoneNumber: result.phoneNumber
           }
-          await this.submitRegistration()
+          // 显示获取头像昵称的按钮
+          this.showPhoneAuth = false
+          uni.showToast({
+            title: '请先设置头像和昵称',
+            icon: 'none',
+            duration: 2000
+          })
         } else if (result && result.isSign === 'true') {
-          console.log('[登录] 已注册用户,登录成功')
+          console.log('[登录] 已注册用户(H5注册),登录成功')
           this.handleLoginSuccess()
         } else {
           throw new Error('验证接口返回数据异常')
@@ -800,6 +804,7 @@ export default {
   padding: 12rpx 24rpx;
   background: rgba(255, 255, 255, 0.2);
   border-radius: 50rpx;
+  -webkit-backdrop-filter: blur(10rpx);
   backdrop-filter: blur(10rpx);
 }
 

+ 1 - 1
src/pages/profile/edit.vue

@@ -130,7 +130,7 @@ const uploadAvatar = async (tempPath) => {
       success: (res) => {
         if (res.statusCode === 200) {
           const data = JSON.parse(res.data)
-          if (data.code === 200 && data.data?.url) {
+          if (data.code === 200 && data.data && data.data.url) {
             resolve(data.data.url)
           } else {
             reject(new Error(data.message || '上传失败'))

+ 1 - 1
src/pages/rank/rank.vue

@@ -62,7 +62,7 @@
                 <movable-view 
                   class="movable-view"
                   direction="horizontal"
-                  :x="slideStates[stock.code]?.x || 0"
+                  :x="(slideStates[stock.code] && slideStates[stock.code].x) || 0"
                   :damping="40"
                   :friction="5"
                   :out-of-bounds="false"

+ 5 - 0
vite.config.js

@@ -6,6 +6,7 @@ export default defineConfig({
     uni(),
   ],
   build: {
+    target: 'es2015',
     // 添加时间戳到文件名,强制浏览器重新加载
     rollupOptions: {
       output: {
@@ -14,5 +15,9 @@ export default defineConfig({
         assetFileNames: `assets/[name]-[hash]-${Date.now()}.[ext]`
       }
     }
+  },
+  server: {
+    host: '0.0.0.0',
+    port: 8080
   }
 })