小程序码 根据环境使用page url
This commit is contained in:
parent
6456a7112f
commit
f68a2d9b13
|
|
@ -17,7 +17,7 @@ var uuid_2 = require("oak-domain/lib/utils/uuid");
|
|||
*/
|
||||
function createWechatQrCode(options, context) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var entity, entityId, tag, _a, permanent, props, qrCodeType, applicationId, _b, system, appId, appType, url, _c, applications, sysConfig, id, self_1, self_2, publicApp, mpApp, data, type, application, applicationType, config, _d, config2, appId_1, appSecret, wechatInstance, buffer, str, config2, appId_2, appSecret, wechatInstance, result;
|
||||
var entity, entityId, tag, _a, permanent, props, qrCodeType, applicationId, _b, system, appId, appType, url, _c, applications, sysConfig, id, self_1, self_2, publicApp, mpApp, data, type, application, applicationType, config, _d, config2, appId_1, appSecret, wechatInstance, url_1, buffer, str, config2, appId_2, appSecret, wechatInstance, result;
|
||||
return tslib_1.__generator(this, function (_e) {
|
||||
switch (_e.label) {
|
||||
case 0:
|
||||
|
|
@ -184,9 +184,12 @@ function createWechatQrCode(options, context) {
|
|||
return [3 /*break*/, 5];
|
||||
case 3:
|
||||
wechatInstance = oak_external_sdk_1.WechatSDK.getInstance(appId_1, 'wechatMp', appSecret);
|
||||
url_1 = process.env.NODE_ENV === 'development'
|
||||
? 'pages/index/index'
|
||||
: 'pages/wechatQrCode/scan/index';
|
||||
return [4 /*yield*/, wechatInstance.getMpUnlimitWxaCode({
|
||||
scene: (0, uuid_2.shrinkUuidTo32Bytes)(id),
|
||||
page: 'pages/index/index', // todo,这里用其它的页面微信服务器拒绝,因为没发布。应该是 pages/wechatQrCode/scan/index
|
||||
page: url_1, // todo,这里用其它的页面微信服务器拒绝,因为没发布。应该是 pages/wechatQrCode/scan/index
|
||||
})];
|
||||
case 4:
|
||||
buffer = _e.sent();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"navigationBarTitleText": "扫码结果",
|
||||
"usingComponents": {
|
||||
"t-icon": "../../../miniprogram_npm/tdesign/icon/icon"
|
||||
"l-icon": "../../../miniprogram_npm/lin-ui/icon/icon"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,25 +2,25 @@
|
|||
<view class="page-body">
|
||||
<block wx:if="{{oakLoading}}">
|
||||
<view class="circle-view">
|
||||
<t-icon name="loading" size="80" />
|
||||
<l-icon name="loading" size="80" />
|
||||
<text class="text">加载中</text>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif="{{!isExist}}">
|
||||
<view class="circle-view">
|
||||
<t-icon name="warning" size="80" />
|
||||
<l-icon name="warning" size="80" />
|
||||
<text class="text">二维码非法</text>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif="{{expired}}">
|
||||
<view class="circle-view">
|
||||
<t-icon name="error" size="80" />
|
||||
<l-icon name="error" size="80" />
|
||||
<text class="text">二维码已过期</text>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view class="circle-view">
|
||||
<t-icon name="loading" size="80" />
|
||||
<l-icon name="loading" size="80" />
|
||||
<text class="text">跳转中</text>
|
||||
</view>
|
||||
</block>
|
||||
|
|
|
|||
|
|
@ -223,9 +223,13 @@ export async function createWechatQrCode<ED extends EntityDict, T extends keyof
|
|||
'wechatMp',
|
||||
appSecret
|
||||
) as WechatMpInstance;
|
||||
const url =
|
||||
process.env.NODE_ENV === 'development'
|
||||
? 'pages/index/index'
|
||||
: 'pages/wechatQrCode/scan/index';
|
||||
const buffer = await wechatInstance.getMpUnlimitWxaCode({
|
||||
scene: shrinkUuidTo32Bytes(id),
|
||||
page: 'pages/index/index', // todo,这里用其它的页面微信服务器拒绝,因为没发布。应该是 pages/wechatQrCode/scan/index
|
||||
page: url, // todo,这里用其它的页面微信服务器拒绝,因为没发布。应该是 pages/wechatQrCode/scan/index
|
||||
});
|
||||
// 把arrayBuffer转成字符串返回
|
||||
const str = String.fromCharCode(...new Uint8Array(buffer));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"navigationBarTitleText": "扫码结果",
|
||||
"usingComponents": {
|
||||
"t-icon": "../../../miniprogram_npm/tdesign/icon/icon"
|
||||
"l-icon": "../../../miniprogram_npm/lin-ui/icon/icon"
|
||||
}
|
||||
}
|
||||
|
|
@ -2,25 +2,25 @@
|
|||
<view class="page-body">
|
||||
<block wx:if="{{oakLoading}}">
|
||||
<view class="circle-view">
|
||||
<t-icon name="loading" size="80" />
|
||||
<l-icon name="loading" size="80" />
|
||||
<text class="text">加载中</text>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif="{{!isExist}}">
|
||||
<view class="circle-view">
|
||||
<t-icon name="warning" size="80" />
|
||||
<l-icon name="warning" size="80" />
|
||||
<text class="text">二维码非法</text>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif="{{expired}}">
|
||||
<view class="circle-view">
|
||||
<t-icon name="error" size="80" />
|
||||
<l-icon name="error" size="80" />
|
||||
<text class="text">二维码已过期</text>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view class="circle-view">
|
||||
<t-icon name="loading" size="80" />
|
||||
<l-icon name="loading" size="80" />
|
||||
<text class="text">跳转中</text>
|
||||
</view>
|
||||
</block>
|
||||
|
|
|
|||
Loading…
Reference in New Issue