guhongwei 3 éve
szülő
commit
062c73ee91
1 módosított fájl, 31 hozzáadás és 5 törlés
  1. 31 5
      src/views/index.vue

+ 31 - 5
src/views/index.vue

@@ -3,12 +3,14 @@
     <admin-frame :useTop="false" :usePage="false" :useNav="false">
       <template v-slot:info>
         <van-button v-for="(i, index) in menu" :key="`menu-${index}`" @click="$router.push(i.router)">{{ i.label }}</van-button>
+        <!-- <van-button @click="toAdd()">添加用户</van-button> -->
       </template>
     </admin-frame>
   </div>
 </template>
 
 <script>
+const { textname } = require('@frame/src/layout/test');
 import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: personal } = createNamespacedHelpers('personal');
@@ -74,14 +76,38 @@ export default {
           router: '/account/index',
         },
       ],
+      list: [],
+      textname: textname,
     };
   },
-  async created() {
-    await this.search();
-  },
+  async created() {},
   methods: {
-    ...personal({ personalCreate: 'create' }),
-    search({ skip = 0, limit = this.limit, ...info } = {}) {},
+    ...personal(['create', 'query']),
+    async search({ skip = 0, limit = this.limit, ...info } = {}) {
+      for (const val of this.textname) {
+        let res = await this.query({ phone: val });
+        if (this.$checkRes(res)) {
+          if (res.total > 0) {
+            console.log('1');
+          } else {
+            let data = {
+              name: val,
+              phone: val,
+              password: '111111',
+              type: '4',
+              code: 'JLKJQYCGD',
+              status: '1',
+            };
+            let p1 = await this.create(data);
+            console.log(p1);
+          }
+        }
+      }
+    },
+    // 添加用户
+    toAdd() {
+      this.search();
+    },
   },
   computed: {
     ...mapState(['user']),