| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <style>
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .input-item {
- display: inline-block;
- width: 250px;
- margin: 0 0 20px;
- }
- .input-item .el-input__inner {
- border-right: 0;
- }
- .input-item .el-input__inner:hover {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input__inner:focus {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input-group__append {
- background-color: #fff;
- border-left: 0;
- width: 10%;
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- margin: 0;
- }
- .table-body .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
-
-
-
- .form-body {
- background-color: #fff;
- margin-bottom: 20px;
- }
- .el-tabs__header{
- background-color: #fff;
- }
- .el-tabs__item{
- width: 100px;
- text-align: center;
- }
-
- .el-table th>.cell{
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper, .el-table__header-wrapper{
- border-bottom: 1.4px solid #D6D6D6;
- }
- .user_img{
- position: relative;
- margin-right: 8px;
- /* height: 50px;
- width: 50px; */
- }
- .default-avatar{
- width: 50px;
- height: 50px;
- border-radius: 50%;
- margin-right: 8px;
- }
- .uer-nickname {
- flex: 1;
- }
- </style>
- <div id="app" v-cloak>
- <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <div>
- <span>评论管理</span>
- <div style="float: right">
- <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="add">添加评论
- </el-button>
- </div>
- </div>
- </div>
- <div class="table-body">
- <!-- <div class="input-item">
- <el-input @keyup.enter.native="search" size="small"
- placeholder="请输入课程名称"
- v-model="keyword"
- clearable
- @clear="search">
- <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
- </el-input>
- </div> -->
-
- <el-table v-loading="listLoading" :data="list" stripe style="width: 100%">
- <el-table-column label="会员ID" prop="user_id" min-width="80" align="center">
- <template slot-scope="scope">
- <div size="small" v-if="scope.row.uid != 0">{{scope.row.uid}}</div>
- <div size="small"v-if="scope.row.uid == 0">--</div>
- </template>
- </el-table-column>
- <el-table-column label="会员信息" >
- <template slot-scope="scope">
- <div class="user_img" flex="cross:center">
- <el-image class="default-avatar" :src="scope.row.avatar_url">
- <div slot="error" class="image-slot">
- <com-image src="resources/img/mall/default_avatar_url.png"></com-image>
- </div>
- </el-image>
- <div class="uer-nickname over1" v-if="scope.row.uid">{{scope.row.nickname}}</div>
- <div class="uer-nickname over1" v-else >系统管理员</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="手机号" prop="mobile" min-width="80" align="center">
- <template slot-scope="scope">
- <div size="small" v-if="scope.row.mobile">{{scope.row.mobile}}</div>
- <div size="small" v-else>--</div>
- </template>
- </el-table-column>
- <el-table-column label="评论课程" prop="course_name" min-width="80" align="center">
- <template slot-scope="scope">
- <div size="small">{{scope.row.course_name}}</div>
- </template>
- </el-table-column>
- <el-table-column label="评分" prop="score" min-width="100" align="center">
- <template slot-scope="scope">
- <div size="small">{{scope.row.score}} 星</div>
- </template>
- </el-table-column>
- <el-table-column label="评论内容" prop="content" min-width="100" align="center">
- <template slot-scope="scope">
- <div size="small">{{scope.row.content}}</div>
- </template>
- </el-table-column>
- <el-table-column label="是否屏蔽" prop="content" min-width="100" align="center">
- <template slot-scope="scope">
- <el-switch v-model="scope.row.is_shield" :active-value="1" :inactive-value="0" active-text="屏蔽" inactive-text="不屏蔽" @change="shield($event, scope.row.id)"> </el-switch>
- </template>
- </el-table-column>
- <el-table-column label="操作" min-width="100" align="center">
- <template slot-scope="scope" >
- <el-button type="text" size="mini" @click="edit(scope.row.id)" style="width:56px;height: 24px;">
- <el-tooltip class="item" effect="dark" content="编辑" placement="top">
- <img src="resources/img/mall/edit.png" alt="">
- </el-tooltip>
- </el-button>
- <el-button circle type="text" size="mini" @click="discussDelete(scope.row.id, scope.$index)">
- <el-tooltip class="item" effect="dark" content="删除" placement="top">
- <img src="resources/img/mall/del.png" alt="">
- </el-tooltip>
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: right;margin: 20px 0;">
- <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
- </div>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- status:0,
- list: [],
- keyword: '',
- listLoading: false,
- page: 1,
- pageCount: 0,
-
- // dialogFormVisible : false, //充值弹窗
- lableLoading : false,
- btnLoading : false,
- addStatus : 1, //默认是增加
- // selectIndex : 0, //充值item的索引
- selectRow : {},
- form:{
- user_id : null,
- username : '',
- mobile : '',
- co_name: '',
- score: 0,
- content: ''
- },
- rules: {
- add_money: [
- {required: true, message: '请输入金额', trigger: 'change'},
- ],
- },
- };
- },
-
-
-
- methods: {
- search() {
- this.page = 1;
- this.getList();
- },
- pagination(currentPage) {
- let self = this;
- self.page = currentPage;
- self.getList();
- },
-
- // 0.1 获取卡券列表
- getList() {
- let self = this;
- self.listLoading = true;
- request({
- params: {
- r: 'course/discuss/index',
- page: self.page,
- keyword: this.keyword
- },
- method: 'get',
- }).then(e => {
- self.listLoading = false;
- self.list = e.data.data.list;
- self.pageCount = e.data.data.page_count;
- }).catch(e => {
- console.log(e);
- });
- },
- // 新建
- add() {
- navigateTo({
- r: 'course/discuss/edit',
- });
- },
- // 编辑
- edit(id) {
- navigateTo({
- r: 'course/discuss/edit',
- id: id,
- });
- },
- discussDelete(id, index) {
- let self = this;
- self.$confirm('是否删除评论?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- self.listLoading = true;
- // console.log(id,'1111')
- request({
- params: {
- r: 'course/discuss/delete',
- },
- method: 'post',
- data: {
- id: id,
- }
- }).then(e => {
- self.listLoading = false;
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- self.list.splice(index, 1);
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- }).catch(() => {
- self.$message.info('已取消删除')
- });
- },
- // 屏蔽状态切换
- shield($event, id) {
- let self = this;
- self.listLoading = true;
- request({
- params: {
- r: 'course/discuss/switch-shield'
- },
- method: 'post',
- data: {id: id, val: $event}
- }).then(e => {
- self.listLoading = false;
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- }
- },
- mounted: function () {
- this.getList();
- }
- });
- </script>
|