| 
					
				 | 
			
			
				@@ -17,6 +17,7 @@ import { AnalysisEventType, useAnalysis } from '@/composables/analysis' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const userStore = useUserStore() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const { option } = useAnalysis(true, false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const id = ref() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const downloading = ref(false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const { data, run: setData } = useRequest(() => getMaterialDetail({ id: id.value })) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const { data: materialHomePageData, run: setMaterialHomePageData } = useRequest( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   () => getMaterialHomePage(id.value), 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -38,37 +39,36 @@ const { data: materialsManageBrands, run: setMaterialsManageBrands } = useReques 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   () => getByDictType(DictType.materialsManageBrand), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   { initialData: [] }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-const handleDownload = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // console.log('handleDownload') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  const Authorization = userStore.userInfo?.token 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  uni.downloadFile({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    url: `https://www.zhuchaohui.com/app-api/member/materials/download?materialsId=${id.value}`, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const handleDownload = async () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const { filePath } = await uni.downloadFile({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    url: data.value.agreementFileUrl, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    filePath: `${uni.env.USER_DATA_PATH}/${data.value.materialsName}的素材包.zip`, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     header: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      'trace-id': 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      Authorization, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    success: (res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log('downloadFile success', res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      uni.saveFile({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        tempFilePath: res.tempFilePath, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        success: (res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          console.log('saveFile success', res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        fail: (err) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          console.log('saveFile fail', err) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      uni.openDocument({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        filePath: res.tempFilePath, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        success: (res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          console.log('openDocument success', res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        fail: (err) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          console.log('openDocument fail', err) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      'Content-Type': 'application/x-zip-compressed', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const { deviceType } = await uni.getDeviceInfo() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (deviceType === 'pc') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uni.saveFileToDisk({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      filePath, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      success: (res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log('saveFileToDisk success', res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      fail: (err) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log('saveFileToDisk fail', err) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uni.openDocument({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      filePath, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      success: (res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log('openDocument success', res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      fail: (err) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log('openDocument fail', err) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 onLoad(async (query: { id: number }) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   id.value = query.id 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -296,8 +296,13 @@ onShareTimeline(() => ({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <wd-button custom-class="w-full! rounded-lg!" @click="handleDownload"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        下载所有素材包 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <wd-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        custom-class="w-full! rounded-lg!" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        :disabled="(data.agreementFileUrl ?? '') !== ''" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        :loading="downloading" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        @click="handleDownload" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        {{ downloading ? '下载中...' : '下载所有素材包' }} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </wd-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </view> 
			 |