From de0151aaae18282e885e5ae2d84653d1131a65a4 Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Wed, 01 Apr 2020 11:26:42 +0800
Subject: [PATCH] xiufu

---
 SunshineLnsMinApp/pages/law2Publicitylist/law2Publicitylist.js |    6 +-
 SunshineLnsMinApp/pages/zhgk/zhgk.wxml                         |    2 
 SunshineLnsMinApp/pages/zhghLogin/zhghLogin.js                 |   22 +++++-
 SunshineLnsMinApp/project.config.json                          |    6 +-
 SunshineLnsMinApp/pages/zhgk/zhgk.js                           |    1 
 SunshineIns/src/page/ActiveManageEdit.jsx                      |   32 +++-------
 SunshineIns/src/page/CareListEdit.jsx                          |   79 +++++++++++++++++++++++++-
 SunshineIns/src/page/ArticleEidt.jsx                           |   16 ++++-
 8 files changed, 122 insertions(+), 42 deletions(-)

diff --git a/SunshineIns/src/page/ActiveManageEdit.jsx b/SunshineIns/src/page/ActiveManageEdit.jsx
index 55c7f98..2c3caca 100644
--- a/SunshineIns/src/page/ActiveManageEdit.jsx
+++ b/SunshineIns/src/page/ActiveManageEdit.jsx
@@ -83,7 +83,6 @@
                 if (endTime == null) {
                     endTime = Date.now();
                 }
-                console.log(res.attachments)
                 this.setState({
                     savedate: {
                         ...res.activity,
@@ -136,7 +135,6 @@
             size: this.state.pageSize,
         })
             .then(res => {
-                console.log('res', res);
                 this.setState({
                     modalLoading: false
                 })
@@ -174,24 +172,16 @@
     }
 
     handleOk = (e) => {
-        console.log(e)
         this.setState({
             questionnaireModal: false,
             selectedRowKeys: []
         })
     }
 
-    questionnaireSearch = (value) => {
-        console.log(value)
-    }
-
     submit = () => {
         const { savedate, selectedQuestionnaireData, fileList } = this.state;
         savedate.startTime = moment(savedate.startDate + " " + moment(savedate.startHour).format(format), 'YYYY-MM-DD HH:mm')
         savedate.endTime = moment(savedate.endDate + " " + moment(savedate.endHour).format(format), 'YYYY-MM-DD HH:mm')
-        // console.log({...savedate,queId:selectedQuestionnaireData[0].id});
-        console.log(savedate);
-        console.log(selectedQuestionnaireData);
         if (!savedate.host) {
             message.warning("主持人不能为空");
             return;
@@ -265,7 +255,6 @@
     }
 
     getNum = (e) => {
-        console.log(e.target.value)
         this.setState({
             num: e.target.value
         })
@@ -306,12 +295,10 @@
     }
 
     confirm = (e) => {
-        console.log(e);
         const data = { id: e, status: 2 };
         this.setState({ loading: true })
         Fetch.auditPerson(data).then(res => {
             if (res.code == 0) {
-                console.log(res)
                 this.setState({ loading: false })
                 message.success('审核通过');
                 this.getDetail();
@@ -324,12 +311,10 @@
     }
 
     cancel = (e) => {
-        console.log(e);
         const data = { id: e, status: 4 };
         this.setState({ loading: true })
         Fetch.auditPerson(data).then(res => {
             if (res.code == 0) {
-                console.log(res)
                 this.setState({ loading: false })
                 message.error('审核不通过');
                 this.getDetail();
@@ -387,13 +372,23 @@
     }
 
     handleEditorChange = (editorState) => {
+        console.log('editorState', editorState)
         this.setState({ editorState })
+        const htmlContent = editorState.toHTML()
+        console.log(htmlContent)
+        this.setState(({ savedate }) => ({
+            savedate: {
+                ...savedate,
+                course: htmlContent
+            }
+        }))
     }
 
     submitContent = () => {
         // 在编辑器获得焦点时按下ctrl+s会执行此方法
         // 编辑器内容提交到服务端之前,可直接调用editorState.toHTML()来获取HTML格式的内容
         const htmlContent = this.state.editorState.toHTML()
+        console.log(htmlContent)
         this.setState(({ savedate }) => ({
             savedate: {
                 ...savedate,
@@ -404,10 +399,6 @@
 
     onSelectChange = (selectedRowKeys, selectedRows) => {
         const { tableData } = this.state;
-        console.log('selectedRowKeys changed: ', selectedRowKeys);
-        console.log('selectedRowKeys changed: ', selectedRows);
-        console.log(tableData[selectedRowKeys[0]]);
-        console.log(tableData);
         this.setState({
             selectedQuestionnaireData: tableData[selectedRowKeys[0]],
             selectedRowKeys
@@ -417,7 +408,6 @@
     handleCancel = () => this.setState({ previewVisible: false })
     render() {
         const { savedate, previewVisible, previewImage, editorState, selectedRowKeys, fileList, attList1, dateSource, code, hitList, activityType, disabled, loading, modalLoading } = this.state;
-        console.log('disabled', fileList)
         const props = {
             action: domain + 'api/v1/attachment/materials?entityId=' + savedate.id,
             onChange: ({ file, fileList }) => {
@@ -544,8 +534,6 @@
                     </Popconfirm> : <span disabled></span>
             )
         }];
-        console.log('savedate.activityStatus', savedate.activityStatus)
-        console.log('savedate.activityType', savedate.activityType)
         return (
             <div className="app-page">
                 <Spin spinning={loading}>
diff --git a/SunshineIns/src/page/ArticleEidt.jsx b/SunshineIns/src/page/ArticleEidt.jsx
index 11c1fd9..cc188ce 100644
--- a/SunshineIns/src/page/ArticleEidt.jsx
+++ b/SunshineIns/src/page/ArticleEidt.jsx
@@ -174,6 +174,17 @@
     xhr.open('POST', serverURL, true)
     xhr.send(fd)
   }
+  handleEditorChange = (editorState) => {
+    this.setState({ editorState })
+    const htmlContent = editorState.toHTML()
+    console.log(htmlContent)
+    this.setState(({ savedate }) => ({
+      savedate: {
+        ...savedate,
+        content: htmlContent
+      }
+    }))
+  }
 
   submitContent = () => {
     // 在编辑器获得焦点时按下ctrl+s会执行此方法
@@ -187,9 +198,6 @@
     }))
   }
 
-  handleEditorChange = (editorState) => {
-    this.setState({ editorState })
-  }
 
   render() {
     const { dateSource, show, visible, closeKey, selectedRow, savedate, fileList, editorState } = this.state;
@@ -272,7 +280,7 @@
               <Col span={18} push={0} style={{ border: 'solid 1px rgba(0, 0, 0, 0.25)', borderRadius: '5PX' }} >
                 <BraftEditor
                   value={editorState}
-                  placeholder='请输入文章内容'
+                  placeholder='请输入活动进程'
                   media={{
                     allowPasteImage: true, // 是否允许直接粘贴剪贴板图片(例如QQ截图等)到编辑器
                     image: true, // 开启图片插入功能
diff --git a/SunshineIns/src/page/CareListEdit.jsx b/SunshineIns/src/page/CareListEdit.jsx
index 854d35d..5ea8cd8 100644
--- a/SunshineIns/src/page/CareListEdit.jsx
+++ b/SunshineIns/src/page/CareListEdit.jsx
@@ -52,6 +52,7 @@
             status: '',
             loading: false,
             socialTaskObject: '',
+            // rowNum: 4,
             editorState: BraftEditor.createEditorState(null),
             editorStatetaskProcess: BraftEditor.createEditorState(null),
         };
@@ -89,6 +90,7 @@
                     taskType: res.taskType || 1,
                     // status: res.activityStatus || '',
                     socialTaskObject: res.socialTaskObject ? { id: res.socialTaskObject.objectId, objectName: res.socialTaskObject.objectName, taskReport: res.socialTaskObject.taskReport } : {},
+                    // rowNum: ReplaceSeperator(res.socialTaskObject.taskReport),
                     disabled: res.status ? true : false,
                     fileList: res.attachments || [],
                     loading: false,
@@ -313,12 +315,72 @@
         }))
     }
 
+    uploadFn = (param) => {
+
+        const serverURL = domain + 'api/v1/attachment/upload'
+        const xhr = new XMLHttpRequest
+        const fd = new FormData()
+        const successFn = (response) => {
+            // 假设服务端直接返回文件上传后的地址
+            // 上传成功后调用param.success并传入上传后的文件地址
+            //Pz
+            const res = JSON.parse(xhr.responseText);
+            param.success({
+                url: domain + 'api/v1/attachment/image/' + res[0].id,
+                meta: {
+                    id: res[0].id,
+                    title: res[0].name,
+                    alt: res[0].name,
+                    loop: true, // 指定音视频是否循环播放
+                    autoPlay: true, // 指定音视频是否自动播放
+                    controls: true, // 指定音视频是否显示控制栏
+                    poster: domain + 'api/v1/attachment/image/' + res[0].id, // 指定视频播放器的封面
+                }
+            })
+        }
+
+
+        const progressFn = (event) => {
+            // 上传进度发生变化时调用param.progress
+            param.progress(event.loaded / event.total * 100)
+        }
+
+        const errorFn = (response) => {
+            // 上传发生错误时调用param.error
+            param.error({
+                msg: 'unable to upload.'
+            })
+        }
+        xhr.upload.addEventListener("progress", progressFn, false)
+        xhr.addEventListener("load", successFn, false)
+        xhr.addEventListener("error", errorFn, false)
+        xhr.addEventListener("abort", errorFn, false)
+        fd.append('file', param.file)
+        xhr.open('POST', serverURL, true)
+        xhr.send(fd)
+    }
+
     handleEditorChange = (editorState) => {
         this.setState({ editorState })
+        const htmlContent = editorState.toHTML()
+        console.log(htmlContent)
+        this.setState(({ savedate }) => ({
+            savedate: {
+                ...savedate,
+                taskRequire: htmlContent
+            }
+        }))
     }
 
     handleEditorLChange = (editorStatetaskProcess) => {
         this.setState({ editorStatetaskProcess })
+        const htmlContent = editorStatetaskProcess.toHTML()
+        this.setState(({ savedate }) => ({
+            savedate: {
+                ...savedate,
+                taskProcess: htmlContent
+            }
+        }))
     }
 
 
@@ -585,7 +647,16 @@
 
 }
 
-function disabledDate(current) {
-    // Can not select days before today and today
-    return current && current < moment().endOf('day');
-}
+function ReplaceSeperator(mobiles) {
+    var i;
+    var result = "";
+    var c;
+    for (i = 0; i < mobiles.length; i++) {
+        c = mobiles.substr(i, 1);
+        if (c == "\n")
+            result = result + "<br/>";
+        // else if (c != "\r")
+        //     result = result + c;
+    }
+    return result;
+}
\ No newline at end of file
diff --git a/SunshineLnsMinApp/pages/law2Publicitylist/law2Publicitylist.js b/SunshineLnsMinApp/pages/law2Publicitylist/law2Publicitylist.js
index dcdf684..6e5867c 100644
--- a/SunshineLnsMinApp/pages/law2Publicitylist/law2Publicitylist.js
+++ b/SunshineLnsMinApp/pages/law2Publicitylist/law2Publicitylist.js
@@ -17,10 +17,10 @@
     }, this.showList(option.title))
   },
 
-  showList: function (title) {
+  showList: function(title) {
     var that = this;
     wx.request({
-      url: app.globalData.url + '/api/article/publicMsgQuery?page=1&size=' + that.data.size + '&flag=' +title,
+      url: app.globalData.url + '/api/article/publicMsgQuery?page=1&size=' + that.data.size + '&flag=' + title,
       success: function(res) {
         console.log(res)
         if (res.data.code == 0) {
@@ -55,7 +55,7 @@
   link: function(event) {
     // 跳转详情页面
     var id = event.currentTarget.dataset['id'];
-    var flag = '办事指南详情';
+    var flag = this.data.title + '信息详情';
     wx.navigateTo({
       url: '../publicMsgDetails/publicMsgDetails?id=' + id + '&flag=' + flag,
     })
diff --git a/SunshineLnsMinApp/pages/zhghLogin/zhghLogin.js b/SunshineLnsMinApp/pages/zhghLogin/zhghLogin.js
index 9eda973..4220fe7 100644
--- a/SunshineLnsMinApp/pages/zhghLogin/zhghLogin.js
+++ b/SunshineLnsMinApp/pages/zhghLogin/zhghLogin.js
@@ -14,10 +14,10 @@
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {},
+  onLoad: function(options) {},
 
   // 输入框内容
-  inputHandler: function (event) {
+  inputHandler: function(event) {
     var type = event.currentTarget.dataset['type'];
     console.log(type)
     console.log(event.detail.value)
@@ -27,11 +27,23 @@
   },
 
   //登录
-  simulationButton: function () {
+  simulationButton: function() {
     const {
       companyAccount,
       companyPassword
     } = this.data;
+    if (!companyAccount) {
+      return wx.showToast({
+        title: '账号不能为空',
+        icon: 'none'
+      })
+    }
+    if (!companyPassword) {
+      return wx.showToast({
+        title: '密码不能为空',
+        icon: 'none'
+      })
+    }
     let that = this;
     wx.request({
       url: app.globalData.url + '/api/socialCompany/loginCheck',
@@ -40,14 +52,14 @@
         companyAccount,
         companyPassword
       },
-      success: function (res) {
+      success: function(res) {
         console.log(res)
         if (res.data.code == 0) {
           wx.showToast({
             title: '登录成功!',
             icon: 'success',
             duration: 1500,
-            success: function () {
+            success: function() {
               wx.setStorageSync('id', res.data.data.id)
               setTimeout(() => {
                 wx.navigateTo({
diff --git a/SunshineLnsMinApp/pages/zhgk/zhgk.js b/SunshineLnsMinApp/pages/zhgk/zhgk.js
index e5da428..370bfd9 100644
--- a/SunshineLnsMinApp/pages/zhgk/zhgk.js
+++ b/SunshineLnsMinApp/pages/zhgk/zhgk.js
@@ -125,6 +125,7 @@
 
   //预览图片
   previewImage: function(e) {
+    console.log('预览')
     app.previewImage(e)
   },
 
diff --git a/SunshineLnsMinApp/pages/zhgk/zhgk.wxml b/SunshineLnsMinApp/pages/zhgk/zhgk.wxml
index f2246f1..5a6bca0 100644
--- a/SunshineLnsMinApp/pages/zhgk/zhgk.wxml
+++ b/SunshineLnsMinApp/pages/zhgk/zhgk.wxml
@@ -18,7 +18,7 @@
   </div>
   <div class="detail-img">
     <view class="educt_hasupload_pic" wx:for="{{attList.attList22}}" wx:key="{{key}}">
-      <image src="{{item.path}}" class="upload" bindtap="previewImage" data-src="{{item.pic}}"></image>
+      <image src="{{item.path}}" class="upload" bindtap="previewImage" data-src="{{item.path}}"></image>
     </view>
     <view class="educt_hasupload_pic" wx:for="{{attList.attList23}}" wx:key="{{key}}">
       <image src="{{item.iconSrc}}" class="fileIcon" bindtap="open" data-path="{{item.path}}" class="detail-img-top"></image>
diff --git a/SunshineLnsMinApp/project.config.json b/SunshineLnsMinApp/project.config.json
index 4177d79..a6721f4 100644
--- a/SunshineLnsMinApp/project.config.json
+++ b/SunshineLnsMinApp/project.config.json
@@ -1,10 +1,9 @@
 {
 	"description": "项目配置文件。",
 	"setting": {
-		"urlCheck": false,
+		"urlCheck": true,
 		"es6": true,
 		"postcss": true,
-		"preloadBackgroundData": false,
 		"minified": true,
 		"newFeature": true,
 		"coverView": true,
@@ -18,7 +17,8 @@
 			"ignore": [],
 			"disablePlugins": [],
 			"outputPath": ""
-		}
+		},
+		"preloadBackgroundData": false
 	},
 	"compileType": "miniprogram",
 	"libVersion": "2.10.1",

--
Gitblit v1.8.0