This commit is contained in:
wenjiarui 2023-02-17 19:48:04 +08:00
parent af335ab1ca
commit 1698de7f37
16 changed files with 117 additions and 90 deletions

View File

@ -82,6 +82,7 @@ function createWechatQrCode(options, context) {
throw new Error('无法生成小程序地址码,未配置跳转前缀');
}
url = "".concat(self_2.config.qrCodePrefix, "/").concat(id);
appId = self_2.id;
appType = 'wechatMpDomainUrl';
break;
}
@ -90,6 +91,7 @@ function createWechatQrCode(options, context) {
if (self_3.type !== 'wechatMp') {
throw new Error('无法生成小程序地址码,未配置跳转前缀');
}
appId = self_3.id;
appType = 'wechatMpWxaCode';
break;
}

View File

@ -19,6 +19,13 @@ export declare type WechatMpConfig = {
appId: string;
appSecret: string;
qrCodePrefix?: string;
server?: {
url?: string;
token: string;
encodingAESKey: string;
mode: 'clear' | 'compatible' | 'safe';
dataFormat: 'json' | 'xml';
};
};
export declare type WebConfig = {
type: 'web';

View File

@ -27,7 +27,10 @@ exports.desc = {
}
},
weight: {
type: "object"
type: "varchar",
params: {
length: 24
}
},
restriction: {
type: "object"

View File

@ -5,7 +5,10 @@ var Action_1 = require("./Action");
exports.desc = {
attributes: {
channel: {
type: "object"
type: "varchar",
params: {
length: 24
}
},
applicationId: {
type: "ref",

View File

@ -10,6 +10,11 @@ import * as Role from "../Role/Schema";
import * as OperEntity from "../OperEntity/Schema";
import * as ModiEntity from "../ModiEntity/Schema";
import * as WechatQrCode from "../WechatQrCode/Schema";
export declare type RedirectToProps = {
pathname: string;
props?: Record<string, any>;
state?: Record<string, any>;
};
export declare type OpSchema = EntityShape & {
entity: "role" | string;
entityId: String<64>;
@ -23,7 +28,7 @@ export declare type OpSchema = EntityShape & {
qrCodeType: QrCodeType;
expiresAt?: Datetime | null;
expired?: Boolean | null;
redirectTo?: Object | null;
redirectTo?: RedirectToProps | null;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
@ -39,7 +44,7 @@ export declare type Schema = EntityShape & {
qrCodeType: QrCodeType;
expiresAt?: Datetime | null;
expired?: Boolean | null;
redirectTo?: Object | null;
redirectTo?: RedirectToProps | null;
granter: User.Schema;
grantee?: User.Schema | null;
role?: Role.Schema;
@ -71,7 +76,7 @@ declare type AttrFilter<E> = {
qrCodeType: Q_EnumValue<QrCodeType>;
expiresAt: Q_DateValue;
expired: Q_BooleanValue;
redirectTo: Object;
redirectTo: Q_EnumValue<RedirectToProps>;
role: Role.Filter;
};
export declare type Filter<E = Q_EnumValue<"role" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
@ -163,6 +168,8 @@ export declare type SortAttr = {
expiresAt: number;
} | {
expired: number;
} | {
redirectTo: number;
} | {
role: Role.SortAttr;
} | {

View File

@ -55,7 +55,10 @@ exports.desc = {
ref: "user"
},
qrCodeType: {
type: "object"
type: "varchar",
params: {
length: 24
}
},
expiresAt: {
type: "datetime"

View File

@ -1 +1 @@
{ "attr": { "relation": "关系", "entity": "关联对象", "entityId": "关联对象id", "type": "类型", "number": "次数", "confirmed": "已确认人数", "remark": "备注", "grantee": "领取人", "granter": "授权人", "codes": "微信码", "expired": "是否过期", "expiresAt": "过期时间", "redirectTo": "重定向页面", "qrCodeType": "二维码类型" }, "action": { "confirm": "确认" }, "v": { "type": { "grant": "授予", "transfer": "转交" } } }
{ "attr": { "relation": "关系", "entity": "关联对象", "entityId": "关联对象id", "type": "类型", "number": "次数", "confirmed": "已确认人数", "remark": "备注", "grantee": "领取人", "granter": "授权人", "codes": "微信码", "expired": "是否过期", "expiresAt": "过期时间", "redirectTo": "重定向页面", "qrCodeType": "二维码类型" }, "action": { "confirm": "确认" }, "v": { "type": { "grant": "授予", "transfer": "转交" }, "qrCodeType": { "webForWechatPublic": "网站引流到公众号", "wechatMpDomainUrl": "小程序url码", "wechatMpWxaCode": "小程序码", "wechatPublic": "公众号关注码", "wechatPublicForMp": "公众号回复小程序码" } } }

View File

@ -18,7 +18,10 @@ exports.desc = {
}
},
type: {
type: "object"
type: "varchar",
params: {
length: 24
}
},
allowShare: {
type: "boolean"

View File

@ -1 +1 @@
{ "attr": { "entity": "关联对象", "entityId": "关联对象id", "type": "类型", "allowShare": "允许分享", "tag": "tag", "ticket": "ticket", "url": "url", "permanent": "是否永久码", "buffer": "小程序码数据(动态)", "expired": "是否过期", "expiresAt": "过期时间", "application": "应用", "props": "属性" } }
{ "attr": { "entity": "关联对象", "entityId": "关联对象id", "type": "类型", "allowShare": "允许分享", "tag": "tag", "ticket": "ticket", "url": "url", "permanent": "是否永久码", "buffer": "小程序码数据(动态)", "expired": "是否过期", "expiresAt": "过期时间", "application": "应用", "props": "属性" }, "v": { "type": { "webForWechatPublic": "网站引流到公众号", "wechatMpDomainUrl": "小程序url码", "wechatMpWxaCode": "小程序码", "wechatPublic": "公众号关注码", "wechatPublicForMp": "公众号回复小程序码" } } }

View File

@ -11,7 +11,7 @@
justify-content: center;
align-items: center;
box-sizing: border-box;
background-color: @bg-color-block;
background-color: @oak-bg-color-container;
.safe-area-inset-bottom();
}

View File

@ -1,13 +1,5 @@
<!-- index.wxml -->
<view class="page-body">
<block wx:if="{{mobiles && mobiles.length > 0}}">
<view wx:for="{{mobiles}}" wx:key="index" class="card">
<text>{{item.mobile}}</text>
</view>
</block>
<block wx:else>
<view style="flex:1; display:flex; align-items:center;justify-content:center">尚未授权手机号</view>
</block>
<view style="display: flex; flex: 1"></view>
<t-button theme="primary" style="margin: 16rpx" block size="large" open-type="getPhoneNumber" bindgetphonenumber="onRefreshMobile" content="授权手机号" />
<l-button type="default" shape="semicircle" disabled="{{loading}}" width="320" bind:lintap="loginByWechatMp">
微信授权一键登录
</l-button>
</view>

View File

@ -5,20 +5,20 @@
.page-body {
height: 100vh;
display: flex;
justify-content: center;
flex: 1;
flex-direction: column;
background-color: @oak-bg-color-page;
background-color: @oak-bg-color-container;
box-sizing: border-box;
.safe-area-inset-bottom();
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
margin-bottom: 60rpx;
}
.circle-view {
margin-top: 30rpx;
padding: 10rpx;
@ -31,20 +31,14 @@
justify-content: center;
background-color: #fff;
}
.text {
font-size: medium;
color: @oak-text-color-secondary;
}
.relation {
margin-top: 30rpx;
.title {
font-size: 32rpx;
color: @oak-text-color-primary;
font-size: x-large;
}
.btn-view {
display: flex;
justify-content: center;
align-items: center;
}
.redirect-btn {
margin-top: 40rpx;
.desc {
margin-top: 16rpx;
font-size: 28rpx;
color: @oak-text-color-secondary;
}

View File

@ -1,44 +1,51 @@
<!-- index.wxml -->
<view class="page-body">
<block wx:if="{{!hasConfirmed}}">
<view class="content">
<text class="text">认领权限</text>
<block wx:if="{{!!expired}}">
<view class="circle-view">
<l-icon name="close" size="80"/>
</view>
<text class="relation">该授权已经过期</text>
</block>
<block wx:elif="{{number <= confirmed}}">
<view class="circle-view">
<l-icon name="close" size="80"/>
</view>
<text class="relation">该授权已经认领结束</text>
</block>
<block wx:else>
<view class="circle-view">
<l-icon name="user" size="80"/>
</view>
<text class="relation">{{t(entity + ':r.' + relation) || '无数据'}}</text>
</block>
<view class="content">
<view class="circle-view">
<l-icon name="user" size="80"/>
</view>
<block wx:if="{{ type !== 'grant' }}">
<view class="title">
{{granter.name || granter.nickname}}
授予您【
{{relation ? t(entity + ':r.' + relation) : ''}}
</view>
<block wx:if="{{!expired && number > confirmed}}">
<l-button type="default" style="margin: 16rpx" size="large" bind:lintap="handleConfirm">
</block>
<block wx:else>
<view class="title">
{{granter.name || granter.nickname}}
转让您【
{{relation ? t(entity + ':r.' + relation) : ''}}
</view>
</block>
<block wx:if="{{hasConfirmed || !!(granteeId && userId === granteeId)}}">
<view class="desc">您已领取</view>
</block>
<block wx:elif="{{!!expired}}">
<view class="desc">已过期,请联系相关人员重新分享</view>
</block>
<block wx:elif="{{number === 1 && confirmed > 0 && (!(granteeId && userId === granteeId) || !hasConfirmed)}}">
<view class="desc">被他人已领取</view>
</block>
<block wx:else>
<view class="desc">请您领取</view>
</block>
</view>
<block wx:if="{{!oakLoading && !expired && number > confirmed && !hasConfirmed}}">
<l-button disabled="{{oakExecuting}}" type="default" style="margin: 16rpx" size="large" bind:lintap="handleConfirm">
确定
</l-button>
</block>
</block>
<block wx:else>
<view class="content">
<l-icon name="success" size="64" />
<l-button
l-class="redirect-btn"
type="success"
bind:lintap="redirectMp"
disabled="{{!redirectTo}}"
>
认领成功{{redirectTo ? '(' + redirectCounter + ')' : '' }}
</l-button>
</view>
<block wx:elif="{{!oakLoading && !expired && (hasConfirmed || !!(granteeId && userId === granteeId) )}}">
<l-button l-class="btn" type="success" style="margin: 16rpx" size="large" bind:lintap="redirectPage" disabled="{{!redirectTo}}">
领领成功{{redirectTo ? '(' + redirectCounter + 's)' : '' }}
</l-button>
</block>
</view>

View File

@ -9,26 +9,28 @@
justify-content: center;
flex: 1;
flex-direction: column;
background-color: @bg-color-block;
background-color: @oak-bg-color-container;
box-sizing: border-box;
.safe-area-inset-bottom();
}
.text {
font-size: @font-size-base;
color: @text-level-3-color;
font-size: 36rpx;
color: @oak-text-color-primary;
margin-top: 16rpx;
}
.desc {
font-size: 24rpx;
color: @oak-text-color-secondary;
margin-top: 16rpx;
}
.icon {
color: @primary-color;
color: @oak-color-primary;
}
.circle-view {
padding: @spacer;
width: 200rpx;
height: 200rpx;
border: 1px dashed @primary-color;
border-radius: 50%;
display: flex;
flex-direction: column;
align-items: center;

View File

@ -1,27 +1,31 @@
<!-- index.wxml -->
<view class="page-body">
<block wx:if="{{oakLoading}}">
<block wx:if="{{oakLoading || loading}}">
<view class="circle-view">
<l-icon name="loading" size="80" />
<l-icon name="loading" size="120" />
<text class="text">加载中</text>
<text class="desc">正在获取数据,请稍后</text>
</view>
</block>
<block wx:elif="{{!isExist}}">
<view class="circle-view">
<l-icon name="warning" size="80" />
<l-icon name="error" size="120" />
<text class="text">二维码非法</text>
<text class="desc">抱歉,该码不存在,请重新扫二维码</text>
</view>
</block>
<block wx:elif="{{expired}}">
<view class="circle-view">
<l-icon name="error" size="80" />
<l-icon name="warning" size="120" />
<text class="text">二维码已过期</text>
<text class="desc">抱歉,该码已过期,请联系相关人员重新分享</text>
</view>
</block>
<block wx:else>
<view class="circle-view">
<l-icon name="loading" size="80" />
<l-icon name="loading" size="120" />
<text class="text">跳转中</text>
<text class="desc">正在跳转...,请稍后</text>
</view>
</block>
</view>

View File

@ -69,7 +69,7 @@ export default OakComponent({
entityId,
type: (type as 'grant') || 'grant',
number: 1,
redirectTo: redirectToAfterConfirm,
redirectTo: redirectToAfterConfirm as EntityDict['userEntityGrant']['Schema']['redirectTo'],
qrCodeType: qrCodeType as QrCodeType,
});
this.setState({