li.shaoyi 2 vuotta sitten
vanhempi
commit
65ba28b528

+ 1 - 0
src/packages/mobile/App.vue

@@ -17,6 +17,7 @@ eventBus.$on('LogoutNotify', (msg) => {
     if (msg) {
       dialog({
         message: msg as string,
+        confirmButtonText: '确定'
       }).then(() => {
         // ---待处理---
         // 登出后应该回退到首页,如果回退后非首页,会导致路由拦截而跳转到登录页面,此时因为 tabIndex = 0 的问题,登录页被 replace 成首页,导致路由还能继续后退

+ 1 - 1
src/packages/mobile/views/order/list/components/presale/list/Index.vue

@@ -49,7 +49,7 @@
                         </li>
                         <li>
                             <span>日期</span>
-                            <span>{{ formatDate(item.clientordertime, 'YYYY-MM-DD') }}</span>
+                            <span>{{ formatDate(item.ordertime, 'YYYY-MM-DD') }}</span>
                         </li>
                     </ul>
                 </div>

+ 6 - 1
src/packages/mobile/views/order/position/components/presale/list/Index.vue

@@ -50,7 +50,8 @@
                 </div>
                 <div class="g-order-list__btnbar">
                     <Button size="small" @click="showComponent('detail', item)" round>详情</Button>
-                    <Button size="small" @click="depositPayment(item)" round>补足定金</Button>
+                    <Button size="small" @click="depositPayment(item)" round
+                        v-if="item.paystatus === PayStatus.UnPay">补足定金</Button>
                 </div>
             </div>
         </div>
@@ -64,6 +65,7 @@ import { shallowRef, defineAsyncComponent } from 'vue'
 import { Button } from 'vant'
 import { fullloading, dialog } from '@/utils/vant'
 import { useComponent } from '@/hooks/component'
+import { PayStatus } from '@/constants/order'
 import { useRequest } from '@/hooks/request'
 import { queryMineCpTradePreSaleResults } from '@/services/api/presale'
 import { makeUpDeposit } from '@/services/api/trade'
@@ -112,6 +114,9 @@ const depositPayment = (row: Model.MineCpTradePreSaleResultsRsp) => {
         fullloading((hideLoading) => {
             makeUpDeposit({
                 data: {
+                    Header: {
+                        MarketID: row.marketid
+                    },
                     TradeID: row.tradeid
                 }
             }).then(() => {

+ 0 - 1
src/services/api/trade/index.ts

@@ -232,7 +232,6 @@ export function makeUpDeposit(config: RequestConfig<Partial<Proto.MakeUpDepositR
         },
         requestCode: 'MakeUpDepositReq',
         responseCode: 'MakeUpDepositRsp',
-        marketId: 48201
     })
 }
 

+ 20 - 6
src/services/http/index.ts

@@ -9,6 +9,7 @@ import { useLoginStore, useAccountStore, useErrorInfoStore } from '@/stores'
 import { CommonResult, ResultCode, SendMsgToMQ } from './types'
 import { FunCode } from '@/constants/funcode'
 import service from '@/services'
+import eventBus from '@/services/bus'
 
 export default new (class {
     private readonly axiosInstance = axios.create({
@@ -58,6 +59,13 @@ export default new (class {
                 if (err.response) {
                     const { msg, message } = err.response.data ?? {}
                     switch (err.response.status) {
+                        case 401: {
+                            const loginStore = useLoginStore()
+                            if (loginStore.token) {
+                                eventBus.$emit('LogoutNotify', '登录失效,请重新登录')
+                            }
+                            return Promise.reject(msg || message)
+                        }
                         case 408: {
                             return Promise.reject('请求超时,请稍后再试')
                         }
@@ -129,12 +137,15 @@ export default new (class {
         config.url = baseUrl + config.url
         const res = await this.request<CommonResult<T>>(config, errMsg)
         switch (res.code) {
-            case ResultCode.InvalidToken:
+            case ResultCode.InvalidToken: {
                 return Promise.reject('令牌无效')
-            case ResultCode.Success:
+            }
+            case ResultCode.Success: {
                 return res
-            default:
+            }
+            default: {
                 return Promise.reject(res.msg)
+            }
         }
     }
 
@@ -149,12 +160,15 @@ export default new (class {
         config.url = baseUrl + config.url
         const res = await this.request<CommonResult<T>>(config, errMsg)
         switch (res.code) {
-            case ResultCode.InvalidToken:
+            case ResultCode.InvalidToken: {
                 return Promise.reject('令牌无效')
-            case 0:
+            }
+            case 0: {
                 return res
-            default:
+            }
+            default: {
                 return Promise.reject(res.msg)
+            }
         }
     }
 

+ 1 - 1
src/services/http/types.ts

@@ -28,7 +28,7 @@ export enum ResultCode {
     Warning = 103, //非法请求
     Unauthorized = 201, //授权失败
     ParameterError = 202, //参数错误
-    InvalidToken = 203, //令牌无效
+    InvalidToken = 20002, //令牌无效
     InvalidSign = 204, //签名无效
 }
 

+ 3 - 1
src/services/websocket/build/index.ts

@@ -78,7 +78,7 @@ export class MTP2WebSocket<T extends Package40 | Package50>{
                 this.uuid = uuid;
 
                 try {
-                    this.ws = new WebSocket(this.host, protocols);
+                    this.ws = new WebSocket(this.host, this.protocols);
                     // 连接成功
                     this.ws.onopen = () => {
                         console.log(this.host, '连接成功');
@@ -148,6 +148,7 @@ export class MTP2WebSocket<T extends Package40 | Package50>{
     * 启动心跳请求包发送Timer
     */
     private startHeartBeat() {
+        console.log('准备发送心跳', moment(new Date()).format('HH:mm:ss'));
         this.beatTimer = window.setTimeout(() => {
             this.beatTimerId = moment(new Date()).format('HH:mm:ss');
             console.log(this.host, '发送心跳', this.beatTimerId);
@@ -172,6 +173,7 @@ export class MTP2WebSocket<T extends Package40 | Package50>{
             // WARNING: - 注意在正常断网时停止心跳逻辑
             this.timeoutTimer = window.setTimeout(() => {
                 console.warn(this.host, '心跳超时', this.beatTimerId);
+                this.close();
                 this.reconnect();
             }, this.timeoutInterval)
         }, this.beatInterval)