显示源版本号信息

pull/1761/head
lyswhut 2023-12-04 13:35:21 +08:00
parent 3803ab045c
commit c0f78b023f
2 changed files with 31 additions and 3 deletions

View File

@ -10,7 +10,10 @@
<use xlink:href="#icon-check-true" />
</svg>
</div>
<span v-if="label != null" :class="$style.label" v-text="label" />
<slot v-if="label == null" />
<span v-else :class="$style.label">
{{ label }}
</span>
</label>
</div>
</template>

View File

@ -41,7 +41,11 @@ dd
.gap-top(v-for="item in apiSources" :key="item.id")
base-checkbox(
:id="`setting_api_source_${item.id}`" name="setting_api_source"
need :model-value="appSetting['common.apiSource']" :disabled="item.disabled" :value="item.id" :label="item.label" @update:model-value="updateSetting({'common.apiSource': $event})")
need :model-value="appSetting['common.apiSource']" :disabled="item.disabled" :value="item.id" :aria-label="item.label" @update:model-value="updateSetting({'common.apiSource': $event})")
span(:class="$style.sourceLabel")
| {{ item.name }}
span(v-if="item.desc" :class="$style.desc") {{ item.desc }}
span(v-if="item.statusLabel" :class="$style.status") {{ item.statusLabel }}
.p.gap-top
base-btn.btn(min @click="isShowUserApiModal = true") {{ $t('setting__basic_source_user_api_btn') }}
@ -239,12 +243,16 @@ export default {
return [
...apiSourceInfo.map(api => ({
id: api.id,
label: t('setting__basic_source_' + api.id) || api.name,
name: api.name,
label: api.name,
disabled: api.disabled,
})),
...userApi.list.map(api => ({
id: api.id,
name: api.name,
label: `${api.name}${api.id == appSetting['common.apiSource'] ? `[${getApiStatus()}]` : ''}`,
desc: [/^\d/.test(api.version) ? `v${api.version}` : api.version, api.author].filter(Boolean).join(', '),
statusLabel: api.id == appSetting['common.apiSource'] ? `[${getApiStatus()}]` : '',
status: api.status,
message: api.message,
disabled: false,
@ -485,4 +493,21 @@ export default {
}
}
.sourceLabel {
flex: auto;
margin-left: 5px;
line-height: 1.5;
cursor: pointer;
.desc {
color: var(--color-500);
font-size: 12px;
margin-left: 5px;
}
.status {
margin-left: 5px;
}
}
</style>