From 2b1f7a47394363e95deb4dfa0f1c67d41e747f7f Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期三, 01 二月 2023 10:56:40 +0800 Subject: [PATCH] Merge branch 'wvp-28181-2.0' into fix-269 --- web_src/src/components/UserManager.vue | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 238 insertions(+), 0 deletions(-) diff --git a/web_src/src/components/UserManager.vue b/web_src/src/components/UserManager.vue new file mode 100644 index 0000000..c0fa695 --- /dev/null +++ b/web_src/src/components/UserManager.vue @@ -0,0 +1,238 @@ +<template> + + <div id="app" style="width: 100%"> + <div class="page-header"> + + <div class="page-title">鐢ㄦ埛鍒楄〃</div> + <div class="page-header-btn"> + <el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="addUser"> + 娣诲姞鐢ㄦ埛 + </el-button> + + </div> + </div> + <!--鐢ㄦ埛鍒楄〃--> + <el-table :data="userList" style="width: 100%;font-size: 12px;" :height="winHeight" + header-row-class-name="table-header"> + <el-table-column prop="username" label="鐢ㄦ埛鍚�" min-width="160"/> + <el-table-column prop="pushKey" label="pushkey" min-width="160"/> + <el-table-column prop="role.name" label="绫诲瀷" min-width="160"/> + <el-table-column label="鎿嶄綔" min-width="450" fixed="right"> + <template slot-scope="scope"> + <el-button size="medium" icon="el-icon-edit" type="text" @click="edit(scope.row)">淇敼瀵嗙爜</el-button> + <el-divider direction="vertical"></el-divider> + <el-button size="medium" icon="el-icon-edit" type="text" @click="changePushKey(scope.row)">淇敼pushkey</el-button> + <el-divider direction="vertical"></el-divider> + <el-button size="medium" icon="el-icon-delete" type="text" @click="deleteUser(scope.row)" + style="color: #f56c6c">鍒犻櫎 + </el-button> + </template> + </el-table-column> + </el-table> + <changePasswordForAdmin ref="changePasswordForAdmin"></changePasswordForAdmin> + <changePushKey ref="changePushKey"></changePushKey> + <addUser ref="addUser"></addUser> + <el-pagination + style="float: right" + @size-change="handleSizeChange" + @current-change="currentChange" + :current-page="currentPage" + :page-size="count" + :page-sizes="[15, 25, 35, 50]" + layout="total, sizes, prev, pager, next" + :total="total"> + </el-pagination> + </div> +</template> + +<script> +import uiHeader from '../layout/UiHeader.vue' +import changePasswordForAdmin from './dialog/changePasswordForAdmin.vue' +import changePushKey from './dialog/changePushKey.vue' +import addUser from '../components/dialog/addUser.vue' + +export default { + name: 'userManager', + components: { + uiHeader, + changePasswordForAdmin, + changePushKey, + addUser + }, + data() { + return { + userList: [], //璁惧鍒楄〃 + currentUser: {}, //褰撳墠鎿嶄綔璁惧瀵硅薄 + + videoComponentList: [], + updateLooper: 0, //鏁版嵁鍒锋柊杞鏍囧織 + currentUserLenth: 0, + winHeight: window.innerHeight - 200, + currentPage: 1, + count: 15, + total: 0, + getUserListLoading: false + }; + }, + mounted() { + this.initData(); + this.updateLooper = setInterval(this.initData, 10000); + }, + destroyed() { + this.$destroy('videojs'); + clearTimeout(this.updateLooper); + }, + methods: { + initData: function () { + this.getUserList(); + }, + currentChange: function (val) { + this.currentPage = val; + this.getUserList(); + }, + handleSizeChange: function (val) { + this.count = val; + this.getUserList(); + }, + getUserList: function () { + let that = this; + this.getUserListLoading = true; + this.$axios({ + method: 'get', + url: `/api/user/users`, + params: { + page: that.currentPage, + count: that.count + } + }).then(function (res) { + if (res.data.code === 0) { + that.total = res.data.data.total; + that.userList = res.data.data.list; + } + that.getUserListLoading = false; + }).catch(function (error) { + that.getUserListLoading = false; + }); + + }, + edit: function (row) { + this.$refs.changePasswordForAdmin.openDialog(row, () => { + this.$refs.changePasswordForAdmin.close(); + this.$message({ + showClose: true, + message: "瀵嗙爜淇敼鎴愬姛", + type: "success", + }); + setTimeout(this.getUserList, 200) + + }) + }, + deleteUser: function (row) { + let msg = "纭畾鍒犻櫎姝ょ敤鎴凤紵" + if (row.online !== 0) { + msg = "<strong>纭畾鍒犻櫎姝ょ敤鎴凤紵</strong>" + } + this.$confirm(msg, '鎻愮ず', { + dangerouslyUseHTMLString: true, + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + center: true, + type: 'warning' + }).then(() => { + this.$axios({ + method: 'delete', + url: `/api/user/delete?id=${row.id}` + }).then((res) => { + this.getUserList(); + }).catch((error) => { + console.error(error); + }); + }).catch(() => { + + }); + + + }, + + changePushKey: function (row) { + this.$refs.changePushKey.openDialog(row, () => { + this.$refs.changePushKey.close(); + this.$message({ + showClose: true, + message: "pushKey淇敼鎴愬姛", + type: "success", + }); + setTimeout(this.getUserList, 200) + + }) + }, + addUser: function () { + // this.$refs.addUser.openDialog() + this.$refs.addUser.openDialog( () => { + this.$refs.addUser.close(); + this.$message({ + showClose: true, + message: "鐢ㄦ埛娣诲姞鎴愬姛", + type: "success", + }); + setTimeout(this.getUserList, 200) + + }) + } + } +} +</script> +<style> +.videoList { + display: flex; + flex-wrap: wrap; + align-content: flex-start; +} + +.video-item { + position: relative; + width: 15rem; + height: 10rem; + margin-right: 1rem; + background-color: #000000; +} + +.video-item-img { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + width: 100%; + height: 100%; +} + +.video-item-img:after { + content: ""; + display: inline-block; + position: absolute; + z-index: 2; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + width: 3rem; + height: 3rem; + background-image: url("../assets/loading.png"); + background-size: cover; + background-color: #000000; +} + +.video-item-title { + position: absolute; + bottom: 0; + color: #000000; + background-color: #ffffff; + line-height: 1.5rem; + padding: 0.3rem; + width: 14.4rem; +} + +</style> -- Gitblit v1.8.0