From 6748bd905cbba6ef9459f2cc7d6b833a110b08d0 Mon Sep 17 00:00:00 2001
From: 明梦爽 <2972214568@qq.com>
Date: 星期六, 22 一月 2022 23:03:12 +0800
Subject: [PATCH] 完善了一些

---
 src/components/page/telephone.vue     |    4 
 /dev/null                             |   46 -----------
 src/components/page/News.vue          |   10 -
 src/api/api.js                        |    8 ++
 src/assets/css/my_style.css           |    3 
 src/components/Administrator/Main.vue |   91 +++++++++++-----------
 src/components/Administrator/Edit.vue |   45 ++++++++++-
 src/components/page/introduce.vue     |    7 +
 src/views/homePage/moreMessage.vue    |   12 +-
 src/router.js                         |    4 
 src/components/Login.vue              |    2 
 11 files changed, 115 insertions(+), 117 deletions(-)

diff --git a/src/api/api.js b/src/api/api.js
index 3f1fd5d..ca3cec2 100644
--- a/src/api/api.js
+++ b/src/api/api.js
@@ -54,4 +54,12 @@
     url:'/news/fuzzy',
     params:data,
   })
+}
+//娣诲姞鏂伴椈
+export const add = data => {
+  return request({
+    method:'POST',
+    url:'/news/add',
+    params:data
+  })
 }
\ No newline at end of file
diff --git a/src/assets/css/my_style.css b/src/assets/css/my_style.css
index 8f31cec..cd6c2ed 100644
--- a/src/assets/css/my_style.css
+++ b/src/assets/css/my_style.css
@@ -41,6 +41,9 @@
 .flex-between{
   justify-content: space-between;
 }
+.flex-around{
+  justify-content: space-around;
+}
 .fl{
   float: left;
 }
diff --git a/src/components/Administrator/Edit.vue b/src/components/Administrator/Edit.vue
index fdd7d01..b9c3b0f 100644
--- a/src/components/Administrator/Edit.vue
+++ b/src/components/Administrator/Edit.vue
@@ -1,13 +1,15 @@
 <template>
   <div class="box">
     鏂伴椈鏍囬锛�<el-input v-model="title" placeholder="璇疯緭鍏ユ柊闂绘爣棰�"></el-input><br/><br/>
-    鍙戝竷鏃ユ湡锛�<el-input v-model="releaseTime" placeholder="璇疯緭鍏ユ柊闂诲彂甯冩棩鏈�"></el-input>
+    鍙戝竷鏃ユ湡锛�<el-date-picker v-model="releaseTime" placeholder="璇烽�夋嫨鏂伴椈鍙戝竷鏃ユ湡"></el-date-picker><br/><br/>
     鏂伴椈鍐呭锛�<quill-editor ref="text" v-model="content" class="myQuillEditor" :options="editorOption" />
-    <el-button type="primary" @click="submit">纭畾</el-button>
-    <el-button type="success">鎻愪氦</el-button>
+    <div class="btn">
+      <el-button  type="success" @click="submit">鍙戝竷</el-button>
+    </div>
   </div>
 </template>
 <script>
+import { add } from '../../api/api'
 import { quillEditor } from 'vue-quill-editor'
 import 'quill/dist/quill.core.css'
 import 'quill/dist/quill.snow.css'
@@ -19,16 +21,41 @@
       title:'', //鏍囬鍐呭
       releaseTime:'', //鍙戝竷鏃ユ湡
       content: '',  //鏂伴椈鍐呭
+      newsCategoryId:2,
       editorOption: {
         placeholder: "璇疯緭鍏ユ鏂�",
+        // editorOption閲屾槸鏀惧浘鐗囦笂浼犻厤缃弬鏁扮敤鐨勶紝渚嬪锛�
+        action:  '/api/product/richtext_img_upload.do',  // 蹇呭~鍙傛暟 鍥剧墖涓婁紶鍦板潃
+        methods: 'POST',  // 蹇呭~鍙傛暟 鍥剧墖涓婁紶鏂瑰紡
+        token: '',  // 鍙�夊弬鏁� 濡傛灉闇�瑕乼oken楠岃瘉锛屽亣璁句綘鐨則oken鏈夊瓨鏀惧湪sessionStorage
+        name: 'upload_file',  // 蹇呭~鍙傛暟 鏂囦欢鐨勫弬鏁板悕
+        size: 10000000,  // 鍙�夊弬鏁�   鍥剧墖澶у皬锛屽崟浣嶄负Kb, 1M = 1024Kb
+        accept: 'multipart/form-data, image/png, image/gif, image/jpeg, image/bmp, image/x-icon,image/jpg'  // 鍙�� 鍙笂浼犵殑鍥剧墖鏍煎紡
       } ,  //缂栬緫鍣ㄦ柊闂诲璞�
     }
   },
   created(){
+    // console.log('>>>>>>>',this.$route.query.id);
+    this.newsCategoryId = this.$route.query.id
   },
   methods:{
-    submit () {
-      console.log(this.$refs.text.value)
+    submit(){
+      const data = {
+        newsCategoryId:this.newsCategoryId,
+        content:this.content,
+        title:this.title,
+        releaseTime:this.releaseTime
+      }
+      add(data).then(res => {
+        console.log(res);
+        if(res.code !== 200){
+          return this.$message.error('鍙戝竷鏂伴椈澶辫触锛岃閲嶈瘯锛�')
+        }else{
+          this.$message.success('鏂伴椈鍙戝竷鎴愬姛锛�')
+          console.log(this.content);
+          this.$router.go(-1)
+        }
+      })
     }
   }
 }
@@ -39,4 +66,12 @@
   width: 1200px;
   margin: 0 auto;
 }
+.myQuillEditor{
+  height: 350px;
+}
+.btn{
+  position: absolute;
+  bottom: 20px;
+  left: 168px;
+}
 </style>
\ No newline at end of file
diff --git a/src/components/Administrator/Main.vue b/src/components/Administrator/Main.vue
index 16ed775..5707748 100644
--- a/src/components/Administrator/Main.vue
+++ b/src/components/Administrator/Main.vue
@@ -15,7 +15,7 @@
         <el-row :gutter="40">
           <el-col :span="4">
             <!-- 娣诲姞鏂伴椈鎸夐挳 -->
-            <el-button el-button class="add" type="success" icon="el-icon-plus" @click="goEdit()">鐐瑰嚮鍦ㄨ鍒楄〃涓嬫坊鍔犱竴鏉℃柊闂�</el-button>
+            <el-button el-button class="add" type="success" icon="el-icon-plus" @click="goEdit(newsCategoryId)">鐐瑰嚮鍦ㄨ鍒楄〃涓嬫坊鍔犱竴鏉℃柊闂�</el-button>
           </el-col>
           <el-col :span="10">
             <!-- 鏂伴椈鎼滅储 -->
@@ -50,22 +50,25 @@
             
           </el-table-column>
         </el-table>
-        <div class="fenye">
+        <!-- 鍒嗛〉 -->
+        <div>
           <!-- 鑾峰彇鏂伴椈鍒楄〃鍒嗛〉 -->
-          <div class="get">
+          <div>
             <el-pagination
+              v-show="getShow"
               @size-change="handleSizeChange"
               @current-change="handleCurrentChange"
               :current-page="currentPage"
-              :page-sizes="[3,6,12, 18,]"
+              :page-sizes="[6,12, 18,]"
               :page-size="100"
               layout="total, sizes, prev, pager, next, jumper"
               :total="total">
             </el-pagination>
           </div>
           <!-- 妯$硦鏂伴椈鍒楄〃鍒嗛〉 -->
-          <div class="fuzzy">
+          <div>
             <el-pagination
+              v-show="fuzzyShow"
               @size-change="handleSizeChangefuzzy"
               @current-change="handleCurrentChangefuzzy"
               :current-page="fuzzyForm.fuzzycurrent"
@@ -92,7 +95,8 @@
             <el-input v-model="editForm.title"></el-input>
           </el-form-item>
           <el-form-item label="鍙戝竷鏃ユ湡:">
-            <el-input v-model="editForm.releaseTime"></el-input>
+            <!-- <el-input v-model="editForm.releaseTime"></el-input> -->
+            <el-date-picker v-model="editForm.releaseTime" type="date" placeholder="璇烽�夋嫨鍙戝竷鏃ユ湡"></el-date-picker>
           </el-form-item>
         </el-form>
         <span slot="footer" class="dialog-footer">
@@ -106,16 +110,17 @@
 
 <script>
 import { getNewsList,getnew,update,deleteNew,fuzzy } from '../../api/api'
-import axios from 'axios'
 export default {
   data() {
     return {
+      fuzzyShow:false,  //妯$硦鏌ヨ鍒嗛〉鐨勬樉绀�(甯冨皵鍊�)
+      getShow:true, //鑾峰彇鍒嗛〉鐨勬樉绀�(甯冨皵鍊�)
       visible: false,
       editDialogVisible:false,  //鎺у埗淇敼瀵硅瘽妗嗙殑甯冨皵鍊�
       editForm:{},  //鏌ヨ鍒扮殑鏂伴椈瀵硅薄锛岀洰鍓嶄粎渚涗慨鏀逛娇鐢�
       newsCategoryId:1, //鍏堝瓨涓�涓皬鏍囬id
       tableData:[],   //鏂伴椈鍒楄〃瀵硅薄
-      pageSize:3,     //姣忛〉鏉℃暟
+      pageSize:6,     //姣忛〉鏉℃暟
       currentPage:1,  //褰撳墠椤�
       total:0,        //鏂伴椈鎬绘潯鏁�
       fuzzyForm:{ fuzzytitle:'',fuzzytotal:0,fuzzycurrent:1,fuzzysize:6 },  //妯$硦鏌ヨ鍒楄〃瀵硅薄
@@ -216,8 +221,8 @@
     },
     //绾ц仈閫夋嫨鍣ㄧ殑鏂规硶
     handleChange(value) {
-      console.log(value);
-      console.log(value[1]);
+      // console.log(value);
+      // console.log(value[1]);
       this.newsCategoryId = value[1]; //灏嗗緱鍒扮殑灏忔爣棰榠d瀛樻斁璧锋潵
       this.query(this.newsCategoryId);
     },
@@ -228,7 +233,7 @@
         size:this.pageSize
       };
       getNewsList(data).then(res=>{
-        console.log(res);
+        // console.log(res);
         if (res.code !== 200) {
           return this.$message.error('鑾峰彇鏂伴椈鍒楄〃澶辫触')
         }else{
@@ -242,7 +247,7 @@
     //灞曠ず淇敼瀵硅瘽妗�
     showEditDialog(id){
       getnew(id).then(res => {
-        console.log(res);
+        // console.log(res);
         if (res.code == 200) {
           this.editForm = res.data
         }     
@@ -251,40 +256,35 @@
     },
     //纭畾淇敼琛ㄥ崟鎻愪氦锛岄獙璇佸彂璧疯姹�
     editNew(){
-      // console.log(typeof(this.editForm.releaseTime)); 
-      // console.log(this.editForm.releaseTime);
-      let arr = this.editForm.releaseTime.split('')
-      if(arr[4] !== '/' || arr[7] !== '/'){
-        return this.$message.error('璇锋寜鐓р�淴XXX/XX/XX鈥濈殑鏍煎紡濉啓鏃ユ湡')
-      }else{
-        const data = {
-          id: this.editForm.id,
-          releaseTime: this.editForm.releaseTime,
-          title:this.editForm.title
-        }
-        update(data).then(res=>{
-          console.log('dsadasas'+res);
-          if (res.code == 200) {
-            this.editDialogVisible =false;
-            this.$message.success('淇敼鏂伴椈鎴愬姛锛�')
-            this.query(this.newsCategoryId);
-          }
-        })
+      const data = {
+        id: this.editForm.id,
+        releaseTime: this.editForm.releaseTime,
+        title:this.editForm.title
       }
+      update(data).then(res=>{
+        // console.log('dsadasas',res);
+        if (res.code == 200) {
+          this.editDialogVisible =false;
+          this.$message.success('淇敼鏂伴椈鎴愬姛锛�')
+          this.query(this.newsCategoryId);
+        }
+      })
     },
     //妯$硦鏌ヨ
     fuzzyList(title){
-      console.log(title);
+      // console.log(title);
       if(title == ''){
         return  this.$message.error('璇峰厛杈撳叆鏌ヨ鏂伴椈鏍囬锛�')
       }
+      this.fuzzyShow = true //妯$硦鍒嗛〉鏄剧ず
+      this.getShow = false  //鑾峰彇鍒嗛〉闅愯棌
       const data = {
         current: this.fuzzyForm.fuzzycurrent,
         size: this.fuzzyForm.fuzzysize,
         title:title
       }
       fuzzy(data).then(res => {
-        console.log(res);
+        // console.log(res);
         if (res.code !== 200) {
           return this.$message.error('鏌ヨ鏂伴椈鍒楄〃澶辫触')
         }else{
@@ -299,10 +299,12 @@
     qingKong(){
       this.tableData = []
       this.fuzzyForm.fuzzytotal = 0
+      this.fuzzyShow = false
+      this.getShow = true
     },
     //鏍规嵁id鍒犻櫎鏂伴椈
     async deleteNews(id){
-      console.log(id);
+      // console.log(id);
       const res = await this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ潯鏂伴椈, 鏄惁缁х画?', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
@@ -355,15 +357,17 @@
       this.fuzzyList(this.fuzzyForm.fuzzytitle) //妯$硦鏌ヨ
     },
     //鍘诲線娣诲姞缂栬緫椤甸潰
-    goEdit(){
-      if (this.newsCategoryId==27||this.newsCategoryId==28||this.newsCategoryId==29||
-      this.newsCategoryId==30||this.newsCategoryId==31) {
-        this.$message.error('璇ユ柊闂绘爣棰樹笅涓嶈兘娣诲姞鏂伴椈')
-      }else if(this.newsCategoryId == 35||this.newsCategoryId==36||this.newsCategoryId==37||
+    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('/administrator/edit')
+        this.$router.push({path:'/administrator/edit',query:{id:id}})
+        console.log(this.newsCategoryId);
       }else{
         this.$message.error('璇峰厛閫夋嫨鏂伴椈鏍囬')
       } 
@@ -376,11 +380,10 @@
 .add{
   margin-bottom: 10px !important;
 }
+.block{
+  margin-bottom: 10px;
+}
 .el-pagination{
   margin-top: 10px;
-}
-.fenye{
-  display: flex;
-  justify-content: space-between;
 }
 </style>
\ No newline at end of file
diff --git a/src/components/Administrator/Update.vue b/src/components/Administrator/Update.vue
deleted file mode 100644
index 5f0ab30..0000000
--- a/src/components/Administrator/Update.vue
+++ /dev/null
@@ -1,46 +0,0 @@
-<template>
-  <div class="box">
-    鏂伴椈鏍囬锛�<el-input v-model="input" placeholder="璇疯緭鍏ユ柊闂绘爣棰�"></el-input><br/><br/>
-    鍙戝竷鏃ユ湡锛�<el-date-picker
-                v-model="value1"
-                type="date"
-                placeholder="閫夋嫨鏃ユ湡">
-              </el-date-picker><br/><br/>
-    鏂伴椈鍐呭锛�<quill-editor ref="text" v-model="content" class="myQuillEditor" :options="editorOption" />
-    <el-button type="primary" @click="submit">纭畾</el-button>
-    <el-button type="success">鎻愪氦</el-button>
-  </div>
-</template>
-<script>
-import { quillEditor } from 'vue-quill-editor'
-import 'quill/dist/quill.core.css'
-import 'quill/dist/quill.snow.css'
-import 'quill/dist/quill.bubble.css'
-export default {
-  components:{ quillEditor },
-  data(){
-    return {
-      input:'', //鏍囬鍐呭
-      value1:'',  //鏃ユ湡
-      content: '',  //鏂伴椈鍐呭
-      editorOption: {
-        placeholder: "璇疯緭鍏ユ鏂�",
-      } ,  //缂栬緫鍣ㄦ柊闂诲璞�
-    }
-  },
-  created(){
-  },
-  methods:{
-    submit () {
-      console.log(this.$refs.text.value)
-    }
-  }
-}
-</script>
-
-<style lang="less" scoped>
-.box{
-  width: 1200px;
-  margin: 0 auto;
-}
-</style>
\ No newline at end of file
diff --git a/src/components/Login.vue b/src/components/Login.vue
index 48999ed..9e3bd7d 100644
--- a/src/components/Login.vue
+++ b/src/components/Login.vue
@@ -68,7 +68,7 @@
         //   1.2 token 鍙簲鍦ㄥ綋鍓嶇綉绔欐墦寮�鏈熼棿鐢熸晥锛屾墍浠ュ皢 token 淇濆瓨鍦� sessionStorage 涓�
         window.sessionStorage.setItem('token', res.data.token)
         // 2. 閫氳繃缂栫▼寮忓鑸烦杞埌鍚庡彴涓婚〉锛岃矾鐢卞湴鍧�鏄� /home
-        this.$router.push('/administrator')
+        this.$router.push('/administrator/main')
       })
     }
   }
diff --git a/src/components/page/News.vue b/src/components/page/News.vue
index a76f040..d96599e 100644
--- a/src/components/page/News.vue
+++ b/src/components/page/News.vue
@@ -22,9 +22,8 @@
     }
   },
   created(){
-    console.log(">>>>>>>>",this.$route.query.id);
+    // console.log(">>>>>>>>",this.$route.query.id);
     this.getalone();
-    // this.queryAll();
   },
   methods:{
     getalone(){
@@ -37,18 +36,15 @@
         this.title = res.data.title;
       })
     },
-    // queryAll(){
-    //   this.content = ``
-    // }
   },
 }
 </script>
 <style>
-h2{
+.header h2{
   color: rgb(3, 73, 144);
   text-align: center;
 }
-p{
+.header p{
   background-color: rgb(246, 246, 246);
   text-align: center;
   height: 35px;
diff --git a/src/components/page/introduce.vue b/src/components/page/introduce.vue
index f9174f7..7ffe283 100644
--- a/src/components/page/introduce.vue
+++ b/src/components/page/introduce.vue
@@ -14,8 +14,8 @@
       </el-col>
        <!-- 鏂伴椈鍐呭 -->
       <el-card class="box-card">
-        <el-col :span="18">
-          <div>{{ this.new.content }}</div>
+        <el-col>
+          <div v-html="this.new.content"></div>
         </el-col>
       </el-card>
     </el-row>
@@ -109,6 +109,9 @@
     text-align: center;
   }
 }
+.box-card{
+  // background-color: rgb(131, 212, 115);
+}
 .ft-blue {
   color: rgb(9, 143, 252);
 }
diff --git a/src/components/page/telephone.vue b/src/components/page/telephone.vue
index d043278..7014ce4 100644
--- a/src/components/page/telephone.vue
+++ b/src/components/page/telephone.vue
@@ -13,7 +13,7 @@
             <img src="../../assets/weiBo.jpg" alt="">
           </el-card>
         </div>
-        <divc class="right">
+        <div class="right">
           <el-table :data="tableData" border  :header-cell-style="{textAlign: 'center'}" :cell-style="{ textAlign: 'center' }">
             <!-- :header-cell-style="{textAlign: 'center'}"璁剧疆澶撮儴灞呬腑锛� -->
             <!-- :cell-style="{ textAlign: 'center' }"璁剧疆鏁翠釜琛ㄦ牸鍐呭姘村钩灞呬腑锛� -->
@@ -28,7 +28,7 @@
             <el-table-column prop="mail" label="閭" width="200">
             </el-table-column>
           </el-table>  
-        </divc>
+        </div>
       </div>
     </el-card>
   </div>
diff --git a/src/router.js b/src/router.js
index 293b4e9..eebd3de 100644
--- a/src/router.js
+++ b/src/router.js
@@ -18,7 +18,6 @@
 import Welcome from './components/Administrator/Welcome.vue'
 import Main from './components/Administrator/Main.vue'
 import Edit from './components/Administrator/Edit.vue'
-import Update from './components/Administrator/Update.vue'
 
 
 Vue.use(Router)
@@ -32,8 +31,7 @@
       children: [{ path:'welcome',component:Welcome },
                 { path:'main',component:Main },
                 { path:'edit',component:Edit },
-                { path:'news',component:News },
-                { path:'update',component:Update }] 
+                { path:'news',component:News },] 
     },
     { 
       path: '/home', 
diff --git a/src/views/homePage/moreMessage.vue b/src/views/homePage/moreMessage.vue
index 43978e9..7b25d0d 100644
--- a/src/views/homePage/moreMessage.vue
+++ b/src/views/homePage/moreMessage.vue
@@ -98,7 +98,7 @@
       currentPagenotice:1,  //閫氱煡鍏憡鐨勫綋鍓嶉〉
       currentPageschool:1,  //瀛﹂櫌鍔ㄦ�佺殑褰撳墠椤�
       currentPagework:1,  //宸ヤ綔鍔ㄦ�佺殑褰撳墠椤�
-      pageSize:4,
+      pageSize:10,
       totalnotice:0,  //閫氱煡鍏憡鏂伴椈鐨勬�绘潯鏁�
       totalschool:0,  //瀛﹂櫌鍔ㄦ�佹柊闂荤殑鎬绘潯鏁�
       totalwork:0,  //宸ヤ綔鍔ㄦ�佹柊闂荤殑鎬绘潯鏁�
@@ -212,7 +212,7 @@
   border-bottom: 1px solid #0f99e9;
 }
 .lieBiao {
-  width: 95%;
+  width: 100%;
   height: 60px;
   background: rgb(241, 241, 241);
   margin-bottom: 10px;
@@ -220,14 +220,12 @@
 .time {
   width: 100px;
   padding: 17px 0px;
-  display: flex;
-  flex-direction: column;
   background-color: rgb(1, 72, 153);
   color: white;
   text-align: center;
 }
 .title {
-  width: 550px;
+  width: 980px;
   height: 50px;
   overflow: hidden;
   line-height: 60px;
@@ -235,7 +233,7 @@
   padding: 0 0 0 10px;
 }
 .ul{
-  width: 700px;
-  margin: 0 auto;
+  width: 1100px;
+  margin: 0;
 }
 </style> 
\ No newline at end of file

--
Gitblit v1.8.0