From cae892f7fa165fadbf0c4e8928846f715cda7a88 Mon Sep 17 00:00:00 2001
From: 明梦爽 <2972214568@qq.com>
Date: 星期三, 23 三月 2022 18:29:30 +0800
Subject: [PATCH] 增加介绍文档

---
 src/components/Administrator/Main.vue |  112 +++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 74 insertions(+), 38 deletions(-)

diff --git a/src/components/Administrator/Main.vue b/src/components/Administrator/Main.vue
index 5707748..2953c2a 100644
--- a/src/components/Administrator/Main.vue
+++ b/src/components/Administrator/Main.vue
@@ -1,15 +1,18 @@
 <template>
   <div>
     <!-- 绾ц仈閫夋嫨鍣� -->
-     <div class="block">
-      <el-cascader
-        v-model="value"
-        :options="options"
-        clearable
-        filterable
-        @change="handleChange">
-      </el-cascader>
-    </div>
+    <el-row class="block">
+      <el-col :span="4">
+        <el-cascader
+          v-model="value"
+          :options="options"
+          clearable
+          filterable
+          :getCheckedNodes="true"
+          @change="handleChange">
+        </el-cascader>
+      </el-col>
+    </el-row>
     <div>
       <el-card class="box-card">
         <el-row :gutter="40">
@@ -19,19 +22,23 @@
           </el-col>
           <el-col :span="10">
             <!-- 鏂伴椈鎼滅储 -->
-            <el-input clearable @clear="qingKong()" placeholder="璇疯緭鍏ユ墍瑕佹煡璇㈢殑鏂伴椈鏍囬" v-model="fuzzyForm.fuzzytitle" class="input-with-select">
-              <el-button class="btn" slot="append" icon="el-icon-search" @click="fuzzyList(fuzzyForm.fuzzytitle)"></el-button>
+            <el-input clearable placeholder="璇疯緭鍏ユ墍瑕佹煡璇㈢殑鏂伴椈鏍囬" v-model="search" class="input-with-select">
             </el-input>
           </el-col>
         </el-row>
         <!-- 鏂伴椈琛ㄦ牸鍖哄煙 -->
-        <el-table :data="tableData" border style="width: 100%" :header-cell-style="{textAlign: 'center'}" :cell-style="{ textAlign: 'center' }"
+        <el-table 
+          :data="tableData.filter(data => !search || data.title.toLowerCase().includes(search.toLowerCase()))"
+          border 
+          style="width: 100%" 
+          :header-cell-style="{textAlign: 'center'}" 
+          :cell-style="{ textAlign: 'center' }"
         >
-          <!-- :header-cell-style="{textAlign: 'center'}"璁剧疆澶撮儴灞呬腑锛� -->
-          <!-- :cell-style="{ textAlign: 'center' }"璁剧疆鏁翠釜琛ㄦ牸鍐呭姘村钩灞呬腑锛� -->
-          <!-- 闂锛氭�庝箞鑾峰彇鏁扮粍涓瘡涓璞$殑key鍊硷紙姣忔潯鏂伴椈鐨刬d锛�?
-               瑙e喅锛氶�氳繃浣滅敤鍩熸彃妲� slot-scope 鑾峰彇姣忎釜瀵硅薄 -->
-          <el-table-column type="index"></el-table-column>
+          <el-table-column type="index" label="搴忓彿" width="50">
+            <template slot-scope="scope">
+              <span>{{ (currentPage-1)*pageSize+scope.$index+1 }}</span>
+            </template>
+          </el-table-column>
           <el-table-column prop="releaseTime" label="鏃ユ湡" width="" >
           </el-table-column>
           <el-table-column prop="title" label="鏂伴椈鏍囬" width="">
@@ -55,7 +62,6 @@
           <!-- 鑾峰彇鏂伴椈鍒楄〃鍒嗛〉 -->
           <div>
             <el-pagination
-              v-show="getShow"
               @size-change="handleSizeChange"
               @current-change="handleCurrentChange"
               :current-page="currentPage"
@@ -63,19 +69,6 @@
               :page-size="100"
               layout="total, sizes, prev, pager, next, jumper"
               :total="total">
-            </el-pagination>
-          </div>
-          <!-- 妯$硦鏂伴椈鍒楄〃鍒嗛〉 -->
-          <div>
-            <el-pagination
-              v-show="fuzzyShow"
-              @size-change="handleSizeChangefuzzy"
-              @current-change="handleCurrentChangefuzzy"
-              :current-page="fuzzyForm.fuzzycurrent"
-              :page-sizes="[6,12, 18,]"
-              :page-size="100"
-              layout="total, sizes, prev, pager, next, jumper"
-              :total="fuzzyForm.fuzzytotal">
             </el-pagination>
           </div>
         </div>
@@ -95,8 +88,13 @@
             <el-input v-model="editForm.title"></el-input>
           </el-form-item>
           <el-form-item label="鍙戝竷鏃ユ湡:">
-            <!-- <el-input v-model="editForm.releaseTime"></el-input> -->
-            <el-date-picker v-model="editForm.releaseTime" type="date" placeholder="璇烽�夋嫨鍙戝竷鏃ユ湡"></el-date-picker>
+            <el-date-picker 
+              v-model="editForm.releaseTime" 
+              type="date" 
+              placeholder="璇烽�夋嫨鍙戝竷鏃ユ湡"
+              format="yyyy 骞� MM 鏈� dd 鏃�"
+              value-format="yyyy-MM-dd"
+            ></el-date-picker>
           </el-form-item>
         </el-form>
         <span slot="footer" class="dialog-footer">
@@ -113,16 +111,22 @@
 export default {
   data() {
     return {
-      fuzzyShow:false,  //妯$硦鏌ヨ鍒嗛〉鐨勬樉绀�(甯冨皵鍊�)
+      search:'',
       getShow:true, //鑾峰彇鍒嗛〉鐨勬樉绀�(甯冨皵鍊�)
+      gettable:true,  //鑾峰彇琛ㄦ牸鐨勬樉绀�
       visible: false,
       editDialogVisible:false,  //鎺у埗淇敼瀵硅瘽妗嗙殑甯冨皵鍊�
+      AdDialogVisible:false,  //瓒呯鐧诲綍瀵硅瘽妗�
+      Ad:{ username:'',password:'' }, //瓒呯瀵硅薄
       editForm:{},  //鏌ヨ鍒扮殑鏂伴椈瀵硅薄锛岀洰鍓嶄粎渚涗慨鏀逛娇鐢�
       newsCategoryId:1, //鍏堝瓨涓�涓皬鏍囬id
       tableData:[],   //鏂伴椈鍒楄〃瀵硅薄
+      fuzzytableData:[],  //妯$硦鏌ヨ鍒楄〃瀵硅薄
       pageSize:6,     //姣忛〉鏉℃暟
       currentPage:1,  //褰撳墠椤�
       total:0,        //鏂伴椈鎬绘潯鏁�
+      fuzzyShow:false,  //妯$硦鏌ヨ鍒嗛〉鐨勬樉绀�(甯冨皵鍊�)
+      fuzzytable:false, //妯$硦鏌ヨ琛ㄦ牸鐨勬樉绀�
       fuzzyForm:{ fuzzytitle:'',fuzzytotal:0,fuzzycurrent:1,fuzzysize:6 },  //妯$硦鏌ヨ鍒楄〃瀵硅薄
       value: [],
       options: [{
@@ -139,6 +143,10 @@
         {
           value:44,
           label: '瀛﹂櫌鍔ㄦ��',
+        },
+        {
+          value:45,
+          label: '杞挱鍥�',
         }],
       },{
           value: 22,
@@ -223,6 +231,7 @@
     handleChange(value) {
       // console.log(value);
       // console.log(value[1]);
+      this.currentPage = 1;
       this.newsCategoryId = value[1]; //灏嗗緱鍒扮殑灏忔爣棰榠d瀛樻斁璧锋潵
       this.query(this.newsCategoryId);
     },
@@ -262,7 +271,7 @@
         title:this.editForm.title
       }
       update(data).then(res=>{
-        // console.log('dsadasas',res);
+        console.log('dsadasas',res);
         if (res.code == 200) {
           this.editDialogVisible =false;
           this.$message.success('淇敼鏂伴椈鎴愬姛锛�')
@@ -278,6 +287,8 @@
       }
       this.fuzzyShow = true //妯$硦鍒嗛〉鏄剧ず
       this.getShow = false  //鑾峰彇鍒嗛〉闅愯棌
+      this.gettable = false
+      this.fuzzytable = true
       const data = {
         current: this.fuzzyForm.fuzzycurrent,
         size: this.fuzzyForm.fuzzysize,
@@ -288,7 +299,7 @@
         if (res.code !== 200) {
           return this.$message.error('鏌ヨ鏂伴椈鍒楄〃澶辫触')
         }else{
-          this.tableData = res.data.records
+          this.fuzzytableData = res.data.records
           this.fuzzyForm.fuzzytotal = res.data.total
         }
       }).catch(err => {
@@ -298,9 +309,12 @@
     //娓呯┖鏌ヨ鍒楄〃鍐呭
     qingKong(){
       this.tableData = []
+      this.fuzzytableData = []
       this.fuzzyForm.fuzzytotal = 0
       this.fuzzyShow = false
       this.getShow = true
+      this.fuzzytable = false
+      this.gettable = true
     },
     //鏍规嵁id鍒犻櫎鏂伴椈
     async deleteNews(id){
@@ -338,6 +352,10 @@
     look(id){
       this.$router.push({path:'news',query:{id:id}})
     },
+    //瓒呯鐧诲綍瀵硅瘽妗�
+    showAdDialog(){
+      this.AdDialogVisible = true
+    },
     handleCurrentChange(val) {
       // console.log(`褰撳墠椤�: ${val}`);
       this.currentPage = val;
@@ -358,6 +376,20 @@
     },
     //鍘诲線娣诲姞缂栬緫椤甸潰
     goEdit(id){
+      let title = '';
+      console.log(this.value);
+      if (this.value.length = 2) {
+        let t = this.value[0];
+        let i = this.value[1];
+        this.options.forEach( item => {
+          if(item.value == t){
+            title += item.label+'/'
+            item.children.forEach( e => {
+              if(e.value == i) title += e.label;
+            })
+          }
+        })
+      }
       if (this.newsCategoryId==27&&this.total==1||this.newsCategoryId==28&&this.total==1||this.newsCategoryId==29&&this.total==1||
       this.newsCategoryId==30&&this.total==1||this.newsCategoryId==31&&this.total==1) {
         this.$message.error('璇ユ柊闂绘爣棰樹笅鍙兘瀛樺湪涓�绡囨柊闂�')
@@ -366,11 +398,15 @@
       this.newsCategoryId==38||this.newsCategoryId==39||this.newsCategoryId==40||
       this.newsCategoryId==41||this.newsCategoryId==42||this.newsCategoryId==43||
       this.newsCategoryId==44){
-        this.$router.push({path:'/administrator/edit',query:{id:id}})
+        this.$router.push({path:'/administrator/edit',query:{id:id,title:title}})
         console.log(this.newsCategoryId);
+      }else if(this.newsCategoryId==45){
+        this.$router.push({path:'/administrator/editlunbo',query:{id:id,title:title}})
+        // console.log(this.newsCategoryId);
       }else{
         this.$message.error('璇峰厛閫夋嫨鏂伴椈鏍囬')
-      } 
+      }
+ 
     }
   },
 }

--
Gitblit v1.8.0