Ver código fonte

Merge branch 'master' of http://git.cc-lotus.info/ball-court/court-badminton

zs 2 anos atrás
pai
commit
efc60e84af

+ 81 - 82
app.json

@@ -1,84 +1,83 @@
 {
-    "pages": [
-        "pages/index/index",
-        "pages/register/index",
-        "pages/home/index",
-        "pages/news/index",
-        "pages/news/mess",
-        "pages/news/add",
-        "pages/news/info",
-        "pages/topic/index",
-        "pages/topic/mess",
-        "pages/match/raceteam",
-        "pages/my/index",
-        "pages/my/userInfo",
-        "pages/matchInfo/index",
-        "pages/matchInfo/sign",
-        "pages/user/index",
-        "pages/match/mess",
-        "pages/match/matchadd",
-        "pages/match/matchgroup",
-        "pages/match/sign",
-        "pages/match/shteam",
-        "pages/match/orderbook",
-        "pages/orderbook/teamAdd",
-        "pages/orderbook/teamautoAdd",
-        "pages/orderbook/raceAdd",
-        "pages/orderbook/raceautoAdd",
-        "pages/order/index",
-        "pages/usermymatch/index",
-        "pages/usermysign/index",
-        "pages/usermyteam/index",
-        "pages/usermyteam/add",
-        "pages/usermyorder/index",
-        "pages/setting/contact",
-        "pages/setting/basic",
-        "pages/setting/index",
-        "pages/dictionary/project",
-        "pages/dictionary/projectadd",
-        "pages/dictionary/address",
-        "pages/dictionary/addressAdd",
-        "pages/agree_txt/index",
-        "pages/openMatch/index",
-        "pages/test/index",
-        "pages/match/index",
-        "pages/logs/index"
-    ],
-    "usingComponents": {
-        "van-sidebar": "@vant/weapp/sidebar/index",
-        "van-sidebar-item": "@vant/weapp/sidebar-item/index",
-        "van-search": "@vant/weapp/search/index",
-        "van-button": "@vant/weapp/button/index",
-        "van-row": "@vant/weapp/row/index",
-        "van-col": "@vant/weapp/col/index",
-        "van-dialog": "@vant/weapp/dialog/index",
-        "van-tab": "@vant/weapp/tab/index",
-        "van-tabs": "@vant/weapp/tabs/index",
-        "van-icon": "@vant/weapp/icon/index",
-        "van-nav-bar": "@vant/weapp/nav-bar/index",
-        "van-tabbar": "@vant/weapp/tabbar/index",
-        "van-tabbar-item": "@vant/weapp/tabbar-item/index",
-        "van-uploader": "@vant/weapp/uploader/index",
-        "van-popup": "@vant/weapp/popup/index",
-        "van-collapse": "@vant/weapp/collapse/index",
-        "van-collapse-item": "@vant/weapp/collapse-item/index",
-        "van-picker": "@vant/weapp/picker/index"
-    },
-    "window": {
-        "backgroundTextStyle": "light",
-        "navigationBarBackgroundColor": "#fff",
-        "navigationBarTitleText": "小程序模板",
-        "navigationBarTextStyle": "black",
-        "navigationStyle": "custom"
-    },
-    "style": "v2",
-    "requiredBackgroundModes": [
-        "location"
-    ],
-    "sitemapLocation": "sitemap.json",
-    "permission": {
-        "scope.userLocation": {
-            "desc": "你的位置信息将用于小程序位置接口的效果展示"
-        }
-    }
+   "pages": [
+      "pages/index/index",
+      "pages/register/index",
+      "pages/home/index",
+      "pages/news/index",
+      "pages/news/mess",
+      "pages/news/add",
+      "pages/topic/index",
+      "pages/topic/mess",
+      "pages/topic/messAdd",
+      "pages/my/index",
+      "pages/my/userInfo",
+      "pages/matchInfo/index",
+      "pages/matchInfo/sign",
+      "pages/user/index",
+      "pages/match/mess",
+      "pages/match/matchadd",
+      "pages/match/matchgroup",
+      "pages/match/sign",
+      "pages/match/shteam",
+      "pages/match/orderbook",
+      "pages/orderbook/teamAdd",
+      "pages/orderbook/teamautoAdd",
+      "pages/orderbook/raceAdd",
+      "pages/orderbook/raceautoAdd",
+      "pages/order/index",
+      "pages/usermymatch/index",
+      "pages/usermysign/index",
+      "pages/usermyteam/index",
+      "pages/usermyteam/add",
+      "pages/usermyorder/index",
+      "pages/setting/contact",
+      "pages/setting/basic",
+      "pages/setting/index",
+      "pages/dictionary/project",
+      "pages/dictionary/projectadd",
+      "pages/dictionary/address",
+      "pages/dictionary/addressAdd",
+      "pages/agree_txt/index",
+      "pages/openMatch/index",
+      "pages/test/index",
+      "pages/match/index",
+      "pages/logs/index"
+   ],
+   "usingComponents": {
+      "van-sidebar": "@vant/weapp/sidebar/index",
+      "van-sidebar-item": "@vant/weapp/sidebar-item/index",
+      "van-search": "@vant/weapp/search/index",
+      "van-button": "@vant/weapp/button/index",
+      "van-row": "@vant/weapp/row/index",
+      "van-col": "@vant/weapp/col/index",
+      "van-dialog": "@vant/weapp/dialog/index",
+      "van-tab": "@vant/weapp/tab/index",
+      "van-tabs": "@vant/weapp/tabs/index",
+      "van-icon": "@vant/weapp/icon/index",
+      "van-nav-bar": "@vant/weapp/nav-bar/index",
+      "van-tabbar": "@vant/weapp/tabbar/index",
+      "van-tabbar-item": "@vant/weapp/tabbar-item/index",
+      "van-uploader": "@vant/weapp/uploader/index",
+      "van-popup": "@vant/weapp/popup/index",
+      "van-collapse": "@vant/weapp/collapse/index",
+      "van-collapse-item": "@vant/weapp/collapse-item/index",
+      "van-picker": "@vant/weapp/picker/index"
+   },
+   "window": {
+      "backgroundTextStyle": "light",
+      "navigationBarBackgroundColor": "#fff",
+      "navigationBarTitleText": "小程序模板",
+      "navigationBarTextStyle": "black",
+      "navigationStyle": "custom"
+   },
+   "style": "v2",
+   "requiredBackgroundModes": [
+      "location"
+   ],
+   "sitemapLocation": "sitemap.json",
+   "permission": {
+      "scope.userLocation": {
+         "desc": "你的位置信息将用于小程序位置接口的效果展示"
+      }
+   }
 }

Diferenças do arquivo suprimidas por serem muito extensas
+ 241 - 0
pages/topic/icon/icon.wxss


+ 82 - 78
pages/topic/index.js

@@ -3,96 +3,100 @@ import { examine_status } from '../../utils/dict';
 import WxValidate from '../../utils/wxValidate';
 Page({
 
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        frameStyle: { useTop: true, name: '话题', leftArrow: false, useBar: true },
-        searchInfo: {},
-        list: [{ name: '1' }],
-    },
-    // 跳转菜单
-    tabPath(e) {
-        let { route } = e.detail.detail;
-        if (route) wx.redirectTo({ url: `/${route}` })
-    },
-    // 跳转菜单
-    back(e) {
-        wx.navigateBack({ delta: 1 })
-    },
-    // 查询
-    search: function (e) { console.log('查询'); },
-
-
-
-
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad: function (options) {
-        const that = this;
-        that.watchLogin();
-    },
-    // 监听用户是否登录
-    watchLogin: async function () {
-        const that = this;
-        wx.getStorage({
-            key: 'user',
-            success: async res => {
-
-            },
-            fail: res => {
-                wx.redirectTo({ url: '/pages/index/index', })
+   /**
+    * 页面的初始数据
+    */
+   data: {
+      frameStyle: { useTop: true, name: '话题', leftArrow: false, useBar: true },
+      searchInfo: {},
+      list: [],
+   },
+   // 跳转菜单
+   tabPath(e) {
+      let { route } = e.detail.detail;
+      if (route) wx.redirectTo({ url: `/${route}` })
+   },
+   // 跳转菜单
+   back(e) {
+      wx.navigateBack({ delta: 1 })
+   },
+   // 查询
+   search: function (e) { console.log('查询'); },
+
+   /**
+    * 生命周期函数--监听页面加载
+    */
+   onLoad: function (options) {
+      const that = this;
+      that.watchLogin();
+   },
+   // 监听用户是否登录
+   watchLogin: function () {
+      const that = this;
+      let searchInfo = that.data.searchInfo;
+      wx.getStorage({
+         key: 'user',
+         success: async (res) => {
+            let info = { skip: 0, limit: 1000 };
+            if (searchInfo && searchInfo.title) info.title = searchInfo.title;
+            const arr = await app.$get(`/newCourt/api/topic`, { ...info });
+            if (arr.errcode == '0') {
+               that.setData({ list: arr.data })
+               console.log(arr.data);
             }
-        })
-    },
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function () {
+            else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
+         },
+         fail: async (res) => {
+            wx.redirectTo({ url: '/pages/index/index' });
+         },
+      });
+   },
+   /**
+    * 生命周期函数--监听页面初次渲染完成
+    */
+   onReady: function () {
 
-    },
+   },
 
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () {
+   /**
+    * 生命周期函数--监听页面显示
+    */
+   onShow: function () {
 
-    },
+   },
 
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function () {
+   /**
+    * 生命周期函数--监听页面隐藏
+    */
+   onHide: function () {
 
-    },
+   },
 
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function () {
+   /**
+    * 生命周期函数--监听页面卸载
+    */
+   onUnload: function () {
 
-    },
+   },
 
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function () {
+   /**
+    * 页面相关事件处理函数--监听用户下拉动作
+    */
+   onPullDownRefresh: function () {
 
-    },
+   },
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function () {
+   /**
+    * 页面上拉触底事件的处理函数
+    */
+   onReachBottom: function () {
 
-    },
+   },
 
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage: function () {
+   /**
+    * 用户点击右上角分享
+    */
+   onShareAppMessage: function () {
 
-    }
+   }
 })

+ 22 - 22
pages/topic/index.wxml

@@ -1,24 +1,24 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back" bind:tabPath="tabPath">
-    <view slot="info" class="container main">
-        <view class="zero one">
-            <input type="text" value="{{searchInfo.name}}" bindconfirm="search" placeholder="请输入关键词" />
-        </view>
-        <view class="zero two">
-            <scroll-view scroll-y="true" class="scroll-view">
-                <view class="list-scroll-view">
-                    <view class="list" wx:for="{{list}}" wx:key="item">
-                        <view class="list_1">
-                            <view class="name">辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛</view>
-                            <view>2022-08-06</view>
-                        </view>
-                        <view class="list_2">辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛</view>
-                        <view class="list_3">
-                            <view>已发布0个帖子</view>
-                            <view class="btn"><button type="primary" size="mini">加入话题>>></button></view>
-                        </view>
-                    </view>
-                </view>
-            </scroll-view>
-        </view>
-    </view>
+   <view slot="info" class="container main">
+      <view class="zero one">
+         <input type="text" value="{{searchInfo.name}}" bindconfirm="search" placeholder="请输入关键词" />
+      </view>
+      <view class="zero two">
+         <scroll-view scroll-y="true" class="scroll-view">
+            <view class="list-scroll-view">
+               <view class="list" wx:for="{{list}}" wx:key="item">
+                  <view class="list_1">
+                     <view class="name">{{item.title}}</view>
+                     <view>{{item.create_time}}</view>
+                  </view>
+                  <view class="list_2">{{item.title}}</view>
+                  <view class="list_3">
+                     <view>已发布0个帖子</view>
+                     <view class="btn"><button type="primary" size="mini">加入话题>>></button></view>
+                  </view>
+               </view>
+            </view>
+         </scroll-view>
+      </view>
+   </view>
 </mobile-main>

+ 105 - 105
pages/topic/mess.js

@@ -1,122 +1,122 @@
 const app = getApp()
 Page({
 
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        frameStyle: { useTop: true, name: '话题信息管理', leftArrow: true, useBar: false },
-        searchInfo: {},
-        list: [],
-    },
-    // 跳转菜单
-    back(e) {
-        wx.navigateBack({ delta: 1 });
-    },
-    search: function (e) {
-        const that = this;
-        that.setData({ 'searchInfo.title': e.detail.value });
-        that.watchLogin()
-    },
-    // 添加
-    toAdd() {
-        wx.navigateTo({ url: '/pages/topic/messAdd' })
-    },
-    // 修改
-    toEdit: function (e) {
-        let { id } = e.currentTarget.dataset;
-        wx.navigateTo({ url: `/pages/topic/messAdd?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.watchLogin()
-                    } else {
-                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
-                    }
-                }
+   /**
+    * 页面的初始数据
+    */
+   data: {
+      frameStyle: { useTop: true, name: '话题信息管理', leftArrow: true, useBar: false },
+      searchInfo: {},
+      list: [],
+   },
+   // 跳转菜单
+   back(e) {
+      wx.navigateBack({ delta: 1 });
+   },
+   search: function (e) {
+      const that = this;
+      that.setData({ 'searchInfo.title': e.detail.value });
+      that.watchLogin()
+   },
+   // 添加
+   toAdd() {
+      wx.navigateTo({ url: '/pages/topic/messAdd' })
+   },
+   // 修改
+   toEdit: function (e) {
+      let { id } = e.currentTarget.dataset;
+      wx.navigateTo({ url: `/pages/topic/messAdd?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.watchLogin()
+               } else {
+                  wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+               }
             }
-        })
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad: function (options) {
-        const that = this;
-        // 监听用户是否登录
-    },
-    watchLogin: function () {
-        const that = this;
-        let searchInfo = that.data.searchInfo;
-        wx.getStorage({
-            key: 'user',
-            success: async (res) => {
-                let info = { skip: 0, limit: 1000 };
-                if (searchInfo && searchInfo.title) info.title = searchInfo.title;
-                const arr = await app.$get(`/newCourt/api/topic`, { ...info });
-                if (arr.errcode == '0') { that.setData({ list: arr.data }) }
-                else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
-            },
-            fail: async (res) => {
-                wx.redirectTo({ url: '/pages/index/index' });
-            },
-        });
-    },
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function () {
+         }
+      })
+   },
+   /**
+    * 生命周期函数--监听页面加载
+    */
+   onLoad: function (options) {
+      const that = this;
+      // 监听用户是否登录
+   },
+   watchLogin: function () {
+      const that = this;
+      let searchInfo = that.data.searchInfo;
+      wx.getStorage({
+         key: 'user',
+         success: async (res) => {
+            let info = { skip: 0, limit: 1000 };
+            if (searchInfo && searchInfo.title) info.title = searchInfo.title;
+            const arr = await app.$get(`/newCourt/api/topic`, { ...info });
+            if (arr.errcode == '0') { that.setData({ list: arr.data }) }
+            else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
+         },
+         fail: async (res) => {
+            wx.redirectTo({ url: '/pages/index/index' });
+         },
+      });
+   },
+   /**
+    * 生命周期函数--监听页面初次渲染完成
+    */
+   onReady: function () {
 
-    },
+   },
 
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () {
-        this.watchLogin();
-    },
+   /**
+    * 生命周期函数--监听页面显示
+    */
+   onShow: function () {
+      this.watchLogin();
+   },
 
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function () {
+   /**
+    * 生命周期函数--监听页面隐藏
+    */
+   onHide: function () {
 
-    },
+   },
 
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function () {
+   /**
+    * 生命周期函数--监听页面卸载
+    */
+   onUnload: function () {
 
-    },
+   },
 
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function () {
+   /**
+    * 页面相关事件处理函数--监听用户下拉动作
+    */
+   onPullDownRefresh: function () {
 
-    },
+   },
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function () {
+   /**
+    * 页面上拉触底事件的处理函数
+    */
+   onReachBottom: function () {
 
-    },
+   },
 
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage: function () {
+   /**
+    * 用户点击右上角分享
+    */
+   onShareAppMessage: function () {
 
-    }
+   }
 })

+ 187 - 113
pages/topic/messAdd.js

@@ -5,131 +5,205 @@ let util = require('../../utils/util');
 
 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: true }, 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 })
-    },
-    // 是否使用
-    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 data = that.data.form;
-        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;
-            let time = util.formatTime(new Date());
-            time = time.slice(0, -3)
-            if (data._id) { arr = await app.$post(`/newCourt/api/topic/${data._id}`, params); }
-            else {
-                params.create_time = time;
-                arr = await app.$post(`/newCourt/api/topic`, params);
+   /**
+    * 页面的初始数据
+    */
+   data: {
+      frameStyle: { useTop: true, name: '信息管理', leftArrow: true, useBar: false },
+      id: '',
+      // 是否使用
+      is_showList: is_show_project,
+      form: {},
+      content: ''
+   },
+   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 })
+   },
+
+   /**
+   * 组件的方法列表
+   */
+   onEditorReady() {
+      const that = this
+      that.createSelectorQuery().select('#editor').context(function (res) {
+         that.editorCtx = res.context
+         if (!res) return
+         that.editorCtx.setContents({
+            html: that.data.form.content,
+         })
+      }).exec()
+   },
+   format(e) {
+      let self = this;
+      let { name, value } = e.target.dataset;
+      // 富文本编辑器格式化内容方法
+      self.editorCtx.format(name, value);
+   },
+   setContents(rechtext) {
+      this.editorCtx.setContents({
+         html: rechtext,
+         success: (res) => {
+            // 富文本内容设置成功
+            // console.log("[setContents success]", res);
+         },
+      });
+   },
+   getEditorContent() {
+      const that = this;
+      let self = this;
+      // 富文本编辑器获取内容方法
+      self.editorCtx.getContents({
+         success: (res) => {
+            let array = [];
+            array["html"] = res.html;
+            array["index"] = self.properties.index;
+            // 通过自定义事件把内容传到父组件
+            self.triggerEvent("getEditorValue", array);
+         },
+      });
+      that.editorCtx.getContents({
+         success: function (res) {
+            that.setData({ content: res.html })
+         },
+      });
+   },
+   insertImage() {
+      const that = this
+      wx.chooseImage({
+         count: 1,
+         success: function (res) {
+            that.editorCtx.insertImage({
+               src: res.tempFilePaths[0],
+               data: {
+                  id: 'abcd',
+                  role: 'god'
+               },
+               width: '80%',
+               success: function () {
+                  console.log('insert image success')
+               }
+            })
+         }
+      })
+   },
+   // 是否公开
+   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 data = that.data.form;
+      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;
+         let time = util.formatTime(new Date());
+         time = time.slice(0, -9)
+         params.content = that.data.content;
+         if (data._id) {
+            arr = await app.$post(`/newCourt/api/topic/${data._id}`, params);
+         }
+         else {
+            params.create_time = time;
+            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: 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 });
+                  that.onEditorReady();
+               }
             }
-            if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
-            else wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
-        }
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    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: function () {
+         },
+         fail: res => {
+            wx.redirectTo({ url: '/pages/index/index', })
+         }
+      })
+   },
+   /**
+    * 生命周期函数--监听页面初次渲染完成
+    */
+   onReady: function () {
 
-    },
+   },
 
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () {
+   /**
+    * 生命周期函数--监听页面显示
+    */
+   onShow: function () {
 
-    },
+   },
 
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function () {
+   /**
+    * 生命周期函数--监听页面隐藏
+    */
+   onHide: function () {
 
-    },
+   },
 
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function () {
+   /**
+    * 生命周期函数--监听页面卸载
+    */
+   onUnload: function () {
 
-    },
+   },
 
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function () {
+   /**
+    * 页面相关事件处理函数--监听用户下拉动作
+    */
+   onPullDownRefresh: function () {
 
-    },
+   },
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function () {
+   /**
+    * 页面上拉触底事件的处理函数
+    */
+   onReachBottom: function () {
 
-    },
+   },
 
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage: function () {
+   /**
+    * 用户点击右上角分享
+    */
+   onShareAppMessage: function () {
 
-    }
+   }
 })

Diferenças do arquivo suprimidas por serem muito extensas
+ 305 - 35
pages/topic/messAdd.less


+ 55 - 39
pages/topic/messAdd.wxml

@@ -1,41 +1,57 @@
 <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"><input name="title" value="{{form.title}}" placeholder="请输入话题名称" /></view>
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">信息简介:</view>
-                    <view class="value">
-                        <view class="value"><input name="brief" value="{{form.brief}}" placeholder="请输入信息简介" /></view>
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">信息来源:</view>
-                    <view class="value">
-                        <view class="value"><input name="origin" value="{{form.origin}}" placeholder="请输入信息来源" /></view>
-                    </view>
-                </view>
-                <view class="content">
-                    <view class="label">信息内容:</view>
-                    <view class="value">
-                        <textarea name="content" value="{{form.content}}" maxlength="-1" placeholder="请输入内容" />
-                    </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>
+   <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"><input name="title" value="{{form.title}}" placeholder="请输入话题名称" /></view>
+               </view>
+            </view>
+            <view class="content">
+               <view class="label">信息简介:</view>
+               <view class="value">
+                  <view class="value"><input name="brief" value="{{form.brief}}" placeholder="请输入信息简介" /></view>
+               </view>
+            </view>
+            <view class="content">
+               <view class="label">信息来源:</view>
+               <view class="value">
+                  <view class="value"><input name="origin" value="{{form.origin}}" placeholder="请输入信息来源" /></view>
+               </view>
+            </view>
+            <view class="content1">
+               <view class="label">信息内容:</view>
+               <view class="value">
+                  <view class="toolbar" catchtouchend="format">
+                     <i class="iconfont icon-charutupian" catchtouchend="insertImage"></i>
+                     <i class="iconfont icon-format-header-2 {{formats.header === 2 ? 'ql-active' : ''}}" data-name="header" data-value="{{2}}"></i>
+                     <i class="iconfont icon-format-header-3 {{formats.header === 3 ? 'ql-active' : ''}}" data-name="header" data-value="{{3}}"></i>
+                     <i class="iconfont icon-zitijiacu {{formats.bold ? 'ql-active' : ''}}" data-name="bold"></i>
+                     <i class="iconfont icon-zitixieti {{formats.italic ? 'ql-active' : ''}}" data-name="italic"></i>
+                     <i class="iconfont icon-zitixiahuaxian {{formats.underline ? 'ql-active' : ''}}" data-name="underline"></i>
+                     <i class="iconfont icon--checklist" data-name="list" data-value="check"></i>
+                     <i class="iconfont icon-youxupailie {{formats.list === 'ordered' ? 'ql-active' : ''}}" data-name="list" data-value="ordered"></i>
+                     <i class="iconfont icon-wuxupailie {{formats.list === 'bullet' ? 'ql-active' : ''}}" data-name="list" data-value="bullet"></i>
+
+                     <i class="iconfont icon-juzhongduiqi {{formats.align === 'center' ? 'ql-active' : ''}}" data-name="align" data-value="center"></i>
+                     <i class="iconfont icon-youduiqi {{formats.align === 'right' ? 'ql-active' : ''}}" data-name="align" data-value="right"></i>
+                     <i class="iconfont icon-zuoyouduiqi {{formats.align === 'justify' ? 'ql-active' : ''}}" data-name="align" data-value="justify"></i>
+                  </view>
+                  <editor style=" min-height:240rpx;" id="editor" class="ql-container" bindinput="getEditorContent" bindready="onEditorReady" placeholder="请输入内容">
+                  </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>

Diferenças do arquivo suprimidas por serem muito extensas
+ 202 - 0
pages/topic/messAdd.wxss