Commit ffc1f82e by zhujian

'fix'

parent 4eddd878
...@@ -8,14 +8,28 @@ export default class WechatApi { ...@@ -8,14 +8,28 @@ export default class WechatApi {
const data = { url: window.location.href.split('#')[0], storeId: User.getStoreId(), } const data = { url: window.location.href.split('#')[0], storeId: User.getStoreId(), }
Service.Hades('anon/hades/getWxWorkJSAPISignature', data).then((result) => { Service.Hades('anon/hades/getWxWorkJSAPISignature', data).then((result) => {
const res = result.result; const res = result.result;
wx.config({ const conf ={
debug: false, corpid: res.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
appId: res.appId, agentid: res.agentid, // 必填,企业微信的应用id (e.g. 1000247)
timestamp: res.timestamp, timestamp: res.timestamp, // 必填,生成签名的时间戳
nonceStr: res.nonceStr, nonceStr: res.nonceStr,// 必填,生成签名的随机串
signature: res.signature, 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);
}); });
// } // }
} }
......
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/PhotoClip.js"></script> <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" 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 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> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
......
...@@ -2,9 +2,12 @@ import React, { useState, useRef, useEffect, useContext } from 'react' ...@@ -2,9 +2,12 @@ import React, { useState, useRef, useEffect, useContext } from 'react'
import { Route, withRouter } from 'react-router-dom'; import { Route, withRouter } from 'react-router-dom';
import Breadcrumbs from "@/components/Breadcrumbs"; import Breadcrumbs from "@/components/Breadcrumbs";
import moment from 'moment' 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 { Form, Alert, Input, Button, InputNumber, DatePicker, Select, Radio, message, Modal } from 'antd';
import Service from "@/common/js/service"; import Service from "@/common/js/service";
import User from "@/common/js/user"; import User from "@/common/js/user";
import qrcode from "@/libs/qrcode/qrcode.js";
declare var wx: any; declare var wx: any;
const { Option } = Select; const { Option } = Select;
...@@ -37,9 +40,12 @@ function CerateQWCourse(props: any) { ...@@ -37,9 +40,12 @@ function CerateQWCourse(props: any) {
type: parseInt(type) type: parseInt(type)
} }
Service.Hades('anon/hades/wxWorkCreateLiveDemo', param).then((res) => { Service.Hades('anon/hades/wxWorkCreateLiveDemo', param).then((res) => {
console.log(22)
handleConvertShortUrl(res.result)
wx.invoke('startLiving', { wx.invoke('startLiving', {
"livingId": res.result, "livingId": res.result,
}, function (res: any) { }, function (res: any) {
console.log(122, res)
if (res.err_msg == "startLiving:ok") { if (res.err_msg == "startLiving:ok") {
// livingId = res.livingId; // livingId = res.livingId;
} }
...@@ -47,6 +53,25 @@ function CerateQWCourse(props: any) { ...@@ -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 "> return <div className="page createQWCourse ">
<Breadcrumbs navList={props.type === 'edit' ? "编辑考试" : "新建直播课"} goBack={props.history.goBack} /> <Breadcrumbs navList={props.type === 'edit' ? "编辑考试" : "新建直播课"} goBack={props.history.goBack} />
...@@ -110,6 +135,9 @@ function CerateQWCourse(props: any) { ...@@ -110,6 +135,9 @@ function CerateQWCourse(props: any) {
</div> </div>
</div> </div>
<div style={{marginTop:100}} className="qrBox">
<div style={{width:100,margin:'0 auto'}} className="qrcode"></div>
</div>
<div className="footer"> <div className="footer">
<Button onClick={props.history.goBack}>取消</Button> <Button onClick={props.history.goBack}>取消</Button>
<Button type="primary" onClick={handleSave}>保存</Button> <Button type="primary" onClick={handleSave}>保存</Button>
......
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import qrcode from '@/core/qrcode/qrcode.js'
import Service from "@/common/js/service"; import Service from "@/common/js/service";
import User from '@/common/js/user'; import User from '@/common/js/user';
import qrcode from "@/libs/qrcode/qrcode.js";
import { PATH } from '@/domains/basic-domain/constants'; import { PATH } from '@/domains/basic-domain/constants';
import './WechatLogin.less' import './WechatLogin.less'
const Logo = require("@/common/images/logo.png") const Logo = require("@/common/images/logo.png")
declare var location: any; declare var location: any;
export default function WechatLogin(props: any) { export default function WechatLogin(props: any) {
const freshTime = 60; const freshTime = 60;
const init: any = null; const init: any = null;
......
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