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

This commit is contained in:
wangcheng 2023-04-24 15:26:35 +08:00
commit 9b29f3e87a
9 changed files with 172 additions and 101 deletions

View File

@ -32,14 +32,30 @@ exports.default = OakComponent({
qrCodeType: '', qrCodeType: '',
}, },
data: { data: {
period: 5, period: 15,
userEntityGrantId: '', userEntityGrantId: '',
unit: 'minute', unit: 'minute',
maxes: { maxes: {
minute: 4320, minute: 3 * 24 * 60,
hour: 72, hour: 3 * 24,
day: 3, day: 3,
}, },
defaultPeriods: {
minute: 15,
hour: 1,
day: 1,
},
unitArr: [
{
label: '分钟',
value: 'minute',
},
{
label: '小时',
value: 'hour',
},
],
unitIndex: 0,
}, },
lifetimes: { lifetimes: {
ready: function () { ready: function () {
@ -103,7 +119,18 @@ exports.default = OakComponent({
this.setPeriod(count); this.setPeriod(count);
}, },
setUnit: function (u) { setUnit: function (u) {
var defaultPeriods = this.state.defaultPeriods;
this.setState({ unit: u }); this.setState({ unit: u });
this.setPeriod(defaultPeriods[u]);
},
setUnitMp: function (e) {
var unitArr = this.state.unitArr;
var value = e.detail.value;
var unitObj = unitArr[value];
this.setState({
unitIndex: value,
});
this.setUnit(unitObj.value);
}, },
onBack: function () { onBack: function () {
this.navigateBack(); this.navigateBack();

View File

@ -72,4 +72,27 @@
.confirm-btn { .confirm-btn {
align-self: flex-end; align-self: flex-end;
} }
}
.unit-box {
margin-left: 32rpx;
height: 50rpx;
width: 120rpx;
border: 1px solid @oak-color-primary;
color: @oak-color-primary;
border-radius: 10rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
.unit {
margin-right: 16rpx;
}
.icon {
color: @oak-color-primary !important;
}
} }

View File

@ -1,48 +1,24 @@
<!-- index.wxml --> <!-- index.wxml -->
<view class="page-body"> <view class="page-body">
<block wx:if="{{!!userEntityGrantId}}"> <block wx:if="{{!!userEntityGrantId}}">
<l-notice-bar <l-notice-bar front-icon-name="notification" show="{{true}}">
front-icon-name="notification"
show="{{true}}"
>
请通过分享或者截屏二维码方式分享权限 请通过分享或者截屏二维码方式分享权限
</l-notice-bar> </l-notice-bar>
<view class="ueg-container"> <view class="ueg-container">
<userEntityGrant-detail <userEntityGrant-detail oakId="{{userEntityGrantId}}" oakAutoUnmount="{{true}}" oakPath="$userRelation/upsert/byUserEntityGrant-userEntityGrant/detail" />
oakId="{{userEntityGrantId}}" <view class="share">
oakAutoUnmount="{{true}}" <l-button size="medium" type="success" open-type="share">
oakPath="$userRelation/upsert/byUserEntityGrant-userEntityGrant/detail"
/>
<view
class="share"
>
<l-button
size="medium"
type="success"
open-type="share"
>
分享 分享
</l-button> </l-button>
</view </view
</view> </view>
</block> </block>
<block wx:else> <block wx:else>
<view class="list-item"> <view class="list-item">
<view class="label">权限:</view> <view class="label">权限:</view>
<view class="value"> <view class="value">
<l-radio-group <l-radio-group placement="row" l-class="radio-container" bind:linchange="setRelationMp" current="{{relation}}">
placement="row" <l-radio wx:for-items="{{relations}}" wx:key="index" key="{{item}}" l-class="radio" size="48rpx">
l-class="radio-container"
bind:linchange="setRelationMp"
current="{{relation}}"
>
<l-radio
wx:for-items="{{relations}}"
wx:key="index"
key="{{item}}"
l-class="radio"
size="48rpx"
>
{{t(entity + ':r.' + item)}} {{t(entity + ':r.' + item)}}
</l-radio> </l-radio>
</l-radio-group> </l-radio-group>
@ -51,51 +27,37 @@
<view class="list-item"> <view class="list-item">
<view class="label">人次:</view> <view class="label">人次:</view>
<view class="value"> <view class="value">
<l-radio-group <l-radio-group placement="row" l-class="radio-container" bind:linchange="setNumberMp" current="{{number}}">
placement="row" <l-radio wx:key="1" key="1" size="48rpx" l-class="radio">
l-class="radio-container"
bind:linchange="setNumberMp"
current="{{number}}"
>
<l-radio
wx:key="1"
key="1"
size="48rpx"
l-class="radio"
>
单人次 单人次
</l-radio> </l-radio>
<l-radio <l-radio wx:key="10000" key="10000" size="48rpx">
wx:key="10000"
key="10000"
size="48rpx"
>
不限人次 不限人次
</l-radio> </l-radio>
</l-radio-group> </l-radio-group>
</view> </view>
</view> </view>
<view class="list-item"> <view class="list-item">
<view class="label">有效期:</view> <view class="label">有效期:</view>
<view class="value-period"> <view class="value-period">
<l-counter <l-counter count="{{period}}" max="{{ maxes[unit] }}" min="1" round-float="{{true}}" bind:linchange="setPeriodMp" />
count="{{period}}" <!-- <view style="margin-left: 30rpx">
max="120"
min="5"
round-float="{{true}}"
bind:linchange="setPeriodMp"
/>
<view style="margin-left: 30rpx">
分钟 分钟
</view> </view> -->
<picker range="{{unitArr}}" range-key="label" value="{{unitIndex}}" bind:change="setUnitMp">
<view class="unit-box">
<view class="unit">
{{unitArr[unitIndex].label}}
</view>
<l-icon l-class="icon" name="down" size="18" />
</view>
</picker>
</view> </view>
</view> </view>
<view style="flex: 1" /> <view style="flex: 1" />
<l-button <l-button size="long" type="default" bind:lintap="confirm">
size="long"
type="default"
bind:lintap="confirm"
>
确定 确定
</l-button> </l-button>
</block> </block>

View File

@ -9,6 +9,10 @@ export default function render(props: WebComponentProps<EntityDict, 'userEntityG
userEntityGrantId: string; userEntityGrantId: string;
unit: Unit; unit: Unit;
maxes: Record<Unit, number>; maxes: Record<Unit, number>;
unitArr: Array<{
label: string;
value: Unit;
}>;
}, { }, {
confirm: () => Promise<void>; confirm: () => Promise<void>;
onBack: () => void; onBack: () => void;

View File

@ -6,7 +6,7 @@ var antd_1 = require("antd");
var detail_1 = tslib_1.__importDefault(require("../../../../pages/userEntityGrant/detail")); var detail_1 = tslib_1.__importDefault(require("../../../../pages/userEntityGrant/detail"));
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less")); var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
function render(props) { function render(props) {
var _a = props.data, relations = _a.relations, userEntityGrant = _a.userEntityGrant, userEntityGrantId = _a.userEntityGrantId, period = _a.period, unit = _a.unit, maxes = _a.maxes; var _a = props.data, relations = _a.relations, userEntityGrant = _a.userEntityGrant, userEntityGrantId = _a.userEntityGrantId, period = _a.period, unit = _a.unit, maxes = _a.maxes, unitArr = _a.unitArr;
var _b = userEntityGrant || {}, relation = _b.relation, type = _b.type, number = _b.number, entity = _b.entity; var _b = userEntityGrant || {}, relation = _b.relation, type = _b.type, number = _b.number, entity = _b.entity;
var _c = props.methods, update = _c.update, t = _c.t, onBack = _c.onBack, confirm = _c.confirm, setInit = _c.setInit, setPeriod = _c.setPeriod, setUnit = _c.setUnit; var _c = props.methods, update = _c.update, t = _c.t, onBack = _c.onBack, confirm = _c.confirm, setInit = _c.setInit, setPeriod = _c.setPeriod, setUnit = _c.setUnit;
var P = !!userEntityGrantId ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Alert, { showIcon: true, message: "\u8BF7\u5C06\u4E8C\u7EF4\u7801\u53D1\u7ED9\u5F85\u5206\u4EAB\u6743\u9650\u7684\u7528\u6237\u626B\u63CF", type: "info", style: { marginBottom: 16 } }), (0, jsx_runtime_1.jsx)(detail_1.default, { showBack: false, oakId: userEntityGrantId, oakAutoUnmount: true, oakPath: "$userRelation/upsert/byUserEntityGrant-userEntityGrant/detail" }), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { var P = !!userEntityGrantId ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Alert, { showIcon: true, message: "\u8BF7\u5C06\u4E8C\u7EF4\u7801\u53D1\u7ED9\u5F85\u5206\u4EAB\u6743\u9650\u7684\u7528\u6237\u626B\u63CF", type: "info", style: { marginBottom: 16 } }), (0, jsx_runtime_1.jsx)(detail_1.default, { showBack: false, oakId: userEntityGrantId, oakAutoUnmount: true, oakPath: "$userRelation/upsert/byUserEntityGrant-userEntityGrant/detail" }), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: {
@ -41,18 +41,11 @@ function render(props) {
required: true, required: true,
message: '请选择一个时效', message: '请选择一个时效',
}, },
], help: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { marginBottom: 16 } }, { children: "\u652F\u6301\u5206\u949F\u3001\u5C0F\u65F6\u9009\u62E9" })) }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { min: 1, max: maxes[unit], value: period, onChange: function (value) { return setPeriod(value); }, addonAfter: (0, jsx_runtime_1.jsxs)(antd_1.Select, tslib_1.__assign({ value: unit, style: { width: 80 }, onChange: function (v) { ], help: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { marginBottom: 16 } }, { children: "\u652F\u6301\u5206\u949F\u3001\u5C0F\u65F6\u9009\u62E9" })), tooltip: "\u901A\u8FC7\u914D\u7F6E\u5B9E\u73B0\u5728\u89C4\u5B9A\u7684\u65F6\u6548\u5185\u626B\u63CF\u4E8C\u7EF4\u7801\u4E0D\u8FC7\u671F\u7684\u6548\u679C\u3002" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { min: 1, max: maxes[unit], value: period, onChange: function (value) { return setPeriod(value); },
// addonAfter="分钟"
addonAfter: (0, jsx_runtime_1.jsx)(antd_1.Select, tslib_1.__assign({ value: unit, style: { width: 80 }, onChange: function (v) {
setUnit(v); setUnit(v);
if (v === 'minute') { } }, { children: unitArr.map(function (ele, index) { return ((0, jsx_runtime_1.jsx)(antd_1.Select.Option, tslib_1.__assign({ value: ele.value }, { children: ele.label }), index)); }) })) }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () { return confirm(); } }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () { return onBack(); } }, { children: "\u8FD4\u56DE" }))] }) }))] })));
setPeriod(5);
}
else if (v === 'hour') {
setPeriod(1);
}
else if (v === 'day') {
setPeriod(1);
}
} }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Select.Option, tslib_1.__assign({ value: "minute" }, { children: "\u5206\u949F" })), (0, jsx_runtime_1.jsx)(antd_1.Select.Option, tslib_1.__assign({ value: "hour" }, { children: "\u5C0F\u65F6" }))] })) }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () { return confirm(); } }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () { return onBack(); } }, { children: "\u8FD4\u56DE" }))] }) }))] })));
return (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: P })); return (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: P }));
} }
exports.default = render; exports.default = render;

View File

@ -72,4 +72,27 @@
.confirm-btn { .confirm-btn {
align-self: flex-end; align-self: flex-end;
} }
}
.unit-box {
margin-left: 32rpx;
height: 50rpx;
width: 120rpx;
border: 1px solid @oak-color-primary;
color: @oak-color-primary;
border-radius: 10rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
.unit {
margin-right: 16rpx;
}
.icon {
color: @oak-color-primary !important;
}
} }

View File

@ -33,14 +33,30 @@ export default OakComponent({
qrCodeType: '' as QrCodeType, qrCodeType: '' as QrCodeType,
}, },
data: { data: {
period: 5, period: 15,
userEntityGrantId: '', userEntityGrantId: '',
unit: 'minute' as Unit, unit: 'minute' as Unit,
maxes: { maxes: {
minute: 4320, // 60 * 24 * 3 minute: 3 * 24 * 60,
hour: 72, hour: 3 * 24,
day: 3, day: 3,
}, },
defaultPeriods: {
minute: 15,
hour: 1,
day: 1,
},
unitArr: [
{
label: '分钟',
value: 'minute',
},
{
label: '小时',
value: 'hour',
},
],
unitIndex: 0,
}, },
lifetimes: { lifetimes: {
ready() { ready() {
@ -112,7 +128,18 @@ export default OakComponent({
this.setPeriod(count); this.setPeriod(count);
}, },
setUnit(u: Unit) { setUnit(u: Unit) {
const { defaultPeriods } = this.state;
this.setState({ unit: u }); this.setState({ unit: u });
this.setPeriod(defaultPeriods[u as Unit]);
},
setUnitMp(e: any) {
const { unitArr } = this.state;
const { value } = e.detail;
const unitObj = unitArr[value];
this.setState({
unitIndex: value,
});
this.setUnit(unitObj.value as Unit);
}, },
onBack() { onBack() {
this.navigateBack(); this.navigateBack();

View File

@ -80,14 +80,24 @@
<view class="value-period"> <view class="value-period">
<l-counter <l-counter
count="{{period}}" count="{{period}}"
max="120" max="{{ maxes[unit] }}"
min="5" min="1"
round-float="{{true}}" round-float="{{true}}"
bind:linchange="setPeriodMp" bind:linchange="setPeriodMp"
/> />
<view style="margin-left: 30rpx"> <!-- <view style="margin-left: 30rpx">
分钟 分钟
</view> </view> -->
<picker range="{{unitArr}}" range-key="label" value="{{unitIndex}}" bind:change="setUnitMp">
<view class="unit-box">
<view class="unit">
{{unitArr[unitIndex].label}}
</view>
<l-icon l-class="icon" name="down" size="18" />
</view>
</picker>
</view> </view>
</view> </view>
<view style="flex: 1" /> <view style="flex: 1" />

View File

@ -29,6 +29,7 @@ export default function render(
userEntityGrantId: string; userEntityGrantId: string;
unit: Unit; unit: Unit;
maxes: Record<Unit, number>; maxes: Record<Unit, number>;
unitArr: Array<{ label: string; value: Unit }>;
}, },
{ {
confirm: () => Promise<void>; confirm: () => Promise<void>;
@ -46,6 +47,7 @@ export default function render(
period, period,
unit, unit,
maxes, maxes,
unitArr,
} = props.data; } = props.data;
const { relation, type, number, entity } = userEntityGrant || {}; const { relation, type, number, entity } = userEntityGrant || {};
const { update, t, onBack, confirm, setInit, setPeriod, setUnit } = const { update, t, onBack, confirm, setInit, setPeriod, setUnit } =
@ -137,7 +139,10 @@ export default function render(
message: '请选择一个时效', message: '请选择一个时效',
}, },
]} ]}
help={<div style={{ marginBottom: 16 }}></div>} help={
<div style={{ marginBottom: 16 }}></div>
}
tooltip="通过配置实现在规定的时效内扫描二维码不过期的效果。"
> >
<> <>
<InputNumber <InputNumber
@ -145,26 +150,23 @@ export default function render(
max={maxes[unit]} max={maxes[unit]}
value={period} value={period}
onChange={(value) => setPeriod(value!)} onChange={(value) => setPeriod(value!)}
// addonAfter="分钟"
addonAfter={ addonAfter={
<Select <Select
value={unit} value={unit}
style={{ width: 80 }} style={{ width: 80 }}
onChange={(v) => { onChange={(v) => {
setUnit(v); setUnit(v);
if (v === 'minute') {
setPeriod(5);
} else if (v === 'hour') {
setPeriod(1);
} else if (v === 'day') {
setPeriod(1);
}
}} }}
> >
<Select.Option value="minute"> {unitArr.map((ele, index) => (
<Select.Option
</Select.Option> key={index}
<Select.Option value="hour"></Select.Option> value={ele.value}
{/* <Select.Option value="day">天</Select.Option> */} >
{ele.label}
</Select.Option>
))}
</Select> </Select>
} }
/> />