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
ffc1f82e
Commit
ffc1f82e
authored
Apr 21, 2021
by
zhujian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'fix'
parent
4eddd878
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
9 deletions
+53
-9
src/core/wechatApi.js
+21
-7
src/index.html
+2
-1
src/modules/course-manage/components/CerateQWCourse.tsx
+28
-0
src/modules/root/WechatLogin.tsx
+2
-1
No files found.
src/core/wechatApi.js
View file @
ffc1f82e
...
...
@@ -8,14 +8,28 @@ export default class WechatApi {
const
data
=
{
url
:
window
.
location
.
href
.
split
(
'#'
)[
0
],
storeId
:
User
.
getStoreId
(),
}
Service
.
Hades
(
'anon/hades/getWxWorkJSAPISignature'
,
data
).
then
((
result
)
=>
{
const
res
=
result
.
result
;
wx
.
config
({
debug
:
false
,
a
ppId
:
res
.
appId
,
timestamp
:
res
.
timestamp
,
nonceStr
:
res
.
nonceStr
,
const
conf
=
{
corpid
:
res
.
corpid
,
// 必填,企业微信的corpid,必须与当前登录的企业一致
a
gentid
:
res
.
agentid
,
// 必填,企业微信的应用id (e.g. 1000247)
timestamp
:
res
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
res
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
res
.
signature
,
jsApiList
:
[]
});
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
);
});
// }
}
...
...
src/index.html
View file @
ffc1f82e
...
...
@@ -43,7 +43,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=
"//res.wx.qq.com/open/js/jweixin-1.2.0.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
View file @
ffc1f82e
...
...
@@ -2,9 +2,12 @@ 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
;
...
...
@@ -37,9 +40,12 @@ function CerateQWCourse(props: any) {
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;
}
...
...
@@ -47,6 +53,25 @@ function CerateQWCourse(props: any) {
})
}
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
}
/>
...
...
@@ -110,6 +135,9 @@ function CerateQWCourse(props: any) {
</
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
>
...
...
src/modules/root/WechatLogin.tsx
View file @
ffc1f82e
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
;
import
qrcode
from
'@/core/qrcode/qrcode.js'
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
;
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