|
@@ -0,0 +1,103 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <search-form
|
|
|
+ :list-loading="listLoading"
|
|
|
+ @change="searchHandle"
|
|
|
+ />
|
|
|
+ <table-list
|
|
|
+ :list-loading="listLoading"
|
|
|
+ :data="tableData2"
|
|
|
+ :columns="listConfig"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-size="pageSize"
|
|
|
+ :total-records="totalRecords"
|
|
|
+ @currentChange="pageHandle"
|
|
|
+ />
|
|
|
+ <popup-edit
|
|
|
+ :isShow="isDtlShow"
|
|
|
+ :curObj="curObj"
|
|
|
+ @close="closePopup"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { arrToObj } from '@/utils'
|
|
|
+import SearchForm from './components/searchForm/Index'
|
|
|
+import PopupEdit from './components/popup/answer'
|
|
|
+import baseTable from '_m/baseTable.js'
|
|
|
+export default {
|
|
|
+ name: 'index',
|
|
|
+ components: {
|
|
|
+ SearchForm,
|
|
|
+ PopupEdit,
|
|
|
+ },
|
|
|
+ provide() {
|
|
|
+ return {
|
|
|
+ parentData: this
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mixins: [baseTable],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ apiStr: 'user.admquestionlist',
|
|
|
+ searchForm: null,
|
|
|
+ isDtlShow: false,
|
|
|
+ curObj: {},
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ tableData2() {
|
|
|
+ const arr = [...this.tableData]
|
|
|
+ arr.map(item => {
|
|
|
+ const question_tag = item.question_tag ? item.question_tag.split(',') : []
|
|
|
+ const qtName = question_tag.map(v => {
|
|
|
+ return arrToObj(this.$dictData.question_tag)[v]
|
|
|
+ })
|
|
|
+ item.qtName = qtName.join(',')
|
|
|
+ })
|
|
|
+ return arr
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ mounted() {
|
|
|
+ this.listConfig = {
|
|
|
+ rows: [
|
|
|
+ { label: '问题内容', prop: 'question_cont', fullShow: true, minWidth: 200, align: 'left' },
|
|
|
+ { label: '标签', prop: 'qtName' },
|
|
|
+ { label: '昵称', prop: 'nickname' },
|
|
|
+ { label: '头像', prop: 'avatar', type: 'img' },
|
|
|
+ { label: '提问时间', prop: 'create_at' },
|
|
|
+ { label: '操作', width: 200, type: 'handle2', operations:
|
|
|
+ [
|
|
|
+ { label: '查看回答', func: this.openPopup, btnType: 'primary' },
|
|
|
+ { label: '删除', func: this.delHandle, btnType: 'danger' },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ delHandle(row) {
|
|
|
+ this.$msg(`您确定要删除该问题吗?`, 'confirm', () => {
|
|
|
+ this.$api.user.admquestiondel({
|
|
|
+ question_id: row.id
|
|
|
+ }).then(data => {
|
|
|
+ this.$msgs(`已删除!`)
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ }, null, true)
|
|
|
+ },
|
|
|
+ openPopup(row) {
|
|
|
+ if (row && row.id) {
|
|
|
+ this.curObj = row
|
|
|
+ } else {
|
|
|
+ this.curObj = {}
|
|
|
+ }
|
|
|
+ this.isDtlShow = true
|
|
|
+ },
|
|
|
+ closePopup(obj) {
|
|
|
+ this.isDtlShow = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|