|
@@ -1,256 +0,0 @@
|
|
|
-<template>
|
|
|
- <div id="index">
|
|
|
- <el-row>
|
|
|
- <el-col :span="24" class="style">
|
|
|
- <el-col :span="24" class="top">
|
|
|
- <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" class="main">
|
|
|
- <el-col :span="24" class="add">
|
|
|
- <el-button type="primary" size="mini" @click="add()">添加用户</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" class="info">
|
|
|
- <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
|
|
|
- <el-col :span="24" class="name">
|
|
|
- {{ item.vipname }}
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" class="text">
|
|
|
- 联系电话:<span>{{ item.vipphone }}</span>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" class="text">
|
|
|
- 单位名称:<span>{{ item.company }}</span>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" class="text">
|
|
|
- email:<span>{{ item.email }}</span>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" class="btn">
|
|
|
- <el-button type="primary" size="mini" @click="editViP(item)">编辑</el-button>
|
|
|
- </el-col>
|
|
|
- </el-col>
|
|
|
- </el-col>
|
|
|
- </el-col>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-dialog title="添加用户" :visible.sync="dialogVisible" width="90%" :before-close="handleClose">
|
|
|
- <el-col :span="24">
|
|
|
- <el-form :model="form">
|
|
|
- <el-form-item label="用户名" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.name" autocomplete="off" placeholder="请输入用户名"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="手机号" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.phone" autocomplete="off" maxlength="11" placeholder="请输入手机号" :disabled="disabled"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="密码" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.passwd" autocomplete="off" placeholder="请输入密码" show-password :disabled="disabled"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="单位名称" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.company" autocomplete="off" placeholder="请输入单位名称"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="email" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.email" autocomplete="off" placeholder="请输入email"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="简介" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.content" type="textarea" autocomplete="off" placeholder="请输入简介"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-col :span="24" style="text-align:center">
|
|
|
- <el-button @click="closeBtn">取 消</el-button>
|
|
|
- <el-button type="primary" @click="onSubmit">确 定</el-button>
|
|
|
- </el-col>
|
|
|
- </el-form>
|
|
|
- </el-col>
|
|
|
- </el-dialog>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
-import NavBar from '@/layout/common/topInfo.vue';
|
|
|
-const { mapActions: dock } = createNamespacedHelpers('dock');
|
|
|
-const { mapActions: apply } = createNamespacedHelpers('apply');
|
|
|
-const { mapActions: authUser } = createNamespacedHelpers('authUser');
|
|
|
-export default {
|
|
|
- name: 'index',
|
|
|
- props: {},
|
|
|
- components: { NavBar },
|
|
|
- data: function() {
|
|
|
- return {
|
|
|
- // 头部标题
|
|
|
- title: '',
|
|
|
- // meta为true
|
|
|
- isleftarrow: '',
|
|
|
- // 返回
|
|
|
- navShow: true,
|
|
|
- list: [],
|
|
|
- dock_id: '',
|
|
|
- dialogVisible: false,
|
|
|
- disabled: false,
|
|
|
- form: {},
|
|
|
- formLabelWidth: '80px',
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.searchInfo();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- ...dock({ dockQuery: 'query', dockfetch: 'fetch', dockupdate: 'update', dockupdateVip: 'updateVip', createvipuser: 'createvipuser' }),
|
|
|
- ...apply({ applyUpdate: 'update' }),
|
|
|
- ...authUser({ authUserQuery: 'query', authUserCreate: 'create', authUserUpdate: 'update' }),
|
|
|
- async searchInfo() {
|
|
|
- let res = await this.dockfetch(this.user.uid);
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$set(this, `list`, res.data.vipuser);
|
|
|
- this.$set(this, `dock_id`, res.data.id);
|
|
|
- }
|
|
|
- },
|
|
|
- // 添加用户
|
|
|
- add() {
|
|
|
- this.dialogVisible = true;
|
|
|
- this.disabled = false;
|
|
|
- },
|
|
|
- // 保存
|
|
|
- async onSubmit() {
|
|
|
- if (this.form.id) {
|
|
|
- const res = await this.authUserUpdate(this.form);
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- let data = {
|
|
|
- vipname: this.form.name,
|
|
|
- vipphone: this.form.phone,
|
|
|
- company: this.form.company,
|
|
|
- email: this.form.email,
|
|
|
- content: this.form.content,
|
|
|
- role: '8',
|
|
|
- status: '1',
|
|
|
- id: this.dock_id,
|
|
|
- vipid: this.form.vipid,
|
|
|
- };
|
|
|
- const arr = await this.dockupdateVip(data);
|
|
|
- if (this.$checkRes(arr)) {
|
|
|
- this.$notify({
|
|
|
- message: '信息修改成功',
|
|
|
- type: 'success',
|
|
|
- });
|
|
|
- this.dialogVisible = false;
|
|
|
- this.searchInfo();
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- const authUserList = await this.authUserQuery();
|
|
|
- let r = authUserList.data.some(f => f.phone == this.form.phone);
|
|
|
- if (r) {
|
|
|
- this.$notify({
|
|
|
- message: '手机号已经被注册,请重新输入',
|
|
|
- type: 'warning',
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.form.role = '8';
|
|
|
- const res = await this.authUserCreate(this.form);
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- let data = {
|
|
|
- vipname: this.form.name,
|
|
|
- vipphone: this.form.phone,
|
|
|
- company: this.form.company,
|
|
|
- email: this.form.email,
|
|
|
- content: this.form.content,
|
|
|
- role: this.form.role,
|
|
|
- uid: res.data.id,
|
|
|
- id: this.dock_id,
|
|
|
- };
|
|
|
- const arr = await this.createvipuser(data);
|
|
|
- if (this.$checkRes(arr)) {
|
|
|
- this.dialogVisible = false;
|
|
|
- this.searchInfo();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 修改
|
|
|
- // 修改
|
|
|
- editViP(data) {
|
|
|
- this.dialogVisible = true;
|
|
|
- let newDate = {};
|
|
|
- newDate.name = data.vipname;
|
|
|
- newDate.phone = data.vipphone;
|
|
|
- newDate.passwd = data.passwd;
|
|
|
- newDate.company = data.company;
|
|
|
- newDate.email = data.email;
|
|
|
- newDate.content = data.content;
|
|
|
- newDate.id = data.uid;
|
|
|
- newDate.vipid = data._id;
|
|
|
- console.log(newDate);
|
|
|
-
|
|
|
- this.disabled = true;
|
|
|
- this.$set(this, `form`, newDate);
|
|
|
- },
|
|
|
- // 取消
|
|
|
- closeBtn() {
|
|
|
- this.form = {};
|
|
|
- this.dialogVisible = false;
|
|
|
- },
|
|
|
- // 取消
|
|
|
- handleClose(done) {
|
|
|
- done();
|
|
|
- },
|
|
|
- },
|
|
|
- computed: { ...mapState(['user']) },
|
|
|
- mounted() {
|
|
|
- this.title = this.$route.meta.title;
|
|
|
- this.isleftarrow = this.$route.meta.isleftarrow;
|
|
|
- },
|
|
|
-};
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="less" scoped>
|
|
|
-.style {
|
|
|
- width: 100%;
|
|
|
- min-height: 667px;
|
|
|
- position: relative;
|
|
|
-}
|
|
|
-.top {
|
|
|
- height: 46px;
|
|
|
- overflow: hidden;
|
|
|
- position: relative;
|
|
|
- z-index: 999;
|
|
|
-}
|
|
|
-.main {
|
|
|
- min-height: 570px;
|
|
|
-}
|
|
|
-.add {
|
|
|
- text-align: center;
|
|
|
- padding: 10px 0;
|
|
|
- position: fixed;
|
|
|
- width: 100%;
|
|
|
- z-index: 999;
|
|
|
- background: #fff;
|
|
|
-}
|
|
|
-.info {
|
|
|
- position: relative;
|
|
|
- top: 60px;
|
|
|
- .list {
|
|
|
- margin: 0 5px 10px 5px;
|
|
|
- width: 97%;
|
|
|
- padding: 0 10px;
|
|
|
- border-radius: 10px;
|
|
|
- background: #f9fafc;
|
|
|
- .name {
|
|
|
- padding: 5px 0px;
|
|
|
- font-size: 16px;
|
|
|
- }
|
|
|
- .text {
|
|
|
- padding: 5px 0;
|
|
|
- font-size: 14px;
|
|
|
- color: #ccc;
|
|
|
- span {
|
|
|
- color: #000;
|
|
|
- }
|
|
|
- }
|
|
|
- .btn {
|
|
|
- margin: 10px 0;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-/deep/.el-dialog__body {
|
|
|
- height: 420px;
|
|
|
-}
|
|
|
-</style>
|