ZaiZai před 2 roky
rodič
revize
cb2a281618
2 změnil soubory, kde provedl 15 přidání a 2 odebrání
  1. 3 1
      pages/image/form.vue
  2. 12 1
      pages/image/view.vue

+ 3 - 1
pages/image/form.vue

@@ -86,12 +86,14 @@ const dateEnd = ref(dayjs().format("YYYY-MM-DD"));
 
 //页面启动
 onLoad((options) => {
-    const {id} = getObjValue(options)
+    const {id, node} = getObjValue(options)
     dataId.value = id ?? '';
     if (id) {
         uni.setNavigationBarTitle({title: '编辑声像文件'})
         getInfoApi()
     } else {
+        const nodes = node ? JSON.parse(decodeURIComponent(node)) : {};
+        console.log(nodes)
         uni.setNavigationBarTitle({title: '新增声像文件'})
     }
 })

+ 12 - 1
pages/image/view.vue

@@ -49,7 +49,7 @@
                     </view>
                     <button hover-class="none" class="cu-btn bg-red-5 text-white" @click="delCheckList">删除选中</button>
                 </view>
-                <button hover-class="none" class="cu-btn block bg-purple-8 text-white" v-else>新增声像文件</button>
+                <button hover-class="none" class="cu-btn block bg-purple-8 text-white" @click="addFileData" v-else>新增声像文件</button>
             </hc-tabbars>
         </template>
     </z-paging>
@@ -188,4 +188,15 @@ const delCheckList = async () => {
         errorToast('删除失败: ' + msg)
     }
 }
+
+//新增文件数据
+const addFileData = () => {
+    //准备跳转路由
+    const node = encodeURIComponent(JSON.stringify({
+        ...pageNode.value
+    }));
+    uni.navigateTo({
+        url: `/pages/image/form?node=${node}`
+    })
+}
 </script>