luohairen
2024-10-29 21e346b09b236c1645a4af2b045dd599b248b6f0
src/views/user/admin/list.vue
@@ -16,6 +16,14 @@
      <el-table-column prop="userName" label="用户名"/>
      <el-table-column prop="realName" label="真实姓名" />
      <el-table-column prop="sex" label="性别" width="60px;" :formatter="sexFormatter"/>
      <el-table-column label="班级">
        <template slot-scope="scope">
        <span v-if="Array.isArray(scope.row.className) && scope.row.className.length > 0">
          {{ scope.row.className.join(', ') }}
        </span>
          <span v-else>-</span>
        </template>
      </el-table-column>
      <el-table-column prop="phone" label="手机号"/>
      <el-table-column prop="createTime" label="创建时间" width="160px"/>
      <el-table-column label="状态" prop="status" width="70px">
@@ -34,6 +42,7 @@
            <el-button size="mini">编辑</el-button>
          </router-link>
          <el-button size="mini" type="danger"  @click="deleteUser(row)" class="link-left">删除</el-button>
          <el-button size="mini"  @click="resetPassword(row)" type="success" class="link-left">重置密码</el-button>
        </template>
      </el-table-column>
    </el-table>
@@ -113,7 +122,22 @@
    },
    statusBtnFormatter (status) {
      return this.enumFormat(this.statusBtn, status)
    }
    },
    resetPassword(row) {
      this.$confirm('此操作将重置该成员的密码, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        userApi.resetUserPassword(row.id).then(re => {
          if (re.code === 1) {
            this.$message.success(re.message)
          } else {
            this.$message.error(re.message)
          }
        })
      })
    },
  },
  computed: {
    ...mapGetters('enumItem', [