浏览代码

temp save

liujq 4 年之前
父节点
当前提交
7b8a228123
共有 3 个文件被更改,包括 128 次插入11 次删除
  1. 3 0
      src/api/user.js
  2. 11 11
      src/router/index.js
  3. 114 0
      src/views/user/app.vue

+ 3 - 0
src/api/user.js

@@ -4,6 +4,9 @@
 import { getRequest, getRequestNoSort } from '@/utils/request'
 
 export default {
+  admwechatuserlist: params => { // 小程序 用户列表
+    return getRequest('/adm/wechat/user/list', params)
+  },
   admadminlist: params => { // 用户列表
     return getRequest('/adm/admin/list', params)
   },

+ 11 - 11
src/router/index.js

@@ -117,17 +117,6 @@ export const moreRoutes = [
       meta: { title: '学校管理', icon: 'dashboard' }
     }]
   },
-  // {
-  //   path: '/user',
-  //   component: Layout,
-  //   redirect: '/user/index',
-  //   children: [{
-  //     path: 'index',
-  //     name: 'UserIndex',
-  //     component: () => import('@/views/user/index'),
-  //     meta: { title: '用户管理', icon: 'dashboard', affix: true }
-  //   }]
-  // },
   {
     path: '/qa',
     component: Layout,
@@ -161,6 +150,17 @@ export const moreRoutes = [
       meta: { title: '反馈管理', icon: 'dashboard' }
     }]
   },
+  {
+    path: '/user',
+    component: Layout,
+    redirect: '/user/app',
+    children: [{
+      path: 'app',
+      name: 'UserApp',
+      component: () => import('@/views/user/app'),
+      meta: { title: '用户管理', icon: 'dashboard', affix: true }
+    }]
+  },
 ]
 export const constantRoutes = [
   {

+ 114 - 0
src/views/user/app.vue

@@ -0,0 +1,114 @@
+<template>
+  <div class="app-container">
+    <search-form
+      :list-loading="listLoading"
+      @change="searchHandle"
+    />
+    <table-list
+      :list-loading="listLoading"
+      :data="tableData2"
+      :columns="listConfig"
+      :current-page="currentPage"
+      :page-size="pageSize"
+      :total-records="totalRecords"
+      @currentChange="pageHandle"
+      :isAdd="true"
+      @add="openPopup"
+    />
+    <popup-edit
+      :isShow="isDtlShow"
+      :curObj="curObj"
+      @close="closePopup"
+    />
+  </div>
+</template>
+<script>
+import { arrToObj } from '@/utils'
+import SearchForm from './components/searchForm/Index'
+import PopupEdit from './components/popup/IndexEdit'
+import baseTable from '_m/baseTable.js'
+import xData from './mixin'
+export default {
+  name: 'index',
+  components: {
+    SearchForm,
+    PopupEdit,
+  },
+  provide() {
+    return {
+      parentData: this
+    }
+  },
+  mixins: [baseTable],
+  data() {
+    return {
+      apiStr: 'user.admwechatuserlist',
+      searchForm: null,
+      isDtlShow: false,
+      curObj: {},
+      ...xData
+    }
+  },
+  computed: {
+    tableData2() {
+      const arr = [...this.tableData]
+      arr.map(item => {
+      })
+      return arr
+    }
+  },
+  created() {},
+  mounted() {
+    this.listConfig = {
+      rows: [
+        { label: '头像', prop: 'avatar', type: 'img' },
+        { label: '昵称', prop: 'nickname' },
+        { label: '手机号', prop: 'email' },
+        { label: '注册时间', prop: 'create_at' },
+        // { label: '操作', width: 200, type: 'handle2', operations:
+        //   [
+        //     { label: '编辑', func: this.openPopup, btnType: 'primary' },
+        //     { label: '删除', func: this.delHandle, btnType: 'danger' },
+        //   ]
+        // }
+      ]
+    }
+  },
+  methods: {
+    delHandle(row) {
+      this.$msg(`您确定要删除该用户吗?`, 'confirm', () => {
+        this.$api.user.admadmindel({
+          id: row.id
+        }).then(data => {
+          this.$msgs(`已删除!`)
+          this.fetchData()
+        })
+      }, null, true)
+    },
+    openPopup(row) {
+      if (row && row.id) {
+        this.curObj = row
+      } else {
+        this.curObj = {}
+      }
+      this.isDtlShow = true
+    },
+    closePopup(obj) {
+      if (obj) {
+        const params = obj
+        let apiStr = 'admadminadd'
+        if (obj.id) apiStr = 'admadminedit'
+        this.$api.user[apiStr]({
+          ...params
+        }).then(data => {
+          this.$msgs(obj.id ? '编辑成功' : '新增成功')
+          this.fetchData()
+          this.isDtlShow = false
+        })
+      } else {
+        this.isDtlShow = false
+      }
+    }
+  }
+}
+</script>