Explorar o código

时间段回复

pzc %!s(int64=4) %!d(string=hai) anos
pai
achega
6cd22a850b

+ 24 - 3
UI/src/layouts/components/sider/Sider.js

@@ -1,12 +1,14 @@
 import React from 'react'
 import PropTypes, { arrayOf } from 'prop-types'
-import { Icon, Layout, Menu } from 'antd'
+import { Icon, Layout, Menu,message } from 'antd'
 import { Link } from 'react-router-dom'
 import styles from './Sider.less'
 import { config } from 'utils';
 import { arequest } from 'utils/request';
 import util from 'utils/util';
 import {BirdSelector} from "../../../components/Form";
+import { connect } from "dva";
+
 const { name,WXMpAPI } = config
 
 const SubMenu = Menu.SubMenu;
@@ -24,22 +26,40 @@ class Silder extends React.Component {
     }
   }
 
+  /**
+   * 缩小左侧菜单回调
+   */
   onCollapse = () => {
     this.setState({
       collapsed: !this.state.collapsed,
     });
   }
 
+  /**
+   * 打开父菜单回调
+   */
   onOpenChange = openKeys => {
     let existKeys = this.props.openKeys;
     openKeys = openKeys.filter(p => existKeys.indexOf(p) < 0);
     this.props.onOpenChange && this.props.onOpenChange(openKeys);
   }
 
+  /**
+   * 打开子菜单回调
+   */
   onSelect = ({key}) => {
-    this.props.onSelect && this.props.onSelect(key);
+    let self = this;
+    // console.log("正在启动系统请稍后再打开菜单---"+self.props.loading.models.app);
+    // if(self.props.loading.models.app){
+    //   message.error("正在启动系统请稍后再打开菜单");
+    // }
+
+    self.props.onSelect && self.props.onSelect(key);
   }
   
+  /**
+   * 公众号切换回调
+   */
   selectChange = (value)=> {
     util.store.set(util.WxAppIdKey, value);
     this.setState({wxAppIdValue:value});
@@ -179,4 +199,5 @@ Silder.defaultProps = {
   selectedKeys: []
 }
 
-export default Silder;
+export default connect(({ loading, app }) => ({ loading, app }))(Silder)
+// export default Silder;

+ 15 - 7
UI/src/layouts/layoutTwo/layoutTwo.js

@@ -25,7 +25,7 @@ let activeKey = "252";
 const LayoutTwo = ({ children, dispatch, app, loading, location }) => {
   let { pathname } = location;
   const { menus, menuHash, menuPath, openKeys, selectedKeys,topMenus,topOpenKeys,locationQuery } = app;
-  const { globalPanes } = app;
+  const { globalPanes,loading_permission } = app;
 
   const siderProps = {
     menus,
@@ -127,12 +127,16 @@ const LayoutTwo = ({ children, dispatch, app, loading, location }) => {
     });
   }
 
+  /**
+   * 登陆页面
+   */
   if (openPages && openPages.includes(pathname)) {
     return (<div>
       <Loader fullScreen spinning={loading.effects['app/query']} />
       {children}
     </div>)
   }
+
   
   const curUser = util.auth.getUser()
   let rolename = curUser == null?"":curUser.rolename;
@@ -142,6 +146,9 @@ const LayoutTwo = ({ children, dispatch, app, loading, location }) => {
   let menuData = menuPath[menuPath.length-1];
   // let panes = globalPanes?globalPanes:[];
   
+  /**
+   * 处理顶部panel 
+   */
   const targetPanes = globalPanes.filter(pane => pane.key == (typeof(menuData) === 'undefined'?"30":menuData.id)); //当前页面panel
   if(targetPanes&&targetPanes.length>0){
     activeKey = ''+targetPanes[0].key;
@@ -155,7 +162,8 @@ const LayoutTwo = ({ children, dispatch, app, loading, location }) => {
       message.error('最多8个');
     }else{
       globalPanes.push({ 
-        title: typeof(menuData) === 'undefined'?"客户列表":menuData.name, content:children, 
+        title: typeof(menuData) === 'undefined'?"客户列表":menuData.name, 
+        content:children, //打开的子页面
         key: ''+(typeof(menuData) === 'undefined'?"30":menuData.id),
         menuPath:menuPath,
         closable:true 
@@ -165,6 +173,9 @@ const LayoutTwo = ({ children, dispatch, app, loading, location }) => {
     }
   }
 
+  /**
+   * 在panel打开新表单页面 随后操作完成 需要在这里查询回退的panel打开 并关闭打开的panel
+   */
   let j = -1;
   for(var i in globalPanes){
     if(locationQuery && locationQuery.data && locationQuery.data.indexOf("_panelchange")>0 && globalPanes[i].key === locationQuery.data){
@@ -175,11 +186,8 @@ const LayoutTwo = ({ children, dispatch, app, loading, location }) => {
 
   if(j>0)
     globalPanes.splice(j,1);
-  // const End = ()=>{
-  //   return (<TopTabs panes={globalPanes} activeKey={activeKey} refs="toptabs"
-  //           remove = {remove}
-  //           ></TopTabs>)
-  // }
+
+
   
   return (
     <Layout className={styles.layoutTwo}>

+ 12 - 5
UI/src/models/app.js

@@ -12,7 +12,7 @@ export default {
     globalPanes: [],
     menusMeta: [],//菜单元数据
     menus: [],//菜单树形数据
-    topmenus: [],
+    topmenus: [],//顶部菜单
     menuHash: {},
     menuPath: [{id:"30",name:"客户列表",url:"/externalWechat/externalUserList"}],
     openKeys: [],
@@ -20,7 +20,7 @@ export default {
     locationPath: '',
     locationQuery: {},
     topOpenKeys:[],
-    wxAppIdValue:''
+    wxAppIdValue:'',//当前的微信APPID
   },
   subscriptions: {
     setupHistory({ dispatch, history }) {
@@ -59,7 +59,7 @@ export default {
 
       let user = util.auth.getUser();
       if (user) {
-   
+        //公众号初始化
         let result = yield call(menuService.initAppIds,{});
         if(result && result instanceof Array){
           let appid = '';
@@ -68,7 +68,14 @@ export default {
             
              
           yield put({
-            type: 'updateState',
+            type: 'sellmanage/updateState',
+            payload: {
+              wxAppIdValue:appid,
+            },
+          })
+          
+          yield put({
+            type: 'pushMessage/initMessage',
             payload: {
               wxAppIdValue:appid,
             },
@@ -183,7 +190,7 @@ export default {
               topMenusNode: topMenusNode,//顶部菜单元数据
               topMenus: topMenuTree,//顶部菜单树
               topOpenKeys,//顶部菜单key
-              buttons:buttons//权限按钮
+              buttons:buttons,//权限按钮
             },
           })
         }else{

+ 6 - 1
UI/src/pages/sellmanage/TimePicker/TimePicker.js

@@ -3,8 +3,13 @@ import { TimePicker } from 'antd';
 import moment from 'moment';
 
 const TimeRanger = ({onChange, value }) => { 
-      console.log(value);
+      //console.log(value);
       var [value1, value2] = value
+      if(!value1 ||isNaN(value1._i ))
+        value1="";
+      if(!value2||isNaN(value2._i ))
+        value2="";
+
       const timeChange = (val, index) => {
         value[index] = moment(val, 'HH:mm:ss')
         onChange(value)

+ 7 - 0
UI/src/pages/sellmanage/keyWordManagement.js

@@ -23,6 +23,13 @@ class keyWordManagement extends Component {
         };
     }
 
+    componentWillReceiveProps(nextProps) {
+        if (!util.object.equal(nextProps.wxAppIdValue, this.state.appid)) {
+          this.setState({appid:nextProps.wxAppIdValue});
+          this.props.dispatch( {type: 'pushMessage/initMessage', payload: {} });
+        }
+      }
+
     keywordModelClick = () => {
         let self = this;
         let keywordModel = this.state.keywordModel;

+ 11 - 4
UI/src/pages/sellmanage/pushMessage/index.js

@@ -11,7 +11,9 @@ import {
 import { connect } from "dva";
 import PropTypes, { string } from 'prop-types'
 import styles from './index.less';
-import { deepClone } from "utils";
+import { deepClone,util } from "utils";
+import { Loader } from 'components';
+
 import moment from 'moment';
 import TimePicker from "../TimePicker/TimePicker";
 const { RangePicker } = DatePicker
@@ -95,6 +97,7 @@ class PushMessage extends React.Component {
     }
   }
 
+
   conTroller = (checked, key) => {
 
     var initData = this.props.pushMessage && this.props.pushMessage.initData ? this.props.pushMessage.initData : undefined;
@@ -159,7 +162,8 @@ class PushMessage extends React.Component {
 
       this.props.dispatch({ type: 'pushMessage/updateState', payload: { times: listData, initData: initData } });
     } else {
-      message.info('最多添加七个时间段');
+      this.props.dispatch({ type: 'pushMessage/message', payload: { msg: '最多添加七个时间段' } });
+      //message.info('最多添加七个时间段');
     }
   }
 
@@ -186,7 +190,8 @@ class PushMessage extends React.Component {
 
       this.props.dispatch({ type: 'pushMessage/updateState', payload: { times: listData, initData: initData } });
     } else {
-      message.info('最少保留一个时间段');
+      // message.info('最少保留一个时间段');
+      this.props.dispatch({ type: 'pushMessage/message', payload: { msg: '最少保留一个时间段' } });
     }
   }
 
@@ -418,6 +423,7 @@ class PushMessage extends React.Component {
     const { Option } = Select;
     const format = 'HH:mm:ss';
 
+    //console.log("pushMessage index-------"+JSON.stringify( self.props.pushMessage.initData));
     return (
       <div className={styles.segmentAutoReeply}>
         <div className={styles.header}>
@@ -456,7 +462,8 @@ class PushMessage extends React.Component {
              message1 = self.props.pushMessage.initData.items[key].message;
 
              if(self.state.msgComponent[key] && self.state.msgComponent[key].props.form
-              &&(self.state.msgComponent[key].props.form.getFieldValue('content')
+              &&((self.state.msgComponent[key].props.form.getFieldValue('content')
+              ||self.state.msgComponent[key].state.mediaId)
               ||self.state.msgComponent[key].props.form.getFieldValue('title')
               ||self.state.msgComponent[key].props.form.getFieldValue('miniAppTitle'))){ 
                 message1.content = self.state.msgComponent[key].props.form.getFieldValue('content')

+ 17 - 10
UI/src/pages/sellmanage/pushMessage/model.js

@@ -11,21 +11,22 @@ export default {
     test:{}
   },
   subscriptions: {
-    setup({dispatch, history}) {
-      history.listen(location => {
-        if (location.pathname.indexOf("/sellmanage/keyWordManagement") >= 0 ) {// 当进入testdemo这路由,就会触发fetchUser方法
-          dispatch( {type: 'initMessage', payload: {} });
-        }
-      })
+    // setup({dispatch, history}) {
+    //   history.listen(location => {
+    //     if (location.pathname.indexOf("/sellmanage/keyWordManagement") >= 0 ) {// 当进入testdemo这路由,就会触发fetchUser方法
+    //       dispatch( {type: 'initMessage', payload: {} });
+    //     }
+    //   })
          
-    }
+    // }
     
   },
   effects: {
     * initMessage({
         payload
       }, { put, call, select }) {
-        const { wxAppIdValue } = yield select(_ => _.app);
+        const { wxAppIdValue } = yield select(_ => _.sellmanage);
+        console.log("pushMessage 11--------------"+wxAppIdValue);
 
         try{
           const data = yield call(getData, {appId:wxAppIdValue});
@@ -70,7 +71,7 @@ export default {
           //   },
           // })
         }catch (e) {
-        
+          console.log("pushMessage -------"+e);
         }
       }
       ,
@@ -88,7 +89,13 @@ export default {
       }catch (e) {
           console.log(e)
       }
-    }
+    },
+    
+    * message({
+      payload
+    }, { put, call, select }) {
+      message.info(payload.msg);
+    },
   },
   reducers: {
     updateState(state, { payload }) {

+ 1 - 1
UI/src/utils/config.js

@@ -3,7 +3,7 @@ const APIV2 = '/api/v2'
 const APIV3 = 'http://192.168.50.32:8004'
 const APIV4 = 'http://192.168.50.32:8005'
 
-const APIV3Auth = 'http://localhost:13001/oauth2T'
+const APIV3Auth = 'http://192.168.50.32:13001/oauth2'
 // const WXAPIV5= 'http://192.168.50.32:7000'
 // const WXMpAPI= 'http://192.168.50.32:13001/mpwechat'
 // const staticMpAPI = 'http://192.168.50.32:8081'