|
|
@@ -24,23 +24,18 @@ import {
|
|
|
newVersionApi,
|
|
|
syncVersionApi
|
|
|
} from '@/api/version'
|
|
|
-import { getChannelListApi } from '@/api/channel'
|
|
|
-import type { ChannelData } from '@/api/channel/types'
|
|
|
+import { getPlatformListApi } from '@/api/platform'
|
|
|
+import type { PlatformData } from '@/api/platform'
|
|
|
|
|
|
interface Params {
|
|
|
pageIndex?: number
|
|
|
pageSize?: number
|
|
|
- channel?: string
|
|
|
+ platform?: string
|
|
|
envVersion?: string
|
|
|
}
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
-const getChannelLabel = (code: string) => {
|
|
|
- const c = channelOptions.value.find((x) => x.code === code)
|
|
|
- return c ? c.name : code
|
|
|
-}
|
|
|
-
|
|
|
const envVersionOptions = [
|
|
|
{ label: '正式服', value: 'release' },
|
|
|
{ label: '体验版', value: 'trial' }
|
|
|
@@ -57,9 +52,8 @@ const columns: TableColumn[] = [
|
|
|
label: t('version_server.title')
|
|
|
},
|
|
|
{
|
|
|
- field: 'channel',
|
|
|
- label: t('version_server.channel'),
|
|
|
- formatter: (row) => getChannelLabel(row.channel)
|
|
|
+ field: 'platform',
|
|
|
+ label: '平台'
|
|
|
},
|
|
|
{
|
|
|
field: 'envVersion',
|
|
|
@@ -118,37 +112,35 @@ const loading = ref(true)
|
|
|
const drawerText = ref('')
|
|
|
|
|
|
const versionDataList = ref<VersionData[]>([])
|
|
|
-const selectedChannel = ref<string>('')
|
|
|
+const selectedPlatform = ref<string>('')
|
|
|
const selectedEnvVersion = ref<string>('')
|
|
|
|
|
|
-// 渠道选项:从后端获取
|
|
|
-const channelOptions = ref<ChannelData[]>([])
|
|
|
-
|
|
|
-const getChannelList = async () => {
|
|
|
- try {
|
|
|
- const res = await getChannelListApi({ pageIndex: 1, pageSize: 100 })
|
|
|
- const list = res?.data?.list ?? (Array.isArray(res?.data) ? res.data : [])
|
|
|
- channelOptions.value = list.filter((c) => c && c.status !== false)
|
|
|
- } catch (e) {
|
|
|
- console.warn('[渠道列表] 请求失败:', e)
|
|
|
- channelOptions.value = []
|
|
|
- }
|
|
|
-}
|
|
|
+const platformOptions = ref<PlatformData[]>([])
|
|
|
|
|
|
-const applyChannelFilter = () => {
|
|
|
+const applyFilters = () => {
|
|
|
getVersionList({
|
|
|
pageIndex: 1,
|
|
|
pageSize: 10,
|
|
|
- channel: selectedChannel.value,
|
|
|
+ platform: selectedPlatform.value,
|
|
|
envVersion: selectedEnvVersion.value
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const getPlatformList = async () => {
|
|
|
+ try {
|
|
|
+ const res = await getPlatformListApi()
|
|
|
+ const list = res?.data?.data ?? res?.data ?? []
|
|
|
+ platformOptions.value = Array.isArray(list) ? list.filter((item) => item && item.status !== false) : []
|
|
|
+ } catch {
|
|
|
+ platformOptions.value = []
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const form = reactive({
|
|
|
type: 'new',
|
|
|
data: {
|
|
|
id: '',
|
|
|
- channel: '',
|
|
|
+ platform: '',
|
|
|
envVersion: 'release',
|
|
|
version: '',
|
|
|
name: '',
|
|
|
@@ -160,7 +152,7 @@ const form = reactive({
|
|
|
|
|
|
const formReset = () => {
|
|
|
form.data.id = ''
|
|
|
- form.data.channel = ''
|
|
|
+ form.data.platform = ''
|
|
|
form.data.envVersion = 'release'
|
|
|
form.data.version = ''
|
|
|
form.data.name = ''
|
|
|
@@ -210,8 +202,11 @@ const editVersion = async (params) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-getChannelList()
|
|
|
-getVersionList()
|
|
|
+getPlatformList()
|
|
|
+getVersionList({
|
|
|
+ pageIndex: 1,
|
|
|
+ pageSize: 10
|
|
|
+})
|
|
|
|
|
|
const updateDefaultStatus = async (row: VersionData, val) => {
|
|
|
row.default = val
|
|
|
@@ -253,7 +248,6 @@ const syncVersion = async () => {
|
|
|
}
|
|
|
|
|
|
const actionFn = (type: string, data: any) => {
|
|
|
- getChannelList()
|
|
|
if (type == 'new') {
|
|
|
formReset()
|
|
|
form.type = 'new'
|
|
|
@@ -262,7 +256,7 @@ const actionFn = (type: string, data: any) => {
|
|
|
if (type == 'edit') {
|
|
|
form.type = 'edit'
|
|
|
drawerText.value = t('version_server.edit')
|
|
|
- form.data.channel = data.channel
|
|
|
+ form.data.platform = data.platform || ''
|
|
|
form.data.envVersion = data.envVersion || 'release'
|
|
|
form.data.id = data.id.id
|
|
|
form.data.cdn = data.cdn
|
|
|
@@ -297,17 +291,17 @@ const closeDrawer = () => {
|
|
|
</ElButton>
|
|
|
<div style="display: flex; align-items: center; gap: 8px">
|
|
|
<span style="font-size: 14px; color: var(--el-text-color-regular)">
|
|
|
- {{ t('version_server.channelSelect') }}:
|
|
|
+ 平台筛选:
|
|
|
</span>
|
|
|
<ElSelect
|
|
|
- v-model="selectedChannel"
|
|
|
- :placeholder="t('version_server.channelSelect')"
|
|
|
+ v-model="selectedPlatform"
|
|
|
+ placeholder="选择平台"
|
|
|
style="width: 180px"
|
|
|
>
|
|
|
- <ElOption :label="t('version_server.allChannels')" value="" />
|
|
|
- <ElOption v-for="c in channelOptions" :key="c.code" :label="c.name" :value="c.code" />
|
|
|
+ <ElOption label="全部平台" value="" />
|
|
|
+ <ElOption v-for="item in platformOptions" :key="item.code" :label="item.name" :value="item.code" />
|
|
|
</ElSelect>
|
|
|
- <ElButton type="primary" @click="applyChannelFilter">
|
|
|
+ <ElButton type="primary" @click="applyFilters">
|
|
|
{{ t('version_server.confirm') }}
|
|
|
</ElButton>
|
|
|
</div>
|
|
|
@@ -356,26 +350,14 @@ const closeDrawer = () => {
|
|
|
<span class="text-16px font-700">{{ drawerText }}</span>
|
|
|
</template>
|
|
|
<ElForm :model="form" label-width="auto" style="max-width: 600px">
|
|
|
- <ElFormItem :label="t('version_server.channel')" required>
|
|
|
- <ElSelect
|
|
|
- v-model="form.data.channel"
|
|
|
- :placeholder="
|
|
|
- channelOptions.length
|
|
|
- ? t('version_server.channelSelect')
|
|
|
- : t('version_server.channelEmpty')
|
|
|
- "
|
|
|
- style="width: 100%"
|
|
|
- :disabled="form.type == 'edit'"
|
|
|
- >
|
|
|
- <ElOption v-for="c in channelOptions" :key="c.code" :label="c.name" :value="c.code" />
|
|
|
- </ElSelect>
|
|
|
- <div v-if="!channelOptions.length" class="el-form-item__error">
|
|
|
- {{ t('version_server.channelEmptyTip') }}
|
|
|
- </div>
|
|
|
- </ElFormItem>
|
|
|
<ElFormItem :label="t('version_server.title')">
|
|
|
<ElInput v-model="form.data.name" />
|
|
|
</ElFormItem>
|
|
|
+ <ElFormItem label="平台" required>
|
|
|
+ <ElSelect v-model="form.data.platform" placeholder="选择平台" style="width: 100%">
|
|
|
+ <ElOption v-for="item in platformOptions" :key="item.code" :label="item.name" :value="item.code" />
|
|
|
+ </ElSelect>
|
|
|
+ </ElFormItem>
|
|
|
<ElFormItem :label="t('version_server.envVersion')" required>
|
|
|
<ElSelect v-model="form.data.envVersion" style="width: 100%">
|
|
|
<ElOption
|