Commit bc884b52 by zhujian

fix

parent 8f65ca47
import Platform from './platform';
import Service from "@/common/js/service";
import User from '@/common/js/user';
export default class WechatApi {
static initShareConfig() {
// if (Platform.isWeiXin()) {
const data = { url: window.location.href.split('#')[0], storeId: User.getStoreId(), }
Service.Hades('anon/hades/getWxWorkJSAPISignature', data).then((result) => {
const res = result.result;
const conf ={
corpid: res.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: res.agentid, // 必填,企业微信的应用id (e.g. 1000247)
timestamp: res.timestamp, // 必填,生成签名的时间戳
nonceStr: res.nonceStr,// 必填,生成签名的随机串
signature: res.signature,
jsApiList: ['startLiving','downloadLivingReplay'],
success: function(res) {
console.log('agentConfig注册成功')
console.log(res,'agentConfig')
},
fail: function(res) {
console.log(res,' agentConfig1 错误')
if(res.errMsg.indexOf('function not exist') > -1){
alert('版本过低请升级')
}
},
complete:(res)=>{
console.log(res,' agentConfig2 错误')
}
}
console.log(conf)
wx.agentConfig(conf);
});
// }
}
}
\ No newline at end of file
......@@ -16,11 +16,10 @@ import User from '@/common/js/user';
import BaseService from "@/domains/basic-domain/baseService";
import moment from 'moment';
import { VersionContext, VersionInfo, XMContext } from '@/store/context';
import WechatApi from '../../core/wechatApi';
import WechatApi from '@/common/js/wechatApi';
import { setStoreGroupPermission, setStorePermission, setStoreGroupList, setStoreList } from '@/store/actions/index';
import Service from "@/common/js/service";
import Bus from '@/core/tbus';
import { func } from 'prop-types';
const { Footer, Sider, Content } = Layout;
......@@ -37,7 +36,8 @@ const App: React.FC = (props: any) => {
useEffect(() => {
WechatApi.initShareConfig();
initWechatConfig();
getStoreAndUserInfo();
getVersion();
if (window.location.hash === "#/") {
......@@ -47,6 +47,11 @@ const App: React.FC = (props: any) => {
}
}, [])
async function initWechatConfig() {
WechatApi.initConfig({ isAgentConfig: true, url: window.location.href.split('#')[0] })
}
useEffect(() => {
getStorePermission();
}, [window.location.hash])
......
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