|
|
@@ -2,6 +2,9 @@
|
|
|
<el-container>
|
|
|
<el-header height="220">
|
|
|
<h3>用户列表</h3>
|
|
|
+ <el-row style="margin-top: 10px">
|
|
|
+ <el-button type="success" size="mini" icon="el-icon-plus" @click="handleAdd">添加</el-button>
|
|
|
+ </el-row>
|
|
|
</el-header>
|
|
|
<el-main>
|
|
|
<el-table
|
|
|
@@ -16,107 +19,71 @@
|
|
|
type="index"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
- prop="pubDate"
|
|
|
+ prop="username"
|
|
|
label="帐号"
|
|
|
- width="150"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
- prop="videoId"
|
|
|
+ prop="createTime"
|
|
|
label="创建时间"
|
|
|
- width="120"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <router-link target="_blank" :to="`/video/${scope.row.videoId}`">
|
|
|
- <span>{{ scope.row.videoId }}</span>
|
|
|
- </router-link>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ />
|
|
|
<el-table-column
|
|
|
- prop="title"
|
|
|
+ prop="sessionCount"
|
|
|
label="会话总数"
|
|
|
- :show-overflow-tooltip="true"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tooltip
|
|
|
- v-if="scope.row.title"
|
|
|
- :content="scope.row.title"
|
|
|
- raw-content
|
|
|
- placement="top-start"
|
|
|
- >
|
|
|
- <span v-if="scope.row.title.length <= 15">
|
|
|
- {{ scope.row.title }}
|
|
|
- </span>
|
|
|
- <span v-else>
|
|
|
- {{ scope.row.title.substr(0, 15) + "..." }}
|
|
|
- </span>
|
|
|
- </el-tooltip>
|
|
|
+ <el-tag>
|
|
|
+ {{ scope.row.sessionCount }}
|
|
|
+ </el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="description"
|
|
|
+ prop="lastAccess"
|
|
|
label="最近访问"
|
|
|
:show-overflow-tooltip="true"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-tooltip
|
|
|
- v-if="scope.row.description"
|
|
|
- :content="scope.row.description"
|
|
|
- raw-content
|
|
|
- placement="top-start"
|
|
|
- >
|
|
|
- <span v-if="scope.row.description && scope.row.description.length <= 15">
|
|
|
- {{ scope.row.description }}
|
|
|
- </span>
|
|
|
- <span v-if="scope.row.description && scope.row.description.length > 15">
|
|
|
- {{ scope.row.description.substr(0, 15) + "..." }}
|
|
|
- </span>
|
|
|
- </el-tooltip>
|
|
|
- <span v-else-if="scope.row.description === null">-</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ />
|
|
|
<el-table-column
|
|
|
- prop="duration"
|
|
|
+ prop="status"
|
|
|
label="状态"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
- prop="horizontal"
|
|
|
+ prop="roleCount"
|
|
|
label="角色总数"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tag v-if="scope.row.horizontal" :type="'warning'" disable-transitions>
|
|
|
- <span icon="el-icon-monitor">横屏</span>
|
|
|
- </el-tag>
|
|
|
- <el-tag v-else :type="'success'" disable-transitions>
|
|
|
- <span icon="el-icon-mobile-phone">竖屏</span>
|
|
|
+ <el-tag>
|
|
|
+ {{ scope.row.roleCount }}
|
|
|
</el-tag>
|
|
|
+ <el-button
|
|
|
+ style="margin-top: 5px; margin-left: 5px"
|
|
|
+ size="mini"
|
|
|
+ type="success"
|
|
|
+ @click="handleUpdateRole(scope.$index, scope.row)"
|
|
|
+ >设置</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="scope"
|
|
|
label="修改密码"
|
|
|
- width="120"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tag v-if="scope.row.scope === 1" :type="'warning'" disable-transitions>
|
|
|
- 本人可见
|
|
|
- </el-tag>
|
|
|
- <el-tag v-if="scope.row.scope === 2" :type="'success'" disable-transitions>
|
|
|
- 所有人可见
|
|
|
- </el-tag>
|
|
|
- <el-tag v-if="scope.row.scope === 3" :type="'danger'" disable-transitions>
|
|
|
- VIP 可见
|
|
|
- </el-tag>
|
|
|
+ <el-button
|
|
|
+ style="margin-top: 5px; margin-left: 5px"
|
|
|
+ size="mini"
|
|
|
+ type="success"
|
|
|
+ @click="handleUpdatePasswd(scope.$index, scope.row)"
|
|
|
+ >重置</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
fixed="right"
|
|
|
label="操作"
|
|
|
- width="280"
|
|
|
+ width="90"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
+ type="danger"
|
|
|
size="mini"
|
|
|
- @click="handleEdit(scope.$index, scope.row)"
|
|
|
+ @click="handleDelete(scope.$index, scope.row)"
|
|
|
>删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -134,51 +101,70 @@
|
|
|
/>
|
|
|
</el-main>
|
|
|
|
|
|
- <!-- 修改视频可见范围对话框 -->
|
|
|
<el-dialog
|
|
|
+ title="添加用户"
|
|
|
+ append-to-body
|
|
|
+ :visible.sync="showAddDialog"
|
|
|
+ center
|
|
|
+ >
|
|
|
+ <el-form :model="addForm" label-width="80px">
|
|
|
+ <el-form-item label="帐号" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-input v-model="addForm.username" style="width: 70%; padding-right: 2px" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="密码" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-input v-model="addForm.password" style="width: 70%; padding-right: 2px" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="角色" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-checkbox-group v-model="addForm.roles">
|
|
|
+ <el-checkbox v-for="(item, index) in addUserRoleList" :key="index" :label="item" />
|
|
|
+ </el-checkbox-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" size="mini" @click="onAdd">确定</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ title="设置角色"
|
|
|
append-to-body
|
|
|
- :visible.sync="showEditScopeDialog"
|
|
|
- width="30%"
|
|
|
+ :visible.sync="showUpdateRoleDialog"
|
|
|
center
|
|
|
>
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>修改视频可见范围</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateScope">更新</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="VIP 可见" value="3" />
|
|
|
- </el-select>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
+ <template>
|
|
|
+ <el-checkbox-group v-model="userRoleList">
|
|
|
+ <el-checkbox v-for="(item, index) in roleList" :key="index" :label="item" />
|
|
|
+ </el-checkbox-group>
|
|
|
+ <el-button type="primary" size="mini" @click="onUpdateRole">确定</el-button>
|
|
|
+ </template>
|
|
|
</el-dialog>
|
|
|
- <!-- 视频预览对话框 -->
|
|
|
<el-dialog
|
|
|
- title="预览视频"
|
|
|
+ title="重置密码"
|
|
|
append-to-body
|
|
|
- :visible.sync="showPreviewDialog"
|
|
|
- :before-close="handleDialogClose"
|
|
|
- width="70%"
|
|
|
+ :visible.sync="showUpdatePasswdDialog"
|
|
|
center
|
|
|
>
|
|
|
<template>
|
|
|
- <video-preview-player :video-prop.sync="videoProp" />
|
|
|
+ <el-form :model="updatePasswdForm" label-width="80px">
|
|
|
+ <el-form-item label="帐号" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-input v-model="updatePasswdForm.username" style="width: 70%; padding-right: 2px" readonly />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="密码" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-input v-model="updatePasswdForm.password" style="width: 70%; padding-right: 2px" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" size="mini" @click="onUpdatePasswd">确定</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
</el-container>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import VideoPreviewPlayer from 'components/VideoPreviewPlayer'
|
|
|
-import { updateVideoScope, videoInfo } from '@/api/video'
|
|
|
-import { getUserList, getVideoList } from '@/api/admin'
|
|
|
+import { getAddUserRoleList, getUserList, getUserRole } from '@/api/devops'
|
|
|
|
|
|
export default {
|
|
|
- name: 'VideoPost',
|
|
|
- components: { VideoPreviewPlayer },
|
|
|
+ name: 'User',
|
|
|
data() {
|
|
|
return {
|
|
|
queryInfo: {
|
|
|
@@ -191,22 +177,33 @@ export default {
|
|
|
pageSize: 10,
|
|
|
totalSize: 0,
|
|
|
dataList: [],
|
|
|
- nextId: 0,
|
|
|
// **********************************************************************
|
|
|
- videoProp: null,
|
|
|
- showVideoResourceDialog: false,
|
|
|
- showEditScopeDialog: false,
|
|
|
- showPreviewDialog: false,
|
|
|
- form: {
|
|
|
- videoId: null,
|
|
|
- scope: 1
|
|
|
+ showAddDialog: false,
|
|
|
+ addUserRoleList: [],
|
|
|
+ addForm: {
|
|
|
+ username: null,
|
|
|
+ password: null,
|
|
|
+ roles: []
|
|
|
+ },
|
|
|
+ // **********************************************************************
|
|
|
+ showUpdateRoleDialog: false,
|
|
|
+ roleList: [],
|
|
|
+ userRoleList: [],
|
|
|
+ updateRoleForm: {
|
|
|
+ userId: null,
|
|
|
+ roles: null
|
|
|
},
|
|
|
- videoResources: [],
|
|
|
- publishVideoDiaglog: false
|
|
|
+ // **********************************************************************
|
|
|
+ showUpdatePasswdDialog: false,
|
|
|
+ updatePasswdForm: {
|
|
|
+ userId: null,
|
|
|
+ username: null,
|
|
|
+ password: null
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- document.title = 'AdminVideoList'
|
|
|
+ document.title = '用户列表'
|
|
|
this.getData()
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -226,63 +223,66 @@ export default {
|
|
|
} else {
|
|
|
this.$message.error(resp.msg)
|
|
|
}
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
})
|
|
|
},
|
|
|
- onRefresh() {
|
|
|
- this.getData()
|
|
|
- },
|
|
|
- handleScope(index, row) {
|
|
|
- this.form.videoId = row.videoId
|
|
|
- this.form.scope = '' + row.scope
|
|
|
- this.showEditScopeDialog = true
|
|
|
- },
|
|
|
- handleDialogClose(done) {
|
|
|
- this.showPreviewDialog = false
|
|
|
- this.videoProp = {
|
|
|
- videoId: null,
|
|
|
- play: false
|
|
|
- }
|
|
|
- done()
|
|
|
- },
|
|
|
- handlePreview(index, row) {
|
|
|
- videoInfo(row.videoId).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.showPreviewDialog = true
|
|
|
- this.videoProp = {
|
|
|
- videoId: res.data.videoId,
|
|
|
- play: true
|
|
|
- }
|
|
|
+ handleAdd() {
|
|
|
+ getAddUserRoleList().then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.addUserRoleList = resp.data
|
|
|
+ this.showAddDialog = true
|
|
|
+ } else {
|
|
|
+ this.$message.error(resp.msg)
|
|
|
}
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
})
|
|
|
},
|
|
|
- handleEdit(index, row) {
|
|
|
- const path = '/post/video/edit/' + row.videoId
|
|
|
- this.$router.push(path)
|
|
|
+ onAdd() {
|
|
|
+ this.showAddDialog = false
|
|
|
+ this.$message.info('add account')
|
|
|
+ console.log(this.addForm)
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append('userId', this.addForm.username)
|
|
|
+ formData.append('password', this.addForm.password)
|
|
|
+ formData.append('roles', this.addForm.roles)
|
|
|
},
|
|
|
- onUpdateScope() {
|
|
|
- this.showEditScopeDialog = false
|
|
|
- updateVideoScope(this.form).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.$notify({
|
|
|
- title: '提示',
|
|
|
- message: '视频可见范围已更新',
|
|
|
- type: 'warning',
|
|
|
- duration: 3000
|
|
|
- })
|
|
|
+ handleUpdateRole(index, row) {
|
|
|
+ this.updateRoleForm.userId = row.userId
|
|
|
+ getUserRole(row.userId).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.roleList = resp.data.allRoles
|
|
|
+ this.userRoleList = resp.data.userRoles
|
|
|
+ this.showUpdateRoleDialog = true
|
|
|
+ } else {
|
|
|
+ this.$message.error(resp.msg)
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
- this.$notify({
|
|
|
- title: '提示',
|
|
|
- message: error.message,
|
|
|
- type: 'warning',
|
|
|
- duration: 3000
|
|
|
- })
|
|
|
+ this.$message.error(error.message)
|
|
|
})
|
|
|
},
|
|
|
- onSelectChange() {
|
|
|
- this.$message.info(this.queryInfo)
|
|
|
+ onUpdateRole() {
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append('userId', this.updateRoleForm.userId)
|
|
|
+ formData.append('roles', this.userRoleList)
|
|
|
+ console.log(this.userRoleList)
|
|
|
+ this.showUpdateRoleDialog = false
|
|
|
+ },
|
|
|
+ handleUpdatePasswd(index, row) {
|
|
|
+ this.updatePasswdForm.userId = row.userId
|
|
|
+ this.updatePasswdForm.username = row.username
|
|
|
+ this.showUpdatePasswdDialog = true
|
|
|
+ },
|
|
|
+ onUpdatePasswd() {
|
|
|
+ this.showUpdatePasswdDialog = false
|
|
|
+ this.$message.info('update passwd')
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append('userId', this.updatePasswdForm.userId)
|
|
|
+ formData.append('password', this.updatePasswdForm.password)
|
|
|
},
|
|
|
- handleClose() {
|
|
|
+ handleDelete(index, row) {
|
|
|
+ this.$message.info('delete -> ' + row.username)
|
|
|
}
|
|
|
}
|
|
|
}
|