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
bc1e34d2
Commit
bc1e34d2
authored
Aug 04, 2021
by
zhujian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:rtyuiopk
parent
3420f33f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
src/common/js/wechatApi.js
+4
-5
src/modules/root/App.tsx
+12
-10
No files found.
src/common/js/wechatApi.js
View file @
bc1e34d2
...
@@ -14,7 +14,7 @@ import Service from '@/common/js/service';
...
@@ -14,7 +14,7 @@ import Service from '@/common/js/service';
export
default
class
WechatApi
{
export
default
class
WechatApi
{
static
async
initConfig
(
params
=
{
isAgentConfig
:
false
,
url
:
''
})
{
static
async
initConfig
(
params
=
{
isAgentConfig
:
false
,
url
:
''
})
{
if
(
Platform
.
isWorkWx
())
{
if
(
Platform
.
isWorkWx
())
{
return
Service
.
Hades
(
'anon/hades/getWxCorpJSAPISignature'
,
{
return
Service
.
Hades
(
'anon/hades/getWxCorpJSAPISignature'
,
{
storeId
:
User
.
getStoreId
(),
storeId
:
User
.
getStoreId
(),
url
:
params
.
url
,
url
:
params
.
url
,
...
@@ -29,7 +29,6 @@ export default class WechatApi {
...
@@ -29,7 +29,6 @@ export default class WechatApi {
signature
:
res
.
signature
,
// 必填,签名,见 附录-JS-SDK使用权限签名算法
signature
:
res
.
signature
,
// 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList
:
[
'chooseImage'
,
'shareToExternalContact'
,
'selectExternalContact'
,
'selectEnterpriseContact'
],
jsApiList
:
[
'chooseImage'
,
'shareToExternalContact'
,
'selectExternalContact'
,
'selectEnterpriseContact'
],
}).
then
(()
=>
{
}).
then
(()
=>
{
if
(
params
.
isAgentConfig
)
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
Service
.
Hades
(
'anon/hades/getWxWorkJSAPISignature'
,
{
Service
.
Hades
(
'anon/hades/getWxWorkJSAPISignature'
,
{
storeId
:
User
.
getStoreId
(),
storeId
:
User
.
getStoreId
(),
...
@@ -56,14 +55,14 @@ export default class WechatApi {
...
@@ -56,14 +55,14 @@ export default class WechatApi {
});
});
});
});
});
});
}
})
})
});
});
}
else
{
}
else
{
if
(
params
.
isAgentConfig
)
{
if
(
params
.
isAgentConfig
)
{
console
.
log
(
32132132
,
'cesgu'
)
console
.
log
(
32132132
,
'cesgu'
)
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
Service
.
Hades
(
'anon/hades/getWxWorkJSAPISignature'
,
{
Service
.
Hades
(
'anon/hades/getWxWorkJSAPISignature'
,
{
storeId
:
User
.
getStoreId
(),
storeId
:
User
.
getStoreId
(),
...
...
src/modules/root/App.tsx
View file @
bc1e34d2
...
@@ -29,7 +29,7 @@ declare var window: any;
...
@@ -29,7 +29,7 @@ declare var window: any;
const
App
:
React
.
FC
=
(
props
:
any
)
=>
{
const
App
:
React
.
FC
=
(
props
:
any
)
=>
{
const
[
storeUserId
,
setStoreUserId
]
=
useState
(
''
)
const
[
storeUserId
,
setStoreUserId
]
=
useState
(
''
)
const
ctx
:
any
=
useContext
(
XMContext
);
const
ctx
:
any
=
useContext
(
XMContext
);
const
[
versionInfo
,
setVersionInfo
]
=
useState
<
VersionInfo
|
null
>
(
null
)
const
[
versionInfo
,
setVersionInfo
]
=
useState
<
VersionInfo
|
null
>
(
null
)
const
userId
=
User
.
getUserId
();
const
userId
=
User
.
getUserId
();
const
[
menuType
,
setMenuType
]
=
useState
(
true
);
const
[
menuType
,
setMenuType
]
=
useState
(
true
);
const
enterpriseId
=
User
.
getEnterpriseId
();
const
enterpriseId
=
User
.
getEnterpriseId
();
...
@@ -47,8 +47,10 @@ const App: React.FC = (props: any) => {
...
@@ -47,8 +47,10 @@ const App: React.FC = (props: any) => {
}
}
},
[])
},
[])
async
function
initWechatConfig
()
{
async
function
initWechatConfig
()
{
WechatApi
.
initConfig
({
isAgentConfig
:
true
,
url
:
window
.
location
.
href
.
split
(
'#'
)[
0
]
})
WechatApi
.
initConfig
({
isAgentConfig
:
true
,
url
:
window
.
location
.
href
.
split
(
'#'
)[
0
]
}).
then
(()
=>
{
}
console
.
log
(
'注册完成'
)
})
}
useEffect
(()
=>
{
useEffect
(()
=>
{
getStorePermission
();
getStorePermission
();
},
[
window
.
location
.
hash
])
},
[
window
.
location
.
hash
])
...
@@ -70,7 +72,7 @@ const App: React.FC = (props: any) => {
...
@@ -70,7 +72,7 @@ const App: React.FC = (props: any) => {
let
version
=
res
.
result
;
let
version
=
res
.
result
;
User
.
setVersion
(
version
);
User
.
setVersion
(
version
);
User
.
setExpirationTime
(
res
.
result
.
validEndTime
)
User
.
setExpirationTime
(
res
.
result
.
validEndTime
)
let
versioninfo
:
VersionInfo
=
{
let
versioninfo
:
VersionInfo
=
{
dayTime
:
version
.
dayTime
,
dayTime
:
version
.
dayTime
,
stateEnum
:
version
.
stateEnum
,
stateEnum
:
version
.
stateEnum
,
userNum
:
version
.
userNum
===
-
1
?
'不限人数'
:
version
.
userNum
,
userNum
:
version
.
userNum
===
-
1
?
'不限人数'
:
version
.
userNum
,
...
@@ -91,28 +93,28 @@ const App: React.FC = (props: any) => {
...
@@ -91,28 +93,28 @@ const App: React.FC = (props: any) => {
}
}
function
getStoreInfo
()
{
function
getStoreInfo
()
{
console
.
log
(
"currentStoreUserInfo"
,
window
.
currentStoreUserInfo
);
console
.
log
(
"currentStoreUserInfo"
,
window
.
currentStoreUserInfo
);
const
params
=
{
const
params
=
{
storeId
:
User
.
getStoreId
(),
storeId
:
User
.
getStoreId
(),
userId
:
User
.
getUserId
(),
userId
:
User
.
getUserId
(),
};
};
Service
.
Hades
(
'public/customerHades/getStoreAndUserMsg'
,
params
).
then
((
res
)
=>
{
Service
.
Hades
(
'public/customerHades/getStoreAndUserMsg'
,
params
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
const
{
id
,
storeUserId
,
storeName
,
userRole
,
storeType
}
=
res
.
result
;
const
{
id
,
storeUserId
,
storeName
,
userRole
,
storeType
}
=
res
.
result
;
User
.
setStoreId
(
id
);
User
.
setStoreId
(
id
);
User
.
setStoreUserId
(
storeUserId
);
User
.
setStoreUserId
(
storeUserId
);
User
.
setStoreName
(
storeName
);
User
.
setStoreName
(
storeName
);
Bus
.
trigger
(
'storeNameChange'
,
storeName
);
Bus
.
trigger
(
'storeNameChange'
,
storeName
);
User
.
setUserRole
(
userRole
);
User
.
setUserRole
(
userRole
);
User
.
setStoreType
(
storeType
);
User
.
setStoreType
(
storeType
);
setCurrentStoreUserInfo
(
id
,
storeUserId
)
setCurrentStoreUserInfo
(
id
,
storeUserId
)
setStoreUserId
(
storeUserId
);
setStoreUserId
(
storeUserId
);
getUserPermission
();
getUserPermission
();
}
}
})
})
}
}
function
setCurrentStoreUserInfo
(
storeId
:
any
,
storeUserId
:
any
)
{
function
setCurrentStoreUserInfo
(
storeId
:
any
,
storeUserId
:
any
)
{
window
.
currentStoreUserInfo
.
storeId
=
storeId
;
window
.
currentStoreUserInfo
.
storeId
=
storeId
;
window
.
currentStoreUserInfo
.
storeUserId
=
storeUserId
;
window
.
currentStoreUserInfo
.
storeUserId
=
storeUserId
;
window
.
currentStoreUserInfo
.
userId
=
User
.
getUserId
();
window
.
currentStoreUserInfo
.
userId
=
User
.
getUserId
();
...
@@ -138,7 +140,7 @@ const App: React.FC = (props: any) => {
...
@@ -138,7 +140,7 @@ const App: React.FC = (props: any) => {
Bus
.
trigger
(
'storeNameChange'
,
storeName
);
Bus
.
trigger
(
'storeNameChange'
,
storeName
);
User
.
setUserRole
(
userRole
);
User
.
setUserRole
(
userRole
);
User
.
setStoreType
(
storeType
);
User
.
setStoreType
(
storeType
);
setCurrentStoreUserInfo
(
id
,
storeUserId
);
setCurrentStoreUserInfo
(
id
,
storeUserId
);
ctx
.
dispatch
(
setStoreGroupList
(
storeGroupVOS
))
ctx
.
dispatch
(
setStoreGroupList
(
storeGroupVOS
))
ctx
.
dispatch
(
setStoreList
(
storeVOS
));
ctx
.
dispatch
(
setStoreList
(
storeVOS
));
setStoreUserId
(
storeUserId
)
setStoreUserId
(
storeUserId
)
...
...
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