From-wh 2 лет назад
Родитель
Сommit
7fa4faa6f8

+ 4 - 3
template/admin/src/api/product.js

@@ -344,12 +344,13 @@ export function productGetTemplateApi() {
 }
 }
 
 
 /**
 /**
- * @description 商品 -- 获取运费模板
+ * @description 获取上传参数
  */
  */
-export function productGetTempKeysApi() {
+export function productGetTempKeysApi(data) {
   return request({
   return request({
     url: `product/product/get_temp_keys`,
     url: `product/product/get_temp_keys`,
     method: 'get',
     method: 'get',
+    params: data,
   });
   });
 }
 }
 
 
@@ -393,7 +394,7 @@ export function productUserLabel() {
   });
   });
 }
 }
 /**
 /**
- * @description 商品添加编辑-- 用户标签
+ * @description 上传类型
  */
  */
 export function uploadType() {
 export function uploadType() {
   return request({
   return request({

+ 12 - 0
template/admin/src/api/upload.js

@@ -22,3 +22,15 @@ export function upload(data, config) {
     data,
     data,
   });
   });
 }
 }
+/**
+ * @description 云存储 url 上传
+ * @param {Object} param data {Object} 传值参数
+ */
+export function ossUpload(url, data) {
+  return request({
+    url,
+    method: 'post',
+    file: true,
+    data,
+  });
+}

+ 5 - 1
template/admin/src/components/uploadVideo/index.vue

@@ -136,7 +136,11 @@ export default {
       if (evfile.target.files[0].type !== 'video/mp4') {
       if (evfile.target.files[0].type !== 'video/mp4') {
         return that.$Message.error('只能上传mp4文件');
         return that.$Message.error('只能上传mp4文件');
       }
       }
-      productGetTempKeysApi().then((res) => {
+      let types = {
+        key: evfile.target.files[0].name,
+        contentType: evfile.target.files[0].type,
+      };
+      productGetTempKeysApi(types).then((res) => {
         that.$videoCloud
         that.$videoCloud
           .videoUpload({
           .videoUpload({
             type: res.data.type,
             type: res.data.type,

+ 5 - 1
template/admin/src/components/uploadVideo2/index.vue

@@ -135,7 +135,11 @@ export default {
       if (evfile.target.files[0].type !== 'video/mp4') {
       if (evfile.target.files[0].type !== 'video/mp4') {
         return that.$Message.error('只能上传mp4文件');
         return that.$Message.error('只能上传mp4文件');
       }
       }
-      productGetTempKeysApi().then((res) => {
+      let types = {
+        key: evfile.target.files[0].name,
+        contentType: evfile.target.files[0].type,
+      };
+      productGetTempKeysApi(types).then((res) => {
         that.$videoCloud
         that.$videoCloud
           .videoUpload({
           .videoUpload({
             type: res.data.type,
             type: res.data.type,

+ 5 - 1
template/admin/src/pages/marketing/recharge/index.vue

@@ -285,7 +285,11 @@ export default {
       if (suffix.indexOf('.mp4') === -1) {
       if (suffix.indexOf('.mp4') === -1) {
         return that.$Message.error('只能上传MP4文件');
         return that.$Message.error('只能上传MP4文件');
       }
       }
-      productGetTempKeysApi()
+      let types = {
+        key: evfile.target.files[0].name,
+        contentType: evfile.target.files[0].type,
+      };
+      productGetTempKeysApi(types)
         .then((res) => {
         .then((res) => {
           that.$videoCloud
           that.$videoCloud
             .videoUpload({
             .videoUpload({

+ 9 - 4
template/admin/src/pages/product/productAdd/index.vue

@@ -824,14 +824,14 @@
                   placeholder="请输入一级返佣"
                   placeholder="请输入一级返佣"
                   :min="0"
                   :min="0"
                   :max="9999999"
                   :max="9999999"
-                  class="columnsBox perW30"
+                  class="columnsBox perW20"
                   v-model="manyBrokerage"
                   v-model="manyBrokerage"
                 ></InputNumber>
                 ></InputNumber>
                 二级返佣:<InputNumber
                 二级返佣:<InputNumber
                   placeholder="请输入二级返佣"
                   placeholder="请输入二级返佣"
                   :min="0"
                   :min="0"
                   :max="99999999"
                   :max="99999999"
-                  class="columnsBox perW30"
+                  class="columnsBox perW20"
                   v-model="manyBrokerageTwo"
                   v-model="manyBrokerageTwo"
                 ></InputNumber>
                 ></InputNumber>
               </span>
               </span>
@@ -840,7 +840,7 @@
                   placeholder="请输入会员价"
                   placeholder="请输入会员价"
                   :min="0"
                   :min="0"
                   :max="99999999"
                   :max="99999999"
-                  class="columnsBox perW30"
+                  class="columnsBox perW20"
                   v-model="manyVipPrice"
                   v-model="manyVipPrice"
                 ></InputNumber>
                 ></InputNumber>
               </span>
               </span>
@@ -2317,7 +2317,12 @@ export default {
       if (suffix.indexOf('.mp4') === -1) {
       if (suffix.indexOf('.mp4') === -1) {
         return that.$Message.error('只能上传MP4文件');
         return that.$Message.error('只能上传MP4文件');
       }
       }
-      productGetTempKeysApi()
+      console.log(evfile.target.files[0]);
+      let types = {
+        key: evfile.target.files[0].name,
+        contentType: evfile.target.files[0].type,
+      };
+      productGetTempKeysApi(types)
         .then((res) => {
         .then((res) => {
           that.$videoCloud
           that.$videoCloud
             .videoUpload({
             .videoUpload({

+ 5 - 1
template/admin/src/pages/system/group/visualization.vue

@@ -675,7 +675,11 @@ export default {
       if (suffix.indexOf('.mp4') === -1) {
       if (suffix.indexOf('.mp4') === -1) {
         return that.$Message.error('只能上传MP4文件');
         return that.$Message.error('只能上传MP4文件');
       }
       }
-      productGetTempKeysApi()
+      let types = {
+        key: evfile.target.files[0].name,
+        contentType: evfile.target.files[0].type,
+      };
+      productGetTempKeysApi(types)
         .then((res) => {
         .then((res) => {
           that.$videoCloud
           that.$videoCloud
             .videoUpload({
             .videoUpload({

+ 18 - 2
template/admin/src/utils/videoCloud.js

@@ -11,7 +11,7 @@
 import * as qiniu from 'qiniu-js';
 import * as qiniu from 'qiniu-js';
 import Cos from 'cos-js-sdk-v5';
 import Cos from 'cos-js-sdk-v5';
 import axios from 'axios';
 import axios from 'axios';
-import { upload } from '@/api/upload';
+import { upload, ossUpload } from '@/api/upload';
 
 
 const sign = (method, publicKey, privateKey, md5, contentType, date, bucketName, fileName) => {
 const sign = (method, publicKey, privateKey, md5, contentType, date, bucketName, fileName) => {
   const CryptoJS = require('crypto-js'); // 这里使用了crypto-js加密算法库,安装方法会在后面说明
   const CryptoJS = require('crypto-js'); // 这里使用了crypto-js加密算法库,安装方法会在后面说明
@@ -38,7 +38,7 @@ export default {
         result = this.us3Http(config.evfile, config.res, config.uploading);
         result = this.us3Http(config.evfile, config.res, config.uploading);
         break;
         break;
       case 'JDOSS':
       case 'JDOSS':
-        result = this.uploadMp4ToLocal(config.evfile, config.res, config.uploading);
+        result = this.jdHttp(config.evfile, config.res, config.uploading);
         break;
         break;
       case 'CTOSS':
       case 'CTOSS':
         result = this.obsHttp(config.evfile, config.res, config.uploading);
         result = this.obsHttp(config.evfile, config.res, config.uploading);
@@ -325,6 +325,22 @@ export default {
       });
       });
     });
     });
   },
   },
+  // 京东云上传
+  jdHttp(evfile, r, videoIng) {
+    const fileObject = evfile.target.files[0]; // 获取的文件对象
+    const formData = new FormData();
+    formData.append('file', fileObject);
+    return new Promise((resolve, reject) => {
+      ossUpload(r.data.upload_url, formData)
+        .then((res) => {
+          console.log(res);
+        })
+        .catch((err) => {
+          videoIng(true, 100);
+          resolve(r.data);
+        });
+    });
+  },
   // 本地上传
   // 本地上传
   uploadMp4ToLocal(evfile, res, videoIng) {
   uploadMp4ToLocal(evfile, res, videoIng) {
     const fileObject = evfile.target.files[0]; // 获取的文件对象
     const fileObject = evfile.target.files[0]; // 获取的文件对象