huangxw 4 maanden geleden
bovenliggende
commit
fbe282a38b

+ 2 - 0
.env.development

@@ -42,3 +42,5 @@ VITE_APP_PACKAGE_SHARE_URL = 'http://dm.share.yujin.shuziyunyao.com/package'
 VITE_APP_SHARE_QR_CODE_URL = 'http://dm.share.yujin.shuziyunyao.com'
 
 VITE_H5_URL = 'https://t.yujin.shuziyunyao.com/'
+# pagetpl地址
+VITE_APP_PAGETPL_URL = 'https://dm.yujin.shuziyunyao.com/trainpage'

BIN
src/assets/images/bg_music_icon.png


+ 1 - 12
src/views/components/H5ModelLook.vue

@@ -1,16 +1,5 @@
 <template>
-    <vxe-modal
-        v-model="dialogVisible"
-        :title="title"
-        resize
-        :show-footer="false"
-        destroy-on-close
-        transfer
-        height="80vh"
-        mask-closable
-        @hide="close"
-        :width="width"
-    >
+    <vxe-modal v-model="dialogVisible" :title="title" resize :show-footer="false" destroy-on-close transfer height="80vh" mask-closable @hide="close" :width="width">
         <template #default>
             <iframe :src="src" class="iframe-wrapper"></iframe>
         </template>

+ 1 - 0
src/views/training/models/meeting-tpl-h5.vue

@@ -2,6 +2,7 @@
     <template v-if="form.img">
         <div class="flex1" style="overflow: auto;">
             <TelViewTem @selectArea="selectArea" :enableDraw="enableDraw" bgColor="#f7f7f7" :bgSrc="form.img">
+                <DragResizeRotate v-if="form.bgm" v-model="form.bgmRact" @deactivated="deactivated"></DragResizeRotate>
                 <template v-for="(item, index) in form?.events" :key="index">
                     <DragResizeRotate v-model="form.events[index]" @delete="deleteItemEvents($event, index, item)" @activated="activated($event, index)" @deactivated="deactivated"></DragResizeRotate>
                 </template>

+ 37 - 3
src/views/training/ptpl/edit/index.vue

@@ -12,9 +12,10 @@
                     </el-button>
                 </div>
                 <div class="d-flex a-c">
+                    <el-button @click="setBgMusic">设置背景音乐</el-button>
                     <el-button @click="router.go(-1)">取消</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 class="flex1 ov-hd d-flex">
@@ -36,6 +37,7 @@
             </div>
         </div>
     </div>
+    <H5ModelLook v-if="showPreviewTpl" v-model:show="showPreviewTpl" :src="previewTplStr" title="预览"></H5ModelLook>
 </template>
 <script setup lang="ts" name="ptpl-edit-index">
 import router from '@/router';
@@ -43,10 +45,13 @@ import { MeetingTplH5, MeetingTplList, MeetingTplEvents } from '../../models';
 import { useRoute } from 'vue-router';
 import { httpRequests } from '@/utils/httpRequests';
 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 dict = proxy?.useDict('page_event')
 const { page_event } = toRefs<any>(dict);
+const showPreviewTpl = ref(false);
 // 获取地址栏参数
 const meetid = ref<string>('');
 const form = ref<any>({});
@@ -73,10 +78,16 @@ const deleteItemEvents = (item: any) => {
     }
 };
 // 预览
+const previewTplStr = ref<string>('');
 const previewTpl = 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;
-    console.log(res);
+    previewTplStr.value = `${VITE_APP_PAGETPL_URL.value}?id=${form.value.id}`;
+    showPreviewTpl.value = true;
 };
 const list = 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(() => {
     getList();
 });