From 5529b7077126be368abd444d45ec085d8c7779e3 Mon Sep 17 00:00:00 2001
From: 明梦爽 <2972214568@qq.com>
Date: 星期日, 17 四月 2022 23:21:22 +0800
Subject: [PATCH] eslint语法规范

---
 src/components/Administrator/Main copy.vue |  405 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 210 insertions(+), 195 deletions(-)

diff --git a/src/components/Administrator/Main copy.vue b/src/components/Administrator/Main copy.vue
index 89c6fe5..d577f88 100644
--- a/src/components/Administrator/Main copy.vue
+++ b/src/components/Administrator/Main copy.vue
@@ -1,14 +1,8 @@
 <template>
   <div>
     <!-- 绾ц仈閫夋嫨鍣� -->
-     <div class="block">
-      <el-cascader
-        v-model="value"
-        :options="options"
-        clearable
-        filterable
-        @change="handleChange">
-      </el-cascader>
+    <div class="block">
+      <el-cascader v-model="value" :options="options" clearable filterable @change="handleChange"> </el-cascader>
     </div>
     <div>
       <el-card class="box-card">
@@ -25,23 +19,19 @@
           </el-col>
         </el-row>
         <!-- 鏂伴椈琛ㄦ牸鍖哄煙 -->
-        <el-table v-show="gettable" :data="tableData" border style="width: 100%" :header-cell-style="{textAlign: 'center'}" :cell-style="{ textAlign: 'center' }"
-        >
+        <el-table v-show="gettable" :data="tableData" 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">
             <template slot-scope="scope">
-              <span>{{ (currentPage-1)*pageSize+scope.$index+1 }}</span>
+              <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="">
-          </el-table-column>
-          <el-table-column prop="id" label="id" width="">
-          </el-table-column>
+          <el-table-column prop="releaseTime" label="鏃ユ湡" width=""> </el-table-column>
+          <el-table-column prop="title" label="鏂伴椈鏍囬" width=""> </el-table-column>
+          <el-table-column prop="id" label="id" width=""> </el-table-column>
           <el-table-column label="鎿嶄綔" width="">
             <template slot-scope="scope">
               <!-- {{ scope.row.id }} -->
@@ -51,22 +41,18 @@
                 <el-button type="info" @click="deleteNews(scope.row.id)">鍒犻櫎</el-button>
               </div>
             </template>
-            
           </el-table-column>
         </el-table>
         <!-- 妯$硦鏌ヨ鐨勮〃鏍兼樉绀� -->
-        <el-table v-show="fuzzytable" :data="fuzzytableData" border style="width: 100%" :header-cell-style="{textAlign: 'center'}" :cell-style="{ textAlign: 'center' }">
+        <el-table v-show="fuzzytable" :data="fuzzytableData" border style="width: 100%" :header-cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }">
           <el-table-column type="index">
             <template slot-scope="scope">
-              <span>{{ (fuzzyForm.fuzzycurrent-1)*fuzzyForm.fuzzysize+scope.$index+1 }}</span>
+              <span>{{ (fuzzyForm.fuzzycurrent - 1) * fuzzyForm.fuzzysize + 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="">
-          </el-table-column>
-          <el-table-column prop="id" label="id" width="">
-          </el-table-column>
+          <el-table-column prop="releaseTime" label="鏃ユ湡" width=""> </el-table-column>
+          <el-table-column prop="title" label="鏂伴椈鏍囬" width=""> </el-table-column>
+          <el-table-column prop="id" label="id" width=""> </el-table-column>
           <el-table-column label="鎿嶄綔" width="">
             <template slot-scope="scope">
               <div>
@@ -75,7 +61,6 @@
                 <el-button type="info" @click="deleteNews(scope.row.id)">鍒犻櫎</el-button>
               </div>
             </template>
-            
           </el-table-column>
         </el-table>
         <!-- 鍒嗛〉 -->
@@ -87,10 +72,11 @@
               @size-change="handleSizeChange"
               @current-change="handleCurrentChange"
               :current-page="currentPage"
-              :page-sizes="[6,12, 18,]"
+              :page-sizes="[6, 12, 18]"
               :page-size="100"
               layout="total, sizes, prev, pager, next, jumper"
-              :total="total">
+              :total="total"
+            >
             </el-pagination>
           </div>
           <!-- 妯$硦鏂伴椈鍒楄〃鍒嗛〉 -->
@@ -100,22 +86,19 @@
               @size-change="handleSizeChangefuzzy"
               @current-change="handleCurrentChangefuzzy"
               :current-page="fuzzyForm.fuzzycurrent"
-              :page-sizes="[6,10, 18,]"
+              :page-sizes="[6, 10, 18]"
               :page-size="100"
               layout="total, sizes, prev, pager, next, jumper"
-              :total="fuzzyForm.fuzzytotal">
+              :total="fuzzyForm.fuzzytotal"
+            >
             </el-pagination>
           </div>
         </div>
       </el-card>
       <!-- 淇敼鏂伴椈鐨勫璇濇 -->
-      <el-dialog
-        title="淇敼鏂伴椈"
-        :visible.sync="editDialogVisible"
-        width="50%"
-        :before-close="handleClose">
+      <el-dialog title="淇敼鏂伴椈" :visible.sync="editDialogVisible" width="50%" :before-close="handleClose">
         <!-- rules琛ㄥ崟楠岃瘉瑙勫垯锛宺ef褰撳墠琛ㄥ崟鐨勯獙璇佸璞� -->
-        <el-form ref="editFormRef" :model="editForm"  label-width="80px" status-icon>
+        <el-form ref="editFormRef" :model="editForm" label-width="80px" status-icon>
           <el-form-item label="id:">
             <el-input v-model="editForm.id" disabled></el-input>
           </el-form-item>
@@ -136,199 +119,214 @@
 </template>
 
 <script>
-import { getNewsList,getnew,update,deleteNew,fuzzy } from '../../api/api'
+import { getNewsList, getnew, update, deleteNew, fuzzy } from '../../api/api'
 export default {
   data() {
     return {
-      getShow:true, //鑾峰彇鍒嗛〉鐨勬樉绀�(甯冨皵鍊�)
-      gettable:true,  //鑾峰彇琛ㄦ牸鐨勬樉绀�
+      getShow: true, //鑾峰彇鍒嗛〉鐨勬樉绀�(甯冨皵鍊�)
+      gettable: true, //鑾峰彇琛ㄦ牸鐨勬樉绀�
       visible: false,
-      editDialogVisible:false,  //鎺у埗淇敼瀵硅瘽妗嗙殑甯冨皵鍊�
-      editForm:{},  //鏌ヨ鍒扮殑鏂伴椈瀵硅薄锛岀洰鍓嶄粎渚涗慨鏀逛娇鐢�
-      newsCategoryId:1, //鍏堝瓨涓�涓皬鏍囬id
-      tableData:[],   //鏂伴椈鍒楄〃瀵硅薄
-      fuzzytableData:[],  //妯$硦鏌ヨ鍒楄〃瀵硅薄
-      pageSize:6,     //姣忛〉鏉℃暟
-      currentPage:1,  //褰撳墠椤�
-      total:0,        //鏂伴椈鎬绘潯鏁�
-      fuzzyShow:false,  //妯$硦鏌ヨ鍒嗛〉鐨勬樉绀�(甯冨皵鍊�)
-      fuzzytable:false, //妯$硦鏌ヨ琛ㄦ牸鐨勬樉绀�
-      fuzzyForm:{ fuzzytitle:'',fuzzytotal:0,fuzzycurrent:1,fuzzysize:6 },  //妯$硦鏌ヨ鍒楄〃瀵硅薄
+      editDialogVisible: false, //鎺у埗淇敼瀵硅瘽妗嗙殑甯冨皵鍊�
+      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: [{
-        value: 1,
-        label: '棣栭〉',
-        children: [{
-          value:42,
-          label: '閫氱煡鍏憡',
-        }, 
+      options: [
         {
-          value:43,
-          label: '宸ヤ綔鍔ㄦ��',
+          value: 1,
+          label: '棣栭〉',
+          children: [
+            {
+              value: 42,
+              label: '閫氱煡鍏憡'
+            },
+            {
+              value: 43,
+              label: '宸ヤ綔鍔ㄦ��'
+            },
+            {
+              value: 44,
+              label: '瀛﹂櫌鍔ㄦ��'
+            }
+          ]
         },
         {
-          value:44,
-          label: '瀛﹂櫌鍔ㄦ��',
-        }],
-      },{
           value: 22,
           label: '绉戝崗姒傚喌',
-          children: [{
-            value:27,
-            label: '绠�浠�',
-          }, 
-          {
-            value:28,
-            label: '绔犵▼',
-          },
-          {
-            value:29,
-            label: '缁勭粐缁撴瀯',
-          },
-          {
-            value:30,
-            label: '宸ヤ綔鑱岃矗',
-          },
-          {
-            value:31,
-            label: '涓撹亴浜哄憳',
-          }],
+          children: [
+            {
+              value: 27,
+              label: '绠�浠�'
+            },
+            {
+              value: 28,
+              label: '绔犵▼'
+            },
+            {
+              value: 29,
+              label: '缁勭粐缁撴瀯'
+            },
+            {
+              value: 30,
+              label: '宸ヤ綔鑱岃矗'
+            },
+            {
+              value: 31,
+              label: '涓撹亴浜哄憳'
+            }
+          ]
         },
         {
           value: 23,
           label: '鏀跨瓥娉曡',
-          children: [{
-            value:35,
-            label: '涓浗绉戝崗鏀跨瓥鏂囦欢',
-          }, 
-          {
-            value:36,
-            label: '鍦版柟绉戝崗鏀跨瓥鏂囦欢',
-          },
-          {
-            value:37,
-            label: '绀惧洟绠$悊鏂囦欢',
-          }],
+          children: [
+            {
+              value: 35,
+              label: '涓浗绉戝崗鏀跨瓥鏂囦欢'
+            },
+            {
+              value: 36,
+              label: '鍦版柟绉戝崗鏀跨瓥鏂囦欢'
+            },
+            {
+              value: 37,
+              label: '绀惧洟绠$悊鏂囦欢'
+            }
+          ]
         },
         {
           value: 25,
           label: '瀛︽湳浜ゆ祦',
-          children: [{
-            value:38,
-            label: '瀛︽湳淇℃伅',
-          }, 
-          {
-            value:39,
-            label: '绉戞妧绔炶禌',
-          }],
+          children: [
+            {
+              value: 38,
+              label: '瀛︽湳淇℃伅'
+            },
+            {
+              value: 39,
+              label: '绉戞妧绔炶禌'
+            }
+          ]
         },
         {
           value: 27,
           label: '绉戞櫘椋庨噰',
-          children: [{
-            value:40,
-            label: '骞抽《灞卞闄㈢鏅椿鍔�',
-          }, 
-          {
-            value:41,
-            label: '骞抽《灞卞競鏀垮崗绉戞櫘娲诲姩',
-          }],
-      }]
+          children: [
+            {
+              value: 40,
+              label: '骞抽《灞卞闄㈢鏅椿鍔�'
+            },
+            {
+              value: 41,
+              label: '骞抽《灞卞競鏀垮崗绉戞櫘娲诲姩'
+            }
+          ]
+        }
+      ]
     }
   },
-  created(){
-  },
-  mounted(){
-  },
+  created() {},
+  mounted() {},
   methods: {
     //淇敼瀵硅瘽妗嗗叧闂殑鏂规硶
     handleClose(done) {
       this.$confirm('纭鍏抽棴锛�')
         .then(_ => {
-          done();
+          done()
         })
-        .catch(_ => {});
+        .catch(_ => {})
     },
     //绾ц仈閫夋嫨鍣ㄧ殑鏂规硶
     handleChange(value) {
       // console.log(value);
       // console.log(value[1]);
-      this.newsCategoryId = value[1]; //灏嗗緱鍒扮殑灏忔爣棰榠d瀛樻斁璧锋潵
-      this.query(this.newsCategoryId);
+      this.newsCategoryId = value[1] //灏嗗緱鍒扮殑灏忔爣棰榠d瀛樻斁璧锋潵
+      this.query(this.newsCategoryId)
     },
-    query(newsCategoryId){
+    query(newsCategoryId) {
       const data = {
-        current:this.currentPage,
-        newsCategoryId:newsCategoryId,
-        size:this.pageSize
-      };
-      getNewsList(data).then(res=>{
-        // console.log(res);
-        if (res.code !== 200) {
-          return this.$message.error('鑾峰彇鏂伴椈鍒楄〃澶辫触')
-        }else{
-          this.tableData = res.data.records
-          this.total = res.data.total
-        }
-      }).catch(err => {
-        console.log(err);
-      })
+        current: this.currentPage,
+        newsCategoryId: newsCategoryId,
+        size: this.pageSize
+      }
+      getNewsList(data)
+        .then(res => {
+          // console.log(res);
+          if (res.code !== 200) {
+            return this.$message.error('鑾峰彇鏂伴椈鍒楄〃澶辫触')
+          } else {
+            this.tableData = res.data.records
+            this.total = res.data.total
+          }
+        })
+        .catch(err => {
+          console.log(err)
+        })
     },
     //灞曠ず淇敼瀵硅瘽妗�
-    showEditDialog(id){
+    showEditDialog(id) {
       getnew(id).then(res => {
         // console.log(res);
         if (res.code == 200) {
           this.editForm = res.data
-        }     
+        }
       })
-      this.editDialogVisible = true;
+      this.editDialogVisible = true
     },
     //纭畾淇敼琛ㄥ崟鎻愪氦锛岄獙璇佸彂璧疯姹�
-    editNew(){
+    editNew() {
       const data = {
         id: this.editForm.id,
         releaseTime: this.editForm.releaseTime,
-        title:this.editForm.title
+        title: this.editForm.title
       }
-      update(data).then(res=>{
+      update(data).then(res => {
         // console.log('dsadasas',res);
         if (res.code == 200) {
-          this.editDialogVisible =false;
+          this.editDialogVisible = false
           this.$message.success('淇敼鏂伴椈鎴愬姛锛�')
-          this.query(this.newsCategoryId);
+          this.query(this.newsCategoryId)
         }
       })
     },
     //妯$硦鏌ヨ
-    fuzzyList(title){
+    fuzzyList(title) {
       // console.log(title);
-      if(title == ''){
-        return  this.$message.error('璇峰厛杈撳叆鏌ヨ鏂伴椈鏍囬锛�')
+      if (title == '') {
+        return this.$message.error('璇峰厛杈撳叆鏌ヨ鏂伴椈鏍囬锛�')
       }
       this.fuzzyShow = true //妯$硦鍒嗛〉鏄剧ず
-      this.getShow = false  //鑾峰彇鍒嗛〉闅愯棌
+      this.getShow = false //鑾峰彇鍒嗛〉闅愯棌
       this.gettable = false
       this.fuzzytable = true
       const data = {
         current: this.fuzzyForm.fuzzycurrent,
         size: this.fuzzyForm.fuzzysize,
-        title:title
+        title: title
       }
-      fuzzy(data).then(res => {
-        // console.log(res);
-        if (res.code !== 200) {
-          return this.$message.error('鏌ヨ鏂伴椈鍒楄〃澶辫触')
-        }else{
-          this.fuzzytableData = res.data.records
-          this.fuzzyForm.fuzzytotal = res.data.total
-        }
-      }).catch(err => {
-        console.log(err);
-      })
+      fuzzy(data)
+        .then(res => {
+          // console.log(res);
+          if (res.code !== 200) {
+            return this.$message.error('鏌ヨ鏂伴椈鍒楄〃澶辫触')
+          } else {
+            this.fuzzytableData = res.data.records
+            this.fuzzyForm.fuzzytotal = res.data.total
+          }
+        })
+        .catch(err => {
+          console.log(err)
+        })
     },
     //娓呯┖鏌ヨ鍒楄〃鍐呭
-    qingKong(){
+    qingKong() {
       this.tableData = []
       this.fuzzytableData = []
       this.fuzzyForm.fuzzytotal = 0
@@ -338,7 +336,7 @@
       this.gettable = true
     },
     //鏍规嵁id鍒犻櫎鏂伴椈
-    async deleteNews(id){
+    async deleteNews(id) {
       // console.log(id);
       const res = await this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ潯鏂伴椈, 鏄惁缁х画?', '鎻愮ず', {
         confirmButtonText: '纭畾',
@@ -349,76 +347,93 @@
       })
       //濡傛灉鐢ㄦ埛鐐瑰嚮纭畾鍒欒繑鍥瀋onfirm
       //濡傛灉鐢ㄦ埛鐐瑰嚮鍙栨秷鍒欒繑鍥瀋ancel
-      console.log(res);
-      if(res !== 'confirm'){
+      console.log(res)
+      if (res !== 'confirm') {
         return this.$message.info('宸插彇娑堝垹闄')
-      }else{
-        console.log(id);
+      } else {
+        console.log(id)
         const data = {
-          id:id
+          id: id
         }
         //鍙傛暟data 瑕佷互瀵硅薄鐨勫舰寮忎紶鍏�
         deleteNew(data).then(res => {
-          console.log('>>>'+res);
-          if(res.code == 200){
+          console.log('>>>' + res)
+          if (res.code == 200) {
             this.$message.success('鍒犻櫎鏂伴椈鎴愬姛锛�')
-            this.query(this.newsCategoryId);
-          }else{
+            this.query(this.newsCategoryId)
+          } else {
             return this.$message.error('鍒犻櫎鏂伴椈澶辫触锛�')
           }
         })
       }
     },
     //鏌ョ湅
-    look(id){
-      this.$router.push({path:'news',query:{id:id}})
+    look(id) {
+      this.$router.push({ path: 'news', query: { id: id } })
     },
     handleCurrentChange(val) {
       // console.log(`褰撳墠椤�: ${val}`);
-      this.currentPage = val;
+      this.currentPage = val
       this.query(this.newsCategoryId)
     },
     handleSizeChange(val) {
       // console.log(`姣忛〉 ${val} 鏉);
-      this.pageSize = val;
+      this.pageSize = val
       this.query(this.newsCategoryId)
     },
-    handleCurrentChangefuzzy(val){
+    handleCurrentChangefuzzy(val) {
       this.fuzzyForm.fuzzycurrent = val
       this.fuzzyList(this.fuzzyForm.fuzzytitle) //妯$硦鏌ヨ
     },
-    handleSizeChangefuzzy(val){
+    handleSizeChangefuzzy(val) {
       this.fuzzyForm.fuzzysize = val
       this.fuzzyList(this.fuzzyForm.fuzzytitle) //妯$硦鏌ヨ
     },
     //鍘诲線娣诲姞缂栬緫椤甸潰
-    goEdit(id){
-      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) {
+    goEdit(id) {
+      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('璇ユ柊闂绘爣棰樹笅鍙兘瀛樺湪涓�绡囨柊闂�')
-      }else if(this.newsCategoryId==27||this.newsCategoryId==28||this.newsCategoryId==29||this.newsCategoryId==30||
-      this.newsCategoryId==31||this.newsCategoryId == 35||this.newsCategoryId==36||this.newsCategoryId==37||
-      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}})
-        console.log(this.newsCategoryId);
-      }else{
+      } else if (
+        this.newsCategoryId == 27 ||
+        this.newsCategoryId == 28 ||
+        this.newsCategoryId == 29 ||
+        this.newsCategoryId == 30 ||
+        this.newsCategoryId == 31 ||
+        this.newsCategoryId == 35 ||
+        this.newsCategoryId == 36 ||
+        this.newsCategoryId == 37 ||
+        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 } })
+        console.log(this.newsCategoryId)
+      } else {
         this.$message.error('璇峰厛閫夋嫨鏂伴椈鏍囬')
-      } 
+      }
     }
-  },
+  }
 }
 </script>
 
 <style lang="less">
-.add{
+.add {
   margin-bottom: 10px !important;
 }
-.block{
+.block {
   margin-bottom: 10px;
 }
-.el-pagination{
+.el-pagination {
   margin-top: 10px;
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0