Handy_Cao 1 年之前
父节点
当前提交
a4e451f178

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

@@ -8,12 +8,33 @@ import { reactive } from 'vue'
 import { useNavigation } from './router/navigation'
 import { dialog } from '@/utils/vant'
 import { useLogin } from '@/business/login'
+import { i18n } from "@/stores"
 import eventBus from '@/services/bus'
 import Notify from '@mobile/components/base/notify/index.vue'
+import { Locale } from 'vant'
+import enUS from 'vant/es/locale/lang/en-US'
+import enCN from 'vant/es/locale/lang/zh-CN'
+import thTH from 'vant/es/locale/lang/th-TH'
+import zhTW from 'vant/es/locale/lang/zh-TW'
 
 const { userLogout } = useLogin()
 const { backHome } = useNavigation()
 
+switch (i18n.global.locale) {
+    case 'en-US':
+      Locale.use(i18n.global.locale, enUS)
+      break;
+    case 'th':
+        Locale.use(i18n.global.locale, thTH)
+        break;
+      case 'zh-TW':
+        Locale.use(i18n.global.locale, zhTW)
+        break;
+  default:
+        Locale.use(i18n.global.locale, enCN)
+        break;
+}
+
 const notify = reactive({
   show: false,
   title: '',

+ 5 - 5
src/packages/mobile/views/mine/setting/Index.vue

@@ -58,11 +58,11 @@ defineProps({
 const luanguage = computed(() => {
     switch (i18n.global.locale) {
         case 'zh-CN':
-            return 'zh_CN'
+            return 'zh-CN'
         case 'en-US':
             return 'en'
         case 'zh-TW':
-            return 'zh_TW'
+            return 'zh-TW'
         default:
             return 'th'
     }
@@ -70,9 +70,9 @@ const luanguage = computed(() => {
 
 const { dataList } = useRequest(getI18nConfigs, {})
 
-const changeLuanguage = (e) => {
+const changeLuanguage = (e: string) => {
     switch (e) {
-        case 'zh_CN':
+        case 'zh-CN':
             i18n.global.locale = 'zh-CN'
             Locale.use(i18n.global.locale, enCN)
             break;
@@ -80,7 +80,7 @@ const changeLuanguage = (e) => {
             i18n.global.locale = 'en-US'
             Locale.use(i18n.global.locale, enUS)
             break;
-        case 'zh_TW':
+        case 'zh-TW':
             i18n.global.locale ='zh-TW'
             Locale.use(i18n.global.locale, zhTW)
             break;

+ 3 - 0
src/packages/pc/App.vue

@@ -21,6 +21,7 @@ import eventBus from '@/services/bus'
 import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
 import en from 'element-plus/dist/locale/en.mjs'
 import th from 'element-plus/dist/locale/th.mjs'
+import zhTW from 'element-plus/dist/locale/zh-tw.mjs'
 
 const { userLogout } = useLogin()
 const router = useRouter()
@@ -32,6 +33,8 @@ const locale = computed(() => {
       return en
     case 'th':
       return th
+    case 'zh-TW':
+      return zhTW
     default:
       return zhCn
   }

+ 5 - 5
src/packages/pc/components/layouts/header/components/setting/index.vue

@@ -90,11 +90,11 @@ const { t } = i18n.global
 const luanguage = computed(() => {
     switch (i18n.global.locale) {
         case 'zh-CN':
-            return 'zh_CN'
+            return 'zh-CN'
         case 'en-US':
             return 'en'
         case 'zh-TW':
-            return 'zh_TW'
+            return 'zh-TW'
         default:
             return 'th'
     }
@@ -106,16 +106,16 @@ const onCancel = () => {
 
 const { dataList } = useRequest(getI18nConfigs, {})
 
-const changeLuanguage = (e) => {
+const changeLuanguage = (e: string) => {
     ElMessageBox.confirm(t('user.login.tips6'), t('common.tips'), { confirmButtonText: t('common.ikonw'), cancelButtonText: t('operation.cancel') }).then(() => {
         switch (e) {
-        case 'zh_CN':
+        case 'zh-CN':
             i18n.global.locale = 'zh-CN'
             break;
         case 'en':
             i18n.global.locale = 'en-US'
             break;
-        case 'zh_TW':
+        case 'zh-TW':
             i18n.global.locale ='zh-TW'
             break;
         default:

+ 1 - 1
src/packages/pc/views/footer/presell/transferposition/index.vue

@@ -86,7 +86,7 @@ getTableColumns('transfer-position').then((res) => {
 })
 
 // 接收委托回应通知
-const orderRspNotify = eventBus.$on('OrderRsp', () => {
+const orderRspNotify = eventBus.$on('PosChangedNtf', () => {
     run()
 })
 

+ 12 - 1
src/packages/pc/views/market/trade/presell/transfer/listing/index.vue

@@ -62,7 +62,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, computed, watch, onMounted } from 'vue'
+import { shallowRef, computed, watch, onMounted, onUnmounted } from 'vue'
 import { ElMessage, ElMessageBox, FormInstance, FormRules } from 'element-plus'
 import { EPriceMode, EListingSelectType, EDelistingType, EBuildType, EValidType } from '@/constants/client'
 import { BuyOrSell, getBuyOrSellList } from '@/constants/order'
@@ -72,6 +72,7 @@ import { useOrder } from '@/business/trade'
 import { useFuturesStore, useSettingStore, i18n } from '@/stores'
 import Forex from '@pc/components/modules/quote/forex/index.vue'
 import Icon from '@pc/components/base/icon/index.vue'
+import eventBus from '@/services/bus'
 
 const settingStore = useSettingStore()
 const futuresStore = useFuturesStore()
@@ -259,6 +260,16 @@ onMounted(() => {
     formData.OrderPrice = getOrderPrice()
     formData.OrderQty = qtyStep.value
 })
+
+// 接收委托回应通知
+const orderRspNotify = eventBus.$on('PosChangedNtf', () => {
+    getMineTradePositionExs()
+})
+
+onUnmounted(() => {
+    orderRspNotify.cancel()
+})
+
 </script>
 
 <style lang="less">

+ 2 - 0
src/services/websocket/message.ts

@@ -14,6 +14,8 @@ export async function pushMessage50(pkg: Package50, contentType: 'encrypted' | '
     const { getErrorInfoByCode } = useErrorInfoStore()
     const { funCode, content } = pkg
     const delay = 500 // 延迟推送消息,防止短时间内重复请求
+    
+    console.log('接收广播通知', funCode)
 
     switch (funCode) {
         case FunCode.LogoutRsp: {

+ 1 - 0
src/shims-vue.d.ts

@@ -20,6 +20,7 @@ declare module 'worker-loader!*' {
 declare module 'element-plus/dist/locale/zh-cn.mjs'
 declare module 'element-plus/dist/locale/en.mjs'
 declare module 'element-plus/dist/locale/th.mjs'
+declare module 'element-plus/dist/locale/zh-tw.mjs'
 declare module 'hqchart'
 declare module 'protobufjs'
 declare module '*.jpg'

+ 3 - 1
src/stores/modules/position.ts

@@ -93,7 +93,9 @@ export const usePositionStore = defineStore(() => {
     }
 
     // 接收头寸变化通知
-    const posChangedNtf = eventBus.$on('PosChangedNtf', () => getTradePosition())
+    const posChangedNtf = eventBus.$on('PosChangedNtf', () => { 
+        getTradePosition()
+    })
 
     // 接收登入请求数据
     eventBus.$on('LoginNotify', () => {

+ 2 - 2
src/utils/vant/index.ts

@@ -24,7 +24,7 @@ export function notify(message?: string, type?: NotifyType, duration = 2000) {
  * @param callback 
  * @returns 
  */
-export function showLoading(message = '加载中...', callback?: (hideLoading: (msg?: string, type?: ToastType) => void) => void,) {
+export function showLoading(message = '', callback?: (hideLoading: (msg?: string, type?: ToastType) => void) => void,) {
     const toast = showLoadingToast({
         message,
         duration: 0,
@@ -48,7 +48,7 @@ export function showLoading(message = '加载中...', callback?: (hideLoading: (
  * @param callback 
  * @param message 
  */
-export function fullloading(callback: (hideLoading: (msg?: string, type?: ToastType) => void) => void, message = '提交中...') {
+export function fullloading(callback: (hideLoading: (msg?: string, type?: ToastType) => void) => void, message = '') {
     return showLoading(message, callback)
 }