li.shaoyi 1 년 전
부모
커밋
98b649b48b

+ 2 - 2
oem/tss/config/appconfig.json

@@ -1,8 +1,8 @@
 {
   "appId": "com.muchinfo.tss",
   "appName": "TCE",
-  "version": "1.0.7",
-  "versionCode": "100007",
+  "version": "1.0.8",
+  "versionCode": "100008",
   "apiUrl": "http://192.168.31.204:8080/cfg?key=test_204",
   "tradeChannel": "ws",
   "modules": [

+ 8 - 5
src/packages/mobile/components/base/region/index.vue

@@ -13,7 +13,8 @@
 <script lang="ts" setup>
 import { shallowRef, computed, watch } from 'vue'
 import { Popup, Cascader, CascaderOption } from 'vant'
-import axios from 'axios'
+import { useRequest } from '@/hooks/request'
+import { getDivisions } from '@/services/api/common'
 
 const props = defineProps({
     modelValue: {
@@ -89,12 +90,14 @@ const arrayToTree = (list: Model.Region[]) => {
     return getChildren('0086')
 }
 
-watch(() => props.label, (val) => {
-    inputValue.value = val
+useRequest(getDivisions, {
+    onSuccess: (res) => {
+        options.value = arrayToTree(res.data)
+    }
 })
 
-axios('./config/address.json').then((res) => {
-    options.value = arrayToTree(res.data)
+watch(() => props.label, (val) => {
+    inputValue.value = val
 })
 </script>
 

+ 2 - 2
src/packages/pc/components/base/region/index.ts

@@ -1,5 +1,5 @@
 import { shallowRef, computed, getCurrentInstance } from 'vue'
-import axios from 'axios'
+import { getDivisions } from '@/services/api/common'
 
 interface Region {
     autoid: number;
@@ -68,7 +68,7 @@ export function useRegion(defaultValue: (number | undefined)[]) {
         regionChage()
     }
 
-    axios('./config/address.json').then((res) => {
+    getDivisions().then((res) => {
         res.data.forEach((e: Region) => {
             if (e.divisionlevel === 'province') {
                 region.province.push(e)

+ 10 - 0
src/services/api/common/index.ts

@@ -270,4 +270,14 @@ export function queryMemberGoodsLimitConfig(config: RequestConfig<Model.MemberGo
             ...config.data
         }
     })
+}
+
+/**
+ * 查询区域信息
+ */
+export function getDivisions(config: RequestConfig = {}) {
+    return http.commonRequest<Model.Region[]>({
+        url: '/Common/GetDivisions',
+        params: config.data,
+    })
 }