feat: add enable/disable switch for each TASK requirement

Each requirement has an el-switch; disabled items grey out and input is locked

Sites can pick only the conditions they need (e.g. upload+download only)
This commit is contained in:
mediabot-pt
2026-07-06 22:31:52 +08:00
parent a956d38365
commit 15dcccb405

View File

@@ -117,9 +117,10 @@
</div> </div>
<div class="req-divider">考核要求</div> <div class="req-divider">考核要求</div>
<div v-for="(r, ri) in (rule.requirements||[])" :key="ri" class="field-row"> <div v-for="(r, ri) in (rule.requirements||[])" :key="ri" class="field-row">
<span class="field-label">{{ r.label }}</span> <el-switch v-model="r.enabled" size="small" @change="sync" style="margin-right:2px" />
<span class="field-label" :style="r.enabled?{}:{color:'#c0c4cc'}">{{ r.label }}</span>
<span class="condition-text">不低于</span> <span class="condition-text">不低于</span>
<el-input v-model.number="r.threshold" size="small" type="number" @input="sync" style="width:100px" /> <el-input v-model.number="r.threshold" size="small" type="number" @input="sync" :disabled="!r.enabled" style="width:100px" />
<span class="field-hint">{{ r.unit }}</span> <span class="field-hint">{{ r.unit }}</span>
</div> </div>
</template> </template>
@@ -278,11 +279,11 @@ const rankDisplay = (v) => {
} }
const taskReqDefaults = [ const taskReqDefaults = [
{ metric:'upload_gb', label:'上传量', threshold:10, unit:'GB', condition:'GTE' }, { metric:'upload_gb', label:'上传量', threshold:10, unit:'GB', condition:'GTE', enabled:true },
{ metric:'download_gb', label:'下载量', threshold:10, unit:'GB', condition:'GTE' }, { metric:'download_gb', label:'下载量', threshold:10, unit:'GB', condition:'GTE', enabled:true },
{ metric:'bonus', label:'魔力值', threshold:1000, unit:'', condition:'GTE' }, { metric:'bonus', label:'魔力值', threshold:1000, unit:'', condition:'GTE', enabled:true },
{ metric:'seeding_score', label:'做种积分', threshold:100, unit:'', condition:'GTE' }, { metric:'seeding_score', label:'做种积分', threshold:100, unit:'', condition:'GTE', enabled:true },
{ metric:'avg_seed_time', label:'平均做种时间', threshold:24, unit:'小时', condition:'GTE' }, { metric:'avg_seed_time', label:'平均做种时间', threshold:24, unit:'小时', condition:'GTE', enabled:true },
] ]
const onTypeChange = (rule) => { const onTypeChange = (rule) => {