shish 2 лет назад
Родитель
Сommit
4d98caa13a
2 измененных файлов с 12 добавлено и 45 удалено
  1. 6 10
      ghs/src/service/order/index.js
  2. 6 35
      ghs/src/views/order/list.vue

+ 6 - 10
ghs/src/service/order/index.js

@@ -1,4 +1,6 @@
 import { BaseService, Service } from '@/cool';
+import store from '@/store';
+import { baseUrl } from '@/config/env';
 
 @Service('order')
 export class OrderService extends BaseService {
@@ -89,18 +91,12 @@ export class OrderService extends BaseService {
 		});
 	}
 
-	down(params) {
-		return this.request({
-			url: '/down',
-			params
-		});
+	down(id) {
+		return baseUrl + `/order/down?id=${id}&token=${store.state.user.token}`;
 	}
 
-	allDown(params) {
-		return this.request({
-			url: '/all-down',
-			params
-		});
+	allDown(id) {
+		return baseUrl + `/order/all-down?id=${id}&token=${store.state.user.token}`;
 	}
 
 }

+ 6 - 35
ghs/src/views/order/list.vue

@@ -243,42 +243,13 @@ export default {
         this.$refs.selOrder.init();
       });
     },
-    async down(info){
-      let imgUrl = ''
-      let name = ''
-			await this.$service.order.down({ id:info.id }).then(data => {
-        imgUrl = data.url
-        name = data.name
-			});
-      console.log(imgUrl)
-        const response = await fetch(imgUrl)
-        const blob = await response.blob()
-        const url = window.URL.createObjectURL(blob)
-        const link = document.createElement('a')
-        link.href = url
-        link.download = name
-        document.body.appendChild(link)
-        link.click()
-        document.body.removeChild(link)
-        window.URL.revokeObjectURL(url)
+    down(info){
+			let imgFile = this.$service.order.down(info.id)
+      location.href = imgFile
     },
-    async allDown(){
-      let imgUrl = ''
-      let name = ''
-			await this.$service.order.allDown({ id:info.id }).then(data => {
-        imgUrl = data.url
-        name = data.name
-      })
-     const response = await fetch(imgUrl)
-     const blob = await response.blob()
-     const url = window.URL.createObjectURL(blob)
-     const link = document.createElement('a')
-     link.href = url
-     link.download = name
-     document.body.appendChild(link)
-     link.click()
-     document.body.removeChild(link)
-     window.URL.revokeObjectURL(url)
+    allDown(info){
+      let imgFile = this.$service.order.allDown(info.id)
+      location.href = imgFile
     },
     detailShowFn(item) {
       this.optionData = item;