huangxw 4 ay önce
ebeveyn
işleme
36f68e1d07

+ 5 - 2
src/views/training/models/meeting-tpl-list.vue

@@ -53,9 +53,12 @@ const addMeetingTpls = async () => {
    emit('addMeetingTpls');
 };
 const selectTplId = ref<string>('');
-const clickItem = (item: any) => {
+const clickItem = async (item: any) => {
     selectTplId.value = item.id;
-    emit('selectItem', item);
+    const res = await httpRequests.get(`/dgtmedicine/trainpage/getInfo/${item.id}`);
+    if (res?.code === 200) {
+        emit('selectItem', res.data);
+    }
 };
 // 更换页面名称
 const changeLabel = async (item: any) => {

+ 5 - 9
src/views/training/ptpl/edit/index.vue

@@ -14,7 +14,7 @@
                 <div class="d-flex a-c">
                     <el-button v-if="form.id" @click="setBgMusic">设置背景音乐</el-button>
                     <el-button @click="router.go(-1)">取消</el-button>
-                    <el-button v-if="form.id" @click="previewTpl" type="primary">预览</el-button>
+                    <el-button @click="previewTpl" type="primary">预览</el-button>
                 </div>
             </div>
             <div class="flex1 ov-hd d-flex">
@@ -89,13 +89,10 @@ 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;
-    previewTplStr.value = `${VITE_APP_PAGETPL_URL.value}?id=${form.value.id}`;
+    if (!list.value?.length) {
+        return proxy?.$modal.msgWarning('请先添加页面');
+    }
+    previewTplStr.value = `${VITE_APP_PAGETPL_URL.value}?id=${list.value[0].id}`;
     showPreviewTpl.value = true;
 };
 const list = ref<any>([]);
@@ -168,7 +165,6 @@ const setIndexTpl = async (item) => {
 const setMuisc = (item: any) => {
     if (form.value.id === item.id) {
         form.value = { ...form.value, ...item }
-        getList();
     }
 };
 const changeLabel = async (item: any) => {