fix event require input

This commit is contained in:
Timi
2026-08-30 11:03:47 +08:00
parent 51a4ba99ee
commit 82e2359857
2 changed files with 7 additions and 50 deletions
+5 -22
View File
@@ -88,8 +88,10 @@
/>
</t-form-item>
</div>
<div v-if="showSourceValueInput" class="source-value-panel">
<div class="source-value-title" v-text="sourceValueAction === 'CONSUME' ? '消耗积分' : '发放积分'" />
<t-form-item v-if="showSourceValueInput" label="积分动作" content-align="right">
<span v-text="sourceValueAction === 'CONSUME' ? '消耗积分' : '发放积分'" />
</t-form-item>
<t-form-item v-if="showSourceValueInput" label="积分数量" required-mark>
<t-input
v-model.trim="pointValueText"
type="number"
@@ -97,7 +99,7 @@
borderless
:placeholder="sourceValuePlaceholder"
/>
</div>
</t-form-item>
<t-form-item label="登记备注">
<t-textarea
v-model.trim="note"
@@ -830,20 +832,6 @@ watch(scanCode, (value) => {
padding: 0 1rem;
}
.source-value-panel {
padding: .75rem 1rem 1rem;
.source-value-title {
font-weight: 700;
}
.t-input {
margin-top: .5rem;
border: 1px solid var(--td-component-border);
border-radius: .75rem;
}
}
.photo {
width: 100%;
@@ -882,11 +870,6 @@ watch(scanCode, (value) => {
}
}
.source-value-panel .t-input {
background: rgba(15, 23, 42, .72);
border-color: rgba(148, 163, 184, .16);
}
:deep(.textarea .t-textarea__inner) {
color: #e2e8f0;
background: rgba(15, 23, 42, .72);
+1 -27
View File
@@ -75,36 +75,10 @@ export function resolvePointRuleAction(rule: PointRule): PointAction | undefined
}
function resolvePointValueRuleConfig(rule: PointRule): SourceValueConfig | undefined {
if (rule.status !== "ACTIVE") {
if (rule.status !== "ACTIVE" || rule.triggerType !== "SOURCE_VALUE" || rule.pointMode !== "SOURCE_VALUE") {
return undefined;
}
if (rule.pointMode === "FIXED") {
return resolveFixedPointValueRuleConfig(rule);
}
if (rule.triggerType === "SOURCE_VALUE" && rule.pointMode === "SOURCE_VALUE") {
return resolveSourceValueRuleConfig(rule);
}
return undefined;
}
function resolveFixedPointValueRuleConfig(rule: PointRule): SourceValueConfig | undefined {
const action = resolvePointRuleAction(rule);
const pointValue = rule.pointValue;
if (
action === undefined
|| pointValue === undefined
|| pointValue === null
|| !Number.isSafeInteger(pointValue)
|| pointValue === 0
) {
return undefined;
}
const value = Math.abs(pointValue);
return {
action,
range: [value, value]
};
}
function resolveSourceValueRuleConfig(rule: PointRule): SourceValueConfig | undefined {