kevin_zhangl 2 лет назад
Родитель
Сommit
2d2a4cdcec
4 измененных файлов с 70 добавлено и 3 удалено
  1. 7 0
      src/api/article.js
  2. 7 0
      src/router/index.js
  3. 2 3
      src/views/ad/list.vue
  4. 54 0
      src/views/article/detail.vue

+ 7 - 0
src/api/article.js

@@ -84,3 +84,10 @@ export function fetchArticleAdd(data) {
     data
     data
   })
   })
 }
 }
+
+export function fetchArticleOne(query) {
+  return request({
+    url: 'v1/article/detail/' + query,
+    method: 'get'
+  })
+}

+ 7 - 0
src/router/index.js

@@ -386,6 +386,13 @@ export const asyncRoutes = [
         name: 'add',
         name: 'add',
         meta: { title: 'metaArticleAdd', noCache: true },
         meta: { title: 'metaArticleAdd', noCache: true },
         hidden: true
         hidden: true
+      },
+      {
+        path: 'detail',
+        component: () => import('@/views/article/detail'),
+        name: 'detail',
+        meta: { title: 'metaArticleDetail', noCache: true },
+        hidden: true
       }
       }
     ]
     ]
   },
   },

+ 2 - 3
src/views/ad/list.vue

@@ -112,11 +112,10 @@
             <el-dropdown-item command="un-hide" @click.native="handleMultiUnHide()">{{ $t('ad.unhide') }}</el-dropdown-item>
             <el-dropdown-item command="un-hide" @click.native="handleMultiUnHide()">{{ $t('ad.unhide') }}</el-dropdown-item>
           </el-dropdown-menu>
           </el-dropdown-menu>
         </el-dropdown>
         </el-dropdown>
-        <el-button v-if="permission.hasPermission(`ad/ad-add`)" type="primary" size="small" icon="el-icon-plus" @click="handleAdd">{{ $t('ad.add') }}</el-button>
+        <el-button v-if="permission.hasPermission(`ad/ad-delete`)" type="primary" size="small" icon="el-icon-plus" @click="handleAdd">{{ $t('ad.add') }}</el-button>
         <pagination v-show="total>0" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize" @pagination="getList" />
         <pagination v-show="total>0" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize" @pagination="getList" />
       </div>
       </div>
-
-      </el-table></div>
+      </div>
   </div>
   </div>
 </template>
 </template>
 
 

+ 54 - 0
src/views/article/detail.vue

@@ -0,0 +1,54 @@
+<template>
+  <div v-loading="loading">
+    <div class="white-box">
+      <div class="white-box-title">
+        <h1>{{ title }}</h1>
+        <span>{{ createdAt | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
+      </div>
+      <div v-html="content" class="white-box-content">
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import {fetchArticleOne} from "@/api/article"
+
+export default {
+  name: 'detail',
+  mounted() {
+    this.getData()
+  },
+  data () {
+    return {
+      title: null,
+      content: null,
+      createdAt: '',
+      loading: true,
+    }
+  },
+  methods: {
+    handleCurrentChange(page) {
+      this.getData(page, this.pageSize)
+    },
+    handleSizeChange(pageSize) {
+      this.getData(this.currentPage, pageSize)
+    },
+    getData() {
+			fetchArticleOne(this.$route.params.ID).then(response => {
+				this.form.title = response.data.oneData.TITLE
+				this.form.cid = response.data.oneData.CID
+				this.form.content = response.data.oneData.CONTENT
+				this.form.sort = response.data.oneData.SORT
+				this.allCategory = response.data.allCategory
+				this.loading = false
+			})
+    },
+  }
+}
+</script>
+
+<style scoped>
+  .white-box-title span{color: #999}
+  .white-box-content{font-size: 16px;padding: 15px 0;line-height: 2;}
+</style>