fix wechatqrcode/scan 页面显示内容不对
This commit is contained in:
parent
be6a5d702d
commit
726f2de7e6
|
|
@ -12,7 +12,6 @@ exports.default = OakComponent({
|
|||
ticket: 1,
|
||||
url: 1,
|
||||
expired: 1,
|
||||
// buffer: 1,
|
||||
props: 1,
|
||||
expiresAt: 1,
|
||||
},
|
||||
|
|
@ -21,16 +20,21 @@ exports.default = OakComponent({
|
|||
scene: '',
|
||||
},
|
||||
data: {
|
||||
loading: true,
|
||||
loading: false,
|
||||
illegal: false,
|
||||
},
|
||||
listeners: {
|
||||
oakLoading: function (prev, next) {
|
||||
if (!!prev.oakLoading && !next.oakLoading) {
|
||||
this.setState({
|
||||
lifetimes: {
|
||||
attached: function () {
|
||||
var _this = this;
|
||||
this.setState({
|
||||
loading: true,
|
||||
});
|
||||
setTimeout(function () {
|
||||
_this.setState({
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
},
|
||||
},
|
||||
filters: [
|
||||
{
|
||||
|
|
@ -48,29 +52,29 @@ exports.default = OakComponent({
|
|||
var wechatQrCode = wechatQrCodes[0];
|
||||
if (!wechatQrCode) {
|
||||
return {
|
||||
isExist: false,
|
||||
illegal: true,
|
||||
};
|
||||
}
|
||||
var scene = decodeURIComponent(props.scene);
|
||||
var uuid = scene && (0, uuid_1.expandUuidTo36Bytes)(scene);
|
||||
if (wechatQrCode.id !== uuid) {
|
||||
return {
|
||||
isExist: false,
|
||||
illegal: true,
|
||||
};
|
||||
}
|
||||
else if (!wechatQrCode.expired) {
|
||||
if (!wechatQrCode.expired) {
|
||||
var _b = wechatQrCode.props, _c = _b.props, props_1 = _c === void 0 ? {} : _c, _d = _b.state, state = _d === void 0 ? {} : _d, pathname = _b.pathname;
|
||||
var url = pathname.substring(0, 1) === '/'
|
||||
? pathname
|
||||
: "/".concat(pathname);
|
||||
var url = pathname.substring(0, 1) === '/' ? pathname : "/".concat(pathname);
|
||||
this.redirectTo(tslib_1.__assign({ url: url }, props_1), state);
|
||||
return {
|
||||
expired: false,
|
||||
illegal: false,
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
expired: true,
|
||||
illegal: false,
|
||||
};
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
/// <reference types="react" />
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
export default function render(props: WebComponentProps<EntityDict, 'token', false, {
|
||||
oakLoading: boolean;
|
||||
isExist: boolean;
|
||||
loading: boolean;
|
||||
illegal: boolean;
|
||||
expired: boolean;
|
||||
}, {}>): JSX.Element;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
|||
var success_1 = tslib_1.__importDefault(require("../../../components/common/result/success"));
|
||||
var fail_1 = tslib_1.__importDefault(require("../../../components/common/result/fail"));
|
||||
function render(props) {
|
||||
var _a = props.data, oakLoading = _a.oakLoading, isExist = _a.isExist, expired = _a.expired;
|
||||
var _a = props.data, oakLoading = _a.oakLoading, expired = _a.expired, illegal = _a.illegal, loading = _a.loading;
|
||||
var V;
|
||||
if (oakLoading) {
|
||||
if (oakLoading || loading) {
|
||||
V = ((0, jsx_runtime_1.jsx)(success_1.default, { icon: (0, jsx_runtime_1.jsx)(icons_1.LoadingOutlined, { className: web_module_less_1.default.brand_icon }), title: "\u52A0\u8F7D\u4E2D", description: "\u6B63\u5728\u83B7\u53D6\u6570\u636E\uFF0C\u8BF7\u7A0D\u540E" }));
|
||||
}
|
||||
else if (!isExist) {
|
||||
else if (illegal) {
|
||||
V = ((0, jsx_runtime_1.jsx)(fail_1.default, { title: "\u4E8C\u7EF4\u7801\u975E\u6CD5", description: "\u62B1\u6B49\uFF0C\u8BE5\u7801\u4E0D\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u626B\u4E8C\u7EF4\u7801" }));
|
||||
}
|
||||
else if (expired) {
|
||||
|
|
|
|||
|
|
@ -1,85 +1,88 @@
|
|||
import { expandUuidTo36Bytes } from 'oak-domain/lib/utils/uuid'
|
||||
|
||||
|
||||
export default OakComponent(
|
||||
{
|
||||
entity: 'wechatQrCode',
|
||||
projection: {
|
||||
id: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
type: 1, //类型
|
||||
ticket: 1,
|
||||
url: 1,
|
||||
expired: 1,
|
||||
// buffer: 1,
|
||||
props: 1,
|
||||
expiresAt: 1,
|
||||
export default OakComponent({
|
||||
entity: 'wechatQrCode',
|
||||
projection: {
|
||||
id: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
type: 1, //类型
|
||||
ticket: 1,
|
||||
url: 1,
|
||||
expired: 1,
|
||||
props: 1,
|
||||
expiresAt: 1,
|
||||
},
|
||||
isList: true,
|
||||
properties: {
|
||||
scene: '',
|
||||
},
|
||||
data: {
|
||||
loading: false,
|
||||
illegal: false,
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this.setState({
|
||||
loading: true,
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.setState({
|
||||
loading: false,
|
||||
});
|
||||
}, 500);
|
||||
},
|
||||
isList: true,
|
||||
properties: {
|
||||
scene: '',
|
||||
},
|
||||
data: {
|
||||
loading: true,
|
||||
},
|
||||
listeners: {
|
||||
oakLoading(prev, next) {
|
||||
if (!!prev.oakLoading && !next.oakLoading) {
|
||||
this.setState({
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
filters: [
|
||||
{
|
||||
filter() {
|
||||
const scene = decodeURIComponent(this.props.scene!);
|
||||
const uuid = scene && expandUuidTo36Bytes(scene!);
|
||||
return {
|
||||
id: uuid! || 'illegal',
|
||||
};
|
||||
},
|
||||
},
|
||||
filters: [
|
||||
{
|
||||
filter() {
|
||||
const scene = decodeURIComponent(this.props.scene!);
|
||||
const uuid = scene && expandUuidTo36Bytes(scene!);
|
||||
return {
|
||||
id: uuid! || 'illegal',
|
||||
};
|
||||
},
|
||||
],
|
||||
formData: function({ data: wechatQrCodes, props }) {
|
||||
const wechatQrCode = wechatQrCodes[0];
|
||||
if (!wechatQrCode) {
|
||||
return {
|
||||
isExist: false,
|
||||
};
|
||||
}
|
||||
|
||||
const scene = decodeURIComponent(props.scene!);
|
||||
const uuid = scene && expandUuidTo36Bytes(scene!);
|
||||
if (wechatQrCode.id !== uuid) {
|
||||
return {
|
||||
isExist: false,
|
||||
};
|
||||
}
|
||||
else if (!wechatQrCode.expired) {
|
||||
const { props = {}, state = {}, pathname } = wechatQrCode!.props!;
|
||||
const url =
|
||||
pathname.substring(0, 1) === '/'
|
||||
? pathname
|
||||
: `/${pathname}`;
|
||||
|
||||
this.redirectTo(
|
||||
{
|
||||
url: url,
|
||||
...props,
|
||||
},
|
||||
state
|
||||
);
|
||||
return {
|
||||
expired: false,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
expired: true,
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
],
|
||||
formData: function ({ data: wechatQrCodes, props }) {
|
||||
const wechatQrCode = wechatQrCodes[0];
|
||||
|
||||
if (!wechatQrCode) {
|
||||
return {
|
||||
illegal: true,
|
||||
};
|
||||
}
|
||||
|
||||
const scene = decodeURIComponent(props.scene!);
|
||||
const uuid = scene && expandUuidTo36Bytes(scene!);
|
||||
if (wechatQrCode.id !== uuid) {
|
||||
return {
|
||||
illegal: true,
|
||||
};
|
||||
}
|
||||
|
||||
if (!wechatQrCode.expired) {
|
||||
const { props = {}, state = {}, pathname } = wechatQrCode!.props!;
|
||||
const url =
|
||||
pathname.substring(0, 1) === '/' ? pathname : `/${pathname}`;
|
||||
|
||||
this.redirectTo(
|
||||
{
|
||||
url: url,
|
||||
...props,
|
||||
},
|
||||
state
|
||||
);
|
||||
return {
|
||||
expired: false,
|
||||
illegal: false,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
expired: true,
|
||||
illegal: false,
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<text class="desc">正在获取数据,请稍后</text>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif="{{!isExist}}">
|
||||
<block wx:elif="{{illegal}}">
|
||||
<view class="circle-view">
|
||||
<l-icon name="error" size="120" />
|
||||
<text class="text">二维码非法</text>
|
||||
|
|
|
|||
|
|
@ -16,17 +16,17 @@ export default function render(
|
|||
'token',
|
||||
false,
|
||||
{
|
||||
oakLoading: boolean;
|
||||
isExist: boolean;
|
||||
loading: boolean;
|
||||
illegal: boolean;
|
||||
expired: boolean;
|
||||
},
|
||||
{}
|
||||
>
|
||||
) {
|
||||
const { oakLoading, isExist, expired } = props.data;
|
||||
const { oakLoading, expired, illegal, loading } = props.data;
|
||||
|
||||
let V;
|
||||
if (oakLoading) {
|
||||
if (oakLoading || loading) {
|
||||
V = (
|
||||
<Success
|
||||
icon={<LoadingOutlined className={Style.brand_icon} />}
|
||||
|
|
@ -34,7 +34,7 @@ export default function render(
|
|||
description="正在获取数据,请稍后"
|
||||
/>
|
||||
);
|
||||
} else if (!isExist) {
|
||||
} else if (illegal) {
|
||||
V = (
|
||||
<Fail
|
||||
title="二维码非法"
|
||||
|
|
|
|||
Loading…
Reference in New Issue