Commit a688575e authored by wangxuelai's avatar wangxuelai

'ss'

parent 037ccb09
...@@ -41,6 +41,7 @@ export default { ...@@ -41,6 +41,7 @@ export default {
fileTransForm: `${dakaapi}member/file_convert/create`, fileTransForm: `${dakaapi}member/file_convert/create`,
fileConvertQuery: `${dakaapi}member/file_convert/query`, fileConvertQuery: `${dakaapi}member/file_convert/query`,
editorUpload: `${dakaapi}common/editor_upload`, editorUpload: `${dakaapi}common/editor_upload`,
getfeatures: `${dakaapi}member/features`,
bindWx: { bindWx: {
getPreAuthorizationUrl: `${dakaapi}member/wechat/open/get_pre_authorization_url`, getPreAuthorizationUrl: `${dakaapi}member/wechat/open/get_pre_authorization_url`,
getOfficialAccount: `${dakaapi}member/wechat/open/get_official_account`, getOfficialAccount: `${dakaapi}member/wechat/open/get_official_account`,
......
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
} from '../utils/index'; } from '../utils/index';
import errorcode from '../common/errorcode'; import errorcode from '../common/errorcode';
import * as pushSettingAjax from '../services/pushsetting'; import * as pushSettingAjax from '../services/pushsetting';
import * as commomAjax from '../services/common';
export default { export default {
...@@ -21,6 +22,7 @@ export default { ...@@ -21,6 +22,7 @@ export default {
created_at: '', created_at: '',
logo: '', logo: '',
}, },
hasPushAuth: false,
}, },
subscriptions: { subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line setup({ dispatch, history }) { // eslint-disable-line
...@@ -69,33 +71,61 @@ export default { ...@@ -69,33 +71,61 @@ export default {
} }
return; return;
} }
const data = yield call(pushSettingAjax.getOfficialAccount, { const getfeaturesData = yield call(commomAjax.getfeatures, {
school_id: sid, school_id: sid,
}); });
if (data.code == 200) { if (getfeaturesData.code == 200) {
yield put({ const status = getfeaturesData.data.list.find(ele => ele.type == 1);
type: 'updateState', if (!status) {
payload: { yield put({
isEmpty: false, type: 'updateState',
wxInfo: { payload: {
title: data.data.title, hasPushAuth: false,
created_at: data.data.created_at,
logo: '',
}, },
}, });
}); } else {
} else if (data.code == 40000) { yield put({
yield put({ type: 'updateState',
type: 'updateState', payload: {
payload: { hasPushAuth: true,
isEmpty: true, },
}, });
}); 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,
},
});
}
}
} else { } else {
yield put({ yield put({
type: 'webapp/errorrequestresolve', type: 'webapp/errorrequestresolve',
payload: { payload: {
data, data: getfeaturesData,
}, },
}); });
} }
......
...@@ -32,6 +32,7 @@ class PushSetting extends React.Component { ...@@ -32,6 +32,7 @@ class PushSetting extends React.Component {
isEmpty, isEmpty,
wxInfo, wxInfo,
sid, sid,
hasPushAuth,
} = this.props; } = this.props;
const data = [ const data = [
{ {
...@@ -40,7 +41,7 @@ class PushSetting extends React.Component { ...@@ -40,7 +41,7 @@ class PushSetting extends React.Component {
]; ];
return ( return (
<div className={pageStyles.container}> <div className={pageStyles.container}>
{!isEmpty && {!isEmpty && hasPushAuth &&
<List <List
itemLayout="horizontal" itemLayout="horizontal"
dataSource={[wxInfo]} dataSource={[wxInfo]}
...@@ -61,7 +62,7 @@ class PushSetting extends React.Component { ...@@ -61,7 +62,7 @@ class PushSetting extends React.Component {
)} )}
/> />
} }
{isEmpty && {isEmpty && hasPushAuth &&
<Empty <Empty
image="https://gw.alipayobjects.com/zos/antfincdn/ZHrcdLPrvN/empty.svg" image="https://gw.alipayobjects.com/zos/antfincdn/ZHrcdLPrvN/empty.svg"
imageStyle={{ imageStyle={{
...@@ -76,6 +77,20 @@ class PushSetting extends React.Component { ...@@ -76,6 +77,20 @@ class PushSetting extends React.Component {
<Button type="primary" onClick={this.goBindWx}>绑定公众号</Button> <Button type="primary" onClick={this.goBindWx}>绑定公众号</Button>
</Empty> </Empty>
} }
{!hasPushAuth &&
<Empty
image="https://gw.alipayobjects.com/zos/antfincdn/ZHrcdLPrvN/empty.svg"
imageStyle={{
height: 60,
}}
description={
<span>
该校区暂未开启自定义公众号推送功能,请联系轻校客服
</span>
}
>
</Empty>
}
</div> </div>
); );
} }
...@@ -88,9 +103,11 @@ function mapStateToProps(state) { ...@@ -88,9 +103,11 @@ function mapStateToProps(state) {
const { const {
isEmpty, isEmpty,
wxInfo, wxInfo,
hasPushAuth,
} = state.pushsetting; } = state.pushsetting;
const { locationQuery, sid } = state.webapp; const { locationQuery, sid } = state.webapp;
return { return {
hasPushAuth,
isEmpty, isEmpty,
wxInfo, wxInfo,
sid, sid,
......
...@@ -111,3 +111,10 @@ export function getschooluuid(params) { ...@@ -111,3 +111,10 @@ export function getschooluuid(params) {
method: 'GET', method: 'GET',
}); });
} }
export function getfeatures(params) {
const data = qs.stringify(params);
return request({
url: `${api.getfeatures}?${data}`,
method: 'GET',
});
}
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