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
1ddf400f
Commit
1ddf400f
authored
Jul 27, 2021
by
zhujian
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature/zhujian/0416/test' into feature/zhujian/0726/qwLiving
parents
c56dcfa0
ffc1f82e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
274 additions
and
5 deletions
+274
-5
src/core/global.less
+21
-0
src/core/platform.js
+44
-0
src/core/wechatApi.js
+38
-0
src/index.html
+2
-0
src/modules/course-manage/components/CerateQWCourse.tsx
+149
-0
src/modules/course-manage/components/LiveCourseOpt.jsx
+15
-3
src/modules/root/App.tsx
+2
-0
src/modules/root/WechatLogin.tsx
+3
-2
No files found.
src/core/global.less
View file @
1ddf400f
...
...
@@ -1698,4 +1698,24 @@ input:focus {
.ant-tag-blue{
background: transparent !important;
}
.createQWCourse{
.footer {
position: fixed;
bottom: 0;
height: 58px;
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
padding-right: 252px;
background: #fff;
border-top: 1px solid #E8E8E8;
z-index: 999;
.ant-btn {
margin-left: 10px;
}
}
}
\ No newline at end of file
src/core/platform.js
0 → 100644
View file @
1ddf400f
module
.
exports
=
{
isWeiXin
()
{
const
ua
=
navigator
.
userAgent
.
toLowerCase
();
return
ua
.
indexOf
(
'micromessenger'
)
>
0
;
},
isWorkWx
(){
return
/wxwork/i
.
test
(
navigator
.
userAgent
)
},
isAlipay
()
{
const
ua
=
navigator
.
userAgent
.
toLowerCase
();
return
ua
.
indexOf
(
'aliapp'
)
>
0
||
ua
.
indexOf
(
'alipay'
)
>
0
;
},
isXiaoMaiApp
()
{
const
ua
=
navigator
.
userAgent
.
toLowerCase
();
return
ua
.
match
(
/xiaomai_ios/i
)
===
'xiaomai_ios'
||
ua
.
match
(
/xiaomai_android/i
)
===
'xiaomai_android'
;
},
isXiaoMaiIOSApp
()
{
const
ua
=
navigator
.
userAgent
.
toLowerCase
();
return
ua
.
match
(
/xiaomai_ios/i
)
===
'xiaomai_ios'
;
},
isXiaoMaiAndroidApp
()
{
const
ua
=
navigator
.
userAgent
.
toLowerCase
();
return
ua
.
match
(
/xiaomai_android/i
)
===
'xiaomai_android'
;
},
isAndroid
()
{
const
ua
=
navigator
.
userAgent
.
toLowerCase
();
return
/android/i
.
test
(
ua
);
},
isIOS
()
{
const
ua
=
navigator
.
userAgent
.
toLowerCase
();
return
/iphone|ipad|ipod/i
.
test
(
ua
);
},
isMeiKe
()
{
const
ua
=
navigator
.
userAgent
.
toLowerCase
();
return
/xmappc/i
.
test
(
ua
);
},
};
\ No newline at end of file
src/core/wechatApi.js
0 → 100644
View file @
1ddf400f
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'
],
success
:
function
(
res
)
{
console
.
log
(
res
,
'agentConfig'
)
},
fail
:
function
(
res
)
{
console
.
log
(
res
,
' agentConfig 错误'
)
if
(
res
.
errMsg
.
indexOf
(
'function not exist'
)
>
-
1
){
alert
(
'版本过低请升级'
)
}
},
complete
:(
res
)
=>
{
console
.
log
(
res
,
' agentConfig 错误'
)
}
}
console
.
log
(
conf
)
wx
.
agentConfig
(
conf
);
});
// }
}
}
\ No newline at end of file
src/index.html
View file @
1ddf400f
...
...
@@ -47,6 +47,8 @@
<script
type=
"text/javascript"
src=
"https://image.xiaomaiketang.com/xm/PhotoClip.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
src=
"//g.alicdn.com/sd/ncpc/nc.js?t=2015052012"
></script>
<script
type=
"text/javascript"
src=
"https://xiaomai-js.oss-cn-hangzhou.aliyuncs.com/loghub-xm-0.0.1-beta.js"
></script>
<script
src=
"https://res.wx.qq.com/open/js/jweixin-1.2.0.js"
></script>
<script
src=
"https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"
></script>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
...
...
src/modules/course-manage/components/CerateQWCourse.tsx
0 → 100644
View file @
1ddf400f
import
React
,
{
useState
,
useRef
,
useEffect
,
useContext
}
from
'react'
import
{
Route
,
withRouter
}
from
'react-router-dom'
;
import
Breadcrumbs
from
"@/components/Breadcrumbs"
;
import
moment
from
'moment'
import
{
LIVE_SHARE
}
from
"@/domains/course-domain/constants"
;
import
{
Form
,
Alert
,
Input
,
Button
,
InputNumber
,
DatePicker
,
Select
,
Radio
,
message
,
Modal
}
from
'antd'
;
import
Service
from
"@/common/js/service"
;
import
User
from
"@/common/js/user"
;
import
qrcode
from
"@/libs/qrcode/qrcode.js"
;
declare
var
wx
:
any
;
const
{
Option
}
=
Select
;
const
courseType
=
{
0
:
'通用直播'
,
1
:
'小班课'
,
2
:
'大班课'
,
3
:
'企业培训'
,
4
:
'活动直播'
}
function
CerateQWCourse
(
props
:
any
)
{
const
[
courseName
,
setCourseName
]
=
useState
(
''
);
const
[
liveDuration
,
setLiveDuration
]
=
useState
(
60
);
const
[
liveStart
,
setLiveStart
]
=
useState
(
0
);
const
[
type
,
setType
]
=
useState
(
'0'
);
function
handleSave
()
{
const
param
=
{
courseName
,
description
:
'直播的简介,最多支持300个字节直播的简介,最多支持300个字节直播的简介,最多支持300个字节直播的简介,最多支持300个字节直播的简介,最多支持300个字节直播的简介,最多支持300个字节'
,
liveDuration
:
liveDuration
*
60
*
100
,
liveStart
,
remindTime
:
1000
*
60
*
10
,
storeId
:
User
.
getStoreId
(),
storeUserId
:
User
.
getStoreUserId
(),
type
:
parseInt
(
type
)
}
Service
.
Hades
(
'anon/hades/wxWorkCreateLiveDemo'
,
param
).
then
((
res
)
=>
{
console
.
log
(
22
)
handleConvertShortUrl
(
res
.
result
)
wx
.
invoke
(
'startLiving'
,
{
"livingId"
:
res
.
result
,
},
function
(
res
:
any
)
{
console
.
log
(
122
,
res
)
if
(
res
.
err_msg
==
"startLiving:ok"
)
{
// livingId = res.livingId;
}
});
})
}
function
handleConvertShortUrl
(
id
:
any
)
{
const
longUrl
=
`
${
LIVE_SHARE
}
qw/live/
${
id
}
?id=
${
User
.
getStoreId
()}
`
console
.
log
(
longUrl
)
// 发请求
Service
.
Sales
(
'public/businessShow/convertShortUrls'
,
{
urls
:
[
longUrl
]
}).
then
((
res
)
=>
{
const
{
result
=
[]
}
=
res
;
const
qrcodeWrapDom
:
any
=
document
.
querySelector
(
'.qrcode'
);
qrcodeWrapDom
.
innerHTML
=
''
const
qrcodeNode
=
new
qrcode
({
text
:
result
[
0
].
shortUrl
,
size
:
100
,
});
(
qrcodeWrapDom
as
any
).
appendChild
(
qrcodeNode
);
})
}
return
<
div
className=
"page createQWCourse "
>
<
Breadcrumbs
navList=
{
props
.
type
===
'edit'
?
"编辑考试"
:
"新建直播课"
}
goBack=
{
props
.
history
.
goBack
}
/>
<
div
className=
"box"
>
<
div
className=
"form"
>
<
div
className=
"title"
>
直播信息
</
div
>
<
Form
labelCol=
{
{
span
:
3
}
}
wrapperCol=
{
{
span
:
14
}
}
layout=
"horizontal"
>
<
Form
.
Item
label=
"课程名称"
required
>
<
Input
value=
{
courseName
}
onChange=
{
(
e
)
=>
{
setCourseName
(
e
.
target
.
value
)
}
}
style=
{
{
width
:
200
}
}
></
Input
>
</
Form
.
Item
>
<
Form
.
Item
label=
"持续时长"
required
>
<
InputNumber
value=
{
liveDuration
}
max=
{
1440
}
min=
{
1
}
onChange=
{
(
value
:
any
)
=>
{
setLiveDuration
(
parseInt
(
value
)
as
any
)
}
}
style=
{
{
width
:
100
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"开始时间"
required
>
<
DatePicker
format=
"YYYY/MM/DD HH:mm"
value=
{
liveStart
?
moment
(
Number
(
liveStart
))
:
null
}
style=
{
{
width
:
200
}
}
placeholder=
"开始时间"
showTime
onChange=
{
(
date
:
any
)
=>
{
setLiveStart
(
date
?
date
.
valueOf
()
:
0
)
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"直播的类型"
required
>
<
Select
value=
{
type
}
placeholder=
"请选直播的类型"
style=
{
{
width
:
200
}
}
onChange=
{
(
val
)
=>
{
setType
(
val
)
}
}
>
{
Object
.
keys
(
courseType
).
map
((
key
:
any
)
=>
{
return
<
Option
value=
{
key
}
>
{
(
courseType
as
any
)[
key
]
}
</
Option
>
})
}
</
Select
>
</
Form
.
Item
>
</
Form
>
</
div
>
</
div
>
<
div
style=
{
{
marginTop
:
100
}
}
className=
"qrBox"
>
<
div
style=
{
{
width
:
100
,
margin
:
'0 auto'
}
}
className=
"qrcode"
></
div
>
</
div
>
<
div
className=
"footer"
>
<
Button
onClick=
{
props
.
history
.
goBack
}
>
取消
</
Button
>
<
Button
type=
"primary"
onClick=
{
handleSave
}
>
保存
</
Button
>
</
div
>
</
div
>
}
export
default
withRouter
(
CerateQWCourse
);
\ No newline at end of file
src/modules/course-manage/components/LiveCourseOpt.jsx
View file @
1ddf400f
...
...
@@ -9,8 +9,10 @@
import
React
from
'react'
;
import
{
Button
,
Modal
,
message
}
from
'antd'
;
import
Service
from
'@/common/js/service'
;
import
{
withRouter
,
Route
}
from
"react-router-dom"
;
import
'./liveCourseOpt.less'
;
import
BaseService
from
"@/domains/basic-domain/baseService"
;
import
CerateQWCourse
from
'./CerateQWCourse'
import
User
from
'@/common/js/user'
class
LiveCourseOpt
extends
React
.
Component
{
constructor
(
props
)
{
...
...
@@ -25,6 +27,13 @@ class LiveCourseOpt extends React.Component {
pathname
:
'/create-live-course?type=add'
,
})
}
handleCreateQWCouese
=
()
=>
{
const
{
match
}
=
this
.
props
;
this
.
props
.
history
.
push
(
`
${
match
.
url
}
/createqwcourse`
)
}
// 下载直播客户端
handleDownloadClient
=
()
=>
{
const
{
isMac
}
=
this
.
state
;
...
...
@@ -47,17 +56,20 @@ class LiveCourseOpt extends React.Component {
}
render
()
{
const
userRole
=
User
.
getUserRole
();
const
{
match
}
=
this
.
props
;
return
(
<
div
className=
"live-course-opt"
>
<
div
className=
"opt__left"
>
{
userRole
!==
"CloudLecturer"
&&
<
Button
type=
"primary"
onClick=
{
this
.
handleCreateLiveCouese
}
>
新建直播课
</
Button
>
}
<
Button
onClick=
{
this
.
handleDownloadClient
}
>
下载直播客户端
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
handleCreateQWCouese
}
>
新建企微直播课
</
Button
>
{
!
this
.
state
.
isMac
&&
<
Button
onClick=
{
this
.
handleDownloadClient
}
>
下载直播客户端
</
Button
>
}
</
div
>
<
Route
path=
{
`${match.url}/createqwcourse`
}
component=
{
CerateQWCourse
}
/>
</
div
>
)
}
}
export
default
LiveCourseOpt
;
\ No newline at end of file
export
default
withRouter
(
LiveCourseOpt
);
\ No newline at end of file
src/modules/root/App.tsx
View file @
1ddf400f
...
...
@@ -16,6 +16,7 @@ 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
{
setStoreGroupPermission
,
setStorePermission
,
setStoreGroupList
,
setStoreList
}
from
'@/store/actions/index'
;
import
Service
from
"@/common/js/service"
;
import
Bus
from
'@/core/tbus'
;
...
...
@@ -36,6 +37,7 @@ const App: React.FC = (props: any) => {
useEffect
(()
=>
{
WechatApi
.
initShareConfig
();
getStoreAndUserInfo
();
getVersion
();
if
(
window
.
location
.
hash
===
"#/"
)
{
...
...
src/modules/root/WechatLogin.tsx
View file @
1ddf400f
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
;
import
qrcode
from
'@/libs/qrcode/qrcode.js'
;
import
Service
from
'@/common/js/service'
;
import
Service
from
"@/common/js/service"
;
import
User
from
'@/common/js/user'
;
import
qrcode
from
"@/libs/qrcode/qrcode.js"
;
import
{
PATH
}
from
'@/domains/basic-domain/constants'
;
import
'./WechatLogin.less'
;
const
Logo
=
require
(
'@/common/images/logo.png'
);
declare
var
location
:
any
;
declare
var
window
:
any
;
export
default
function
WechatLogin
(
props
:
any
)
{
const
freshTime
=
60
;
const
init
:
any
=
null
;
...
...
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