Commit 2e7873f7 by zhujian

fix:ghjdlkhlk

parents c5578a0b f1f3bede
import React, { useRef, useLayoutEffect } from 'react'
export default function WWOpenDataCom({ type, openid }) {
const ref = useRef(null)
useLayoutEffect(() => {
console.log('1111');
console.log(WWOpenData);
WWOpenData && WWOpenData.bind(ref.current)
})
return <ww-open-data ref={ref} type={type} openid={openid} />
}
\ No newline at end of file
import React, { useRef, useLayoutEffect } from 'react' import React, { useContext, useRef, useLayoutEffect } from 'react'
export default function WWOpenDataCom({ type, openid }) { import { XMContext } from '@/store/context';
import WWOpenData from './WWOpenData'
export default function WWOpenDataCom(props) {
const ctx = useContext(XMContext);
const ref = useRef(null) const ref = useRef(null)
useLayoutEffect(() => {
wx.ready(function () { return ctx.xmState.wechatLogin ? <WWOpenData {...props} /> : <div></div>
WWOpenData && WWOpenData.bind(ref.current)
});
})
return <ww-open-data ref={ref} type={type} openid={openid} />
} }
\ No newline at end of file
...@@ -17,7 +17,7 @@ import BaseService from "@/domains/basic-domain/baseService"; ...@@ -17,7 +17,7 @@ import BaseService from "@/domains/basic-domain/baseService";
import moment from 'moment'; import moment from 'moment';
import WechatApi from '@/common/js/wechatApi'; import WechatApi from '@/common/js/wechatApi';
import { VersionContext, VersionInfo, XMContext } from '@/store/context'; import { VersionContext, VersionInfo, XMContext } from '@/store/context';
import { setStoreGroupPermission, setStorePermission, setStoreGroupList, setStoreList } from '@/store/actions/index'; import { setStoreGroupPermission, setStorePermission, setStoreGroupList, setStoreList, setWechatLogin } from '@/store/actions/index';
import Service from "@/common/js/service"; import Service from "@/common/js/service";
import Bus from '@/core/tbus'; import Bus from '@/core/tbus';
import { func } from 'prop-types'; import { func } from 'prop-types';
...@@ -39,6 +39,7 @@ const App: React.FC = (props: any) => { ...@@ -39,6 +39,7 @@ const App: React.FC = (props: any) => {
useEffect(() => { useEffect(() => {
initWechatConfig(); initWechatConfig();
getStoreAndUserInfo();
getVersion(); getVersion();
if (window.location.hash === "#/") { if (window.location.hash === "#/") {
window.RCHistory.replace({ window.RCHistory.replace({
...@@ -48,21 +49,10 @@ const App: React.FC = (props: any) => { ...@@ -48,21 +49,10 @@ const App: React.FC = (props: any) => {
}, []) }, [])
async function initWechatConfig() { async function initWechatConfig() {
WechatApi.initConfig({ isAgentConfig: true, url: window.location.href.split('#')[0] }).then(() => { WechatApi.initConfig({ isAgentConfig: true, url: window.location.href.split('#')[0] }).then(() => {
if (!initWechat) { ctx.dispatch(setWechatLogin(true))
console.log('回调结束',new Date().valueOf())
getStoreAndUserInfo();
setInitWechat(true)
}
}) })
setTimeout(() => {
console.log('开始调用store',new Date().valueOf())
if (!initWechat) {
getStoreAndUserInfo();
setInitWechat(true)
}
}, 1000)
} }
useEffect(() => { useEffect(() => {
getStorePermission(); getStorePermission();
......
...@@ -7,7 +7,7 @@ import { LIVE_SHARE } from "@/domains/course-domain/constants"; ...@@ -7,7 +7,7 @@ import { LIVE_SHARE } from "@/domains/course-domain/constants";
import { Modal, message } from 'antd'; import { Modal, message } from 'antd';
import WechatApi from '@/common/js/wechatApi'; import WechatApi from '@/common/js/wechatApi';
import { brandLogo } from '@/domains/brand/constants' import { brandLogo } from '@/domains/brand/constants'
import WWOpenDataCom from '@/components/WWOpenDataCom'; import WWOpenDataCom from '@/components/WWOpenData';
import './CollegeManagePage.less'; import './CollegeManagePage.less';
import storage from '@/common/js/storage'; import storage from '@/common/js/storage';
...@@ -21,21 +21,6 @@ const roleMap = { ...@@ -21,21 +21,6 @@ const roleMap = {
function ExpirationPopover(props) { function ExpirationPopover(props) {
const [showType, setShowType] = useState(0); //0不显示,1剩余30天,2小于等于7天,3已过期 const [showType, setShowType] = useState(0); //0不显示,1剩余30天,2小于等于7天,3已过期
const [initWechat, setInitWechat] = useState(false);
useEffect(() => {
}, [])
async function initWechatConfig() {
WechatApi.initConfig({ isAgentConfig: true, url: window.location.href.split('#')[0] }).then(() => {
setInitWechat(true)
})
}
useEffect(() => { useEffect(() => {
if (props.surplusDayTime === 0) { if (props.surplusDayTime === 0) {
//已过期 //已过期
...@@ -102,9 +87,9 @@ function ExpirationPopover(props) { ...@@ -102,9 +87,9 @@ function ExpirationPopover(props) {
<div className="title">{props.surplusDayTime === 0 ? "服务已到期" : "服务到期提醒"}</div> <div className="title">{props.surplusDayTime === 0 ? "服务已到期" : "服务到期提醒"}</div>
{ {
showType === 3 ? ( showType === 3 ? (
<div className="tip-text">当前企业购买的{`${window.brandName}`}服务已于<span style={{ color: "#FF4F4F" }}>{moment(props.endTime).format("YYYY-MM-DD HH:mm:ss")}</span>到期,到期后仍可访问,但功能不可使用,建议尽快续费购买哦~</div> <div className="tip-text">当前企业购买的小麦企学院服务已于<span style={{ color: "#FF4F4F" }}>{moment(props.endTime).format("YYYY-MM-DD HH:mm:ss")}</span>到期,到期后仍可访问,但功能不可使用,建议尽快续费购买哦~</div>
) : ( ) : (
<div className="tip-text">当前企业购买的{`${window.brandName}`}服务 <span style={{ color: "#FF4F4F" }}>仅剩{props.surplusDayTime}</span>(于<span>{moment(props.endTime).format("YYYY-MM-DD")}</span>到期),为了不影响使用,建议尽快续费购买哦~</div> <div className="tip-text">当前企业购买的小麦企学院服务 <span style={{ color: "#FF4F4F" }}>仅剩{props.surplusDayTime}</span>(于<span>{moment(props.endTime).format("YYYY-MM-DD")}</span>到期),为了不影响使用,建议尽快续费购买哦~</div>
) )
} }
...@@ -132,10 +117,10 @@ export default class CollegeManagePage extends React.Component { ...@@ -132,10 +117,10 @@ export default class CollegeManagePage extends React.Component {
list: [], list: [],
enterpriseId: User.getEnterpriseId(), enterpriseId: User.getEnterpriseId(),
isAdmin: false, isAdmin: false,
createStoreList:[], createStoreList: [],
joinStoreList:[], joinStoreList: [],
initWechat:false, initWechat: false,
surplusDayTime:365, //剩余天数 surplusDayTime: 365, //剩余天数
endTime: 0, //有效截至时间 endTime: 0, //有效截至时间
}; };
} }
...@@ -144,16 +129,16 @@ export default class CollegeManagePage extends React.Component { ...@@ -144,16 +129,16 @@ export default class CollegeManagePage extends React.Component {
this.getStoreList(); this.getStoreList();
this.getEnterpriseUser(); this.getEnterpriseUser();
this.getVersion() this.getVersion()
} }
initWechatConfig() { initWechatConfig() {
WechatApi.initConfig({ isAgentConfig: true, url: window.location.href.split('#')[0] }).then(() => { WechatApi.initConfig({ isAgentConfig: true, url: window.location.href.split('#')[0] }).then(() => {
this.setState({initWechat:true}) this.setState({ initWechat: true })
}) })
} }
getEnterpriseUser() { getEnterpriseUser() {
const { enterpriseId } = this.state; const { enterpriseId } = this.state;
const params = { const params = {
...@@ -193,7 +178,7 @@ export default class CollegeManagePage extends React.Component { ...@@ -193,7 +178,7 @@ export default class CollegeManagePage extends React.Component {
User.setStoreUserId(mainStore.storeUserId); User.setStoreUserId(mainStore.storeUserId);
} }
this.initWechatConfig(); this.initWechatConfig();
const createStoreList = list.filter((item)=>{ const createStoreList = list.filter((item) => {
return item.userRole === 'StoreManager' return item.userRole === 'StoreManager'
}) })
const joinStoreList = list.filter((item) => { const joinStoreList = list.filter((item) => {
...@@ -307,9 +292,9 @@ export default class CollegeManagePage extends React.Component { ...@@ -307,9 +292,9 @@ export default class CollegeManagePage extends React.Component {
<span className="name"> <span className="name">
{name} {name}
{ {
initWechat && <WWOpenDataCom type="userName" openid={name}/> initWechat && <WWOpenDataCom type="userName" openid={name} />
} }
</span> </span>
</div> </div>
<div> <div>
......
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