Browse Source

话题资讯管理

zs 2 years ago
parent
commit
e4019836f3
47 changed files with 1903 additions and 260 deletions
  1. 111 0
      commpents/hg-editor/hg-editor.js
  2. 4 0
      commpents/hg-editor/hg-editor.json
  3. 40 0
      commpents/hg-editor/hg-editor.wxml
  4. 39 0
      commpents/hg-editor/hg-editor.wxss
  5. 67 0
      commpents/hg-editor/iconfont.wxss
  6. 0 1
      pages/address/add.less
  7. 0 1
      pages/address/add.wxss
  8. 8 0
      pages/address/list.js
  9. 1 1
      pages/address/list.wxml
  10. 0 140
      pages/my/index.less
  11. 106 13
      pages/news/add.js
  12. 7 2
      pages/news/add.json
  13. 39 0
      pages/news/add.less
  14. 48 2
      pages/news/add.wxml
  15. 32 1
      pages/news/add.wxss
  16. 13 2
      pages/news/index.js
  17. 4 4
      pages/news/index.wxml
  18. 42 13
      pages/news/info.js
  19. 5 2
      pages/news/info.json
  20. 34 0
      pages/news/info.less
  21. 17 2
      pages/news/info.wxml
  22. 28 1
      pages/news/info.wxss
  23. 111 14
      pages/news/list.js
  24. 5 2
      pages/news/list.json
  25. 103 0
      pages/news/list.less
  26. 45 2
      pages/news/list.wxml
  27. 82 1
      pages/news/list.wxss
  28. 0 1
      pages/project/add.less
  29. 0 1
      pages/project/add.wxss
  30. 84 11
      pages/topic/add.js
  31. 6 2
      pages/topic/add.json
  32. 43 0
      pages/topic/add.less
  33. 46 2
      pages/topic/add.wxml
  34. 36 1
      pages/topic/add.wxss
  35. 11 0
      pages/topic/index.js
  36. 1 1
      pages/topic/index.wxml
  37. 90 13
      pages/topic/info.js
  38. 6 2
      pages/topic/info.json
  39. 108 0
      pages/topic/info.less
  40. 51 2
      pages/topic/info.wxml
  41. 88 1
      pages/topic/info.wxss
  42. 109 14
      pages/topic/list.js
  43. 5 2
      pages/topic/list.json
  44. 103 0
      pages/topic/list.less
  45. 39 2
      pages/topic/list.wxml
  46. 82 1
      pages/topic/list.wxss
  47. 4 0
      utils/dict.js

+ 111 - 0
commpents/hg-editor/hg-editor.js

@@ -0,0 +1,111 @@
+// components/hg-editor/hg-editor.js
+const app = getApp()
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    /**是否显示工具栏 */
+    showTabBar: {
+      type: 'Boolean',
+      value: true
+    },
+    placeholder: {
+      type: 'String',
+      value: '请输入相关内容'
+    },
+    name: {
+      type: 'String',
+      value: ''
+    },
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    _onEditorReady: async function () {
+      const that = this;
+      that.createSelectorQuery().select('#editor').context(function (res) {
+        that.editorCtx = res.context
+        let html = that.data.name;
+        if (html) {
+          that.editorCtx.setContents({
+            html: html,
+            success: (res) => { },
+            fail: (res) => { console.log(res) }
+          })
+        }
+      }).exec()
+    },
+    //插入图片
+    _addImage: function (event) {
+      let _this = this;
+      wx.chooseImage({
+        count: 1,
+        sizeType: ['compressed'],
+        sourceType: ['album'],
+        success: function (res) {
+          _this._uploadImage(res.tempFilePaths[0]);
+        }
+      });
+    },
+    _uploadImage: function (tempFilePath) {
+      let _this = this;
+      wx.uploadFile({
+        url: `${app.globalData.fileUrl}/files/court/elimg/upload`,
+        filePath: tempFilePath,
+        name: 'file',
+        formData: {},
+        success: (res) => {
+          let arr = JSON.parse(res.data);
+          if (arr.errcode == '0') {
+            _this.editorCtx.insertImage({ src: app.globalData.fileUrl + arr.uri });
+          } else {
+            wx.showToast({ title: `${arr.errmsg}`, icon: 'fail', duration: 2000 })
+          }
+        },
+      })
+    },
+    //设置斜体
+    _addItalic: function () {
+      this.editorCtx.format("italic")
+    },
+    //添加粗体样式
+    _addBold: function () {
+      this.editorCtx.format("bold")
+    },
+    //设置标题
+    _addHeader: function (e) {
+      let headerType = e.currentTarget.dataset.header;
+      this.editorCtx.format("header", headerType)
+    },
+    //设置文字的排列方式
+    _addAlign: function (e) {
+      let alignType = e.currentTarget.dataset.align;
+      this.editorCtx.format("align", alignType);
+    },
+    //设置列表
+    _addList: function (e) {
+      let listType = e.currentTarget.dataset.list;
+      this.editorCtx.format("list", listType);
+    },
+    //撤销
+    _undo: function () {
+      this.editorCtx.undo();
+    },
+    //监控输入
+    _onInputting: function (e) {
+      let html = e.detail.html;
+      let text = e.detail.text;
+      this.triggerEvent("input", { html: html, text: text }, {});
+    }
+  }
+})

+ 4 - 0
commpents/hg-editor/hg-editor.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 40 - 0
commpents/hg-editor/hg-editor.wxml

@@ -0,0 +1,40 @@
+<view class="editor-box">
+  <view class="editor-box-header" wx:if="{{showTabBar}}">
+    <view class="operate-box" data-uploadImageURL="{{uploadImageURL}}" bind:tap="_addImage">
+      <text class="iconfont icon-image"></text>
+    </view>
+    <view class="operate-box" bind:tap="_addItalic">
+      <text class="iconfont icon-italic"></text>
+    </view>
+    <view class="operate-box" bind:tap="_addBold">
+      <text class="iconfont icon-bold"></text>
+    </view>
+    <view class="operate-box" data-header="h1" bind:tap="_addHeader">
+      <text class="iconfont icon-h1"></text>
+    </view>
+    <view class="operate-box" data-header="h2" bind:tap="_addHeader">
+      <text class="iconfont icon-h2"></text>
+    </view>
+    <view class="operate-box" data-header="h3" bind:tap="_addHeader">
+      <text class="iconfont icon-h3"></text>
+    </view>
+    <view class="operate-box" data-align="left" bind:tap="_addAlign">
+      <text class="iconfont icon-alignLeft"></text>
+    </view>
+    <view class="operate-box" data-align="right" bind:tap="_addAlign">
+      <text class="iconfont icon-alignRight"></text>
+    </view>
+    <view class="operate-box" data-list="ordered" bind:tap="_addList">
+      <text class="iconfont icon-orderedList"></text>
+    </view>
+    <view class="operate-box" data-list="bullet" bind:tap="_addList">
+      <text class="iconfont icon-unorderedList"></text>
+    </view>
+    <view class="operate-box" bind:tap="_undo">
+      <text class="iconfont icon-undo"></text>
+    </view>
+  </view>
+  <view class="editor-box-content">
+    <editor id="editor" name="{{name}}" placeholder="{{placeholder}}" bind:ready="_onEditorReady" bind:input="_onInputting" show-img-resize="{{true}}"></editor>
+  </view>
+</view>

+ 39 - 0
commpents/hg-editor/hg-editor.wxss

@@ -0,0 +1,39 @@
+/* components/hg-editor/hg-editor.wxss */
+@import "iconfont.wxss";
+
+.editor-box {
+  width: 100%;
+  padding: 0;
+  box-sizing: border-box;
+  background-color: #fff;
+  border:2px solid #f6f6f6;
+}
+
+.editor-box-header,
+.editor-box-content {
+  width: 100%;
+}
+
+.editor-box-header {
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+  justify-content:flex-start;
+  padding: 20rpx 20rpx;
+  box-sizing: border-box;
+  border-bottom: 2rpx solid #f6f6f6;
+  background-color: #f6f6f6;
+}
+
+.editor-box-header>.operate-box {
+  margin-right: 20rpx;
+  width: 40rpx;
+  height: 40rpx;
+  overflow: hidden;
+  color:gray;
+}
+
+.editor-box-content{
+  padding:20rpx;
+  box-sizing: border-box;
+}

+ 67 - 0
commpents/hg-editor/iconfont.wxss

@@ -0,0 +1,67 @@
+@font-face {
+  font-family: 'iconfont';  /* Project id 2549449 */
+  src: url('//at.alicdn.com/t/font_2549449_hxmflg4qsr6.woff2?t=1621002720450') format('woff2'),
+       url('//at.alicdn.com/t/font_2549449_hxmflg4qsr6.woff?t=1621002720450') format('woff'),
+       url('//at.alicdn.com/t/font_2549449_hxmflg4qsr6.ttf?t=1621002720450') format('truetype');
+}
+
+.iconfont {
+  font-family: "iconfont" !important;
+  font-size: 38rpx;
+  font-style: normal;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+.icon-undo:before {
+  content: "\e609";
+}
+
+.icon-hr:before {
+  content: "\e60a";
+}
+
+.icon-h3:before {
+  content: "\e60b";
+}
+
+.icon-quote:before {
+  content: "\e60c";
+}
+
+.icon-bold:before {
+  content: "\e60e";
+}
+
+.icon-orderedList:before {
+  content: "\e612";
+}
+
+.icon-h2:before {
+  content: "\e61a";
+}
+
+.icon-italic:before {
+  content: "\e61c";
+}
+
+.icon-unorderedList:before {
+  content: "\e620";
+}
+
+.icon-alignLeft:before {
+  content: "\e621";
+}
+
+.icon-alignRight:before {
+  content: "\e622";
+}
+
+.icon-h1:before {
+  content: "\e623";
+}
+
+.icon-image:before {
+  content: "\e629";
+}
+

+ 0 - 1
pages/address/add.less

@@ -1,5 +1,4 @@
 .main {
-    height: var(--twoHeight);
     background-color: var(--bgColor);
 
     .one {

+ 0 - 1
pages/address/add.wxss

@@ -1,5 +1,4 @@
 .main {
-  height: var(--twoHeight);
   background-color: var(--bgColor);
 }
 .main .one .content {

+ 8 - 0
pages/address/list.js

@@ -12,6 +12,12 @@ Page({
     back: function () {
         wx.navigateBack({ delta: 1 })
     },
+    //查询
+    onSearch: function (e) {
+        const that = this;
+        that.setData({ 'searchInfo.title': e.detail.value });
+        that.watchLogin()
+    },
     toCommon: function (e) {
         const that = this;
         that.setData({ list: [] })
@@ -75,10 +81,12 @@ Page({
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
+        let searchInfo = that.data.searchInfo;
         wx.getStorage({
             key: 'user',
             success: async res => {
                 let info = { skip: that.data.skip, limit: that.data.limit };
+                if (searchInfo && searchInfo.title) info.title = searchInfo.title;
                 let arr;
                 arr = await app.$get(`/newCourt/api/ground`, { ...info });
                 if (arr.errcode == '0') {

+ 1 - 1
pages/address/list.wxml

@@ -2,7 +2,7 @@
     <view slot="info" class="container main">
         <view class="one">
             <view class="one_1">
-                <input type="text" placeholder="请输入关键词" />
+                <input type="text" value="{{searchInfo.title}}" bindconfirm="onSearch" placeholder="请输入资讯名称" />
             </view>
             <view class="one_2">
                 <button type="primary" bindtap="toCommon" data-route="address/add">添加</button>

+ 0 - 140
pages/my/index.less

@@ -124,146 +124,6 @@
             }
         }
     }
-
-    // .zero {
-    //     margin: 0 2vw 2vw 2vw;
-    // }
-
-    // .one {
-    //     position: relative;
-    //     height: 120px;
-
-    //     .one_1 {
-    //         height: 80px;
-    //         background-color: #216EC7;
-    //         border-bottom-left-radius: 10px;
-    //         border-bottom-right-radius: 10px;
-    //         color: transparent;
-    //     }
-
-    //     .one_2 {
-    //         position: absolute;
-    //         top: 5vw;
-    //         width: 86vw;
-    //         height: 86px;
-    //         margin: 0 3vw;
-    //         padding: 2vw;
-    //         background-color: var(--bgColor);
-    //         display: flex;
-    //         justify-content: space-between;
-
-    //         .l {
-    //             display: flex;
-    //             justify-content: start;
-    //             width: 72vw;
-
-    //             .l_1 {
-    //                 padding: 3vw 0;
-
-    //                 .icon {
-    //                     width: 60px;
-    //                     height: 60px;
-    //                     border-radius: 90px;
-    //                 }
-    //             }
-
-    //             .l_2 {
-    //                 width: 56vw;
-    //                 padding: 4vw 0 0 0;
-
-    //                 .info {
-    //                     margin: 0 0 2vw 0;
-    //                     padding: 0 2vw;
-    //                     font-size: var(--txtSize);
-    //                 }
-
-    //                 .info:nth-child(1) {
-    //                     font-weight: bold;
-    //                     font-size: var(--titleSize);
-    //                 }
-
-    //                 .info:nth-child(2) {
-    //                     color: var(--labelColor);
-    //                     font-size: 15px;
-    //                 }
-    //             }
-    //         }
-
-    //         .r {
-    //             padding: 8vw 0;
-    //             font-size: var(--txtSize);
-    //             color: var(--labelColor);
-    //         }
-    //     }
-    // }
-
-    // .two {
-    //     flex-grow: 1;
-    //     position: relative;
-
-    //     .scroll-view {
-    //         position: absolute;
-    //         top: 0;
-    //         left: 0;
-    //         right: 0;
-    //         bottom: 0;
-
-    //         .list-scroll-view {
-    //             display: flex;
-    //             flex-wrap: wrap;
-    //             flex-direction: row;
-    //             align-content: flex-start;
-    //             justify-content: space-between;
-
-    //             .list {
-    //                 background-color: var(--bgColor);
-    //                 width: 96vw;
-    //                 margin: 0 0 1.5vw 0;
-    //                 padding: 2vw;
-
-    //                 .list_1 {
-
-    //                     .icon {
-    //                         margin: 0 2vw 0 0;
-    //                     }
-
-    //                     .title {
-    //                         font-size: var(--txtSize);
-    //                     }
-    //                 }
-
-    //                 .list_2 {
-    //                     display: flex;
-    //                     flex-direction: row;
-    //                     justify-content: space-between;
-    //                     flex-wrap: wrap;
-    //                     margin: 1vw 0 0 0;
-
-    //                     .routeList {
-    //                         display: flex;
-    //                         justify-content: center;
-    //                         align-items: center;
-    //                         width: 25vw;
-    //                         height: 25vw;
-    //                         padding: 1vw;
-    //                         background-color: var(--f9Color);
-
-    //                         .route_1 {
-    //                             display: flex;
-    //                             flex-direction: column;
-
-    //                             .title {
-    //                                 font-size: var(--txtSize);
-    //                                 padding: 1vw 0 0 0;
-    //                                 text-align: center;
-    //                             }
-    //                         }
-    //                     }
-    //                 }
-    //             }
-    //         }
-    //     }
-    // }
 }
 
 .scroll-view {

+ 106 - 13
pages/news/add.js

@@ -1,66 +1,159 @@
-// pages/news/add.js
+const app = getApp()
+import WxValidate from '../../utils/wxValidate'
+const moment = require("../../utils/moment.min")
+import { is_show_project } from '../../utils/dict';
+import { news_type } from '../../utils/dict';
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '信息管理', leftArrow: true, useBar: false },
+        id: '',
+        form: { home_url: [], },
+        // 是否使用
+        is_showList: is_show_project,
+        typeList: news_type,
+    },
+    initValidate() {
+        const rules = { title: { required: true }, type: { required: true }, origin: { required: true }, brief: { required: true }, is_show: { required: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { title: { required: '请输入资讯名称', }, type: { required: '请输入资讯类型', }, origin: { required: '请输入来源', }, brief: { required: '请输入内容' }, is_show: { required: '请选择是否公开' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    //用户输入内容
+    inputChange: function (e) {
+        const that = this;
+        let html = e.detail.html;
+        that.setData({ "form.content": html });
+    },
+    // 选择类型
+    typeChange: function (e) {
+        const that = this;
+        let data = that.data.typeList[e.detail.value];
+        if (data) that.setData({ 'form.type': data.value })
+    },
+    // 是否使用
+    is_showChange: function (e) {
+        const that = this;
+        let data = that.data.is_showList[e.detail.value];
+        that.setData({ 'form.is_show': data.value });
+    },
+    // 上傳圖片
+    imgUpload: function (e) {
+        const that = this;
+        let data = that.data.form.home_url;
+        data.push(e.detail)
+        that.setData({ "form.home_url": data })
+    },
+    // 删除图片
+    imgDel: function (e) {
+        const that = this;
+        let list = that.data.form.home_url;
+        let arr = list.filter((i, index) => index != e.detail.index)
+        that.setData({ "form.home_url": arr })
+    },
+    // 提交登录
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        params.create_time = moment().format('YYYY-MM-DD');
+        const form = that.data.form;
+        params.content = form.content;
+        params.home_url = form.home_url;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            let arr;
+            if (form._id) { arr = await app.$post(`/newCourt/api/news/${form._id}`, params); }
+            else { arr = await app.$post(`/newCourt/api/news`, params); }
+            if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
+            else wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+
+        }
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: function (options) {
+        const that = this;
+        that.setData({ id: options.id || '' })
+        //验证规则函数
+        that.initValidate();
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                if (that.data.id) {
+                    const arr = await app.$get(`/newCourt/api/news/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        that.setData({ form: arr.data });
+                    }
+                }
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
+    onShow: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 7 - 2
pages/news/add.json

@@ -1,3 +1,8 @@
 {
-    "usingComponents": {}
-}
+    "component": true,
+    "usingComponents": {
+      "mobile-main": "/commpents/mobile-frame/index",
+      "vanupload": "/commpents/upload/index",
+      "hg-editor": "/commpents/hg-editor/hg-editor"
+    }
+  }

+ 39 - 0
pages/news/add.less

@@ -0,0 +1,39 @@
+.main {
+    background-color: var(--bgColor);
+
+    .one {
+        width: 96vw;
+        margin: 2vw;
+
+        .content {
+            display: flex;
+            flex-direction: row;
+            justify-content: space-between;
+            align-items: center;
+            padding: 10px 0;
+            border-bottom: 1px dashed var(--f1Color);
+
+            .label {
+                color: var(--labelColor);
+                font-size: 15px;
+            }
+
+            .value {
+                color: var(--txtColor);
+                font-size: var(--txtSize);
+                text-align: right;
+            }
+        }
+
+        .btn {
+            width: 96vw;
+            margin: 2vw 0 0 0;
+            text-align: center;
+
+            button {
+                font-size: 14px;
+            }
+        }
+    }
+
+}

+ 48 - 2
pages/news/add.wxml

@@ -1,2 +1,48 @@
-<!--pages/news/add.wxml-->
-<text>pages/news/add.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form catchsubmit="onSubmit">
+                <view class="content">
+                    <view class="label">资讯标题</view>
+                    <view class="value"><textarea name="title" value="{{form.title}}" auto-height placeholder="请输入资讯标题" /></view>
+                </view>
+                <view class="content">
+                    <view class="label">资讯图片</view>
+                    <view class="value">
+                        <vanupload list="{{form.home_url}}" count="{{1}}" previewSize="{{80}}" bind:imgUpload="imgUpload" bind:imgDel="imgDel"></vanupload>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">资讯类型</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="typeChange" value="{{form.type}}" name="type" range-key='label' range="{{typeList}}">
+                            <view class="input">{{form.type=='0'?'其他':form.type=='1'?'羽毛球':'请选择资讯类型'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">信息来源</view>
+                    <view class="value"><input name="origin" value="{{form.origin}}" placeholder="请输入信息来源" /></view>
+                </view>
+                <view class="content">
+                    <view class="label">信息简介</view>
+                    <view class="value"><textarea name="brief" value="{{form.brief}}" auto-height placeholder="请输入信息简介" /></view>
+                </view>
+                <view class="content">
+                    <view class="value">
+                        <hg-editor placeholder="请输入信息内容" name="{{form.content}}" bind:ready="onEditorReady" bind:input="inputChange"> </hg-editor>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">是否公开</view>
+                    <picker name="is_show" bindchange="is_showChange" value="{{form.is_show}}" range-key='label' range="{{is_showList}}">
+                        <view class="input">{{form.is_show=='0'?'公开':form.is_show=='1'?'不公开':'是否公开'}}</view>
+                    </picker>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 32 - 1
pages/news/add.wxss

@@ -1 +1,32 @@
-/* pages/news/add.wxss */
+.main {
+  background-color: var(--bgColor);
+}
+.main .one {
+  width: 96vw;
+  margin: 2vw;
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  padding: 10px 0;
+  border-bottom: 1px dashed var(--f1Color);
+}
+.main .one .content .label {
+  color: var(--labelColor);
+  font-size: 15px;
+}
+.main .one .content .value {
+  color: var(--txtColor);
+  font-size: var(--txtSize);
+  text-align: right;
+}
+.main .one .btn {
+  width: 96vw;
+  margin: 2vw 0 0 0;
+  text-align: center;
+}
+.main .one .btn button {
+  font-size: 14px;
+}

+ 13 - 2
pages/news/index.js

@@ -22,6 +22,15 @@ Page({
         let { route } = e.detail.detail;
         if (route) wx.redirectTo({ url: `/${route}` })
     },
+    //查询
+    onSearch: function (e) {
+        const that = this;
+        that.setData({ skip: 0 })
+        that.setData({ page: 0 })
+        that.setData({ list: [] })
+        that.setData({ 'searchInfo.title': e.detail.value });
+        that.watchLogin()
+    },
     // 选项卡
     tabsChange: function (e) {
         const that = this;
@@ -37,8 +46,8 @@ Page({
         that.setData({ skip: 0 })
         that.setData({ page: 0 })
         that.setData({ list: [] })
-        const { item } = e.currentTarget.dataset;
-        wx.navigateTo({ url: `/pages/news/info?id=${item._id}` })
+        const { id } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/news/info?id=${id}` })
     },
     // 分页
     toPage: function () {
@@ -63,11 +72,13 @@ Page({
     watchLogin: async function () {
         const that = this;
         let type = that.data.tabs.active;
+        let searchInfo = that.data.searchInfo;
         // 监听用户是否登录,
         wx.getStorage({
             key: 'user',
             success: async res => {
                 let info = { skip: that.data.skip, limit: that.data.limit, type: type, is_show: '0' };
+                if (searchInfo && searchInfo.title) info.title = searchInfo.title;
                 const arr = await app.$get(`/newCourt/api/news`, { ...info });
                 if (arr.errcode == '0') {
                     that.setData({ list: [...that.data.list, ...arr.data] });

+ 4 - 4
pages/news/index.wxml

@@ -6,12 +6,12 @@
         <view class="two">
             <view class="a" wx:if="{{tabs.active=='0'}}">
                 <view class="a_1">
-                    <input type="text" placeholder="请输入关键词" />
+                    <input type="text" value="{{searchInfo.title}}" bindconfirm="onSearch" placeholder="请输入关键词" />
                 </view>
                 <view class="a_2">
                     <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
                         <view class="list-scroll-view">
-                            <view class="list" wx:for="{{list}}" wx:key="item" bindtap="toView" data-item="{{item._id}}">
+                            <view class="list" wx:for="{{list}}" wx:key="item" bindtap="toView" data-id="{{item._id}}">
                                 <view class="list_1">
                                     <view class="name textOver">{{item.title||'暂无'}}</view>
                                     <view class="brief">{{item.brief||'暂无'}}</view>
@@ -30,12 +30,12 @@
             </view>
             <view class="a" wx:elif="{{tabs.active=='1'}}">
                 <view class="a_1">
-                    <input type="text" placeholder="请输入关键词" />
+                    <input type="text" value="{{searchInfo.title}}" bindconfirm="onSearch" placeholder="请输入关键词" />
                 </view>
                 <view class="a_2">
                     <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
                         <view class="list-scroll-view">
-                            <view class="list" wx:for="{{list}}" wx:key="item" bindtap="toView" data-item="{{item._id}}">
+                            <view class="list" wx:for="{{list}}" wx:key="item" bindtap="toView" data-id="{{item._id}}">
                                 <view class="list_1">
                                     <view class="name textOver">{{item.title||'暂无'}}</view>
                                     <view class="brief">{{item.brief||'暂无'}}</view>

+ 42 - 13
pages/news/info.js

@@ -1,66 +1,95 @@
-// pages/news/info.js
+const app = getApp()
+import { news_type } from '../../utils/dict';
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '详情信息', leftArrow: true, useBar: false },
+        id: '',
+        form: {},
+        typeList: news_type,
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: function (options) {
+        const that = this;
+        that.setData({ id: options.id || '' })
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                if (that.data.id) {
+                    const arr = await app.$get(`/newCourt/api/news/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        that.setData({ form: arr.data });
+                        let content = arr.data.content.replace(/\<img/gi, '<img style="width:100%;height:auto;margin: 5px 0"');
+                        that.setData({ 'form.content': content });
+                    }
+                }
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
+    onShow: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 5 - 2
pages/news/info.json

@@ -1,3 +1,6 @@
 {
-    "usingComponents": {}
-}
+    "component": true,
+    "usingComponents": {
+      "mobile-main": "/commpents/mobile-frame/index"
+    }
+  }

+ 34 - 0
pages/news/info.less

@@ -0,0 +1,34 @@
+.main {
+    background-color: var(--bgColor);
+
+    .one {
+        width: 96vw;
+        margin: 2vw;
+        border-bottom: 1px dashed var(--labelColor);
+
+        .one_1 {
+            text-align: center;
+            font-weight: bold;
+            font-size: 20px;
+            padding: 6vw 0;
+        }
+
+        .one_2 {
+            display: flex;
+            justify-content: space-between;
+            font-size: var(--txtSize);
+            color: var(--labelColor);
+            padding: 2vw 0;
+
+            text {
+                padding-right: 5px;
+            }
+        }
+    }
+
+    .two {
+        width: 96vw;
+        padding: 2vw;
+    }
+
+}

+ 17 - 2
pages/news/info.wxml

@@ -1,2 +1,17 @@
-<!--pages/news/info.wxml-->
-<text>pages/news/info.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <view class="one_1">{{form.title}}</view>
+            <view class="one_2">
+                <view class="type">
+                    <text>{{typeList[form.type].label||'未知'}}</text>
+                    <text>来源:{{form.origin||'暂无'}}</text>
+                </view>
+                <view class="time">{{form.create_time||'暂无'}}</view>
+            </view>
+        </view>
+        <view class="two">
+            <rich-text nodes="{{form.content}}"></rich-text>
+        </view>
+    </view>
+</mobile-main>

+ 28 - 1
pages/news/info.wxss

@@ -1 +1,28 @@
-/* pages/news/info.wxss */
+.main {
+  background-color: var(--bgColor);
+}
+.main .one {
+  width: 96vw;
+  margin: 2vw;
+  border-bottom: 1px dashed var(--labelColor);
+}
+.main .one .one_1 {
+  text-align: center;
+  font-weight: bold;
+  font-size: 20px;
+  padding: 6vw 0;
+}
+.main .one .one_2 {
+  display: flex;
+  justify-content: space-between;
+  font-size: var(--txtSize);
+  color: var(--labelColor);
+  padding: 2vw 0;
+}
+.main .one .one_2 text {
+  padding-right: 5px;
+}
+.main .two {
+  width: 96vw;
+  padding: 2vw;
+}

+ 111 - 14
pages/news/list.js

@@ -1,66 +1,163 @@
-// pages/news/list.js
+const app = getApp()
+import { news_type } from '../../utils/dict';
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '资讯信息管理', leftArrow: true, useBar: false },
+        searchInfo: {},
+        list: [],
+        total: 0,
+        limit: 5,
+        page: 0,
+        skip: 0,
+        typeList: news_type,
+    },
+    // 跳转菜单
+    back(e) {
+        wx.navigateBack({ delta: 1 });
+    },
+    //查询
+    onSearch: function (e) {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ page: 0 })
+        that.setData({ 'searchInfo.title': e.detail.value });
+        that.watchLogin()
+    },
+    // 添加
+    toAdd() {
+        const that = this;
+        that.setData({ skip: 0 })
+        that.setData({ page: 0 })
+        that.setData({ list: [] })
+        wx.navigateTo({ url: '/pages/news/add' })
+    },
+    // 修改
+    toEdit: function (e) {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ page: 0 })
+        let { id } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/news/add?id=${id}` })
+    },
+    // 删除
+    toDel: async function (e) {
+        const that = this;
+        const { id } = e.currentTarget.dataset;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认删除该条数据?',
+            async success(res) {
+                if (res.confirm) {
+                    const arr = await app.$delete(`/newCourt/api/news/${id}`);
+                    if (arr.errcode == '0') {
+                        wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
+                        that.setData({ list: [] })
+                        that.setData({ skip: 0 })
+                        that.setData({ page: 0 })
+                        that.watchLogin()
+                    } else {
+                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    }
+                }
+            }
+        })
+    },
+    toPage: function () {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page: page })
+            let skip = page * limit;
+            that.setData({ skip: skip })
+            that.watchLogin();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: function (options) {
+      
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        let searchInfo = that.data.searchInfo;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                let info = { skip: that.data.skip, limit: that.data.limit };
+                if (searchInfo && searchInfo.title) info.title = searchInfo.title;
+                let arr;
+                arr = await app.$get(`/newCourt/api/news`, { ...info });
+                if (arr.errcode == '0') {
+                    that.setData({ list: [...that.data.list, ...arr.data] })
+                    that.setData({ total: arr.total })
+                }
+                else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
+    onShow: function () {
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 5 - 2
pages/news/list.json

@@ -1,3 +1,6 @@
 {
-    "usingComponents": {}
-}
+    "component": true,
+    "usingComponents": {
+      "mobile-main": "/commpents/mobile-frame/index"
+    }
+  }

+ 103 - 0
pages/news/list.less

@@ -0,0 +1,103 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--bgColor);
+
+    .one {
+        display: flex;
+        flex-direction: row;
+        width: 96vw;
+        padding: 2vw;
+
+        .one_1 {
+            flex-grow: 1;
+
+            input {
+                padding: 1vw 2vw 2vw 2vw;
+                border-radius: 2px;
+                font-size: var(--txtSize);
+                background-color: var(--f1Color);
+            }
+        }
+
+        .one_2 {
+            width: 15vw;
+
+            button {
+                width: 100%;
+                font-size: var(--btnSize);
+                padding: 2vw;
+            }
+        }
+    }
+
+    .two {
+        flex-grow: 1;
+        position: relative;
+        width: 100vw;
+
+        .list {
+            background-color: var(--f9Color);
+            padding: 2vw;
+            margin: 0 2vw 2vw 2vw;
+
+            .name {
+                font-size: var(--titleSize);
+                font-weight: bold;
+                margin: 0 0 1vw 0;
+            }
+
+            .other {
+                margin: 0 0 1vw 0;
+
+                .other_1 {
+                    font-size: var(--txtSize);
+                    margin: 0 0 1vw 0;
+
+                    text {
+                        color: var(--labelColor);
+                    }
+
+                    text:last-child {
+                        color: var(--txtColor);
+                    }
+                }
+            }
+
+            .btn {
+                display: flex;
+                flex-direction: row;
+                justify-content: center;
+                text-align: center;
+                flex-wrap: wrap;
+
+                .btn_1 {
+                    width: 20vw;
+                    margin: 0 1vw 1vw 1vw;
+
+                    button {
+                        width: 100%;
+                        font-size: var(--btnSize);
+                        padding: 2vw;
+                    }
+                }
+            }
+        }
+
+        // .list:last-child {
+        //     margin: 0 2vw 0 2vw;
+        // }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 45 - 2
pages/news/list.wxml

@@ -1,2 +1,45 @@
-<!--pages/news/list.wxml-->
-<text>pages/news/list.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back" bind:tabPath="tabPath">
+    <view slot="info" class="container main">
+        <view class="zero one">
+            <view class="one_1">
+                <input type="text" value="{{searchInfo.title}}" bindconfirm="onSearch" placeholder="请输入资讯名称" />
+            </view>
+            <view class="one_2">
+                <button type="primary" bindtap="toAdd">添加</button>
+            </view>
+        </view>
+        <view class="zero two">
+            <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
+                <view class="list-scroll-view">
+                    <view class="list" wx:for="{{list}}" wx:key="item">
+                        <view class="name">
+                            {{item.title||'暂无'}}
+                        </view>
+                        <view class="other">
+                            <view class="other_1">
+                                <text>资讯类型:</text>
+                                <text>{{typeList[item.type].label||'未知'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>信息来源:</text>
+                                <text>{{item.origin||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>发布时间:</text>
+                                <text>{{item.create_time||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>是否公开:</text>
+                                <text>{{item.is_show=='0'?'公开':'不公开'}}</text>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <button size="mini" type="primary" bindtap="toEdit" data-id="{{item._id}}">信息维护</button>
+                            <button size="mini" type="warn" bindtap="toDel" data-id="{{item._id}}">信息删除</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>

+ 82 - 1
pages/news/list.wxss

@@ -1 +1,82 @@
-/* pages/news/list.wxss */
+.main {
+  height: var(--twoHeight);
+  background-color: var(--bgColor);
+}
+.main .one {
+  display: flex;
+  flex-direction: row;
+  width: 96vw;
+  padding: 2vw;
+}
+.main .one .one_1 {
+  flex-grow: 1;
+}
+.main .one .one_1 input {
+  padding: 1vw 2vw 2vw 2vw;
+  border-radius: 2px;
+  font-size: var(--txtSize);
+  background-color: var(--f1Color);
+}
+.main .one .one_2 {
+  width: 15vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  font-size: var(--btnSize);
+  padding: 2vw;
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+  width: 100vw;
+}
+.main .two .list {
+  background-color: var(--f9Color);
+  padding: 2vw;
+  margin: 0 2vw 2vw 2vw;
+}
+.main .two .list .name {
+  font-size: var(--titleSize);
+  font-weight: bold;
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other {
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 {
+  font-size: var(--txtSize);
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 text {
+  color: var(--labelColor);
+}
+.main .two .list .other .other_1 text:last-child {
+  color: var(--txtColor);
+}
+.main .two .list .btn {
+  display: flex;
+  flex-direction: row;
+  justify-content: center;
+  text-align: center;
+  flex-wrap: wrap;
+}
+.main .two .list .btn .btn_1 {
+  width: 20vw;
+  margin: 0 1vw 1vw 1vw;
+}
+.main .two .list .btn .btn_1 button {
+  width: 100%;
+  font-size: var(--btnSize);
+  padding: 2vw;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 0 - 1
pages/project/add.less

@@ -1,5 +1,4 @@
 .main {
-    height: var(--twoHeight);
     background-color: var(--bgColor);
 
     .one {

+ 0 - 1
pages/project/add.wxss

@@ -1,5 +1,4 @@
 .main {
-  height: var(--twoHeight);
   background-color: var(--bgColor);
 }
 .main .one .content {

+ 84 - 11
pages/topic/add.js

@@ -1,66 +1,139 @@
-// pages/topic/add.js
+const app = getApp()
+import WxValidate from '../../utils/wxValidate'
+import { is_show_project } from '../../utils/dict';
+const moment = require("../../utils/moment.min")
+
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
+        frameStyle: { useTop: true, name: '信息管理', leftArrow: true, useBar: false },
+        id: '',
+        // 是否使用
+        is_showList: is_show_project,
+        form: {},
+    },
+    initValidate() {
+        const rules = { title: { required: true }, create_time: { required: false }, origin: { required: true }, brief: { required: true }, content: { required: false }, is_show: { required: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { title: { required: '请输入话题名称', }, create_time: { required: '请输入发布时间', }, origin: { required: '请输入信息来源', }, brief: { required: '请输入信息简介' }, content: { required: '请输入信息内容' }, is_show: { required: '请选择是否公开' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    //用户输入内容
+    inputChange: function (e) {
+        const that = this;
+        let html = e.detail.html;
+        that.setData({ "form.content": html });
+    },
+    // 是否公开
+    is_showChange: function (e) {
+        const that = this;
+        let index = e.detail.value;
+        let value = that.data.is_showList[index];
+        that.setData({ 'form.is_show': value.value });
+    },
 
+    // 提交登录
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const form = that.data.form;
+        params.content = form.content;
+        params.create_time = moment().format('YYYY-MM-DD');
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            let arr;
+            if (form._id) { arr = await app.$post(`/newCourt/api/topic/${form._id}`, params); }
+            else { arr = await app.$post(`/newCourt/api/topic`, params); }
+            if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
+            else wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+        }
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: function (options) {
+        const that = this;
+        that.setData({ id: options.id || '' })
+        //验证规则函数
+        that.initValidate();
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                if (that.data.id) {
+                    const arr = await app.$get(`/newCourt/api/topic/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        that.setData({ form: arr.data });
+                    }
+                }
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
+    onShow: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 6 - 2
pages/topic/add.json

@@ -1,3 +1,7 @@
 {
-    "usingComponents": {}
-}
+    "component": true,
+    "usingComponents": {
+       "mobile-main": "/commpents/mobile-frame/index",
+       "hg-editor": "/commpents/hg-editor/hg-editor"
+    }
+ }

+ 43 - 0
pages/topic/add.less

@@ -0,0 +1,43 @@
+.main {
+    background-color: var(--bgColor);
+
+    .one {
+        width: 96vw;
+        margin: 2vw;
+
+        .content {
+            display: flex;
+            flex-direction: row;
+            justify-content: space-between;
+            align-items: center;
+            padding: 10px 0;
+            border-bottom: 1px dashed var(--f1Color);
+
+            .label {
+                color: var(--labelColor);
+                font-size: 15px;
+                width: 25vw;
+            }
+
+            .value {
+                color: var(--txtColor);
+                font-size: var(--txtSize);
+                text-align: right;
+                textarea {
+                    max-width: 220px;
+                 }
+            }
+        }
+
+        .btn {
+            width: 96vw;
+            margin: 2vw 0 0 0;
+            text-align: center;
+
+            button {
+                font-size: 14px;
+            }
+        }
+    }
+
+}

+ 46 - 2
pages/topic/add.wxml

@@ -1,2 +1,46 @@
-<!--pages/topic/add.wxml-->
-<text>pages/topic/add.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back" bind:tabPath="tabPath">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form catchsubmit="onSubmit">
+                <view class="content">
+                    <view class="label">话题名称</view>
+                    <view class="value">
+                        <view class="value">
+                            <textarea name="title" value="{{form.title}}" auto-height maxlength="-1" placeholder="请输入话题名称" />
+                        </view>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">信息简介:</view>
+                    <view class="value">
+                        <view class="value">
+                            <textarea name="brief" value="{{form.brief}}" auto-height maxlength="-1" placeholder="请输入信息简介" />
+                        </view>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">信息来源:</view>
+                    <view class="value">
+                        <view class="value">
+                            <textarea name="origin" value="{{form.origin}}" auto-height maxlength="-1" placeholder="请输入信息来源" />
+                        </view>
+                    </view>
+                </view>
+                <view class="content1">
+                    <view class="value">
+                        <hg-editor placeholder="请输入信息内容" name="{{form.content}}" bind:ready="onEditorReady" bind:input="inputChange"> </hg-editor>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">是否公开:</view>
+                    <picker name="is_show" bindchange="is_showChange" value="{{form.is_show}}" range-key='label' range="{{is_showList}}">
+                        <view class="input">{{form.is_show=='0'?'公开':form.is_show=='1'?'不公开':'选择是否公开'}}</view>
+                    </picker>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 36 - 1
pages/topic/add.wxss

@@ -1 +1,36 @@
-/* pages/topic/add.wxss */
+.main {
+  background-color: var(--bgColor);
+}
+.main .one {
+  width: 96vw;
+  margin: 2vw;
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  padding: 10px 0;
+  border-bottom: 1px dashed var(--f1Color);
+}
+.main .one .content .label {
+  color: var(--labelColor);
+  font-size: 15px;
+  width: 25vw;
+}
+.main .one .content .value {
+  color: var(--txtColor);
+  font-size: var(--txtSize);
+  text-align: right;
+}
+.main .one .content .value textarea {
+  max-width: 220px;
+}
+.main .one .btn {
+  width: 96vw;
+  margin: 2vw 0 0 0;
+  text-align: center;
+}
+.main .one .btn button {
+  font-size: 14px;
+}

+ 11 - 0
pages/topic/index.js

@@ -14,6 +14,15 @@ Page({
         let { route } = e.detail.detail;
         if (route) wx.redirectTo({ url: `/${route}` })
     },
+    //查询
+    onSearch: function (e) {
+        const that = this;
+        that.setData({ skip: 0 })
+        that.setData({ page: 0 })
+        that.setData({ list: [] })
+        that.setData({ 'searchInfo.title': e.detail.value });
+        that.watchLogin()
+    },
     toView: function (e) {
         const that = this;
         that.setData({ skip: 0 })
@@ -44,10 +53,12 @@ Page({
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
+        let searchInfo = that.data.searchInfo;
         wx.getStorage({
             key: 'user',
             success: async (res) => {
                 let info = { skip: that.data.skip, limit: that.data.limit, is_show: '0' };
+                if (searchInfo && searchInfo.title) info.title = searchInfo.title;
                 const arr = await app.$get(`/newCourt/api/topic`, { ...info });
                 if (arr.errcode == '0') { that.setData({ list: [...that.data.list, ...arr.data] }); that.setData({ total: arr.total }); }
                 else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }

+ 1 - 1
pages/topic/index.wxml

@@ -1,7 +1,7 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:tabPath="tabPath">
     <view slot="info" class="container main">
         <view class="one">
-            <input type="text" placeholder="请输入关键词" />
+            <input type="text" value="{{searchInfo.title}}" bindconfirm="onSearch" placeholder="请输入关键词" />
         </view>
         <view class="two">
             <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">

+ 90 - 13
pages/topic/info.js

@@ -1,66 +1,143 @@
-// pages/topic/info.js
+const app = getApp()
+const moment = require("../../utils/moment.min")
+import WxValidate from '../../utils/wxValidate'
+
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '信息管理', leftArrow: true, useBar: false },
+        // dialog弹框
+        dialog: { title: '发帖', show: false, type: '1' },
+        id: '',
+        // 详情
+        info: {},
+        // 用户信息
+        user: {},
+    },
+    initValidate() {
+        const rules = { title: { required: true }, content: { required: false } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { title: { required: '请输入话题名称', }, content: { required: '请输入信息内容' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () {
+        wx.navigateBack({ delta: 1 })
+    },
+    // 打开弹框
+    toDialog: function () {
+        const that = this;
+        that.setData({ dialog: { title: '发帖', show: true, type: '1' } })
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ dialog: { title: '发帖', show: false, type: '1' } })
+    },
+    // 发帖
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const user = that.data.user;
+        params.create_time = moment().format('YYYY-MM-DD');
+        params.openid = user.openid;
+        params.name = user.name;
+        let stick = [...that.data.info.stick, params];
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            const arr = await app.$post(`/newCourt/api/topic/${that.data.id}`, { stick: stick });
+            if (arr.errcode == '0') {
+                wx.showToast({ title: `发帖完成`, icon: 'success', duration: 2000 });
+                that.toClose(); that.watchLogin();
+                that.setData({ form: {} })
+            }
+            else wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+        }
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: function (options) {
+        const that = this;
+        that.setData({ id: options.id || '' })
+        //验证规则函数
+        that.initValidate();
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                this.setData({ user: res.data });
+                if (that.data.id) {
+                    const arr = await app.$get(`/newCourt/api/topic/${that.data.id}`);
+                    if (arr.errcode == '0') {
+                        that.setData({ info: arr.data });
+                        let content = arr.data.content.replace(/\<img/gi, '<img style="width:100%;height:auto;margin: 5px 0"');
+                        this.setData({ 'info.content': content });
+                    }
+                }
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
+    onShow: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 6 - 2
pages/topic/info.json

@@ -1,3 +1,7 @@
 {
-    "usingComponents": {}
-}
+    "component": true,
+    "usingComponents": {
+      "mobile-main": "/commpents/mobile-frame/index",
+      "e-dialog": "/commpents/dialog/index"
+    }
+  }

+ 108 - 0
pages/topic/info.less

@@ -0,0 +1,108 @@
+.main {
+    background-color: var(--bgColor);
+
+    .one {
+        width: 96vw;
+        margin: 2vw;
+        border-bottom: 1px dashed var(--labelColor);
+
+        .one_1 {
+            text-align: center;
+            font-weight: bold;
+            font-size: 20px;
+            padding: 6vw 0;
+        }
+
+        .one_2 {
+            display: flex;
+            justify-content: space-between;
+            font-size: var(--txtSize);
+            color: var(--labelColor);
+            padding: 2vw 0;
+
+            text {
+                padding-right: 5px;
+            }
+        }
+    }
+
+    .two {
+        width: 96vw;
+        padding: 2vw;
+    }
+
+    .thr {
+        width: 96vw;
+        margin: 2vw;
+
+        .list {
+            border-bottom: 1px dashed var(--labelColor);
+            border-top: 1px dashed var(--labelColor);
+            margin: 0 0 2vw 0;
+
+            .list_1 {
+                display: flex;
+                flex-direction: row;
+                justify-content: space-between;
+                padding: 2vw;
+
+                .name {
+                    font-size: var(--txtSize);
+                }
+
+                .time {
+                    font-size: 14px;
+                    color: var(--labelColor);
+                }
+            }
+
+            .list_2 {
+                display: flex;
+                flex-direction: column;
+                padding: 2vw;
+                font-size: var(--txtSize);
+
+                .content {
+                    color: var(--labelColor);
+                }
+            }
+        }
+    }
+
+    .foot {
+        position: fixed;
+        width: 96vw;
+        bottom: 8vh;
+        right: 1vw;
+        text-align: right;
+
+        .mymatch {
+            display: inline-block;
+            width: 10vw;
+            padding: 1vw;
+            text-align: center;
+            background-color: green;
+            color: #fff;
+            font-size: 14px;
+            border-radius: 5px;
+        }
+
+    }
+}
+
+.dialog_one {
+    .other {
+        display: flex;
+        flex-direction: column;
+
+        .other_1 {
+            border-bottom: 1px dashed var(--labelColor);
+            padding: 1vw;
+        }
+
+        .other_2 {
+            text-align: center;
+            margin: 2vw 0 0 0;
+        }
+    }
+}

+ 51 - 2
pages/topic/info.wxml

@@ -1,2 +1,51 @@
-<!--pages/topic/info.wxml-->
-<text>pages/topic/info.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <view class="one_1">{{info.title}}</view>
+            <view class="one_2">
+                <view class="type">
+                    <text>{{typeList[info.type].label||'未知'}}</text>
+                    <text>来源:{{info.origin||'暂无'}}</text>
+                </view>
+                <view class="time">{{info.create_time||'暂无'}}</view>
+            </view>
+        </view>
+        <view class="two">
+            <rich-text nodes="{{info.content}}"></rich-text>
+        </view>
+        <view class="thr">
+            <view class="list" wx:for="{{info.stick}}" wx:key="item">
+                <view class="list_1">
+                    <view class="name">{{item.name}}</view>
+                    <view class="time">{{item.create_time}}</view>
+                </view>
+                <view class="list_2">
+                    <view class="title">{{item.title}}</view>
+                    <view class="content">{{item.content}}</view>
+                </view>
+            </view>
+        </view>
+        <view class="foot" wx:if="{{user.type=='-1'}}">
+            <text class="mymatch" bindtap="toDialog">我要发帖</text>
+        </view>
+    </view>
+</mobile-main>
+<e-dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info">
+        <view class="dialog_one" wx:if="{{dialog.type=='1'}}">
+            <form catchsubmit="onSubmit">
+                <view class="other">
+                    <view class="other_1">
+                        <input type="text" name="title" value="{{form.title}}" placeholder="请输入标题" />
+                    </view>
+                    <view class="other_1">
+                        <textarea name="content" value="{{form.content}}" maxlength="-1" placeholder="请输入发帖内容" />
+                    </view>
+                    <view class="other_2">
+                        <button type="primary" size="mini" formType="submit">发送</button>
+                    </view>
+                </view>
+            </form>
+        </view>
+    </view>
+</e-dialog>

+ 88 - 1
pages/topic/info.wxss

@@ -1 +1,88 @@
-/* pages/topic/info.wxss */
+.main {
+  background-color: var(--bgColor);
+}
+.main .one {
+  width: 96vw;
+  margin: 2vw;
+  border-bottom: 1px dashed var(--labelColor);
+}
+.main .one .one_1 {
+  text-align: center;
+  font-weight: bold;
+  font-size: 20px;
+  padding: 6vw 0;
+}
+.main .one .one_2 {
+  display: flex;
+  justify-content: space-between;
+  font-size: var(--txtSize);
+  color: var(--labelColor);
+  padding: 2vw 0;
+}
+.main .one .one_2 text {
+  padding-right: 5px;
+}
+.main .two {
+  width: 96vw;
+  padding: 2vw;
+}
+.main .thr {
+  width: 96vw;
+  margin: 2vw;
+}
+.main .thr .list {
+  border-bottom: 1px dashed var(--labelColor);
+  border-top: 1px dashed var(--labelColor);
+  margin: 0 0 2vw 0;
+}
+.main .thr .list .list_1 {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  padding: 2vw;
+}
+.main .thr .list .list_1 .name {
+  font-size: var(--txtSize);
+}
+.main .thr .list .list_1 .time {
+  font-size: 14px;
+  color: var(--labelColor);
+}
+.main .thr .list .list_2 {
+  display: flex;
+  flex-direction: column;
+  padding: 2vw;
+  font-size: var(--txtSize);
+}
+.main .thr .list .list_2 .content {
+  color: var(--labelColor);
+}
+.main .foot {
+  position: fixed;
+  width: 96vw;
+  bottom: 8vh;
+  right: 1vw;
+  text-align: right;
+}
+.main .foot .mymatch {
+  display: inline-block;
+  width: 10vw;
+  padding: 1vw;
+  text-align: center;
+  background-color: green;
+  color: #fff;
+  font-size: 14px;
+  border-radius: 5px;
+}
+.dialog_one .other {
+  display: flex;
+  flex-direction: column;
+}
+.dialog_one .other .other_1 {
+  border-bottom: 1px dashed var(--labelColor);
+  padding: 1vw;
+}
+.dialog_one .other .other_2 {
+  text-align: center;
+  margin: 2vw 0 0 0;
+}

+ 109 - 14
pages/topic/list.js

@@ -1,66 +1,161 @@
-// pages/topic/list.js
+const app = getApp()
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        frameStyle: { useTop: true, name: '话题信息管理', leftArrow: true, useBar: false },
+        searchInfo: {},
+        list: [],
+        total: 0,
+        limit: 5,
+        page: 0,
+        skip: 0,
+    },
+    // 跳转菜单
+    back(e) {
+        wx.navigateBack({ delta: 1 });
+    },
+    //查询
+    onSearch: function (e) {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ page: 0 })
+        that.setData({ 'searchInfo.title': e.detail.value });
+        that.watchLogin()
+    },
+    // 添加
+    toAdd() {
+        const that = this;
+        that.setData({ skip: 0 })
+        that.setData({ page: 0 })
+        that.setData({ list: [] })
+        wx.navigateTo({ url: '/pages/topic/add' })
+    },
+    // 修改
+    toEdit: function (e) {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ page: 0 })
+        let { id } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/topic/add?id=${id}` })
+    },
+    // 删除
+    toDel: async function (e) {
+        const that = this;
+        const { id } = e.currentTarget.dataset;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认删除该条数据?',
+            async success(res) {
+                if (res.confirm) {
+                    const arr = await app.$delete(`/newCourt/api/topic/${id}`);
+                    if (arr.errcode == '0') {
+                        wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
+                        that.setData({ list: [] })
+                        that.setData({ skip: 0 })
+                        that.setData({ page: 0 })
+                        that.watchLogin()
+                    } else {
+                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    }
+                }
+            }
+        })
+    },
+    toPage: function () {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page: page })
+            let skip = page * limit;
+            that.setData({ skip: skip })
+            that.watchLogin();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
-
+    onLoad: function (options) {
+      
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        let searchInfo = that.data.searchInfo;
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                let info = { skip: that.data.skip, limit: that.data.limit };
+                if (searchInfo && searchInfo.title) info.title = searchInfo.title;
+                let arr;
+                arr = await app.$get(`/newCourt/api/topic`, { ...info });
+                if (arr.errcode == '0') {
+                    that.setData({ list: [...that.data.list, ...arr.data] })
+                    that.setData({ total: arr.total })
+                }
+                else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
+    onReady: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow() {
-
+    onShow: function () {
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide() {
+    onHide: function () {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload() {
+    onUnload: function () {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh() {
+    onPullDownRefresh: function () {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom() {
+    onReachBottom: function () {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage() {
+    onShareAppMessage: function () {
 
     }
 })

+ 5 - 2
pages/topic/list.json

@@ -1,3 +1,6 @@
 {
-    "usingComponents": {}
-}
+    "component": true,
+    "usingComponents": {
+      "mobile-main": "/commpents/mobile-frame/index"
+    }
+  }

+ 103 - 0
pages/topic/list.less

@@ -0,0 +1,103 @@
+.main {
+    height: var(--twoHeight);
+    background-color: var(--bgColor);
+
+    .one {
+        display: flex;
+        flex-direction: row;
+        width: 96vw;
+        padding: 2vw;
+
+        .one_1 {
+            flex-grow: 1;
+
+            input {
+                padding: 1vw 2vw 2vw 2vw;
+                border-radius: 2px;
+                font-size: var(--txtSize);
+                background-color: var(--f1Color);
+            }
+        }
+
+        .one_2 {
+            width: 15vw;
+
+            button {
+                width: 100%;
+                font-size: var(--btnSize);
+                padding: 2vw;
+            }
+        }
+    }
+
+    .two {
+        flex-grow: 1;
+        position: relative;
+        width: 100vw;
+
+        .list {
+            background-color: var(--f9Color);
+            padding: 2vw;
+            margin: 0 2vw 2vw 2vw;
+
+            .name {
+                font-size: var(--titleSize);
+                font-weight: bold;
+                margin: 0 0 1vw 0;
+            }
+
+            .other {
+                margin: 0 0 1vw 0;
+
+                .other_1 {
+                    font-size: var(--txtSize);
+                    margin: 0 0 1vw 0;
+
+                    text {
+                        color: var(--labelColor);
+                    }
+
+                    text:last-child {
+                        color: var(--txtColor);
+                    }
+                }
+            }
+
+            .btn {
+                display: flex;
+                flex-direction: row;
+                justify-content: center;
+                text-align: center;
+                flex-wrap: wrap;
+
+                .btn_1 {
+                    width: 20vw;
+                    margin: 0 1vw 1vw 1vw;
+
+                    button {
+                        width: 100%;
+                        font-size: var(--btnSize);
+                        padding: 2vw;
+                    }
+                }
+            }
+        }
+
+        // .list:last-child {
+        //     margin: 0 2vw 0 2vw;
+        // }
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 39 - 2
pages/topic/list.wxml

@@ -1,2 +1,39 @@
-<!--pages/topic/list.wxml-->
-<text>pages/topic/list.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <view class="one_1">
+                <input type="text" value="{{searchInfo.title}}" bindconfirm="onSearch" placeholder="请输入资讯名称" />
+            </view>
+            <view class="one_2">
+                <button type="primary" bindtap="toAdd">添加</button>
+            </view>
+        </view>
+        <view class="two">
+            <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
+                <view class="list-scroll-view">
+                    <view class="list" wx:for="{{list}}" wx:key="item">
+                        <view class="name">{{item.title||'暂无'}}</view>
+                        <view class="other">
+                            <view class="other_1">
+                                <text>来源:</text>
+                                <text>{{item.origin||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>发布时间:</text>
+                                <text>{{item.create_time||'暂无'}}</text>
+                            </view>
+                            <view class="other_1">
+                                <text>是否公开:</text>
+                                <text>{{item.is_show=='0'?'公开':'不公开'}}</text>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" bindtap="toEdit" data-id="{{item._id}}" size="mini">信息维护</button>
+                            <button size="mini" type="warn" bindtap="toDel" data-id="{{item._id}}">信息删除</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>

+ 82 - 1
pages/topic/list.wxss

@@ -1 +1,82 @@
-/* pages/topic/list.wxss */
+.main {
+  height: var(--twoHeight);
+  background-color: var(--bgColor);
+}
+.main .one {
+  display: flex;
+  flex-direction: row;
+  width: 96vw;
+  padding: 2vw;
+}
+.main .one .one_1 {
+  flex-grow: 1;
+}
+.main .one .one_1 input {
+  padding: 1vw 2vw 2vw 2vw;
+  border-radius: 2px;
+  font-size: var(--txtSize);
+  background-color: var(--f1Color);
+}
+.main .one .one_2 {
+  width: 15vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  font-size: var(--btnSize);
+  padding: 2vw;
+}
+.main .two {
+  flex-grow: 1;
+  position: relative;
+  width: 100vw;
+}
+.main .two .list {
+  background-color: var(--f9Color);
+  padding: 2vw;
+  margin: 0 2vw 2vw 2vw;
+}
+.main .two .list .name {
+  font-size: var(--titleSize);
+  font-weight: bold;
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other {
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 {
+  font-size: var(--txtSize);
+  margin: 0 0 1vw 0;
+}
+.main .two .list .other .other_1 text {
+  color: var(--labelColor);
+}
+.main .two .list .other .other_1 text:last-child {
+  color: var(--txtColor);
+}
+.main .two .list .btn {
+  display: flex;
+  flex-direction: row;
+  justify-content: center;
+  text-align: center;
+  flex-wrap: wrap;
+}
+.main .two .list .btn .btn_1 {
+  width: 20vw;
+  margin: 0 1vw 1vw 1vw;
+}
+.main .two .list .btn .btn_1 button {
+  width: 100%;
+  font-size: var(--btnSize);
+  padding: 2vw;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 4 - 0
utils/dict.js

@@ -116,4 +116,8 @@ export const type = [
 export const match_project = [
     { label: '单打', value: '单打' },
     { label: '双打', value: '双打' },
+]
+export const is_show_project = [
+    { label: '公开', value: '0' },
+    { label: '不公开', value: '1' },
 ]