xiongzhu 2 lat temu
rodzic
commit
17d27f172e
2 zmienionych plików z 22 dodań i 9 usunięć
  1. 1 1
      public/meta.js
  2. 21 8
      src/App.vue

+ 1 - 1
public/meta.js

@@ -1 +1 @@
-window.www_version = 1120
+window.www_version = 1121

+ 21 - 8
src/App.vue

@@ -71,7 +71,7 @@
 <script setup>
 <script setup>
 import { ConfigProvider as VantConfigProvider, showConfirmDialog } from 'vant'
 import { ConfigProvider as VantConfigProvider, showConfirmDialog } from 'vant'
 import { useBackButton, useIonRouter } from '@ionic/vue'
 import { useBackButton, useIonRouter } from '@ionic/vue'
-import { onMounted, onBeforeUnmount, ref, provide } from 'vue'
+import { onMounted, onBeforeUnmount, ref, provide, watch } from 'vue'
 import { useRoute } from 'vue-router'
 import { useRoute } from 'vue-router'
 import { useSystemStore } from './stores/system'
 import { useSystemStore } from './stores/system'
 import { App } from '@capacitor/app'
 import { App } from '@capacitor/app'
@@ -85,12 +85,15 @@ import { Clipboard as NativeClipboard } from '@capacitor/clipboard'
 import { Capacitor } from '@capacitor/core'
 import { Capacitor } from '@capacitor/core'
 import { useClipboard } from '@vueuse/core'
 import { useClipboard } from '@vueuse/core'
 import { AppLauncher } from '@capacitor/app-launcher'
 import { AppLauncher } from '@capacitor/app-launcher'
+import { storeToRefs } from 'pinia'
+import { useUserStore } from './stores/user'
 
 
 const store = useSettingsStore()
 const store = useSettingsStore()
 const { t } = useI18n()
 const { t } = useI18n()
 const ionRouter = useIonRouter()
 const ionRouter = useIonRouter()
 const route = useRoute()
 const route = useRoute()
 const customers = ref([])
 const customers = ref([])
+const { user } = storeToRefs(useUserStore())
 
 
 const promptLogin = async () => {
 const promptLogin = async () => {
     const confirm = await showConfirmDialog({
     const confirm = await showConfirmDialog({
@@ -119,14 +122,8 @@ useBackButton(1, processNextHandler => {
         processNextHandler()
         processNextHandler()
     }
     }
 })
 })
-onMounted(() => {
-    init()
-})
 
 
-function init() {
-    useSystemStore().getSysConfigs()
-    emitter.on('promptLogin', promptLogin)
-    emitter.on('customer', customer)
+function getBrokers() {
     http.get('/sysConfig/get/customer_json').then(res => {
     http.get('/sysConfig/get/customer_json').then(res => {
         customers.value = JSON.parse(res.value)
         customers.value = JSON.parse(res.value)
         http.get('/user/myBroker').then(res => {
         http.get('/user/myBroker').then(res => {
@@ -141,9 +138,25 @@ function init() {
     })
     })
 }
 }
 
 
+function init() {
+    useSystemStore().getSysConfigs()
+    getBrokers()
+    emitter.on('promptLogin', promptLogin)
+    emitter.on('customer', customer)
+}
+
+onMounted(() => {
+    init()
+})
+
 onBeforeUnmount(() => {
 onBeforeUnmount(() => {
     emitter.off('promptLogin', promptLogin)
     emitter.off('promptLogin', promptLogin)
 })
 })
+
+watch(user, () => {
+    getBrokers()
+})
+
 const showCustmer = ref(false)
 const showCustmer = ref(false)
 function customer() {
 function customer() {
     showCustmer.value = true
     showCustmer.value = true