| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <template>
- <el-row>
- <el-row>
- <el-form :inline="true" :model="searchForm" class="demo-form-inline">
- <el-form-item>
- <el-select v-model="searchForm.type" placeholder="查询类型">
- <el-option label="用户名" value="1" />
- <el-option label="用户 ID" value="2" />
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-input v-model="searchForm.content" placeholder="" />
- </el-form-item>
- <el-form-item>
- <el-button size="mini" type="warning" @click="search">查询</el-button>
- </el-form-item>
- </el-form>
- <el-table
- :data="dataList"
- border
- style="width: 100%"
- >
- <el-table-column
- fixed="left"
- label="No"
- type="index"
- />
- <el-table-column
- prop="avatarUrl"
- label="头像"
- width="90"
- >
- <template slot-scope="scope">
- <el-image :src="scope.row.avatarUrl" min-width="30" height="20" />
- </template>
- </el-table-column>
- <el-table-column
- prop="screenName"
- label="用户名"
- >
- <template slot-scope="scope">
- <router-link style="text-decoration-line: none" target="_blank" :to="`/user/${scope.row.userId}`">
- <span>{{ scope.row.screenName }}</span>
- </router-link>
- </template>
- </el-table-column>
- <el-table-column
- prop="gender"
- label="性别"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.gender === 0">女</span>
- <span v-else-if="scope.row.gender === 1">男</span>
- <span v-else>未知</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="signature"
- label="签名"
- >
- <template slot-scope="scope">
- <el-tooltip
- v-if="scope.row.signature"
- :content="scope.row.signature"
- raw-content
- placement="top-start"
- >
- <span v-if="scope.row.signature.length <= 15">
- {{ scope.row.signature }}
- </span>
- <span v-else>
- {{ scope.row.signature.substr(0, 15) + "..." }}
- </span>
- </el-tooltip>
- <span v-else>-</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="following"
- label="关注数"
- />
- <el-table-column
- prop="follower"
- label="粉丝数"
- />
- <el-table-column
- prop="userId"
- label="帐号状态"
- width="120"
- >
- <template slot-scope="scope">
- <el-tag v-if="scope.row.status === 1" :type="'warning'" disable-transitions>
- 正常
- </el-tag>
- <el-tag v-else-if="scope.row.status === 2" :type="'success'" disable-transitions>
- 禁言
- </el-tag>
- <el-tag v-else-if="scope.row.status === 3" :type="'danger'" disable-transitions>
- 封禁
- </el-tag>
- <el-tag v-else :type="'danger'" disable-transitions>
- 注销
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column
- fixed="right"
- label="操作"
- >
- <template slot-scope="scope">
- <el-button
- size="mini"
- @click="handleEdit(scope.$index, scope.row)"
- >编辑</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 修改修改帐号状态对话框 -->
- <el-dialog
- append-to-body
- :visible.sync="showEditScopeDialog"
- width="30%"
- center
- >
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <span>修改帐号状态</span>
- <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateStatus">更新</el-button>
- </div>
- <div class="text item">
- <el-select v-model="form.scope" placeholder="设置帐号状态">
- <el-option label="正常" value="1" />
- <el-option label="禁言" value="2" />
- <el-option label="封禁" value="3" />
- </el-select>
- </div>
- </el-card>
- </el-dialog>
- </el-row>
- <el-row>
- <el-pagination
- background
- :small="screenWidth <= 768"
- layout="prev, pager, next"
- :page-size="pageSize"
- :current-page="currentPage"
- :total="totalSize"
- @current-change="handleCurrentChange"
- @prev-click="handleCurrentChange"
- @next-click="handleCurrentChange"
- />
- </el-row>
- </el-row>
- </template>
- <script>
- import { getUserList } from '@/api/admin'
- export default {
- name: 'UserList',
- data() {
- return {
- // 屏幕宽度, 为了控制分页条的大小
- screenWidth: document.body.clientWidth,
- currentPage: 1,
- pageSize: 100,
- totalSize: 0,
- dataList: [],
- // **********************************************************************
- showEditScopeDialog: false,
- form: {
- videoId: null,
- scope: '1'
- },
- searchForm: {
- page: 1,
- type: '1',
- content: null
- }
- }
- },
- created() {
- document.title = '用户列表'
- this.getData(this.searchForm)
- },
- methods: {
- handleCurrentChange(pageNumber) {
- this.currentPage = pageNumber
- this.searchForm.page = this.currentPage
- this.getData(this.searchForm)
- // 回到顶部
- scrollTo(0, 0)
- },
- getData(searchForm) {
- this.dataList = []
- getUserList(searchForm).then(resp => {
- if (resp.code === 0) {
- this.dataList = resp.data.list
- this.totalSize = resp.data.totalSize
- } else {
- this.$notify({
- title: '提示',
- message: resp.msg,
- type: 'warning',
- duration: 3000
- })
- }
- }).catch(error => {
- this.$notify({
- title: '提示',
- message: error.message,
- type: 'error',
- duration: 3000
- })
- })
- },
- handleScope(index, row) {
- this.form.videoId = row.videoId
- this.form.scope = '' + row.scope
- this.showEditScopeDialog = true
- },
- handleEdit(index, row) {
- this.showEditScopeDialog = true
- },
- onUpdateStatus() {
- this.showEditScopeDialog = false
- this.$notify({
- message: '接口未实现',
- type: 'warning',
- duration: 3000
- })
- },
- search() {
- this.currentPage = 1
- this.searchForm.page = this.currentPage
- this.getData(this.searchForm)
- }
- }
- }
- </script>
- <style>
- </style>
|