Переглянути джерело

修改任务详情删除任务时无法删除的问题

一只小菜杨 1 місяць тому
батько
коміт
3816fcf6fb
3 змінених файлів з 25 додано та 17 видалено
  1. 2 1
      src/stores/global.ts
  2. 1 0
      src/views/CommandInfo.vue
  3. 22 16
      src/views/ProjectInfo.vue

+ 2 - 1
src/stores/global.ts

@@ -42,7 +42,8 @@ export const useGlobalStore = defineStore(
                     id: '113',
                     type: 'time',
                     label: '每天',
-                    value: '08:00'
+                    value: '08:00',
+                    operation: '等于'
                   }
                 ]
               },

+ 1 - 0
src/views/CommandInfo.vue

@@ -463,6 +463,7 @@ const handleAddCommand = async (type: string) => {
           crtProject.value!.commandList = crtProject.value!.commandList.filter(
             (item) => crtCommand.value?.id !== item.id
           )
+          isExit = true
           router.push(`/project-info/${crtProject.value!.id}`)
         })
         .catch(() => {

+ 22 - 16
src/views/ProjectInfo.vue

@@ -37,22 +37,24 @@
     </div>
 
     <van-popup v-model:show="showMorePopup" position="right" :style="{ width: '50%', height: '100%' }">
-      <van-cell-group :style="{ marginTop: '16px' }">
-        <van-cell title="编辑工程名称" clickable @click="handleEditName" :title-style="{ color: '#07c160' }" />
-        <van-cell title="编译文件" @click="get_c_code" clickable :title-style="{ color: '#1989fa' }" />
-        <van-cell clickable v-show="crtProject?.isCompiled">
-          <template #title>
-            <div v-html="wxtag"></div>
-          </template>
-        </van-cell>
-        <van-cell title="删除工程" @click="delProject" clickable :title-style="{ color: '#fd5632' }" />
-        <van-cell clickable v-if="isInWx">
-          <template #title>
-            <div v-html="wxShareTag"></div>
-          </template>
-        </van-cell>
-        <!-- <van-cell title="分享" @click="shareProject" clickable /> -->
-      </van-cell-group>
+      <template v-if="showMorePopup">
+        <van-cell-group :style="{ marginTop: '16px' }">
+          <van-cell title="编辑工程名称" clickable @click="handleEditName" :title-style="{ color: '#07c160' }" />
+          <van-cell title="编译文件" @click="get_c_code" clickable :title-style="{ color: '#1989fa' }" />
+          <van-cell clickable v-show="crtProject?.isCompiled">
+            <template #title>
+              <div v-html="wxtag"></div>
+            </template>
+          </van-cell>
+          <van-cell title="删除工程" @click="delProject" clickable :title-style="{ color: '#fd5632' }" />
+          <van-cell clickable v-if="isInWx">
+            <template #title>
+              <div v-html="wxShareTag"></div>
+            </template>
+          </van-cell>
+          <!-- <van-cell title="分享" @click="shareProject" clickable /> -->
+        </van-cell-group>
+      </template>
     </van-popup>
 
     <van-popup v-model:show="showEditPopup" round :style="{ width: '80%' }">
@@ -186,6 +188,9 @@ const onSubmit = (values: Record<string, string>) => {
     return
   } else {
     crtProject.value!.name = values.newProjectName
+    wxShareTag.value = `<wx-open-launch-weapp appid="wx4c5a777c71f2981c" path="pages/sharefile/index?content=${encodeURIComponent(JSON.stringify({ ...crtProject.value, qrcodeType: 'worldflying_plc_editor' }))}&filename=${crtProject.value?.name}.jmpec"><template><text style="color: #896ef4">分享</text></template></wx-open-launch-weapp>`
+    console.log(wxShareTag.value)
+
     handleCancel()
   }
 }
@@ -201,6 +206,7 @@ const handleDelete = (val: string) => {
     if (project) {
       if (project.commandList.length === 1) return showFailToast('请至少保留一个任务!')
       project.commandList = project.commandList.filter((item) => item.id !== val)
+      crtProject.value!.commandList = crtProject.value!.commandList.filter((item) => item.id !== val)
       if (crtProject.value?.isCompiled) {
         crtProject.value.isCompiled = false
         localStorage.removeItem('imgobj' + crtProject.value!.id)