xjc 4 years ago
parent
commit
86499e2c34
5 changed files with 70 additions and 31 deletions
  1. 16 0
      src/api.js
  2. 21 5
      src/components/fuEditor/index.vue
  3. 1 1
      src/router.js
  4. 14 12
      src/views/match/addArticle.vue
  5. 18 13
      src/views/match/notice.vue

+ 16 - 0
src/api.js

@@ -221,5 +221,21 @@ export default {
 	autoCompleteData: params => {
 		return axios.post(`${baseURL}/api/admin/player/autorecord`, params);
 	},
+	// 文章
+	addArticle: params => {
+		return axios.post(`${baseURL}/api/admin/article`, params);
+	},
+	editArticle: params => {
+		return axios.put(`${baseURL}/api/admin/article`, params);
+	},
+	delArticle: params => {
+		return axios.delete(`${baseURL}/api/admin/article`, { params: params });
+	},
+	getArticleById: params => {
+		return axios.get(`${baseURL}/api/admin/article`, { params: params })
+	},
+	getArticleList: params => {
+		return axios.get(`${baseURL}/api/admin/article/list`, { params: params })
+	},
 
 }

+ 21 - 5
src/components/fuEditor/index.vue

@@ -1,9 +1,9 @@
 <template lang="html">
   <div class="editor">
-    <div ref="toolbar" class="toolbar">
-    </div>
-    <div ref="editor" class="text">
-    </div>
+      <div ref="toolbar" class="toolbar">
+      </div>
+      <div ref="editor" class="text">
+      </div>
   </div>
 </template>
 
@@ -114,7 +114,7 @@ export default {
           //循环插入图片
           // for (let i = 0; i < 1; i++) {
           // console.log(result)
-          let url = result.data;
+          let url = result.data.url;
           insertImg(url);
           // }
         }
@@ -138,10 +138,26 @@ export default {
   z-index: 0;
   /deep/ .toolbar {
     border: 1px solid #ccc;
+    position: fixed;
+    z-index: 100000;
+    width: 100%;
+    background: #fff;
+    height: 52px;
   }
   /deep/ .text {
     border: 1px solid #ccc;
     min-height: 500px;
+    // margin-top:52px;
+        top: 52px;
   }
+  height: 500px;
+  overflow-y: scroll;
+  // .w-e-toolbar{
+  //   position: fixed;
+  //   width: 100%;
+  //   background: #fff;
+  //   height: 52px;
+  // }
+
 }
 </style>

+ 1 - 1
src/router.js

@@ -46,7 +46,7 @@ export default new Router({
         path: '/addNotice',
         component: () => import('./views/match/addArticle.vue'),
         name: '新增公告',
-        show:0,
+        hide:1,
         isLeaf:1
       }]
     },

+ 14 - 12
src/views/match/addArticle.vue

@@ -59,21 +59,27 @@
 }
 </style>
 <template>
-  <section class="add">
-    <p>内容管理 > 新增公告</p>
-    <div class="content">
+  <section class="content">
+        <h4>新增公告</h4>
+        <el-divider></el-divider>
       <el-form label-width="80px">
         <el-form-item label="标题">
-          <el-input placeholder="标题" v-model="form.title"></el-input>
+          <el-input placeholder="标题" v-model="form.name"></el-input>
         </el-form-item>
         <el-form-item label="详情">
           <fuEditor v-model="form.content" :isClear="isClear" @change="change"></fuEditor>
         </el-form-item>
+        <el-form-item label="状态" prop="status">
+            <el-select v-model="form.status" placeholder="请选择状态">
+                <el-option key='1' label="编辑中" :value="1"></el-option>
+                <el-option key='2' label="上线" :value="2"></el-option>
+                <el-option key='-1' label="下线" :value="-1"></el-option>
+            </el-select>
+        </el-form-item>
         <el-form-item label=" ">
           <el-button type="primary" @click="save">保存</el-button>
         </el-form-item>
       </el-form>
-    </div>
   </section>
 </template>
 <script>
@@ -107,10 +113,6 @@ export default {
     getData() {
       this.$api.getArticleById({ id: this.form.id }).then(res => {
         this.form = res.data.data;
-        this.point={
-          lng:this.form.point.split(',')[0],
-          lat:this.form.point.split(',')[1]
-        }
       });
     },
     getContent(){
@@ -153,7 +155,7 @@ export default {
         this.$api.editArticle(parm).then(res => {
           if (res.data.code == 0) {
             this.$message({ message: "修改成功!", type: "success" });
-            this.$router.push({ path: "/article" });
+            this.$router.push({ path: "/notice" });
           } else {
             this.$message.error(res.data.message);
           }
@@ -162,7 +164,7 @@ export default {
         this.$api.addArticle(parm).then(res => {
           if (res.data.code == 0) {
             this.$message({ message: "添加成功!", type: "success" });
-            this.$router.push({ path: "/article" });
+            this.$router.push({ path: "/notice" });
           } else {
             this.$message.error(res.data.message);
           }
@@ -207,7 +209,7 @@ export default {
     },
   },
   created() {
-    this.getContent()
+    // this.getContent()
     if (this.$route.query.id) {
       this.form.id = this.$route.query.id;
       this.id = this.$route.query.id;

+ 18 - 13
src/views/match/notice.vue

@@ -25,10 +25,17 @@
         </el-form>
         <el-table v-loading='loading' :data="list" style="width: 100%;margin-top:10px;" height="50vh">
                 <el-table-column align="center" prop="name" label="公告名称"/>
-                <el-table-column align="center"  prop="end_time" label="创建时间"/>
+                <el-table-column align="center"  prop="ctime" label="创建时间"/>
+                <el-table-column align="center"  prop="date" label="状态">
+                    <template slot-scope="scope">
+                        <span v-if="scope.row.status==1">编辑中</span>
+                        <span v-if="scope.row.status==2">上线</span>
+                        <span v-if="scope.row.status==-1">下线</span>
+                    </template>
+                </el-table-column>
                 <el-table-column align="center"  prop="date" label="操作">
                     <template slot-scope="scope">
-                        <el-button @click="title='编辑赛事',open=true,form=scope.row" size="mini" type="warning">编辑</el-button>
+                        <el-button @click="handleEdit(scope.row)" size="mini" type="warning">编辑</el-button>
                         <el-button @click="del(scope.row.id)" size="mini" type="danger">删除</el-button>
                     </template>
                 </el-table-column>
@@ -113,7 +120,7 @@ export default {
         this.$confirm("确定删除吗?", "提示", {
             type: "warning",
         }).then(() => {
-            this.$api.delMatch({ id: id }).then((res) => {
+            this.$api.delArticle({ id: id }).then((res) => {
             this.$message({
                 message: "删除成功",
                 type: "success",
@@ -131,17 +138,8 @@ export default {
         },
         getData(){
             this.loading = true;
-            this.$api.getMatchList().then(res=>{
-                this.matchList=res.data.data
-            })
-            this.$api.getGroupList().then(res=>{
-                this.groupList=res.data.data
-            })
-            this.$api.getUserSearch().then(res=>{
-                this.userList=res.data.data
-            })
             // 
-            this.$api.getMatchs(this.queryParams).then(res=>{
+            this.$api.getArticleList(this.queryParams).then(res=>{
                 this.list=res.data.data.list
                 this.total = res.data.data.total;
                 this.loading = false;
@@ -151,6 +149,13 @@ export default {
             this.open=true;
             this.title='新增赛事';
             this.form={}
+            this.$router.push({path:'/addNotice'})
+        },
+        handleEdit(row){
+            this.open=true;
+            this.title='新增赛事';
+            // this.form={}
+            this.$router.push({path:'/addNotice',query:{id:row.id}})
         },
         /** 提交按钮 */
         submitForm() {