119 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			119 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <ai-list class="notice">
 | |
|     <template slot="title">
 | |
|       <ai-title title="评论管理" isShowBottomBorder isShowBack @onBackClick="cancel(false)"></ai-title>
 | |
|     </template>
 | |
|     <template slot="content">
 | |
|       <ai-search-bar class="search-bar">
 | |
|         <template #left>
 | |
|         </template>
 | |
|         <template #right>
 | |
|         </template>
 | |
|       </ai-search-bar>
 | |
|       <ai-table
 | |
|         :tableData="tableData"
 | |
|         :col-configs="colConfigs"
 | |
|         :total="total"
 | |
|         style="margin-top: 6px;"
 | |
|         :current.sync="search.current"
 | |
|         :size.sync="search.size"
 | |
|         @getList="getList">
 | |
|         <el-table-column slot="options" width="120px" fixed="right" label="操作" align="center">
 | |
|           <template slot-scope="{ row }">
 | |
|             <div class="table-options">
 | |
|               <el-button type="text" v-if="permissions('app_appcoursecomment_config')" @click="show(row.id, row.isShow)">{{ row.isShow === '1' ? '隐藏' : '显示' }}</el-button>
 | |
|             </div>
 | |
|           </template>
 | |
|         </el-table-column>
 | |
|       </ai-table>
 | |
|     </template>
 | |
|   </ai-list>
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
|   export default {
 | |
|     name: 'Comment',
 | |
| 
 | |
|     props: {
 | |
|       instance: Function,
 | |
|       dict: Object,
 | |
|       params: Object
 | |
|     },
 | |
| 
 | |
|     data () {
 | |
|       return {
 | |
|         search: {
 | |
|           current: 1,
 | |
|           size: 10,
 | |
|           title: '',
 | |
|           status: ''
 | |
|         },
 | |
|         total: 10,
 | |
|         colConfigs: [
 | |
|           { prop: 'name',  label: '微信昵称', align: 'left' },
 | |
|           { prop: 'content',  label: '评论', align: 'center' },
 | |
|           { prop: 'commentTime',  label: '评论时间', align: 'center' }
 | |
|         ],
 | |
|         tableData: []
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     created () {
 | |
|       this.getList()
 | |
|     },
 | |
| 
 | |
|     methods: {
 | |
|       getList() {
 | |
|         this.instance.post(`/app/appcoursecomment/list?courseId=${this.params.id}`, null, {
 | |
|           params: {
 | |
|             ...this.search
 | |
|           }
 | |
|         }).then(res => {
 | |
|           if (res.code == 0) {
 | |
|             this.tableData = res.data.records
 | |
|             this.total = res.data.total
 | |
|           }
 | |
|         })
 | |
|       },
 | |
|       cancel (isRefresh) {
 | |
|         this.$emit('change', {
 | |
|           type: 'List',
 | |
|           isRefresh: !!isRefresh
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       show (id, isShow) {
 | |
|         this.$confirm(isShow === '1' ? '确定隐藏该留言?' : '确定隐藏该留言').then(() => {
 | |
|           this.instance.post(`/app/appcoursecomment/configCommentById?id=${id}&status=${isShow === '1' ? '0' : '1'}`).then(res => {
 | |
|             if (res.code == 0) {
 | |
|               this.$message.success('操作成功')
 | |
|               this.getList()
 | |
|             }
 | |
|           })
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       toDetail (id) {
 | |
|         this.$emit('change', {
 | |
|           type: 'Detail',
 | |
|           params: {
 | |
|             id: id || ''
 | |
|           }
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       toAdd(id) {
 | |
|         this.$emit('change', {
 | |
|           type: 'Add',
 | |
|           params: {
 | |
|             id: id || ''
 | |
|           }
 | |
|         })
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| </script>
 | |
| 
 | |
| <style lang="scss" scoped>
 | |
| </style>
 |