|
|
@@ -71,7 +71,7 @@
|
|
|
<script setup>
|
|
|
import { ConfigProvider as VantConfigProvider, showConfirmDialog } from 'vant'
|
|
|
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 { useSystemStore } from './stores/system'
|
|
|
import { App } from '@capacitor/app'
|
|
|
@@ -85,12 +85,15 @@ import { Clipboard as NativeClipboard } from '@capacitor/clipboard'
|
|
|
import { Capacitor } from '@capacitor/core'
|
|
|
import { useClipboard } from '@vueuse/core'
|
|
|
import { AppLauncher } from '@capacitor/app-launcher'
|
|
|
+import { storeToRefs } from 'pinia'
|
|
|
+import { useUserStore } from './stores/user'
|
|
|
|
|
|
const store = useSettingsStore()
|
|
|
const { t } = useI18n()
|
|
|
const ionRouter = useIonRouter()
|
|
|
const route = useRoute()
|
|
|
const customers = ref([])
|
|
|
+const { user } = storeToRefs(useUserStore())
|
|
|
|
|
|
const promptLogin = async () => {
|
|
|
const confirm = await showConfirmDialog({
|
|
|
@@ -119,14 +122,8 @@ useBackButton(1, 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 => {
|
|
|
customers.value = JSON.parse(res.value)
|
|
|
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(() => {
|
|
|
emitter.off('promptLogin', promptLogin)
|
|
|
})
|
|
|
+
|
|
|
+watch(user, () => {
|
|
|
+ getBrokers()
|
|
|
+})
|
|
|
+
|
|
|
const showCustmer = ref(false)
|
|
|
function customer() {
|
|
|
showCustmer.value = true
|