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

---
 src/components/Administrator/Edit.vue |   45 ++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 40 insertions(+), 5 deletions(-)

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

--
Gitblit v1.8.0