Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
bc884b52
Commit
bc884b52
authored
Jul 27, 2021
by
zhujian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
8f65ca47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
43 deletions
+8
-43
src/core/wechatApi.js
+0
-40
src/modules/root/App.tsx
+8
-3
No files found.
src/core/wechatApi.js
deleted
100644 → 0
View file @
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
src/modules/root/App.tsx
View file @
bc884b52
...
...
@@ -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
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment