Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-general-business into dev

This commit is contained in:
Xu Chang 2022-06-02 21:25:43 +08:00
commit d45a101c27
6 changed files with 65 additions and 22 deletions

View File

@ -59,17 +59,20 @@ const triggers: Trigger<EntityDict, 'userEntityGrant', GeneralRuntimeContext<Ent
});
// 如果是微信体系的应用为之创建一个默认的weChatQrCode
if (['wechatPublic', 'wechatMp'].includes(appConfig.type)) {
await createWechatQrCode({
entity: 'userEntityGrant',
entityId: id,
applicationId,
props: {
pathname: 'pages/userEntityGrant/confirm',
await createWechatQrCode(
{
entity: 'userEntityGrant',
entityId: id,
applicationId,
props: {
oakId: id,
pathname: 'pages/userEntityGrant/confirm/index',
props: {
oakId: id,
},
},
}
}, context);
},
context
);
}
}
if (data instanceof Array) {

View File

@ -1,4 +1,4 @@
import { MakeOakComponent, MakeOakPage, I18nRuntimeBase } from 'oak-frontend-base';
import { MakeOakComponent, MakeOakPage, I18nWechatMpRuntimeBase } from 'oak-frontend-base';
import { EntityDict } from 'oak-app-domain';
import { GeneralRuntimeContext } from '../RuntimeContext';
import aspectDict from '../aspects';
@ -19,7 +19,7 @@ declare global {
>;
const generateNewId: (options?: { timestamp?: boolean }) => Promise<string>;
const OakI18n: {
i18nInstance: I18nRuntimeBase | null;
i18nInstance: I18nWechatMpRuntimeBase | null;
};
}
export {}

View File

@ -6,9 +6,9 @@
<view>
<radio value="{{item}}" color="#2d8cf0" />
</view>
<view>{{item}}</view>
<view>{{t(entity + ':relation.' + item)}}</view>
</label>
</radio-group>
</view>
<g-btn type="primary" bind:click="handleConfirm">确定</g-btn>
<g-btn type="primary" bind:click="handleConfirm">{{t('common:action.confirm')}}</g-btn>
</view>

View File

@ -1,5 +1,5 @@
{
"navigationBarTitleText": "跳转页",
"navigationBarTitleText": "扫码结果",
"usingComponents": {
"g-icon": "../../../components/UI/g-icon/index"
}

View File

@ -29,12 +29,40 @@ OakPage(
},
],
formData: async ({ data: wechatQrCodes }) => {
if (wechatQrCodes[0] && !wechatQrCodes[0]?.expired) {
wx.redirectTo({
url: `/${wechatQrCodes[0]?.props?.pathname}/index?oakId=${wechatQrCodes[0]?.props?.props?.oakId}`,
});
const wechatQrCode = wechatQrCodes[0];
if (!wechatQrCode) {
return {
isExist: false,
};
}
if (!wechatQrCode.expired) {
const { props, pathname } = wechatQrCode.props;
let url =
pathname.substring(0, 1) === '/'
? pathname
: `/${pathname}`;
if (props) {
for (const param in props) {
const param2 = param as unknown as keyof typeof props;
url += url.includes('?') ? '&' : '?';
url += `${param}=${
typeof props[param2] === 'string'
? props[param2]
: JSON.stringify(props[param2])
}`;
}
}
wx.redirectTo({
url: url,
});
return {
expired: false,
};
} else {
return {
expired: true,
};
}
return {};
},
},
{

View File

@ -1,15 +1,27 @@
<!-- index.wxml -->
<view class="page-body">
<block wx:if="{{!expired}}">
<block wx:if="{{oakLoading}}">
<view class="circle-view">
<g-icon name="near_me" size="80" />
<text class="text">跳转中</text>
<text class="text">加载中</text>
</view>
</block>
<block wx:else>
<block wx:elif="{{!isExist}}">
<view class="circle-view">
<g-icon name="near_me" size="80" />
<text class="text">二维码非法</text>
</view>
</block>
<block wx:elif="{{expired}}">
<view class="circle-view">
<g-icon name="timer_off" size="80" />
<text class="text">二维码已过期</text>
</view>
</block>
<block wx:else>
<view class="circle-view">
<g-icon name="near_me" size="80" />
<text class="text">跳转中</text>
</view>
</block>
</view>