Commit f5187301 by zhanghaozhe

大咖直播预约弹窗重复

parent 87e43860
......@@ -12,6 +12,8 @@ import { withRouter } from 'react-router-dom'
@connect(state => ({user: state.user}))
class Live extends Component {
popupInstance = null
state = {
tabs: [],
lives: {},
......@@ -89,11 +91,11 @@ class Live extends Component {
saveImage = () => {
let version = getParam('version')
version = typeof version === 'string' ? version.replace('.', '').replace('.', '').slice(0, 3) : ''
const {QRCodeUrl} = this.state;
const {QRCodeUrl} = this.state
if (version && parseInt(version) < 451) {
Toast.info('当前不支持此功能,升级到最新版本app可以点击保存二维码!', 2, null, false)
} else {
SendMessageToApp('generateQRCode', QRCodeUrl);
SendMessageToApp('generateQRCode', QRCodeUrl)
}
}
......@@ -106,11 +108,12 @@ class Live extends Component {
.then(res => {
const {data} = res
if (data.errno == 200) {
this.setState(()=>({
this.setState(() => ({
QRCodeUrl: data.data.url,
}));
}))
QRCode.toDataURL(data.data.url, (err, url) => {
Popup({
if (!this.popupInstance) {
this.popupInstance = Popup({
title: '扫码关注“七月在线”服务号即可预约',
content: (
<>
......@@ -118,14 +121,16 @@ class Live extends Component {
{
browser.isAndroidApp ? (
<button className={'save-image'} onClick={this.saveImage}>保存二维码</button>
) : (
null
)
) : null
}
</>
)
),
close: () => new Promise(resolve => {
this.popupInstance = null
resolve()
})
})
}
})
} else {
Toast.info(data.msg, 2, null, false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment