|
@@ -4,7 +4,12 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import Card from '@/components/card.vue'
|
|
import Card from '@/components/card.vue'
|
|
import SectionHeading from '@/components/section-heading.vue'
|
|
import SectionHeading from '@/components/section-heading.vue'
|
|
-import { getMaterialDetail, getByDictType, getMaterialHomePage } from '../../../core/libs/requests'
|
|
|
|
|
|
+import {
|
|
|
|
+ getMaterialDetail,
|
|
|
|
+ getByDictType,
|
|
|
|
+ getMaterialHomePage,
|
|
|
|
+ downloadMaterials,
|
|
|
|
+} from '../../../core/libs/requests'
|
|
import NavbarEvo from '@/components/navbar-evo.vue'
|
|
import NavbarEvo from '@/components/navbar-evo.vue'
|
|
import { DictType } from '../../../core/libs/models'
|
|
import { DictType } from '../../../core/libs/models'
|
|
import { phone } from '../../../core/libs/svgs'
|
|
import { phone } from '../../../core/libs/svgs'
|
|
@@ -13,7 +18,9 @@ import router from '@designer-hub/assets/src/assets/svgs/router'
|
|
import { isVideoUrl } from 'wot-design-uni/components/common/util'
|
|
import { isVideoUrl } from 'wot-design-uni/components/common/util'
|
|
import { useUserStore } from '@/store'
|
|
import { useUserStore } from '@/store'
|
|
import { AnalysisEventType, useAnalysis } from '@/composables/analysis'
|
|
import { AnalysisEventType, useAnalysis } from '@/composables/analysis'
|
|
|
|
+import { usePermissions } from '@/composables/permissions'
|
|
|
|
|
|
|
|
+const { clickByPermission } = usePermissions()
|
|
const userStore = useUserStore()
|
|
const userStore = useUserStore()
|
|
const { option } = useAnalysis(true, false)
|
|
const { option } = useAnalysis(true, false)
|
|
const id = ref()
|
|
const id = ref()
|
|
@@ -40,6 +47,7 @@ const { data: materialsManageBrands, run: setMaterialsManageBrands } = useReques
|
|
{ initialData: [] },
|
|
{ initialData: [] },
|
|
)
|
|
)
|
|
const handleDownload = async () => {
|
|
const handleDownload = async () => {
|
|
|
|
+ downloading.value = true
|
|
const { filePath } = await uni.downloadFile({
|
|
const { filePath } = await uni.downloadFile({
|
|
url: data.value.agreementFileUrl,
|
|
url: data.value.agreementFileUrl,
|
|
filePath: `${uni.env.USER_DATA_PATH}/${data.value.materialsName}的素材包.zip`,
|
|
filePath: `${uni.env.USER_DATA_PATH}/${data.value.materialsName}的素材包.zip`,
|
|
@@ -47,6 +55,8 @@ const handleDownload = async () => {
|
|
'Content-Type': 'application/x-zip-compressed',
|
|
'Content-Type': 'application/x-zip-compressed',
|
|
},
|
|
},
|
|
})
|
|
})
|
|
|
|
+ downloading.value = false
|
|
|
|
+ await downloadMaterials({ materialsId: id.value })
|
|
const { deviceType } = await uni.getDeviceInfo()
|
|
const { deviceType } = await uni.getDeviceInfo()
|
|
if (deviceType === 'pc') {
|
|
if (deviceType === 'pc') {
|
|
uni.saveFileToDisk({
|
|
uni.saveFileToDisk({
|
|
@@ -298,9 +308,9 @@ onShareTimeline(() => ({
|
|
|
|
|
|
<wd-button
|
|
<wd-button
|
|
custom-class="w-full! rounded-lg!"
|
|
custom-class="w-full! rounded-lg!"
|
|
- :disabled="(data.agreementFileUrl ?? '') !== ''"
|
|
|
|
|
|
+ :disabled="(data?.agreementFileUrl ?? '') === ''"
|
|
:loading="downloading"
|
|
:loading="downloading"
|
|
- @click="handleDownload"
|
|
|
|
|
|
+ @click="clickByPermission('download', () => handleDownload())"
|
|
>
|
|
>
|
|
{{ downloading ? '下载中...' : '下载所有素材包' }}
|
|
{{ downloading ? '下载中...' : '下载所有素材包' }}
|
|
</wd-button>
|
|
</wd-button>
|