yu_ber пре 4 година
родитељ
комит
3a9829f79b

+ 0 - 0
UI/src/pages/contentManage/articleManage.js


+ 46 - 65
UI/src/pages/sellmanage/msgComponent.js

@@ -83,8 +83,8 @@ class MsgComponent extends React.Component {
             imgInitialization: false,
             _ID: "",
             anyKes: false,
-            tabsKes:false,
-            num:false
+            tabsKes: false,
+            num: false
         };
     }
 
@@ -138,7 +138,7 @@ class MsgComponent extends React.Component {
         this.props.updateFrom();
         this.setState({
             imageVisiable: true,
-            tabsKes:true
+            tabsKes: true
         })
         this.loadData();
 
@@ -329,43 +329,24 @@ class MsgComponent extends React.Component {
         });
     }
     componentWillReceiveProps(nextProps) {
-        if(nextProps.selectKeys == nextProps.tabIndex){
-            if(!this.state.tabsKes){
-                if (!nextProps.type && nextProps.mediaId && nextProps.chooseKey == nextProps.cutextKey) {
-                    console.log(nextProps,'nextProps');
-                    this.setState({anyKes:nextProps.cutextKey,chooseKey: nextProps.chooseKey, _ID:this.state.chooseKey != "miniprogrampage" ? nextProps.mediaId : nextProps.thumbMediaId }, () => { this.loadImgs()})
-                } else {
-                    this.setState({
-                        imgUrlText:"",
-                        imgUrlNews:"",
-                        imgUrlMini:"",
-                    })
-                }
+        // console.log(nextProps, 'nextProps');
+        // 默认选中
+        if (nextProps.selectKeys == nextProps.tabIndex && !nextProps.type) {
+            this.setState({
+                chooseKey: nextProps.chooseKey,
+            })
+            if (nextProps.mediaId || nextProps.thumbMediaId) {
+                this.setState({
+                    _ID: nextProps.chooseKey != "miniprogrampage" ? nextProps.mediaId : nextProps.thumbMediaId
+                }, () => { this.loadImgs() })
             } else {
-                switch(this.state.chooseKey){
-                    case this.state.chooseKey == "text" && nextProps.cutextKey == "text":
-                         this.setState({
-                        imgUrlNews:"",
-                        imgUrlMini:"",
-                    })
-                    break
-                    case this.state.chooseKey == "news" && nextProps.cutextKey == "news":
-                         this.setState({
-                        imgUrlText:"",
-                        imgUrlMini:"",
-                    })
-                    break
-                    case this.state.chooseKey == "miniprogrampage" && nextProps.cutextKey == "miniprogrampage":
-                         this.setState({
-                        imgUrlText:"",
-                        imgUrlNews:"",
-                    })
-                    break
-                }
+                this.setState({
+                    imgUrlText: "",
+                    imgUrlNews: "",
+                    imgUrlMini: "",
+                })
             }
-    }
-
-
+        }
 
         // let self = this;
         // if (!util.object.equal(nextProps.msgId, this.state.msgId)) {
@@ -452,10 +433,10 @@ class MsgComponent extends React.Component {
         this.state.faceArr.map((item, index) => {
             if (index == i) {
                 if (this.state.chooseKey == 'text') {
-                    let existContent = this.props.form.getFieldValue('content') ? this.props.form.getFieldValue('content') : "" ;
+                    let existContent = this.props.form.getFieldValue('content') ? this.props.form.getFieldValue('content') : "";
                     this.props.form.setFieldsValue({ content: existContent + "/" + item });
                 } else if (this.state.chooseKey == 'news') {
-                    let existDescription = this.props.form.getFieldValue('description') ? this.props.form.getFieldValue('description') : "" ;
+                    let existDescription = this.props.form.getFieldValue('description') ? this.props.form.getFieldValue('description') : "";
                     this.props.form.setFieldsValue({ description: existDescription + "/" + item });
                 }
             }
@@ -496,10 +477,10 @@ class MsgComponent extends React.Component {
         }
         let itemA = `<a href="${this.state.linkUrl}">${this.state.linkText}</a>`;
         if (this.state.chooseKey == 'text') {
-            let existContent = this.props.form.getFieldValue('content') ?  this.props.form.getFieldValue('content'):"";
+            let existContent = this.props.form.getFieldValue('content') ? this.props.form.getFieldValue('content') : "";
             this.props.form.setFieldsValue({ content: existContent + itemA });
         } else if (this.state.chooseKey == 'news') {
-            let existDescription = this.props.form.getFieldValue('description') ?  this.props.form.getFieldValue('description'):"";
+            let existDescription = this.props.form.getFieldValue('description') ? this.props.form.getFieldValue('description') : "";
             this.props.form.setFieldsValue({ description: existDescription + itemA });
         }
         this.setState({
@@ -508,28 +489,28 @@ class MsgComponent extends React.Component {
     }
     //tabs切换事件
     tabChange = (key) => {
-    //  if (key != this.state.anyKes) {
-    //     //  console
-    //     if(this.state.anyKes == "text" ){
-    //         this.setState({ 
-    //             imgUrlNews:"",
-    //             imgUrlMini:""
-    //         })
-    //     }
-    //     if(this.state.anyKes == "news" ){
-    //         this.setState({ 
-    //             imgUrlText:"",
-    //             imgUrlMini:""
-    //         })
-    //     }
-    //     if(this.state.anyKes == "miniprogrampage" ){
-    //         this.setState({ 
-    //             imgUrlText:"",
-    //             imgUrlNews:""
-    //         })
-    //     }
-    //  }
-      
+        //  if (key != this.state.anyKes) {
+        //     //  console
+        //     if(this.state.anyKes == "text" ){
+        //         this.setState({ 
+        //             imgUrlNews:"",
+        //             imgUrlMini:""
+        //         })
+        //     }
+        //     if(this.state.anyKes == "news" ){
+        //         this.setState({ 
+        //             imgUrlText:"",
+        //             imgUrlMini:""
+        //         })
+        //     }
+        //     if(this.state.anyKes == "miniprogrampage" ){
+        //         this.setState({ 
+        //             imgUrlText:"",
+        //             imgUrlNews:""
+        //         })
+        //     }
+        //  }
+
     }
     render() {
         let self = this;
@@ -636,7 +617,7 @@ class MsgComponent extends React.Component {
                         self.props.chooseKeyChange(key);
                         this.setState({
                             chooseKey: key,
-                            tabsKes:true
+                            tabsKes: true
                         });
                     }}
                     onTabClick={key => this.tabChange(key)}

+ 17 - 32
UI/src/pages/sellmanage/pushMessage/index.js

@@ -1,12 +1,8 @@
 import React, { Component } from "react";
-import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
 import {
-  Tabs,
   Button,
   Switch,
-  Input,
   Select,
-  DatePicker,
   Icon,
   message
 } from "antd";
@@ -14,19 +10,9 @@ import {
 import { connect } from "dva";
 import PropTypes, { string } from 'prop-types'
 import styles from './index.less';
-import { deepClone, util } from "utils";
-import { Loader } from 'components';
-
 import moment from 'moment';
 import TimePicker from "../TimePicker/TimePicker";
-const { RangePicker } = DatePicker
-const dateFormat = 'MM/DD'
-
 import MsgComponent from "../msgComponent";
-import { error } from "jquery";
-const { TabPane } = Tabs;
-const { Search } = Input;
-const { TextArea } = Input;
 
 const textButtom = [
   // "时间段(每天)",
@@ -179,7 +165,6 @@ class PushMessage extends React.Component {
       message.info('最多添加七个时间段');
     }
   }
-
   remove = (key, key1) => {
     var listData = this.props.pushMessage && this.props.pushMessage.times ? this.props.pushMessage.times : { key: [] }
     const { initData, initData: { items } } = this.props.pushMessage
@@ -202,14 +187,14 @@ class PushMessage extends React.Component {
   }
   handleSubmit = key => {
     const { initData, initData: { items } } = this.props.pushMessage
-    console.log(items,'............................');
+    console.log(items, '............................');
     if (items) {
       if (!items[key])
         items[key] = {};
       items[key].message = this.getFormModel(key);
       initData.items = items;
     }
-   
+
     var data = initData.items[key];
     if (typeof (data.disable) === 'undefined')
       data.disable = 0;
@@ -220,20 +205,20 @@ class PushMessage extends React.Component {
     if (typeof (data.tableNo) === 'undefined')
       data.tableNo = key;
 
-     const seleckey  =  initData.items[key] && initData.items[key].message && initData.items[key].message.msgType
-     const Validator = this.getFormModel(key)
+    const seleckey = initData.items[key] && initData.items[key].message && initData.items[key].message.msgType
+    const Validator = this.getFormModel(key)
     //  console.log(seleckey,Validator,'Validator');
     //  if(seleckey == 'news'){
     //  }
-      // pushMessageItem.content = FormModelItem.props.form.getFieldValue('content')
-      // pushMessageItem.miniAppTitle = FormModelItem.props.form.getFieldValue('miniAppTitle')
-      // pushMessageItem.title = FormModelItem.props.form.getFieldValue('title')
-      // pushMessageItem.url = FormModelItem.props.form.getFieldValue('url')
-      // pushMessageItem.description = FormModelItem.props.form.getFieldValue('description')
-      // pushMessageItem.miniProgramAppId = FormModelItem.props.form.getFieldValue('miniProgramAppId')
-      // pushMessageItem.pagepath = FormModelItem.props.form.getFieldValue('pagepath')
-
-    
+    // pushMessageItem.content = FormModelItem.props.form.getFieldValue('content')
+    // pushMessageItem.miniAppTitle = FormModelItem.props.form.getFieldValue('miniAppTitle')
+    // pushMessageItem.title = FormModelItem.props.form.getFieldValue('title')
+    // pushMessageItem.url = FormModelItem.props.form.getFieldValue('url')
+    // pushMessageItem.description = FormModelItem.props.form.getFieldValue('description')
+    // pushMessageItem.miniProgramAppId = FormModelItem.props.form.getFieldValue('miniProgramAppId')
+    // pushMessageItem.pagepath = FormModelItem.props.form.getFieldValue('pagepath')
+
+
     this.props.dispatch({ type: 'pushMessage/submit', payload: { data } });
   }
 
@@ -279,7 +264,7 @@ class PushMessage extends React.Component {
     this.props.dispatch({ type: 'pushMessage/updateState', payload: { initData: initData } });
   }
   updateFromMessage = (value, key) => {
-    const { initData,initData:{ items } } = this.props.pushMessage
+    const { initData, initData: { items } } = this.props.pushMessage
     if (items) {
       if (!items[key])
         items[key] = {};
@@ -320,9 +305,7 @@ class PushMessage extends React.Component {
   }
   handleClick = (value, key1, key) => {
     var listData = this.props.pushMessage.times ? this.props.pushMessage.times : { key: [] }
-
     const { initData, initData: { items } } = this.props.pushMessage
-
     let selectTime = [];
     if (!listData[key])
       listData[key] = []
@@ -408,11 +391,13 @@ class PushMessage extends React.Component {
             ) {
               let keys = self.props.pushMessage.initData.items[self.state.currentState]
               keys ? chooseKey = keys.message && keys.message.msgType : chooseKey = "text"
+
+              // console.log(keys,'keys');
               let item = self.props.pushMessage.selectKesData.items[self.state.currentState]
               item ? cutextKey = item.message && item.message.msgType : cutextKey = "text"
               message1 = self.props.pushMessage.initData.items[self.state.currentState].message;
               message1.content = self.props.pushMessage.initData.items[self.state.currentState].message.content ?
-              self.props.pushMessage.initData.items[self.state.currentState].message.content : this.state.contentValueItem
+                self.props.pushMessage.initData.items[self.state.currentState].message.content : this.state.contentValueItem
             }
 
             return (

+ 12 - 19
UI/src/pages/sellmanage/templateMessage/index.js

@@ -170,38 +170,22 @@ class TemplateMessage extends React.Component {
         }
       }
     }
-
-  
-
     if (!selectNameList) {
       message.error("请选择推送对象");
       return
     }
-
     let data = {}
     let itemDate = this.props.TemplateMessage.Information.result;
-    // let startStr = "{";
-    // let endStr = "}";
-    // let strList = "";
-
     for (let i = 0; i < itemDate.contentValueList.length; i++) {
       if (itemDate.contentValueList[i].value == "") {
-        console.log(itemDate.contentValueList);
         message.error(itemDate.contentValueList[i].message);
         return
       }
     }
-
-    // for (let i = 0; i < itemDate.contentValueList.length; i++) {
-    //   strList += `"${itemDate.contentValueList[i].lable}":{"color":"${itemDate.contentValueList[i].color}","value":"${itemDate.contentValueList[i].value}"};`
-    // }
-    // strList = startStr + strList + endStr;
-
     let strJson = {};
     for (let i = 0; i < itemDate.contentValueList.length; i++) {
       strJson[itemDate.contentValueList[i].lable] = {"prefix": itemDate.contentValueList[i].prefix, "color": itemDate.contentValueList[i].color, "value": itemDate.contentValueList[i].value };
     }
-
     data.appId = this.props.wxAppIdValue;
     data.id = this.state.editStateSmall ? 0 : this.state.templateMsgId;
     data.theme = this.state.pushValueItem;
@@ -363,8 +347,16 @@ class TemplateMessage extends React.Component {
     if (this.state.templateId) {
       this.setState({
         size: e.target.value,
-        templateMsgId:this.state.size == "small"?0:1
+        templateMsgId:this.state.size == "small"?0:""
       });
+
+      if(this.state.size != "small"){
+        this.setState({
+          pushValueItem:"",
+          selectArray:[],
+          value:""
+        })
+      }
     } else {
       message.error("请先选择模板消息");
     }
@@ -465,8 +457,9 @@ class TemplateMessage extends React.Component {
       columns: [
         { title: "id", data: "id", editor: {}, type: "number", hide: true },
         { title: "推送主题", data: "theme", type: "text", query: false },
-        // { title: "推送时间", data: "date", type: "date", editor: {}, query: true ,  hide: true},
-        { title: "推送时间", data: "sendTime", type: "text" },
+        { title: "推送时间", data: "sendTime", type: "date", editor: {}, query: true },
+        { title: "推送时间", data: "sendTime", type: "number" },
+        // { title: "推送时间", data: "sendTime", type: "text" },
 
         { title: "推送对象", data: "tagNames", type: "text", editor: {}, query: true ,
         // render: (text, record, index) =>