|
@@ -12,9 +12,10 @@
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="d-flex a-c">
|
|
<div class="d-flex a-c">
|
|
|
|
|
+ <el-button @click="setBgMusic">设置背景音乐</el-button>
|
|
|
<el-button @click="router.go(-1)">取消</el-button>
|
|
<el-button @click="router.go(-1)">取消</el-button>
|
|
|
<el-button @click="previewTpl" type="primary">预览</el-button>
|
|
<el-button @click="previewTpl" type="primary">预览</el-button>
|
|
|
- <el-button type="success">发布</el-button>
|
|
|
|
|
|
|
+ <el-button @click="publishTpl" type="success">发布</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="flex1 ov-hd d-flex">
|
|
<div class="flex1 ov-hd d-flex">
|
|
@@ -36,6 +37,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <H5ModelLook v-if="showPreviewTpl" v-model:show="showPreviewTpl" :src="previewTplStr" title="预览"></H5ModelLook>
|
|
|
</template>
|
|
</template>
|
|
|
<script setup lang="ts" name="ptpl-edit-index">
|
|
<script setup lang="ts" name="ptpl-edit-index">
|
|
|
import router from '@/router';
|
|
import router from '@/router';
|
|
@@ -43,10 +45,13 @@ import { MeetingTplH5, MeetingTplList, MeetingTplEvents } from '../../models';
|
|
|
import { useRoute } from 'vue-router';
|
|
import { useRoute } from 'vue-router';
|
|
|
import { httpRequests } from '@/utils/httpRequests';
|
|
import { httpRequests } from '@/utils/httpRequests';
|
|
|
import { importFileGetUrls } from '@/utils/models';
|
|
import { importFileGetUrls } from '@/utils/models';
|
|
|
-import { it } from 'node:test';
|
|
|
|
|
|
|
+import { H5ModelLook } from '@/views/components';
|
|
|
|
|
+
|
|
|
|
|
+const VITE_APP_PAGETPL_URL = ref(import.meta.env.VITE_APP_PAGETPL_URL || '');
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const dict = proxy?.useDict('page_event')
|
|
const dict = proxy?.useDict('page_event')
|
|
|
const { page_event } = toRefs<any>(dict);
|
|
const { page_event } = toRefs<any>(dict);
|
|
|
|
|
+const showPreviewTpl = ref(false);
|
|
|
// 获取地址栏参数
|
|
// 获取地址栏参数
|
|
|
const meetid = ref<string>('');
|
|
const meetid = ref<string>('');
|
|
|
const form = ref<any>({});
|
|
const form = ref<any>({});
|
|
@@ -73,10 +78,16 @@ const deleteItemEvents = (item: any) => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
// 预览
|
|
// 预览
|
|
|
|
|
+const previewTplStr = ref<string>('');
|
|
|
const previewTpl = async () => {
|
|
const previewTpl = async () => {
|
|
|
|
|
+ if (!form.value?.id) {
|
|
|
|
|
+ ElMessage.warning('请先选择一个页面进行预览');
|
|
|
|
|
+ return;
|
|
|
|
|
+ };
|
|
|
const res: any = await httpRequests.post(`/dgtmedicine/trainpage/edit`, form.value);
|
|
const res: any = await httpRequests.post(`/dgtmedicine/trainpage/edit`, form.value);
|
|
|
if (!res || res.code !== 200) return;
|
|
if (!res || res.code !== 200) return;
|
|
|
- console.log(res);
|
|
|
|
|
|
|
+ previewTplStr.value = `${VITE_APP_PAGETPL_URL.value}?id=${form.value.id}`;
|
|
|
|
|
+ showPreviewTpl.value = true;
|
|
|
};
|
|
};
|
|
|
const list = ref<any>([]);
|
|
const list = ref<any>([]);
|
|
|
const itemsData = ref<any>([]);
|
|
const itemsData = ref<any>([]);
|
|
@@ -146,6 +157,29 @@ const changeLabel = async (item: any) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
+// 设置背景音乐
|
|
|
|
|
+const setBgMusic = async () => {
|
|
|
|
|
+ const res: any[] = await importFileGetUrls(['mp3'], false);
|
|
|
|
|
+ if (!res || !res.length) return;
|
|
|
|
|
+ const music = res.find(item => item.code === 200);
|
|
|
|
|
+ if (!music || !music.data || !music.data.url) return;
|
|
|
|
|
+ form.value.bgMusic = music.data.url;
|
|
|
|
|
+ const saveRes = await httpRequests.post('/dgtmedicine/trainpage/edit', form.value);
|
|
|
|
|
+ if (saveRes && saveRes.code === 200) {
|
|
|
|
|
+ ElMessage.success('设置背景音乐成功');
|
|
|
|
|
+ getList();
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+// 发布页面
|
|
|
|
|
+const publishTpl = async () => {
|
|
|
|
|
+ if (!form.value?.id) {
|
|
|
|
|
+ ElMessage.warning('请先选择一个页面进行发布');
|
|
|
|
|
+ return;
|
|
|
|
|
+ };
|
|
|
|
|
+ const res: any = await httpRequests.post(`/dgtmedicine/trainpage/edit`, form.value);
|
|
|
|
|
+ if (!res || res.code !== 200) return;
|
|
|
|
|
+ ElMessage.success('发布成功');
|
|
|
|
|
+};
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getList();
|
|
getList();
|
|
|
});
|
|
});
|