Commit a688575e authored by wangxuelai's avatar wangxuelai

'ss'

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