liujq 3 vuotta sitten
vanhempi
commit
1fbe85aa87

+ 6 - 0
src/api/house.js

@@ -103,6 +103,12 @@ export default {
   adminformationlist: params => { // 洪楼文章列表接口
     return getRequest('/adm/information/list', params)
   },
+  adminformationrefinedadd: params => { // 推荐文章 - 添加
+    return getRequestNoSort('/adm/information/refined/add', params, 'loading')
+  },
+  adminformationrefineddel: params => { // 推荐文章 - 删除
+    return getRequestNoSort('/adm/information/refined/del', params, 'loading')
+  },
   adminformationadd: params => { // 洪楼文章添加
     return getRequestNoSort('/adm/information/add', params, 'loading')
   },

+ 1 - 1
src/views/map/dtl.vue

@@ -987,7 +987,7 @@ export default {
   text-align: center;
   font-size: 12px;
   border-radius: 50%;
-  padding-top: 16px;
+  padding-top: 20px;
   box-sizing: border-box;
 }
 

+ 1 - 0
src/views/news/components/popup/IndexEdit.vue

@@ -77,6 +77,7 @@ export default {
         { label: '作者', key: 'author', class: 'c-2' },
         { label: '状态', key: 'hide_status', type: 'select', class: 'c-2', options: this.$dictData.hide_status },
         { label: '发布时间', key: 'create_at', class: 'c-2', type: 'datePicker', type2: 'date'},
+        { label: '精选文章', key: 'select_status', type: 'select', class: 'c-2', options: this.$dictData.select_status },
         { label: '主图', key: 'pri_image', type: 'cuImg',
           options: {
             w: 500,

+ 1 - 0
src/views/news/components/searchForm/Index.vue

@@ -21,6 +21,7 @@ export default {
         { label: '标题', key: 'title' },
         { label: '分类', key: 'information_category', type: 'select', options: this.$dictData.information_category},
         { label: '状态', key: 'hide_status', type: 'select', class: 'c-3', options: this.$dictData.hide_status },
+        { label: '是否精选', key: 'select_status', type: 'select', class: 'c-3', options: this.$dictData.select_status },
         { label: '文章类型', key: 'news_type', type: 'select', class: 'c-3', options: this.$dictData.news_type },
       ]
     }

+ 34 - 3
src/views/news/index.vue

@@ -5,6 +5,7 @@
       @change="searchHandle"
     />
     <table-list
+      :operationsDefaultLength="4"
       :list-loading="listLoading"
       :data="tableData2"
       :columns="listConfig"
@@ -81,6 +82,9 @@ export default {
           item.linkStr = `${item.link.length}---${item.link.substring(item.link.length-16, item.link.length-1)}`
         }
         item.hideStatus = Number(item.hide_status)
+        item.selectStatus = Number(item.select_status)
+        if (Number(item.select_status) === 1) item.noDel = true
+        if (Number(item.select_status) !== 1) item.recommend = true
       })
       return arr
     }
@@ -95,20 +99,47 @@ export default {
         { label: '主图', prop: 'pri_image', type: 'img' },
         { label: '链接Str', prop: 'linkStr', fullShow: true },
         { label: '作者', prop: 'author' },
-        { label: '状态', prop: 'hideStatus', type: 'tag', tags: arrToObj(this.$dictData.hide_status) }, 
+        { label: '状态', prop: 'hideStatus', type: 'tag', tags: arrToObj(this.$dictData.hide_status), tagTypeObj: {'1': 'success', '2': 'danger'} }, 
+        { label: '精选', prop: 'selectStatus', type: 'tag', tags: arrToObj(this.$dictData.select_status), tagTypeObj: {'1': 'success', '2': 'danger'} }, 
         { label: '创建时间', prop: 'create_at' },
         { label: '更新人', prop: 'update_by' },
         { label: '更新时间', prop: 'update_at' },
-        { label: '操作', width: 120, type: 'handle2', operations:
+        { label: '操作', width: 130, type: 'handle2', operations:
           [
+            // { labelFor: 'selectStatus', func: this.recommendHandle, hide: 'recommend',
+            //   labelConfig: {
+            //     texts: {
+            //       1: '不推',
+            //       2: '推荐'
+            //     },
+            //     btnTypes: {
+            //       1: 'danger',
+            //       2: 'success'
+            //     }
+            //   }
+            // },
+            { label: '推首页', func: this.recommendHandle, btnType: 'success', hide: 'recommend' },
             { label: '编辑', func: this.openPopup, btnType: 'primary' },
-            { label: '删除', func: this.delHandle, btnType: 'danger' },
+            { label: '删除', func: this.delHandle, btnType: 'danger', hide: 'noDel' },
           ]
         }
       ]
     }
   },
   methods: {
+    recommendHandle (row) {
+      let flag = 2
+      const apiStr = flag=== 1 ? 'adminformationrefineddel' : 'adminformationrefinedadd'
+      const msgText = flag=== 1 ? '取消推首页' : '推首页'
+      this.$msg(`确定该文章要${msgText}吗?`, 'confirm', ()=> {
+        this.$api.house[apiStr]({
+          id: row.id,
+        }).then(data => {
+          this.$msgs(`${msgText}成功!`)
+          this.fetchData()
+        })
+      }, null, true)
+    },
     delHandle(row) {
       this.$msg(`您确定要删除该文章吗?`, 'confirm', () => {
         this.$api.house.adminformationdel({

+ 182 - 0
src/views/news/index2.vue

@@ -0,0 +1,182 @@
+<template>
+  <div class="app-container">
+    <search-form
+      :list-loading="listLoading"
+      @change="searchHandle"
+    />
+    <table-list
+      :operationsDefaultLength="4"
+      :list-loading="listLoading"
+      :data="tableData2"
+      :columns="listConfig"
+      :current-page="currentPage"
+      :page-size="-1"
+      :insertSlotArr="[4]"
+    >
+      <div slot="OI4">
+        <el-table-column
+          width="50"
+          label="链接"
+          align="center"
+        >
+          <template slot-scope="scope">
+            <a v-if="scope.row.news_type === 'adminadd'" :href="'https://h5.honglounews.com/wxnews.html?id=' + scope.row.id" target="_blank" class="scoped-link">链接</a>
+            <a v-else :href="scope.row.link" target="_blank" class="scoped-link">链接</a>
+          </template>
+        </el-table-column>
+      </div>
+      <div slot="otherItem">
+        <el-button type="small" icon="el-icon-plus" class="xl-form-btn bgc1" @click="openPopup">添加公众号文章</el-button>
+        <el-button type="small" icon="el-icon-plus" class="xl-form-btn bgc2" @click="openIESPopup">添加新资讯</el-button>
+      </div>
+    </table-list>
+    <popup-edit
+      :isShow="isDtlShow"
+      :curObj="curObj"
+      @close="closePopup"
+    />
+    <index-edit-self
+      :isShow="isIESShow"
+      :curObj="curObj"
+      @close="closeIESPopup"
+    />
+  </div>
+</template>
+<script>
+import { arrToObj } from '@/utils'
+import SearchForm from './components/searchForm/Index'
+import PopupEdit from './components/popup/IndexEdit'
+import IndexEditSelf from './components/popup/IndexEditSelf'
+import baseTable from '_m/baseTable.js'
+export default {
+  name: 'index',
+  components: {
+    SearchForm,
+    PopupEdit,
+    IndexEditSelf,
+  },
+  provide() {
+    return {
+      parentData: this
+    }
+  },
+  mixins: [baseTable],
+  data() {
+    return {
+      apiStr: 'house.adminformationlist',
+      searchForm: null,
+      isDtlShow: false,
+      isIESShow: false,
+      curObj: {},
+      tableData3: [],
+    }
+  },
+  computed: {
+    tableData2() {
+      const arr = [...this.tableData3]
+      arr.map(item => {
+        if (item.link) {
+          item.linkStr = `${item.link.length}---${item.link.substring(item.link.length-16, item.link.length-1)}`
+        }
+        item.hideStatus = Number(item.hide_status)
+        item.selectStatus = Number(item.select_status)
+      })
+      return arr
+    }
+  },
+  created() {},
+  mounted() {
+    this.listConfig = {
+      rows: [
+        { label: '精选', prop: 'selectStatus', type: 'tag', tags: arrToObj(this.$dictData.select_status), tagTypeObj: {'1': 'success', '2': 'danger'} }, 
+        { label: '浏览数', prop: 'view_count' },
+        { label: '标题', prop: 'title', fullShow: true, minWidth: 200 }, 
+        { label: '分类', prop: 'information_category', type: 'flag', flags: arrToObj(this.$dictData.information_category) }, 
+        { label: '主图', prop: 'pri_image', type: 'img' },
+        { label: '链接Str', prop: 'linkStr', fullShow: true },
+        { label: '作者', prop: 'author' },
+        { label: '创建时间', prop: 'create_at' },
+        { label: '更新人', prop: 'update_by' },
+        { label: '更新时间', prop: 'update_at' },
+        { label: '操作', width: 80, type: 'handle2', operations:
+          [
+            { label: '删除推荐', func: this.recommendHandle, btnType: 'danger' },
+          ]
+        }
+      ]
+    }
+  },
+  methods: {
+    getMoreData (data) {
+      this.tableData3 = [...data.recommend_article]
+    },
+    recommendHandle (row) {
+      let flag = 1
+      const apiStr = flag=== 1 ? 'adminformationrefineddel' : 'adminformationrefinedadd'
+      const msgText = flag=== 1 ? '取消推首页' : '推首页'
+      this.$msg(`确定该文章要${msgText}吗?`, 'confirm', ()=> {
+        this.$api.house[apiStr]({
+          id: row.id,
+        }).then(data => {
+          this.$msgs(`${msgText}成功!`)
+          this.fetchData()
+        })
+      }, null, true)
+    },
+    delHandle(row) {
+      this.$msg(`您确定要删除该文章吗?`, 'confirm', () => {
+        this.$api.house.adminformationdel({
+          id: row.id,
+        }).then(data => {
+          this.$msgs(`已删除!`)
+          this.fetchData()
+        })
+      }, null, true)
+    },
+    openPopup(row) {
+      if (row && row.news_type === 'adminadd') {
+        this.openIESPopup(row)
+      } else {
+        if (row && row.id) {
+          this.curObj = row
+        } else {
+          this.curObj = {}
+        }
+        this.isDtlShow = true
+      }
+    },
+    closePopup(obj) {
+      this.isDtlShow = false
+      if (obj) {
+        this.fetchData()
+      }
+    },
+    openIESPopup(row) {
+      // if (row && row.id) {
+      //   this.curObj = row
+      // } else {
+      //   this.curObj = {}
+      // }
+      // this.isIESShow = true
+      if (row && row.id) {
+        this.$router.push(`/news/indexEditSelf?id=${row.id}`)
+      } else {
+        this.$router.push(`/news/indexEditSelf`)
+      }
+    },
+    closeIESPopup(obj) {
+      this.isIESShow = false
+      if (obj) {
+        this.fetchData()
+      }
+    },
+  }
+}
+</script>
+<style lang="scss" scoped>
+.scoped-link {
+  color: #2d8cf0;
+  text-decoration: underline;
+}
+</style>
+

+ 2 - 1
src/views/news/indexEditSelf.vue

@@ -63,7 +63,8 @@ export default {
             h: 350,
           }, class: 'c-2' },
         { label: '状态', key: 'hide_status', type: 'select', class: 'c-2', options: this.$dictData.hide_status },
-        { label: '时间', key: 'create_at', type: 'datePicker', type2: 'date'},
+        { label: '时间', key: 'create_at', type: 'datePicker', type2: 'date', class: 'c-2'},
+        { label: '精选', key: 'select_status', type: 'select', class: 'c-2', options: this.$dictData.select_status },
         { label: '楼盘', key: 'estate_id_list', type: 'selectRemote', multiple: true, changeHandle: this.deviceChange,
           remoteParams: { skey: 'estate_name', api: `house.admestatelist?search_EQ_status=1`, opKey: 'estate_name', opVal: 'id' },
           remoteOptions: remoteOptionsIds