Browse Source

improve: 城市文件

From-wh 2 years ago
parent
commit
186188a00a

+ 10 - 0
template/admin/src/api/app.js

@@ -372,3 +372,13 @@ export function downloadReplyCode(id) {
     method: 'GET',
   });
 }
+
+/**
+ * 城市列表
+ */
+export function cityList() {
+  return request({
+    url: `setting/city/full_list`,
+    method: 'GET',
+  });
+}

+ 11 - 0
template/admin/src/api/setting.js

@@ -1111,3 +1111,14 @@ export function langCodeTranslate(data) {
     data,
   });
 }
+
+/**
+ * @description 代码生成
+ */
+export function codeCurd(data) {
+  return request({
+    url: `curd`,
+    method: 'post',
+    data,
+  });
+}

+ 23 - 15
template/admin/src/pages/setting/systemStore/index.vue

@@ -157,8 +157,10 @@
 <script>
 import { storeApi, keyApi, storeAddApi } from '@/api/setting';
 import { mapState } from 'vuex';
-import city from '@/utils/city';
+// import city from '@/utils/city';
 import uploadPictures from '@/components/uploadPictures';
+import { cityList } from '@/api/app';
+
 export default {
   name: 'systemStore',
   components: { uploadPictures },
@@ -182,7 +184,7 @@ export default {
     return {
       spinShow: false,
       modalMap: false,
-      addresData: city,
+      addresData: [],
       formItem: {
         name: '',
         introduction: '',
@@ -247,19 +249,7 @@ export default {
     };
   },
   created() {
-    city.map((item) => {
-      item.value = item.label;
-      if (item.children && item.children.length) {
-        item.children.map((j) => {
-          j.value = j.label;
-          if (j.children && j.children.length) {
-            j.children.map((o) => {
-              o.value = o.label;
-            });
-          }
-        });
-      }
-    });
+    this.getCityList();
     this.getKey();
     this.getFrom();
   },
@@ -288,6 +278,24 @@ export default {
     window.selectAdderss = this.selectAdderss;
   },
   methods: {
+    getCityList() {
+      cityList().then((res) => {
+        res.data.map((item) => {
+          item.value = item.label;
+          if (item.children && item.children.length) {
+            item.children.map((j) => {
+              j.value = j.label;
+              if (j.children && j.children.length) {
+                j.children.map((o) => {
+                  o.value = o.label;
+                });
+              }
+            });
+          }
+        });
+        this.addresData = res.data;
+      });
+    },
     // 选择经纬度
     selectAdderss(data) {
       this.formItem.latlng = data.latlng.lat + ',' + data.latlng.lng;

+ 11 - 3
template/admin/src/pages/user/list/index.vue

@@ -427,8 +427,10 @@ import editFrom from '../../../components/from/from';
 import sendFrom from '@/components/sendCoupons/index';
 import userDetails from './handle/userDetails';
 import newsCategory from '@/components/newsCategory/index';
-import city from '@/utils/city';
+// import city from '@/utils/city';
 import customerInfo from '@/components/customerInfo';
+import { cityList } from '@/api/app';
+
 export default {
   name: 'user_list',
   components: {
@@ -536,7 +538,7 @@ export default {
         { type: 'app', name: 'APP' },
       ],
       address: [],
-      addresData: city,
+      addresData: [],
       isShowSend: true,
       modal13: false,
       maxCols: 4,
@@ -688,6 +690,7 @@ export default {
   },
   created() {
     this.getList();
+    this.getCityList();
   },
   mounted() {
     this.userGroup();
@@ -695,6 +698,11 @@ export default {
     // this.groupLists();
   },
   methods: {
+    getCityList() {
+      cityList().then((res) => {
+        this.addresData = res.data;
+      });
+    },
     setUser() {
       let data = this.$refs.userEdit.formItem;
       let ids = [];
@@ -969,7 +977,7 @@ export default {
     // 赠送会员等级
     giveLevelTime(id) {
       this.$modalForm(giveLevelTimeApi(id)).then(() => this.getList(1));
-      
+
       // giveLevelTimeApi(id)
       //   .then(async (res) => {
       //     if (res.data.status === false) {