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
f1f3bede
Commit
f1f3bede
authored
Aug 04, 2021
by
zhujian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
5c312a53
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
46 deletions
+49
-46
src/components/WWOpenData.jsx
+11
-0
src/components/WWOpenDataCom.jsx
+10
-8
src/modules/root/App.tsx
+3
-13
src/modules/root/CollegeManagePage.jsx
+25
-25
No files found.
src/components/WWOpenData.jsx
0 → 100644
View file @
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
src/components/WWOpenDataCom.jsx
View file @
f1f3bede
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
(()
=>
{
console
.
log
(
'1111'
);
return
ctx
.
xmState
.
wechatLogin
?
<
WWOpenData
{
...
props
}
/>
:
<
div
></
div
>
console
.
log
(
WWOpenData
);
WWOpenData
&&
WWOpenData
.
bind
(
ref
.
current
)
})
return
<
ww
-
open
-
data
ref=
{
ref
}
type=
{
type
}
openid=
{
openid
}
/>
}
}
\ No newline at end of file
src/modules/root/App.tsx
View file @
f1f3bede
...
@@ -16,7 +16,7 @@ import User from '@/common/js/user';
...
@@ -16,7 +16,7 @@ import User from '@/common/js/user';
import
BaseService
from
"@/domains/basic-domain/baseService"
;
import
BaseService
from
"@/domains/basic-domain/baseService"
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
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
WechatApi
from
'@/common/js/wechatApi'
;
import
WechatApi
from
'@/common/js/wechatApi'
;
...
@@ -39,7 +39,7 @@ const App: React.FC = (props: any) => {
...
@@ -39,7 +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
({
...
@@ -49,20 +49,10 @@ const App: React.FC = (props: any) => {
...
@@ -49,20 +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
))
getStoreAndUserInfo
();
setInitWechat
(
true
)
}
})
})
setTimeout
(()
=>
{
if
(
!
initWechat
)
{
getStoreAndUserInfo
();
setInitWechat
(
true
)
}
},
1000
)
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
getStorePermission
();
getStorePermission
();
...
...
src/modules/root/CollegeManagePage.jsx
View file @
f1f3bede
...
@@ -6,7 +6,7 @@ import User from "@/common/js/user";
...
@@ -6,7 +6,7 @@ import User from "@/common/js/user";
import
{
LIVE_SHARE
}
from
"@/domains/course-domain/constants"
;
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
WWOpenDataCom
from
'@/components/WWOpenData
Com
'
;
import
WWOpenDataCom
from
'@/components/WWOpenData'
;
import
'./CollegeManagePage.less'
;
import
'./CollegeManagePage.less'
;
import
storage
from
'@/common/js/storage'
;
import
storage
from
'@/common/js/storage'
;
...
@@ -21,8 +21,8 @@ function ExpirationPopover(props) {
...
@@ -21,8 +21,8 @@ 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已过期
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
props
.
surplusDayTime
===
0
)
{
if
(
props
.
surplusDayTime
===
0
)
{
//已过期
//已过期
let
loginflag
=
storage
.
get
(
"expiration_tip_login"
)
let
loginflag
=
storage
.
get
(
"expiration_tip_login"
)
if
(
loginflag
===
null
||
loginflag
===
"true"
)
{
if
(
loginflag
===
null
||
loginflag
===
"true"
)
{
...
@@ -33,7 +33,7 @@ function ExpirationPopover(props) {
...
@@ -33,7 +33,7 @@ function ExpirationPopover(props) {
}
}
//即将过期
//即将过期
if
(
props
.
surplusDayTime
===
30
||
props
.
surplusDayTime
<=
7
)
{
if
(
props
.
surplusDayTime
===
30
||
props
.
surplusDayTime
<=
7
)
{
let
daysflag
=
storage
.
get
(
"expiration_tip"
+
User
.
getUserId
()
+
"_days"
)
let
daysflag
=
storage
.
get
(
"expiration_tip"
+
User
.
getUserId
()
+
"_days"
)
if
(
daysflag
===
null
||
daysflag
!==
moment
().
format
(
"YYYYMMDD"
))
{
if
(
daysflag
===
null
||
daysflag
!==
moment
().
format
(
"YYYYMMDD"
))
{
setShowType
(
2
)
setShowType
(
2
)
}
}
...
@@ -55,11 +55,11 @@ function ExpirationPopover(props) {
...
@@ -55,11 +55,11 @@ function ExpirationPopover(props) {
// }
// }
// }
// }
},
[
props
.
endTime
,
props
.
surplusDayTime
])
},
[
props
.
endTime
,
props
.
surplusDayTime
])
function
iknow
()
{
function
iknow
()
{
storage
.
set
(
"expiration_tip_login"
,
false
)
storage
.
set
(
"expiration_tip_login"
,
false
)
storage
.
set
(
"expiration_tip"
+
User
.
getUserId
()
+
"_days"
,
moment
().
format
(
"YYYYMMDD"
))
storage
.
set
(
"expiration_tip"
+
User
.
getUserId
()
+
"_days"
,
moment
().
format
(
"YYYYMMDD"
))
/*
/*
if (props.surplusDayTime === 0 ) {
if (props.surplusDayTime === 0 ) {
//已过期
//已过期
...
@@ -81,15 +81,15 @@ function ExpirationPopover(props) {
...
@@ -81,15 +81,15 @@ function ExpirationPopover(props) {
return
(
return
(
<>
<>
{
{
showType
===
0
?
(
""
)
:(
showType
===
0
?
(
""
)
:
(
<
div
className=
"expirationpopover"
>
<
div
className=
"expirationpopover"
>
<
div
className=
"dialog"
>
<
div
className=
"dialog"
>
<
div
className=
"title"
>
{
props
.
surplusDayTime
===
0
?
"服务已到期"
:
"服务到期提醒"
}
</
div
>
<
div
className=
"title"
>
{
props
.
surplusDayTime
===
0
?
"服务已到期"
:
"服务到期提醒"
}
</
div
>
{
{
showType
===
3
?
(
showType
===
3
?
(
<
div
className=
"tip-text"
>
当前企业购买的小麦企学院服务已于
<
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"
>
当前企业购买的小麦企学院服务
<
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
>
)
)
}
}
...
@@ -97,7 +97,7 @@ function ExpirationPopover(props) {
...
@@ -97,7 +97,7 @@ function ExpirationPopover(props) {
<
img
src=
"https://cdn.xiaomai5.com/qixueyuankehu.png"
alt=
""
></
img
>
<
img
src=
"https://cdn.xiaomai5.com/qixueyuankehu.png"
alt=
""
></
img
>
<
div
className=
"des"
>
微信/企业微信扫码咨询
</
div
>
<
div
className=
"des"
>
微信/企业微信扫码咨询
</
div
>
</
div
>
</
div
>
<
div
className=
"phone"
><
svg
style=
{
{
position
:
"relative"
,
top
:
"2px"
,
marginRight
:
"4px"
}
}
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
><
path
d=
"M512.651 3.78c-281.433 0-509.21 228.324-509.21 509.209 0 281.43 228.325 509.203 509.21 509.203 281.427 0 509.202-228.317 509.202-509.203 0.55-280.885-227.775-509.21-509.202-509.21z m198.205 743.553c-36.14 36.136-169.737 1.641-302.24-130.312-131.953-131.959-165.902-266.104-129.768-301.695 31.211-31.21 68.99-85.417 125.939-14.782 56.943 70.629 29.016 90.34-3.291 122.647-22.449 22.448 24.642 79.392 73.37 128.125 49.283 48.73 105.678 95.818 128.126 73.368 32.306-32.305 52.017-60.23 122.646-3.288 71.182 56.949 16.426 95.276-14.782 125.937z"
p
-
id=
"4409"
fill=
"#999999"
></
path
></
svg
>
<
div
className=
"phone"
><
svg
style=
{
{
position
:
"relative"
,
top
:
"2px"
,
marginRight
:
"4px"
}
}
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
><
path
d=
"M512.651 3.78c-281.433 0-509.21 228.324-509.21 509.209 0 281.43 228.325 509.203 509.21 509.203 281.427 0 509.202-228.317 509.202-509.203 0.55-280.885-227.775-509.21-509.202-509.21z m198.205 743.553c-36.14 36.136-169.737 1.641-302.24-130.312-131.953-131.959-165.902-266.104-129.768-301.695 31.211-31.21 68.99-85.417 125.939-14.782 56.943 70.629 29.016 90.34-3.291 122.647-22.449 22.448 24.642 79.392 73.37 128.125 49.283 48.73 105.678 95.818 128.126 73.368 32.306-32.305 52.017-60.23 122.646-3.288 71.182 56.949 16.426 95.276-14.782 125.937z"
p
-
id=
"4409"
fill=
"#999999"
></
path
></
svg
>
咨询电话:19157875632
</
div
>
咨询电话:19157875632
</
div
>
<
div
className=
"button"
onClick=
{
iknow
}
>
我知道了
</
div
>
<
div
className=
"button"
onClick=
{
iknow
}
>
我知道了
</
div
>
</
div
>
</
div
>
...
@@ -117,10 +117,10 @@ export default class CollegeManagePage extends React.Component {
...
@@ -117,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
,
//有效截至时间
};
};
}
}
...
@@ -134,7 +134,7 @@ export default class CollegeManagePage extends React.Component {
...
@@ -134,7 +134,7 @@ export default class CollegeManagePage extends React.Component {
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
})
})
})
}
}
...
@@ -153,7 +153,7 @@ export default class CollegeManagePage extends React.Component {
...
@@ -153,7 +153,7 @@ export default class CollegeManagePage extends React.Component {
getVersion
()
{
getVersion
()
{
BaseService
.
getLesseeVersionMsg
()
BaseService
.
getLesseeVersionMsg
()
.
then
(
res
=>
{
.
then
(
res
=>
{
User
.
setVersion
(
res
.
result
)
User
.
setVersion
(
res
.
result
)
User
.
setExpirationTime
(
res
.
result
.
validEndTime
)
User
.
setExpirationTime
(
res
.
result
.
validEndTime
)
this
.
setState
({
this
.
setState
({
...
@@ -178,13 +178,13 @@ export default class CollegeManagePage extends React.Component {
...
@@ -178,13 +178,13 @@ 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
)
=>
{
return
item
.
userRole
!==
'StoreManager'
return
item
.
userRole
!==
'StoreManager'
})
})
this
.
setState
({
createStoreList
:
createStoreList
,
joinStoreList
:
joinStoreList
})
this
.
setState
({
createStoreList
:
createStoreList
,
joinStoreList
:
joinStoreList
})
});
});
}
}
checkCollege
(
item
,
bool
)
{
checkCollege
(
item
,
bool
)
{
...
@@ -230,7 +230,7 @@ export default class CollegeManagePage extends React.Component {
...
@@ -230,7 +230,7 @@ export default class CollegeManagePage extends React.Component {
}
}
handleLogout
()
{
handleLogout
()
{
BaseService
.
logout
({
identifier
:
User
.
getIdentifier
()
}).
then
((
res
)
=>
{
BaseService
.
logout
({
identifier
:
User
.
getIdentifier
()
}).
then
((
res
)
=>
{
User
.
removeUserId
();
User
.
removeUserId
();
User
.
removeToken
();
User
.
removeToken
();
User
.
removeEnterpriseId
();
User
.
removeEnterpriseId
();
...
@@ -253,7 +253,7 @@ export default class CollegeManagePage extends React.Component {
...
@@ -253,7 +253,7 @@ export default class CollegeManagePage extends React.Component {
}
=
this
.
state
;
}
=
this
.
state
;
return
(
return
(
<
div
className=
"college-manage-page"
>
<
div
className=
"college-manage-page"
>
<
ExpirationPopover
surplusDayTime=
{
this
.
state
.
surplusDayTime
}
endTime=
{
this
.
state
.
endTime
}
/>
<
ExpirationPopover
surplusDayTime=
{
this
.
state
.
surplusDayTime
}
endTime=
{
this
.
state
.
endTime
}
/>
<
div
className=
"college-header"
>
<
div
className=
"college-header"
>
<
div
className=
"box"
>
<
div
className=
"box"
>
<
img
className=
"box-image"
src=
"https://image.xiaomaiketang.com/xm/fe4NCjr7XF.png"
/>
<
img
className=
"box-image"
src=
"https://image.xiaomaiketang.com/xm/fe4NCjr7XF.png"
/>
...
@@ -292,7 +292,7 @@ export default class CollegeManagePage extends React.Component {
...
@@ -292,7 +292,7 @@ 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
>
...
@@ -374,7 +374,7 @@ export default class CollegeManagePage extends React.Component {
...
@@ -374,7 +374,7 @@ export default class CollegeManagePage extends React.Component {
}
}
</
div
>
</
div
>
</
div
>
</
div
>
{
joinStoreList
.
length
>
0
&&
{
joinStoreList
.
length
>
0
&&
<
div
className=
"join-container"
>
<
div
className=
"join-container"
>
<
div
className=
"title-box"
>
<
div
className=
"title-box"
>
<
span
className=
"title"
>
我加入的(
{
joinStoreList
.
length
}
)
</
span
>
<
span
className=
"title"
>
我加入的(
{
joinStoreList
.
length
}
)
</
span
>
...
...
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