glsxUpload.js
2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-08-21 11:35:26
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-08-21 16:25:51
* @FilePath: \scrm-micro-marketing\src\api\glsxUpload.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import TcVod from 'vod-js-sdk-v6'
import { http } from '@/main'
// 请求配置
const SIGN = {
v: '1.0.0',
source: 'scm-home',
format: 'json',
appKey: '48e5e13229b82c1b4e6e8c96151f0637'
}
const SECRET = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const REQUEST = {
timeout: 180000,
responseType: 'json',
baseURL: 'http://scrm.dev.glsx.com.cn',
withCredentials: true
}
// const RESPONSE = {
// code_key: ['code', 'returnCode'],
// code_message_map: {},
// code_success_value: '0',
// data_key: 'data',
// errId_logout_value: '21',
// message_key: 'message'
// }
class GlsxUpload {
constructor(params) {
this.initParam = params
}
// init() {
// return new Promise((resolve, reject) => {
// if (this.tcVod) return resolve({ status: 0, msg: 'init successful' })
// const { params: { data, url } = {} } = this.initParam || {}
// console.log(data)
// return http({
// data,
// url: url,
// returnAll: true
// })
// .then(res => {
// if (res.code == '0') {
// this.tcVod = new TcVod({
// getSignature: () => {
// return res.data
// }
// })
// }
// if (this.tcVod) return resolve({ status: 0, msg: 'init successful' })
// reject({ status: -1, msg: 'init failed' })
// })
// .catch(err => {
// reject({ status: -1, msg: 'init failed' })
// })
// })
// }
// uploaded(file, img) {
// return new Promise((resolve, reject) => {
// if (!file) return reject({ status: -1, msg: 'file is required' })
// let params = {
// mediaFile: file
// }
// if (img) params.coverFile = img
// this.uploader = this.tcVod.upload(params)
// this.uploader
// .done()
// .then(doneResult => {
// resolve(doneResult)
// })
// .catch(err => {
// reject(err)
// })
// })
// }
// uploadEvent(eventType, callback) {
// if (!eventType) callback({ status: -1, msg: 'eventType is required' })
// try {
// this.uploader.on(eventType, info => {
// callback(info)
// })
// } catch (err) {
// callback(err)
// }
// }
// uploadCancel() {
// this.uploader.cancel()
// }
}
export default GlsxUpload