Commit c007c73a authored by wangxuelai's avatar wangxuelai

'消息推送功能'

parent 85c724c2
......@@ -13,10 +13,10 @@
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=XSZBZ-5LHCV-5I2P7-UQHPW-6456F-JBB3B"></script>
<script src="/js/ueeditor/ueditor.config.js?20200107" charset="utf-8"></script><script src="/js/ueeditor/ueditor.all.js?20200107" charset="utf-8"></script>
<script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/console-polyfill.js?20200107" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es6-shim.min.js?20200107" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-shim.js?20200107" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-sham.min.js?20200107" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/json3.min.js?20200107" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/html5shiv.min.js?20200107" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/polyfill.js?20200107" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/lib/vendor.dll.js?20200107" charset="utf-8"></script>
<script src="js/console-polyfill.js?20200107" charset="utf-8"></script><script src="js/es6-shim.min.js?20200107" charset="utf-8"></script><script src="js/es5-shim.js?20200107" charset="utf-8"></script><script src="js/es5-sham.min.js?20200107" charset="utf-8"></script><script src="js/json3.min.js?20200107" charset="utf-8"></script><script src="js/html5shiv.min.js?20200107" charset="utf-8"></script><script src="js/polyfill.js?20200107" charset="utf-8"></script><script src="lib/vendor.dll.js?20200107" charset="utf-8"></script>
</head>
</head>
<body>
<div id="root"></div>
<script type="text/javascript" src="https://cdn.img.shangjiadao.cn/qingxiao/biz/dist/main.8f5119.js"></script></body>
<script type="text/javascript" src="/dist/main.5f823f.js"></script></body>
</html>
\ No newline at end of file
......@@ -41,6 +41,11 @@ export default {
fileTransForm: `${dakaapi}member/file_convert/create`,
fileConvertQuery: `${dakaapi}member/file_convert/query`,
editorUpload: `${dakaapi}common/editor_upload`,
bindWx: {
getPreAuthorizationUrl: `${dakaapi}member/wechat/open/get_pre_authorization_url`,
getOfficialAccount: `${dakaapi}member/wechat/open/get_official_account`,
bindToOpenPlatform: `${dakaapi}member/wechat/open/bind_to_open_platform`,
},
newLogin: {
loginPost: `${dakaapi}common/business_login`,
},
......
......@@ -210,10 +210,24 @@ export default {
},
],
},
// {
// id: '70',
// name: '直播课堂',
// key: 70,
// isFather: false,
// style: {
// width: '20px',
// height: '20px',
// },
// activeurl: `${__IMGCDN__}menu/live.png?v=1`,
// notactiveurl: `${__IMGCDN__}menu/liveactive.png`,
// path: '/sjd/liveClass',
// relativePath: ['/sjd/liveClass', '/sjd/addLive', '/sjd/editLive/:id'],
// },
{
id: '70',
name: '直播课堂',
key: 70,
id: '80',
name: '公众号消息推送配置',
key: 80,
isFather: false,
style: {
width: '20px',
......@@ -221,8 +235,8 @@ export default {
},
activeurl: `${__IMGCDN__}menu/live.png?v=1`,
notactiveurl: `${__IMGCDN__}menu/liveactive.png`,
path: '/sjd/liveClass',
relativePath: ['/sjd/liveClass', '/sjd/addLive', '/sjd/editLive/:id'],
path: '/sjd/pushsetting',
relativePath: ['/sjd/pushsetting'],
},
],
};
......@@ -61,6 +61,7 @@ import createmarke from './createmarke';
import newthemelist from './newthemelist';
import clockmember from './clockmember';
import common from './common';
import pushsetting from './pushsetting';
export default {
loginModel,
indexstaicModel,
......@@ -116,4 +117,5 @@ export default {
newthemelist,
clockmember,
common,
pushsetting,
};
import { routerRedux } from 'dva/router';
import { message } from 'antd';
import { delay } from 'redux-saga';
import {
LocalStorage,
SessionStorage,
isExpired,
getRandomString,
} from '../utils/index';
import errorcode from '../common/errorcode';
import * as pushSettingAjax from '../services/pushsetting';
export default {
namespace: 'pushsetting',
state: {
isEmpty: true,
wxInfo: {
title: '',
created_at: '',
logo: '',
},
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
},
},
effects: {
* gobindwx({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const data = yield call(pushSettingAjax.getPreAuthorizationUrl, {
school_id: sid,
});
if (data.code == 200) {
window.open(data.data);
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* queryinfo({ payload }, { call, put, select }) {
const { sid, locationQuery } = yield select(state => state.webapp);
const { auth_code } = locationQuery;
if (auth_code) {
yield put(routerRedux.replace({
pathname: '/sjd/pushsetting',
}));
const bindToOpenPlatformData = yield call(pushSettingAjax.bindToOpenPlatform, {
auth_code,
school_id: sid,
});
if (bindToOpenPlatformData.code == 200) {
yield put(routerRedux.replace({
pathname: '/sjd/pushsetting',
}));
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data: bindToOpenPlatformData,
},
});
}
return;
}
const data = yield call(pushSettingAjax.getOfficialAccount, {
school_id: sid,
});
if (data.code == 200) {
yield put({
type: 'updateState',
payload: {
isEmpty: false,
wxInfo: {
title: data.data.title,
created_at: data.data.created_at,
logo: '',
},
},
});
} else if (data.code == 40000) {
yield put({
type: 'updateState',
payload: {
isEmpty: true,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
},
reducers: {
save(state, action) {
return { ...state, ...action.payload };
},
updateState(state, action) {
return { ...state, ...action.payload };
},
},
};
......@@ -1423,6 +1423,22 @@ export default {
},
});
}
if (pathname === '/sjd/pushsetting') {
dispatch({
type: 'pushsetting/queryinfo',
});
dispatch({
type: 'updateState',
payload: {
breadcrumbList: [
{
path: pathname,
name: '公众号消息推送配置',
},
],
},
});
}
const editLiveclass = pathToRegexp('/sjd/editLive/:id').exec(pathname);
if (editLiveclass) {
dispatch({
......
import React from 'react';
import { connect } from 'dva';
import qs from 'qs';
import { List, Avatar, Empty, Button } from 'antd';
import pageStyles from './index.less';
import disData from '../../common/dis.data';
import { LocalStorage, SessionStorage, pageIn } from '../../utils/index';
class PushSetting extends React.Component {
constructor(props) {
super(props);
this.state = {
};
}
componentDidMount() {
pageIn('轻校-公众号消息推送配置');
}
componentWillUnmount() {
}
goBindWx = () => {
const { dispatch } = this.props;
dispatch({
type: 'pushsetting/gobindwx',
});
}
render() {
const {
isEmpty,
wxInfo,
} = this.props;
const data = [
{
title: 'Ant Design Title 1',
},
];
return (
<div className={pageStyles.container}>
{!isEmpty &&
<List
itemLayout="horizontal"
dataSource={[wxInfo]}
renderItem={item => (
<List.Item>
<List.Item.Meta
avatar={<Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />}
title={<span>{item.title}</span>}
description={`${item.created_at}绑定`}
/>
</List.Item>
)}
/>
}
{isEmpty &&
<Empty
image="https://gw.alipayobjects.com/zos/antfincdn/ZHrcdLPrvN/empty.svg"
imageStyle={{
height: 60,
}}
description={
<span>
该校区暂未绑定自己的公众号,绑定之后可以使用自己的公众号推送
</span>
}
>
<Button type="primary" onClick={this.goBindWx}>绑定公众号</Button>
</Empty>
}
</div>
);
}
}
PushSetting.propTypes = {
};
function mapStateToProps(state) {
const {
isEmpty,
wxInfo,
} = state.pushsetting;
const { locationQuery } = state.webapp;
return {
isEmpty,
wxInfo,
};
}
export default connect(mapStateToProps)(PushSetting);
@import '../../less/variables.less';
@images: '@{imagesroot}/login/';
.container {
background-color: #fff;
border-radius: 2px;
padding: 20px;
}
\ No newline at end of file
......@@ -301,6 +301,11 @@ const ClockMember = props => (
{ ClockMember => (<ClockMember {...props} />) }
</Bundle>
);
const PushSetting = props => (
<Bundle load={() => import(/* webpackChunkName:"PushSetting" */'./pages/pushsetting/index')}>
{ PushSetting => (<PushSetting {...props} />) }
</Bundle>
);
function RouterConfig({ history }) {
return (
<ConfigProvider locale={zhCN}>
......@@ -361,6 +366,7 @@ function RouterConfig({ history }) {
<Route path="/sjd/editLive/:id" exact component={AddLive} />
<Route path="/sjd/clockList" exact component={ClockList} />
<Route path="/sjd/member/:type/:id" exact component={ClockMember} />
<Route path="/sjd/pushsetting" exact component={PushSetting} />
<Route component={Errorpage} />
</Switch>
</SjdIndex>
......
import qs from 'qs';
import request from '../utils/request';
import api from '../common/api';
// common: `${dakaapi}member/erp/classes`,
// changeClassStatus: `${dakaapi}member/erp/class/status`,
// addClassStudents: `${dakaapi}member/erp/class/student/add`,
export function getPreAuthorizationUrl(params) {
const data = qs.stringify(params);
return request({
url: `${api.bindWx.getPreAuthorizationUrl}?${data}`,
method: 'GET',
data,
});
}
export function getOfficialAccount(params) {
const data = qs.stringify(params);
return request({
url: `${api.bindWx.getOfficialAccount}?${data}`,
method: 'GET',
data,
});
}
export function bindToOpenPlatform(params) {
const data = qs.stringify(params);
return request({
url: `${api.bindWx.bindToOpenPlatform}?${data}`,
method: 'POST',
data,
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment