|
|
@@ -0,0 +1,382 @@
|
|
|
+<template>
|
|
|
+ <PageWrapper contentBackground>
|
|
|
+ <template #footer>
|
|
|
+ <a-tabs v-model:activeKey="tableType" @change="changeTable">
|
|
|
+ <a-tab-pane :key="0" :tab="t('routes.scenes.4dkk')" :disabled="loading" />
|
|
|
+ <a-tab-pane :key="1" :tab="t('routes.scenes.4dkj')" :disabled="loading" />
|
|
|
+ <a-tab-pane :key="2" :tab="t('routes.scenes.4dssdy')" :disabled="loading" />
|
|
|
+ <a-tab-pane :key="4" :tab="t('routes.scenes.obj')" :disabled="loading" />
|
|
|
+ <!-- <a-tab-pane :key="3" tab="四维双目Lite" :disabled="loading"/> -->
|
|
|
+ </a-tabs>
|
|
|
+ </template>
|
|
|
+ <div class="desc-wrap-BasicTable">
|
|
|
+ <BasicTable
|
|
|
+ @register="registerTable"
|
|
|
+ :rowSelection="{ type: 'checkbox', onChange: handleSelect }"
|
|
|
+ >
|
|
|
+ <template #toolbar>
|
|
|
+ <!-- <a-button type="primary" @click="() => {}"> 新增</a-button> -->
|
|
|
+ <!-- <a-button type="primary" color="warning" @click="() => {}"> 编辑</a-button>
|
|
|
+ <a-button type="primary" color="error" @click="() => {}"> 删除</a-button> -->
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #cover="{ record }">
|
|
|
+ <TableImg
|
|
|
+ :size="120"
|
|
|
+ :simpleShow="true"
|
|
|
+ :imgList="[record.thumb || '/resource/img/header.jpg']"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <template #link="{ record }">
|
|
|
+ <!-- <a
|
|
|
+ v-if="record.status != 0"
|
|
|
+ :href="record.webSite + `&lang=${isJA ? 'ja' : 'zh'}`"
|
|
|
+ target="_blank"
|
|
|
+ >
|
|
|
+ {{ record.webSite }}
|
|
|
+ </a> -->
|
|
|
+ <span>{{ record.webSite }}</span>
|
|
|
+ </template>
|
|
|
+ <template #action="{ record }">
|
|
|
+ <TableAction
|
|
|
+ :actions="[
|
|
|
+ {
|
|
|
+ color: 'success',
|
|
|
+ label: '复原',
|
|
|
+ // disabled: record.status != -2,
|
|
|
+ onClick: openSceneEditor.bind(null, record),
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ </div>
|
|
|
+ </PageWrapper>
|
|
|
+</template>
|
|
|
+<script lang="ts">
|
|
|
+ import { defineComponent, computed, h, ref } from 'vue';
|
|
|
+ import { openUrl } from '/@/utils/auth';
|
|
|
+ import { PageWrapper } from '/@/components/Page';
|
|
|
+ import {
|
|
|
+ BasicTable,
|
|
|
+ useTable,
|
|
|
+ BasicColumn,
|
|
|
+ FormProps,
|
|
|
+ TableAction,
|
|
|
+ TableImg,
|
|
|
+ } from '/@/components/Table';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ // import { useModal } from '/@/components/Modal';
|
|
|
+ import { Tabs } from 'ant-design-vue';
|
|
|
+ import { sceneDetail, buildSceneObj } from '/@/api/lastApi/index';
|
|
|
+ // import { Progress } from 'ant-design-vue';
|
|
|
+ // import { h } from 'vue';
|
|
|
+ // addDownloadNumApi,
|
|
|
+ // checkDownloadApi,
|
|
|
+ // generateSceneEditTokenApi,
|
|
|
+ import {
|
|
|
+ ListApi,
|
|
|
+ downloadSceneDataAPi,
|
|
|
+ addDownloadNumApi,
|
|
|
+ checkDownloadApi,
|
|
|
+ DeleteApi,
|
|
|
+ UpgradeToV4,
|
|
|
+ sceneCopy,
|
|
|
+ } from '/@/api/scene/list';
|
|
|
+ import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
+ import {
|
|
|
+ downloadByUrl,
|
|
|
+ // downloadByData,
|
|
|
+ // downloadByBase64,
|
|
|
+ // downloadByOnlineUrl,
|
|
|
+ } from '/@/utils/file/download';
|
|
|
+
|
|
|
+ import { useUserStore } from '/@/store/modules/user';
|
|
|
+
|
|
|
+ import { useLocaleStore } from '/@/store/modules/locale';
|
|
|
+ import { SceneDownloadParam } from '/@/api/scene/model';
|
|
|
+ const localeStore = useLocaleStore();
|
|
|
+ console.log('localeStore', localeStore);
|
|
|
+ const userStore = useUserStore();
|
|
|
+
|
|
|
+ export default defineComponent({
|
|
|
+ components: {
|
|
|
+ BasicTable,
|
|
|
+ TableAction,
|
|
|
+ TableImg,
|
|
|
+ PageWrapper,
|
|
|
+ [Tabs.name]: Tabs,
|
|
|
+ [Tabs.TabPane.name]: Tabs.TabPane,
|
|
|
+ },
|
|
|
+ setup() {
|
|
|
+ const { createMessage, createConfirm } = useMessage();
|
|
|
+ const { t } = useI18n();
|
|
|
+ const loading = ref(false);
|
|
|
+ const tableType = ref<Number>(0); //0看看 、1看见、2深时
|
|
|
+ const isJA = computed(() => localeStore.getLocale === 'ja');
|
|
|
+ const columns: BasicColumn[] = [
|
|
|
+ {
|
|
|
+ title: 'ID',
|
|
|
+ dataIndex: 'id',
|
|
|
+ width: 80,
|
|
|
+ defaultHidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('routes.scenes.sceneName'),
|
|
|
+ dataIndex: 'sceneName',
|
|
|
+ ellipsis: false,
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('routes.corporation.enterpriseName'),
|
|
|
+ dataIndex: 'companyName',
|
|
|
+ ellipsis: false,
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('routes.scenes.webSite'),
|
|
|
+ dataIndex: 'webSite',
|
|
|
+ ellipsis: false,
|
|
|
+ slots: { customRender: 'link' },
|
|
|
+ width: 180,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('routes.scenes.appListPicUrl'),
|
|
|
+ dataIndex: 'thumb',
|
|
|
+ ellipsis: true,
|
|
|
+ slots: { customRender: 'cover' },
|
|
|
+ width: 150,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('routes.scenes.childName'),
|
|
|
+ dataIndex: 'childName',
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('routes.scenes.viewCount'),
|
|
|
+ dataIndex: 'viewCount',
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('routes.scenes.createTime'),
|
|
|
+ dataIndex: 'createTime',
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ title: t('routes.scenes.num'),
|
|
|
+ dataIndex: 'num',
|
|
|
+ width: 180,
|
|
|
+ },
|
|
|
+
|
|
|
+ // {
|
|
|
+ // title: t('routes.scenes.process'),
|
|
|
+ // dataIndex: '',
|
|
|
+ // width: 180,
|
|
|
+ // slots: { customRender: 'process' },
|
|
|
+ // ifShow: false,
|
|
|
+ // },
|
|
|
+
|
|
|
+ {
|
|
|
+ title: t('common.operation'),
|
|
|
+ dataIndex: '',
|
|
|
+ slots: { customRender: 'action' },
|
|
|
+ width: isJA.value ? 100 : 100,
|
|
|
+ fixed: 'right',
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ const searchForm: Partial<FormProps> = {
|
|
|
+ labelWidth: 100,
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'companyName',
|
|
|
+ label: t('routes.corporation.enterpriseName'),
|
|
|
+ component: 'Input',
|
|
|
+ colProps: {
|
|
|
+ lg: 6,
|
|
|
+ xl: 6,
|
|
|
+ xxl: 6,
|
|
|
+ sm: 12,
|
|
|
+ xs: 24,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'sceneName',
|
|
|
+ label: t('routes.scenes.sceneName'),
|
|
|
+ component: 'Input',
|
|
|
+ colProps: {
|
|
|
+ lg: 6,
|
|
|
+ xl: 6,
|
|
|
+ xxl: 6,
|
|
|
+ sm: 12,
|
|
|
+ xs: 24,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'childName',
|
|
|
+ label: t('routes.scenes.childName'),
|
|
|
+ component: 'Input',
|
|
|
+ colProps: {
|
|
|
+ lg: 6,
|
|
|
+ xl: 6,
|
|
|
+ xxl: 6,
|
|
|
+ sm: 12,
|
|
|
+ xs: 24,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ // { getForm }
|
|
|
+ const [registerTable, { reload, getSelectRowKeys }] = useTable({
|
|
|
+ title: t('routes.scenes.sceneList'),
|
|
|
+ api: ListApi,
|
|
|
+ columns: columns,
|
|
|
+ useSearchForm: true,
|
|
|
+ formConfig: searchForm,
|
|
|
+ showTableSetting: true,
|
|
|
+ searchInfo: { type: tableType },
|
|
|
+ tableSetting: { fullScreen: true },
|
|
|
+ clickToRowSelect: true,
|
|
|
+ showIndexColumn: true,
|
|
|
+ rowKey: 'num',
|
|
|
+ beforeFetch: (T) => {
|
|
|
+ loading.value = true;
|
|
|
+ return T;
|
|
|
+ },
|
|
|
+ afterFetch: (T) => {
|
|
|
+ loading.value = false;
|
|
|
+ return T;
|
|
|
+ },
|
|
|
+ });
|
|
|
+ async function handleGenerate(record: Recordable) {
|
|
|
+ let { data } = await sceneDetail({ id: record.id });
|
|
|
+ let { buildObjStatus } = data.data;
|
|
|
+ let toastText =
|
|
|
+ buildObjStatus == 2
|
|
|
+ ? t('routes.scenes.objTips.Modifying')
|
|
|
+ : buildObjStatus == 1
|
|
|
+ ? t('routes.scenes.objTips.coverData')
|
|
|
+ : t('routes.scenes.objTips.updateSuccess');
|
|
|
+ console.log('buildObjStatus', data);
|
|
|
+ if (data.code === 200) {
|
|
|
+ createConfirm({
|
|
|
+ iconType: 'warning',
|
|
|
+ title: () => h('span', t('routes.scenes.creatobj')),
|
|
|
+ content: () => h('span', toastText),
|
|
|
+ onOk: async () => {
|
|
|
+ if (buildObjStatus !== 2) {
|
|
|
+ await buildSceneObj({ id: record.id });
|
|
|
+ }
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ reload();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ createMessage.error(t(`apiCode.errCode${data.code}`));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function handleLivestream(item) {
|
|
|
+ let url = item.webSite;
|
|
|
+ let page = url.substring(url.lastIndexOf('/') + 1, url.lastIndexOf('.html'));
|
|
|
+ url = url.replace(page, 'rtc-live');
|
|
|
+ window.open(url.replace('http://', 'https://') + (isJA.value ? '&lang=ja' : ''), '_blank');
|
|
|
+ }
|
|
|
+ function handleCopy(item) {
|
|
|
+ createConfirm({
|
|
|
+ iconType: 'warning',
|
|
|
+ title: () => h('span', t('routes.scenes.copyInfi.title')),
|
|
|
+ content: () => h('span', t('routes.scenes.copyInfi.content')),
|
|
|
+ onOk: async () => {
|
|
|
+ await sceneCopy(item.num);
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ reload();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function handleUpgrade(item) {
|
|
|
+ createConfirm({
|
|
|
+ iconType: 'warning',
|
|
|
+ title: () => h('span', t('routes.scenes.upgradeMessg.title')),
|
|
|
+ content: () => h('span', t('routes.scenes.upgradeMessg.text')),
|
|
|
+ onOk: async () => {
|
|
|
+ console.log('item', item);
|
|
|
+ let res = await UpgradeToV4(item.num);
|
|
|
+ console.log('res', res);
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ reload();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ async function openSceneEditor(record: Recordable) {
|
|
|
+ try {
|
|
|
+ const langtext = isJA.value ? 'ja' : 'zh';
|
|
|
+ const token = userStore.getToken; //&token=${token}
|
|
|
+ let url = record.webSite.replace('smobile', 'epc') + `&lang=${langtext}`;
|
|
|
+ if (tableType.value == 4 || tableType.value == 2) {
|
|
|
+ url = url + `&token=${token}`;
|
|
|
+ }
|
|
|
+ if (record.isUpgrade == 1) {
|
|
|
+ url = url.replace('smg', 'epg');
|
|
|
+ }
|
|
|
+ openUrl(url);
|
|
|
+ } catch (error) {
|
|
|
+ console.log('error', error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ async function handleDelete(record: Recordable) {
|
|
|
+ console.log('DeleteApi', record);
|
|
|
+ await DeleteApi(record.num);
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+
|
|
|
+ async function handleDownloadScene(record: Recordable) {
|
|
|
+ let param: SceneDownloadParam = {
|
|
|
+ num: record.num,
|
|
|
+ isObj: null,
|
|
|
+ };
|
|
|
+ if (tableType.value == 4 || tableType.value == 2) {
|
|
|
+ param.isObj = tableType.value == 4 ? 1 : 0;
|
|
|
+ }
|
|
|
+ await addDownloadNumApi(param);
|
|
|
+ // SceneDownloadModel
|
|
|
+ const checker = await checkDownloadApi(param);
|
|
|
+ if (checker.downloadStatus < 3) {
|
|
|
+ const res = await downloadSceneDataAPi(param);
|
|
|
+ console.log('res', res);
|
|
|
+ } else {
|
|
|
+ downloadByUrl({
|
|
|
+ url: checker.downloadUrl,
|
|
|
+ target: '_self',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function changeTable(val: Number) {
|
|
|
+ tableType.value = val;
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+ const handleSelect = async () => {
|
|
|
+ const keys = getSelectRowKeys();
|
|
|
+ console.log('key', keys);
|
|
|
+ };
|
|
|
+ return {
|
|
|
+ registerTable,
|
|
|
+ createMessage,
|
|
|
+ t,
|
|
|
+ handleGenerate,
|
|
|
+ openSceneEditor,
|
|
|
+ handleDownloadScene,
|
|
|
+ handleDelete,
|
|
|
+ handleLivestream,
|
|
|
+ handleUpgrade,
|
|
|
+ changeTable,
|
|
|
+ handleCopy,
|
|
|
+ tableType,
|
|
|
+ loading,
|
|
|
+ isJA,
|
|
|
+ handleSelect,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ });
|
|
|
+</script>
|