zhaoxiaohai пре 3 година
родитељ
комит
b50a080d40

+ 20 - 8
pages/storeMessage/editor/editor.js

@@ -11,22 +11,34 @@ Page({
     keyboardHeight: 0,
     isIOS: false,
     showRichText: '', //富文本文件
+    isDisabled: false, //只读
   },
   readOnlyChange() {
     this.setData({
       readOnly: !this.data.readOnly
     })
   },
-  onLoad(options) {
-    console.log(options)
-    this.setData({
-      showRichText: "<p>asdasdsdgss<img src=\"https://bwj.obs.cn-east-2.myhuaweicloud.com:443/202201061641468934405B8cac64d.png\" width=\"80%\" data-custom=\"id=535&amp;role=god\"></p><p><br></p>"
+  /* 回调 */
+  callBack() {
+    wx.showToast({
+      title: '保存成功',
     })
-
+    this.getOpenerEventChannel().emit('richTextCallBack', {
+      richText: this.data.showRichText
+    })
+    setTimeout(() => {
+      wx.navigateBack()
+    }, 500);
+  },
+  onLoad(options) {
+    let isDisabled = false;
+    if (wx.getStorageSync('userData').fisadministrator == 1) isDisabled = true;
     const platform = wx.getSystemInfoSync().platform
     const isIOS = platform === 'ios'
     this.setData({
-      isIOS
+      isIOS,
+      showRichText: decodeURIComponent(options.fintroduction),
+      isDisabled
     })
     const that = this
     this.updatePosition(0)
@@ -73,7 +85,6 @@ Page({
   onEditorReady() {
     const that = this
     wx.createSelectorQuery().select('#editor').context(function (res) {
-      console.log(res)
       that.editorCtx = res.context
       that.editorCtx.setContents({
         html: that.data.showRichText //将数据写入编辑器内
@@ -83,6 +94,7 @@ Page({
 
   },
   compileText(e) {
+    console.log(e.detail.html)
     this.setData({
       showRichText: e.detail.html
     })
@@ -200,7 +212,7 @@ Page({
               id: res.data[0].tattachmentid,
               role: 'god'
             },
-            width: '80%',
+            /* width: '80%', */
             success: function () {
               console.log('insert image success')
             }

+ 0 - 1
pages/storeMessage/editor/editor.json

@@ -1,4 +1,3 @@
 {
-  "navigationBarTitleText": "发表文章",
   "disableScroll": true
 }

+ 7 - 7
pages/storeMessage/editor/editor.wxml

@@ -1,13 +1,13 @@
-<view class="container" style="height:65vh;">
-  <!-- {{editorHeight}} -->
-  <editor id="editor" class="ql-container" placeholder="{{placeholder}}" bindstatuschange="onStatusChange" bindready="onEditorReady" bindinput='compileText'>
+<view class="container" style="height:{{!isDisabled?editorHeight+'px':'65vh'}};">
+  <editor id="editor" read-only='{{!isDisabled}}' class="ql-container" placeholder="{{placeholder}}" bindstatuschange="onStatusChange" bindready="onEditorReady" bindinput='compileText'>
   </editor>
 </view>
-<view style="margin-top: 67vh;">
-  <van-button type="default">保存</van-button>
+<view wx:if="{{isDisabled}}" class="checkbox_but">
+  <view>
+    <van-button type="info" size="large" color="#4EBFCF" custom-class="customClass" catchtap="callBack">保存</van-button>
+  </view>
 </view>
-<!-- hidden="{{keyboardHeight > 0 ? false : true}}" style="bottom: {{isIOS ? keyboardHeight : 0}}px" -->
-<view class="toolbar" catchtouchend="format" >
+<view class="toolbar" catchtouchend="format" hidden="{{keyboardHeight > 0 ? false : true}}" style="bottom: {{isIOS ? keyboardHeight : 0}}px">
   <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>

+ 24 - 3
pages/storeMessage/editor/editor.wxss

@@ -2,9 +2,9 @@
 @import "./assets/iconfont.wxss";
 
 .container {
-  position: absolute; 
-  top: 0; 
-  left: 0; 
+  position: absolute;
+  top: 0;
+  left: 0;
   width: 100%;
   background-color: #ffffff;
 }
@@ -49,3 +49,24 @@
   border-right: none;
 }
 
+/* 按钮 */
+.checkbox_but {
+  width: 100vw;
+  margin: 70vh 0 80rpx 0;
+  box-sizing: border-box;
+}
+
+.checkbox_but>view {
+  position: absolute;
+  width: 188rpx;
+  height: 64rpx;
+  background: #4EBFCF;
+  border-radius: 14rpx;
+  right: 60rpx;
+  overflow: hidden;
+}
+
+.customClass {
+  width: 100% !important;
+  height: 100% !important;
+}

+ 15 - 8
pages/storeMessage/index.js

@@ -68,10 +68,6 @@ Page({
                 isDisabled: true
             })
         } else {
-            //解析富文本
-            var article = decodeURIComponent(options.fintroduction);
-            var that = this;
-            WxParse.wxParse('article', 'html', article, that, 5);
             //处理数据
             const data = JSON.parse(options.data);
             this.returnData(data)
@@ -79,8 +75,17 @@ Page({
     },
     //跳转富文本
     toRichText() {
+        const that = this;
+        const fintroduction = encodeURIComponent(this.data.fintroduction);
         wx.navigateTo({
-            url: './editor/editor?isDisabled=' + this.data.isDisabled,
+            url: './editor/editor?fintroduction=' + fintroduction,
+            events: {
+                richTextCallBack: function (richText) {
+                    that.setData({
+                        fintroduction: richText.richText
+                    })
+                }
+            }
         })
     },
     /* 添加图片 */
@@ -109,6 +114,7 @@ Page({
     },
     /* 返回数据 */
     returnData(data) {
+        console.log(data)
         var attinfos = [],
             coverAttinfos = [];
         // 格式化图片
@@ -126,14 +132,14 @@ Page({
                 coverAttinfos.unshift(Data)
             }
         }
-
         //格式化经营类目
         if (data.saleprodclass.length >= 1) {
             this.saleprodChange({
                 detail: data.saleprodclass
             })
         }
-        /* fintroduction: data.fintroduction, */
+        //解码富文本
+        const fintroduction = decodeURIComponent(data.fintroduction);
         this.setData({
             fbrand: data.fbrand,
             saleprodclass: data.saleprodclass,
@@ -143,7 +149,8 @@ Page({
             faddress: data.faddress,
             fdutyparagraph: data.fdutyparagraph,
             attinfos,
-            coverAttinfos
+            coverAttinfos,
+            fintroduction
         })
     },
     /* 提交数据 */

+ 1 - 3
pages/storeMessage/index.wxml

@@ -30,11 +30,9 @@
         </My_GreyRectangleForm>
         <import src="/wxParse/wxParse" />
         <My_GreyRectangleForm title="公司介绍" required>
-            <view style="width: 400rpx; text-align: right; color: #4BBECF; text-decoration: underline;" bindtap="toRichText">
+            <view style="width: 400rpx; text-align: right; color: #4BBECF; text-decoration: underline;" catchtap="toRichText">
                 编辑/预览
-                <!-- <template is="wxParse" data="{{wxParseData:article.nodes}}" /> -->
             </view>
-            <!-- <van-field autosize type="textarea" disabled="{{isDisabled}}" model:value="{{ fintroduction }}" data-name="fintroduction" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fintroduction}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" /> -->
         </My_GreyRectangleForm>
 
         <My_GreyRectangleForm title="地址" required>

+ 3 - 6
pages/tabbar-pages/user/index.js

@@ -33,8 +33,7 @@ Page({
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
-    },
+    onLoad: function (options) {},
     /* 宫格展示区跳转 */
     gridJumpPage(e) {
         const {
@@ -56,15 +55,13 @@ Page({
                 "method": "query_enterpriseAgentsMain",
                 "content": {}
             }).then(res => {
-                console.log(res)
                 if (res.msg != '成功') return;
                 const data = res.data[0];
-                console.log(data.fintroduction)
                 const fintroduction = encodeURIComponent(data.fintroduction);
-                data.fintroduction = "";
+                data.fintroduction = fintroduction;
                 //商户
                 if (data.ftype != '个人') return wx.navigateTo({
-                    url: '/pages/storeMessage/index?data=' + JSON.stringify(data) + "&fintroduction=" + fintroduction,
+                    url: '/pages/storeMessage/index?data=' + JSON.stringify(data),
                 });
                 if (data.fisauthenticating == 1) {
                     //正在审核中

+ 1 - 1
project.config.json

@@ -47,7 +47,7 @@
         "ignoreUploadUnusedFiles": true
     },
     "compileType": "miniprogram",
-    "libVersion": "2.19.6",
+    "libVersion": "2.21.2",
     "appid": "wx5dc7fd18b6335214",
     "projectname": "%E5%B8%83%E4%B8%87%E5%AE%B6%E5%B0%8F%E7%A8%8B%E5%BA%8F",
     "debugOptions": {