liyongli vor 2 Jahren
Ursprung
Commit
e84dc4292d

+ 7 - 7
saveOSSAGitte.js

@@ -92,11 +92,11 @@ const { execSync } = require("child_process");
   }
 
   execFun();
-  await delDir(baseOssDir);
-  try {
-    await getFiles(dirPath);
-    console.log("数据上传oss---完成");
-  } catch (err) {
-    console.log("数据上传oss---失败");
-  }
+//   await delDir(baseOssDir);
+//   try {
+//     await getFiles(dirPath);
+//     console.log("数据上传oss---完成");
+//   } catch (err) {
+//     console.log("数据上传oss---失败");
+//   }
 })();

+ 31 - 37
src/view/allMedia/H5Editor.vue

@@ -4,7 +4,7 @@
       v-model:show="leftEle"
       position="left"
       :style="{
-        width: '300px',
+        width: '600px',
         'background-color': '#f3f3f3',
         height: '100%',
       }"
@@ -90,7 +90,7 @@
 
       <el-dialog v-model="showpage" title="保存页面">
         <el-form :model="pageconfig">
-          <el-form-item label="页面名称(英文)">
+          <el-form-item label="页面名称">
             <el-input v-model="pageconfig.name" />
           </el-form-item>
           <el-form-item label="页面描述">
@@ -104,7 +104,15 @@
         </template>
       </el-dialog>
 
-      <el-dialog v-model="dialogVisible" :title="'请选择向' + (visbileData.type == 'bottom' ? '下': '上') + '方添加的组件'" width="50vw">
+      <el-dialog
+        v-model="dialogVisible"
+        :title="
+          '请选择向' +
+          (visbileData.type == 'bottom' ? '下' : '上') +
+          '方添加的组件'
+        "
+        width="50vw"
+      >
         <span>This is a message</span>
         <template #footer>
           <span class="dialog-footer">
@@ -132,7 +140,7 @@
 <script setup>
 import { ref, provide } from 'vue';
 import { useRoute } from 'vue-router';
-import { createTemplateList, updateTemplateList } from '../../api/index';
+import { createTemplateList } from '../../api/index';
 import { ElMessage } from 'element-plus';
 
 // 中间显示模块组件
@@ -186,10 +194,9 @@ const selectComponent = (v, i) => {
 const addComponent = (type, index) => {
   dialogVisible.value = true;
   visbileData.value = {
-    type,   
+    type,
     index,
-  }
-  console.log(type, index);
+  };
 };
 
 // 查看页面大小,
@@ -229,39 +236,26 @@ const pageconfig = ref({
 });
 const savePageFunc = () => {
   showpage.value = true;
-  pageconfig.value.name = '';
-  pageconfig.value.desc = '';
+  pageconfig.value.name = item.title;
+  pageconfig.value.desc = item.h5Desc;
 };
 
 const savePage = () => {
-  if (item.operate_id) {
-    updateTemplateList({
-      data: {
-        h5Name: pageconfig.value.name,
-        h5Desc: pageconfig.value.desc,
-        h5Conf: JSON.stringify(hoversList.value),
-        id: item.operate_id,
-      },
-    }).then(() => {
-      showpage.value = false;
-      pageconfig.value.name = '';
-      pageconfig.value.desc = '';
-      ElMessage.success('保存成功');
-    });
-  } else
-    createTemplateList({
-      data: {
-        h5Name: pageconfig.value.name,
-        h5Desc: pageconfig.value.desc,
-        h5Conf: JSON.stringify(hoversList.value),
-        templateId: item.templateId,
-      },
-    }).then(() => {
-      showpage.value = false;
-      pageconfig.value.name = '';
-      pageconfig.value.desc = '';
-      ElMessage.success('保存成功');
-    });
+  const data = {
+    title: pageconfig.value.name,
+    h5Desc: pageconfig.value.desc,
+    hoversList: JSON.stringify(hoversList.value),
+  };
+  if (item.operate_id) data.id = item.operate_id;
+  else data.templateId = item.templateId;
+  createTemplateList({
+    data,
+  }).then(() => {
+    showpage.value = false;
+    pageconfig.value.name = '';
+    pageconfig.value.desc = '';
+    ElMessage.success('保存成功');
+  });
 };
 
 // provide 传递方法

+ 4 - 16
src/view/allMedia/H5Mall.vue

@@ -29,20 +29,8 @@
         </el-table-column>
         <el-table-column property="url" label="操作">
           <template #default="scope">
-            <el-link
-              type="primary"
-              v-if="scope.row.url"
-              :href="scope.row.url"
-              target="_blank"
-            >
-              打开
-            </el-link>
-            <el-button
-              link
-              type="primary"
-              size="small"
-              @click="() => editBL(scope)"
-            >
+            <el-button v-if="scope.row.url" type="primary" link @click="() => openurl(scope.row.url)"> 打开 </el-button>
+            <el-button link type="primary" @click="() => editBL(scope)">
               修改
             </el-button>
           </template>
@@ -91,14 +79,12 @@ const toH5Editor = item => {
 
 const showData = () => {
   getPersonalList({ data: {} }).then(r => {
-    console.log(r);
     localList.value = r;
     show.value = true;
   });
 };
 
 const editBL = item => {
-    console.log("---")
   router.push({
     path: '/h5editor',
     query: {
@@ -106,6 +92,8 @@ const editBL = item => {
     },
   });
 };
+
+const openurl = url => window.open(url);
 </script>
 
 <style scoped>

+ 0 - 1
src/view/allMedia/analysis_detail.vue

@@ -18,7 +18,6 @@ const route = useRoute();
 const detail = ref('');
 const raw = ref({});
 const D = JSON.parse(route.query.detail || '{}');
-console.log(D);
 detail.value = D.content || '';
 raw.value = D || {};
 </script>

+ 12 - 11
src/view/allMedia/components/H5Editor/van_field.vue

@@ -7,16 +7,12 @@
       readonly
     >
       <template v-if="item.child_list && item.child_list.length" #input>
-        <template v-for="(v, i) in item.child_list" :key="i">
-          <h5-van-radio-group
-            :item="v"
-            v-if="v.type === 'van-radio-group'"
-          ></h5-van-radio-group>
-          <h5-van-uploader
-            :item="v"
-            v-if="v.type === 'van-uploader'"
-          ></h5-van-uploader>
-        </template>
+        <component
+          v-for="(v, i) in item.child_list"
+          :key="i"
+          :item="v"
+          :is="component[v.type]"
+        ></component>
       </template>
     </van-field>
     <div class="van_field_item">
@@ -29,7 +25,6 @@
         </div>
       </div>
     </div>
-
   </div>
 </template>
 <script setup>
@@ -47,6 +42,12 @@ const emit = defineEmits(['addComponent']);
 const item = JSON.parse(JSON.stringify(props.item || '{}'));
 label.value = item.attr.label || item.attr.name;
 placeholder.value = item.attr.placeholder;
+isRequired.value = item.attr.isRequired;
+
+const component = {
+  'van-radio-group': H5VanRadioGroup,
+  'van-uploader': H5VanUploader,
+};
 
 const addTop = () => {
   emit('addComponent', 'top', props.index);

+ 0 - 1
src/view/allMedia/components/H5EditorLeft/paragraph.vue

@@ -23,7 +23,6 @@ const props = defineProps({
   item: Object,
   index: String,
 });
-console.log(props);
 const item = JSON.parse(JSON.stringify(props.item));
 const form = ref({
   title: item.item.title,

+ 10 - 9
src/view/allMedia/components/H5EditorLeft/vanButtom.vue

@@ -2,7 +2,7 @@
   <left-skeleton @save="save" @deleteFunc="deleteFunc">
     <el-form :model="form">
       <el-form-item label="按钮名称">
-        <el-input v-model="form.name" placeholder="请输入按钮名称"/>
+        <el-input v-model="form.name" placeholder="请输入按钮名称" />
       </el-form-item>
       <el-form-item label="api">
         <el-input v-model="form.api" placeholder="请输入按钮调用api" />
@@ -23,14 +23,18 @@ const props = defineProps({
   index: String,
 });
 
-
 const form = ref({
-    name: props.item.item.text || "",
-    api: props.item.item.api || "",
+  name: props.item.item.text || '',
+  api: props.item.item.api || '',
 });
 
 const save = () => {
-  saveComponents('保存');
+  const item = JSON.parse(JSON.stringify(props.item.item));
+  item.text = form.value.name;
+  item.api = form.value.api;
+  item.type = 'van-buttom';
+  delete item.index
+  saveComponents({ item, index: props.index });
 };
 
 const deleteFunc = () => {
@@ -40,9 +44,6 @@ const deleteFunc = () => {
    */
   deleteItemComponents(props.index);
 };
-
-console.log(form.value,props.item);
 </script>
 
-<style scoped>
-</style>
+<style scoped></style>

+ 19 - 27
src/view/allMedia/components/H5EditorLeft/vanField.vue

@@ -1,40 +1,29 @@
 <template>
   <left-skeleton @save="save" @deleteFunc="deleteFunc">
-    <el-form :model="form" v-if="defaultForm">
-      <el-form-item label="组件名称">
+    <el-form :model="form" label-width="55px">
+      <el-form-item label="名称">
         <el-input v-model="form.label" />
       </el-form-item>
-      <el-form-item label="默认提示">
+      <el-form-item v-if="defaultForm" label="提示">
         <el-input v-model="form.placeholder" />
       </el-form-item>
-      <el-form-item label="是否必填">
+      <el-form-item label="必填">
         <el-switch v-model="form.isRequired" />
       </el-form-item>
-      <el-form-item label="参数key">
+      <el-form-item label="key">
         <el-input v-model="form.key" />
       </el-form-item>
+      <el-form-item v-if="!defaultForm" label="子属性">
+        <component
+          v-for="(item, index) in form.child_list"
+          :key="index"
+          :is="H5EditorObj[item.type]"
+          :item="item"
+          :index="index + ''"
+          @change="seacechange"
+        ></component>
+      </el-form-item>
     </el-form>
-    <div v-else>
-      <el-form :model="form">
-        <el-form-item label="组件名称">
-          <el-input v-model="form.label" />
-        </el-form-item>
-        <el-form-item label="是否必填">
-          <el-switch v-model="form.isRequired" />
-        </el-form-item>
-        <el-form-item label="参数key值">
-          <el-input v-model="form.key" />
-        </el-form-item>
-      </el-form>
-      <component
-        v-for="(item, index) in form.child_list"
-        :key="index"
-        :is="H5EditorObj[item.type]"
-        :item="item"
-        :index="index + ''"
-        @change="seacechange"
-      ></component>
-    </div>
   </left-skeleton>
 </template>
 
@@ -66,18 +55,19 @@ if (!item.child_list || !item.child_list.length) {
   formSele.label = item.attr.label;
   formSele.placeholder = item.attr.placeholder;
   formSele.isRequired = item.attr.isRequired;
+  formSele.key = item.attr.key;
 } else {
   defaultForm.value = false;
   formSele.child_list = item.child_list;
   formSele.label = item.attr.label;
   formSele.isRequired = item.attr.isRequired;
+  formSele.key = item.attr.key;
 }
 
 const form = ref(formSele);
 
 // 获取子组件内更新的数据
 const seacechange = (item, index) => {
-  console.log(item, index, form.value.child_list);
   form.value.child_list[index] = item;
 };
 
@@ -86,10 +76,12 @@ const save = () => {
     item.attr.label = form.value.label;
     item.attr.placeholder = form.value.placeholder;
     item.attr.isRequired = form.value.isRequired;
+    item.attr.key = form.value.key;
   } else {
     item.child_list = form.value.child_list;
     item.attr.label = form.value.label;
     item.attr.isRequired = form.value.isRequired;
+    item.attr.key = form.value.key;
   }
   saveComponents({ item, index: props.index });
 };

+ 0 - 12
src/view/allMedia/components/H5EditorLeft/van_radio.vue

@@ -1,12 +0,0 @@
-<template>
-  <van-radio checked-color="#f63634" :name="radioName">{{ label }}</van-radio>
-</template>
-<script setup>
-import { defineProps, ref } from 'vue';
-const props = defineProps({
-  item: Object,
-});
-const item = JSON.parse(JSON.stringify(props.item || '{}'));
-const label = ref(item.attr.label || '');
-const radioName = ref(item.attr.name || '');
-</script>

+ 15 - 18
src/view/allMedia/components/H5EditorLeft/van_radio_group.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <van-radio-group v-model="select" :direction="localItem.attr.direction">
+    <van-radio-group direction="vertical">
       <div
         v-for="(v, i) in localItem.child_list || []"
         @close="close"
@@ -11,20 +11,18 @@
           <el-icon @click="() => editEle(v, i)"><Edit /></el-icon>
           <el-icon @click="() => close(v, i)"><Close /></el-icon>
         </div>
-        <h5-van-radio :item="v"></h5-van-radio>
+        <van-radio checked-color="#f63634" :name="v.attr.name">{{
+          v.attr.label
+        }}</van-radio>
       </div>
     </van-radio-group>
     <div style="padding-top: 1em">
-      <el-icon
-        v-if="!showEle"
-        color="#409eff"
-        :size="30"
-        @click="() => editEle()"
-        ><FolderAdd
-      /></el-icon>
-
+      <el-button v-if="!showEle" type="primary" @click="() => editEle()">
+        <el-icon color="#fff" :size="15"><Plus /></el-icon>
+        新增选项
+      </el-button>
       <el-form class="formEle" :model="form" v-if="showEle">
-        <el-form-item label="文案">
+        <el-form-item label="选项名称">
           <el-input v-model="form.name" />
         </el-form-item>
         <el-form-item>
@@ -37,7 +35,6 @@
 </template>
 <script setup>
 import { defineProps, ref, defineEmits } from 'vue';
-import H5VanRadio from './van_radio.vue';
 const props = defineProps({
   item: Object,
   index: String,
@@ -45,17 +42,13 @@ const props = defineProps({
 
 const localItem = ref(JSON.parse(JSON.stringify(props.item)));
 
-const select = ref(
-  localItem.value.child_list ? localItem.value.child_list[0].attr.name : ''
-);
-
 const showEle = ref(false);
+console.log(localItem);
 
 const emit = defineEmits(['change']);
 const form = ref({
   name: '',
 });
-console.log(localItem.value);
 
 const editEle = (v, i) => {
   showEle.value = true;
@@ -63,6 +56,9 @@ const editEle = (v, i) => {
   if (v) {
     form.value.index = i;
     form.value.name = v.attr.label;
+  } else {
+    form.value.index = -1;
+    form.value.name = '';
   }
 };
 
@@ -78,6 +74,7 @@ const onSubmit = () => {
   showEle.value = false;
   if (form.value.isEdit) {
     localItem.value.child_list[form.value.index].attr.name = form.value.name;
+    localItem.value.child_list[form.value.index].attr.label = form.value.name;
   } else {
     localItem.value.child_list.push({
       attr: {
@@ -105,7 +102,7 @@ const cancel = () => {
 }
 .closeCss {
   position: absolute;
-  top: 7px;
+  top: 0;
   right: 3px;
 }
 </style>

+ 14 - 5
src/view/allMedia/components/H5EditorLeft/van_uploader.vue

@@ -1,10 +1,19 @@
 <template>
-   <el-form :model="localitem">
-    <el-form-item label="介绍文案">
-      <el-input @input="setData" v-model="localitem.subtitle" />
-    </el-form-item>
+   <el-form style="width: 100%" :model="localitem" label-width="80px">
     <el-form-item label="api">
-      <el-input @input="setData" v-model="localitem.attr.api" placeholder="请输入文件上传地址" />
+      <el-input @input="setData" v-model="localitem.attr.api" placeholder="文件上传地址" />
+    </el-form-item>
+    <br />
+    <el-form-item label="大小">
+      <el-input @input="setData" v-model="localitem.attr.maxSize" placeholder="文件限制" />
+    </el-form-item>
+    <br />
+    <el-form-item label="数量">
+      <el-input-number @change="setData" v-model="localitem.attr.maxCount" placeholder="请输入数字" />
+    </el-form-item>
+    <br />
+    <el-form-item label="介绍">
+      <el-input @input="setData" type="textarea" :rows="3" v-model="localitem.subtitle" />
     </el-form-item>
   </el-form>
 </template>

+ 0 - 1
src/view/allMedia/components/analysis_hot_list.vue

@@ -41,7 +41,6 @@ const hot = () => {
 };
 
 watch(props, () => {
-  console.log(props.province);
   hot();
 });