Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
confucius
Commits
df16d6d1
Commit
df16d6d1
authored
May 20, 2024
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件上传调整
parent
7dc34c06
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
226 deletions
+93
-226
common.js
src/api/common/common.js
+54
-47
makeAd.vue
src/pages/activity/makeAd.vue
+9
-23
siteconfig.vue
src/pages/system/siteconfig.vue
+4
-4
erpindex.js
src/utils/erpindex.js
+26
-152
No files found.
src/api/common/common.js
View file @
df16d6d1
...
...
@@ -25,11 +25,10 @@ export function getFontConfig() {
export
function
CommonConfig
()
{
return
{
FileConfig
:
{
FileUrl
:
'http://192.168.5.
214
:8130'
,
//本地服务器文件预览地址
UploadUrl
:
'http://192.168.5.214
:8120'
FileUrl
:
'http://192.168.5.
46
:8130'
,
//本地服务器文件预览地址
UploadUrl
:
'http://192.168.5.46
:8120'
}
}
}
/**
...
...
@@ -53,7 +52,7 @@ export function UploadSelfFile(path, file, callback, configObj) {
uploadLoadding
.
show
({
message
:
'正在上传文件,请稍后...'
})
if
(
uploadConfig
)
{
switch
(
uploadConfig
.
StoreType
)
{
//上传文件到腾讯云
...
...
@@ -174,7 +173,6 @@ export function UploadBolbFileToSystem(uploadConfig, fileFullPath, fileObj, uplo
ExtFile
:
tempArray
}
if
(
successCall
)
{
successCall
(
uploadResult
);
}
}
...
...
@@ -290,60 +288,72 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo
* 上传文件到阿里云
*/
export
function
UploadFileToALi
(
uploadConfig
,
fileFullPath
,
fileObj
,
uploadLoadding
,
successCall
)
{
var
OSS
=
require
(
'ali-oss'
);
var
oss
=
new
OSS
({
region
:
uploadConfig
.
Region
,
accessKeyId
:
uploadConfig
.
SecretId
,
accessKeySecret
:
uploadConfig
.
SecretKey
,
bucket
:
uploadConfig
.
Bucket
})
var
result
=
oss
.
multipartUpload
(
fileFullPath
,
fileObj
,
{
progress
:
function
*
(
p
)
{}
}).
then
(
res
=>
{
let
str
=
''
;
//str = "/2024/"
var
newFileName
=
str
+
fileFullPath
;
let
fileConfig
=
CommonConfig
();
let
locationName
=
window
.
location
.
hostname
;
if
(
locationName
.
indexOf
(
'localhost'
)
!==
-
1
)
{
uploadConfig
.
UploadDomain
=
fileConfig
.
FileConfig
.
UploadUrl
;
}
let
url
=
uploadConfig
.
UploadDomain
+
"/Upload/UploadToALiOSS?filePath="
+
newFileName
;
let
formData
=
new
FormData
()
formData
.
append
(
'myfile'
,
fileObj
)
let
xhr
=
new
XMLHttpRequest
()
xhr
.
onload
=
function
()
{
uploadLoadding
.
hide
();
var
uploadResult
=
{
Code
:
1
,
FileName
:
fileObj
.
name
,
FileUrl
:
res
.
res
.
requestUrls
[
0
].
split
(
'?'
)[
0
].
replace
(
'http'
,
'https'
)
}
if
(
successCall
)
{
successCall
(
uploadResult
);
var
jsonObj
=
JSON
.
parse
(
xhr
.
responseText
);
if
(
jsonObj
.
StatusCode
===
1
&&
successCall
)
{
var
uploadResult
=
{
Code
:
1
,
FileName
:
fileObj
.
name
,
FileUrl
:
jsonObj
.
FilePath
,
VideoCoverImg
:
uploadConfig
.
CustomDomain
+
jsonObj
.
VideoCoverImg
,
Message
:
jsonObj
.
Message
}
if
(
successCall
)
{
successCall
(
uploadResult
);
}
}
})
}
xhr
.
open
(
'post'
,
url
,
true
)
xhr
.
send
(
formData
)
}
/**
* 上传文件到腾讯云
*/
export
function
UploadFileToTencent
(
uploadConfig
,
fileFullPath
,
fileObj
,
uploadLoadding
,
successCall
)
{
var
COS
=
require
(
'cos-js-sdk-v5'
)
;
var
cos
=
new
COS
({
SecretId
:
uploadConfig
.
SecretId
,
SecretKey
:
uploadConfig
.
SecretKey
,
})
;
cos
.
putObject
(
{
Bucket
:
uploadConfig
.
Bucket
,
Region
:
uploadConfig
.
Region
,
//存储桶所在地域,必须字段
Key
:
fileFullPath
,
//文件名
StorageClass
:
'STANDARD'
,
Body
:
fileObj
,
// 上传文件对象
onProgress
:
function
(
progressData
)
{}
},
function
(
err
,
data
)
{
let
str
=
''
;
//str = "/2024/"
var
newFileName
=
str
+
fileFullPath
;
let
fileConfig
=
CommonConfig
();
let
locationName
=
window
.
location
.
hostname
;
if
(
locationName
.
indexOf
(
'localhost'
)
!==
-
1
)
{
uploadConfig
.
UploadDomain
=
fileConfig
.
FileConfig
.
UploadUrl
;
}
let
url
=
uploadConfig
.
UploadDomain
+
"/Upload/UploadToTecent?filePath="
+
newFileName
;
let
formData
=
new
FormData
()
formData
.
append
(
'myfile'
,
fileObj
)
let
xhr
=
new
XMLHttpRequest
()
xhr
.
onload
=
function
(
)
{
uploadLoadding
.
hide
();
if
(
data
&&
data
.
statusCode
==
200
)
{
var
jsonObj
=
JSON
.
parse
(
xhr
.
responseText
);
if
(
jsonObj
.
StatusCode
===
1
&&
successCall
)
{
var
uploadResult
=
{
Code
:
1
,
FileName
:
fileObj
.
name
,
FileUrl
:
"https://"
+
data
.
Location
FileUrl
:
jsonObj
.
FilePath
,
VideoCoverImg
:
uploadConfig
.
CustomDomain
+
jsonObj
.
VideoCoverImg
,
Message
:
jsonObj
.
Message
}
if
(
successCall
)
{
successCall
(
uploadResult
);
}
}
else
{
/*上传文件异常*/
console
.
log
(
err
||
data
);
}
});
}
xhr
.
open
(
'post'
,
url
,
true
)
xhr
.
send
(
formData
)
}
/***
...
...
@@ -482,10 +492,7 @@ export function wechatUploadSelfFile(path, file, callback, configObj) {
//用户登录缓存
//配置写死的 腾讯云
var
uploadConfig
=
{
Region
:
"ap-chengdu"
,
SecretId
:
"AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd"
,
SecretKey
:
"PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob"
,
Bucket
:
"viitto-1301420277"
};
//获取文件扩展名
var
index
=
file
.
name
.
lastIndexOf
(
"."
);
...
...
@@ -501,4 +508,4 @@ export function wechatUploadSelfFile(path, file, callback, configObj) {
newPath
+=
"/"
+
timestamp1
+
""
+
suffix
;
UploadFileToTencent
(
uploadConfig
,
newPath
,
file
,
uploadLoadding
,
callback
);
}
}
\ No newline at end of file
}
src/pages/activity/makeAd.vue
View file @
df16d6d1
...
...
@@ -61,18 +61,14 @@
<li
@
click=
"tiggerMax"
class=
"source"
>
原图
</li>
<!--
<li
class=
"save"
@
click=
"outerVisible=true"
>
保存
</li>
-->
<li
class=
"save"
@
click=
"getFileBase64(2)"
>
保存
</li>
<li
class=
"down"
@
click=
"getFileBase64(1)"
>
下载
</li>
<!--
<li
class=
"return"
@
click=
"returnback"
>
返回
</li>
-->
</ul>
<div
class=
"property-box"
v-if=
'currentNode.type==0 && !isMax'
>
<el-form
ref=
"form"
:model=
"currentNode"
label-width=
"80px"
>
...
...
@@ -172,12 +168,7 @@
</div>
<div
class=
"property-box"
v-if=
'currentNode.type==1 && !isMax'
>
<el-form
ref=
"form"
:model=
"currentNode"
label-width=
"80px"
>
<!-- <el-form-item label="宽度:">
<el-input-number v-model="currentNode.width" :min="0"></el-input-number>
</el-form-item>
<el-form-item label="高度">
<el-input-number v-model="currentNode.height" :min="0"></el-input-number>
</el-form-item> -->
<el-form-item
label=
"圆角:"
>
<el-input-number
v-model=
"currentNode.radius"
:min=
"0"
></el-input-number>
<label
class=
"remark"
>
修改块的圆角弧度(有背景色时体现)
</label>
...
...
@@ -399,7 +390,7 @@
import
browserMD5File
from
'browser-md5-file'
;
import
vueWaterfallEasy
from
'vue-waterfall-easy'
import
h2c
from
'html2canvas'
// import Canvas2Image from 'Canvas2Image'
import
{
getAdvertisingList
,
saveMakeAd
,
...
...
@@ -502,19 +493,15 @@
}
},
mounted
()
{
if
(
this
.
$route
.
query
.
id
)
{
this
.
dataId
=
this
.
$route
.
query
.
id
}
// this.user = JSON.parse(window.localStorage.userInfo)
if
(
this
.
dataId
!=
0
)
{
this
.
bg
=
' '
this
.
loadObj
()
}
else
{
this
.
isLoading
=
false
}
// this.loadingFont(this.nodes[0])
this
.
nodes
.
forEach
(
x
=>
{
this
.
currentZIndex
=
x
.
zindex
>
this
.
currentZIndex
?
x
.
zindex
:
this
.
currentZIndex
this
.
currentMaxId
=
x
.
nodeId
>
this
.
currentMaxId
?
x
.
nodeId
:
this
.
currentMaxId
...
...
@@ -587,7 +574,7 @@
'label'
:
'叶根友毛笔行书体'
,
'value'
:
'YGYXSZITI'
})
// this.getline()
this
.
getaddatas
(
0
)
var
sUserAgent
=
navigator
.
userAgent
;
var
isWin
=
(
navigator
.
platform
==
"Win32"
)
||
(
navigator
.
platform
==
"Windows"
);
...
...
@@ -622,7 +609,8 @@
this
.
currentMaxId
=
y
.
nodeId
>
this
.
currentMaxId
?
y
.
nodeId
:
this
.
currentMaxId
})
let
reg
=
/^http
(
s
)?
:
\/\/(
.*
?)\/
/
let
getBlob
=
this
.
getFileBlob
(
data
.
pictureUrl
.
replace
(
reg
,
''
),
'aa.jpg'
)
console
.
log
(
"getMyAdDetail"
,
data
.
pictureUrl
);
let
getBlob
=
this
.
getAnyFileBlob
(
data
.
pictureUrl
.
replace
(
reg
,
''
))
let
that
=
this
getBlob
.
then
(
blob
=>
{
that
.
blobToDataURL
(
blob
,
function
(
e
)
{
...
...
@@ -658,9 +646,6 @@
})
}
})
},
uuid
(
len
,
radix
)
{
var
chars
=
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
.
split
(
''
);
...
...
@@ -701,7 +686,8 @@
this
.
st
=
x
.
SamplePicturesUrl
+
'?width=470'
this
.
templateId
=
x
.
ID
let
reg
=
/^http
(
s
)?
:
\/\/(
.*
?)\/
/
let
getBlob
=
this
.
getFileBlob
(
x
.
PictureUrl
.
replace
(
reg
,
''
),
'aa.jpg'
)
let
getBlob
=
this
.
getAnyFileBlob
(
x
.
PictureUrl
.
replace
(
reg
,
''
))
let
that
=
this
getBlob
.
then
(
blob
=>
{
that
.
blobToDataURL
(
blob
,
function
(
e
)
{
...
...
src/pages/system/siteconfig.vue
View file @
df16d6d1
...
...
@@ -30,11 +30,11 @@
</template>
<
template
v-slot:body-cell-Using=
"props"
>
<q-td
:props=
"props"
>
<div
class=
"site_ListDiv"
>
空间名称(Bucket):
{{
props
.
row
.
Bucket
}}
</div>
<
!--
<
div
class=
"site_ListDiv"
>
空间名称(Bucket):
{{
props
.
row
.
Bucket
}}
</div>
<div
class=
"site_ListDiv"
>
所属地域:
{{
props
.
row
.
Region
}}
</div>
<div
class=
"site_ListDiv"
>
自定义域名:
{{
props
.
row
.
CustomDomain
}}
</div>
<div
class=
"site_ListDiv"
>
SecretId:
{{
props
.
row
.
SecretId
}}
</div>
<div>
SecretKey:
{{
props
.
row
.
SecretKey
}}
</div>
<div
class=
"site_ListDiv"
>
自定义域名:
{{
props
.
row
.
CustomDomain
}}
</div>
-->
<
!--
<
div
class=
"site_ListDiv"
>
SecretId:
{{
props
.
row
.
SecretId
}}
</div>
<div>
SecretKey:
{{
props
.
row
.
SecretKey
}}
</div>
-->
</q-td>
</
template
>
<
template
v-slot:bottom
>
...
...
src/utils/erpindex.js
View file @
df16d6d1
...
...
@@ -230,7 +230,6 @@ export default {
var
JHTenantId
=
1
;
if
(
this
.
getLocalStorage
()
!=
null
)
{
token
=
this
.
getLocalStorage
().
MallToken
;
// key = this.getLocalStorage().SecretKey;
JHMallBaseId
=
this
.
getLocalStorage
().
JHMallBaseId
;
JHTenantId
=
this
.
getLocalStorage
().
JHTenantId
;
}
...
...
@@ -434,9 +433,7 @@ export default {
},
//上传文件到云存储
Vue
.
prototype
.
UploadFileToTencent
=
function
(
path
,
fileObj
,
callback
)
{
// debugger;
var
upInfo
=
JSON
.
parse
(
localStorage
.
uploadInfo
);
let
maxSize
=
500
*
1024
if
((
fileObj
.
type
==
"image/png"
||
fileObj
.
type
==
"image/jpeg"
)
&&
fileObj
.
size
>
maxSize
)
{
let
that
=
this
...
...
@@ -457,124 +454,40 @@ export default {
var
newFile
=
new
File
([
u8arr
],
fileObj
.
name
,
{
type
:
mime
});
if
(
upInfo
&&
upInfo
.
IsDefault
==
1
)
{
if
(
upInfo
.
StoreType
==
1
)
{
that
.
uploadStart
(
path
,
newFile
,
callback
)
let
str
=
''
;
str
=
"/2024/"
var
newFileName
=
str
+
path
;
let
url
=
upInfo
.
UploadDomain
+
"/Upload/UploadToTecent?filePath="
+
newFileName
;
let
formData
=
new
FormData
()
formData
.
append
(
'myfile'
,
newFile
)
let
xhr
=
new
XMLHttpRequest
()
xhr
.
onload
=
function
()
{
uploadLoadding
.
hide
();
var
jsonObj
=
JSON
.
parse
(
xhr
.
responseText
);
if
(
jsonObj
.
StatusCode
===
1
&&
callback
)
{
var
uploadResult
=
{
resultCode
:
1
,
FileName
:
fileObj
.
name
,
FileUrl
:
jsonObj
.
FilePath
,
}
if
(
callback
)
{
callback
(
uploadResult
);
}
}
if
(
upInfo
.
StoreType
==
2
)
{
that
.
uploadToAli
(
path
,
newFile
,
callback
)
}
}
else
{
that
.
Error
(
'请先配置上传'
);
}
xhr
.
open
(
'post'
,
url
,
true
)
xhr
.
send
(
formData
)
}).
catch
(
function
(
error
)
{
if
(
upInfo
&&
upInfo
.
IsDefault
==
1
)
{
if
(
upInfo
.
StoreType
==
1
)
{
that
.
uploadStart
(
path
,
fileObj
,
callback
)
}
if
(
upInfo
.
StoreType
==
2
)
{
that
.
uploadToAli
(
path
,
fileObj
,
callback
)
}
}
else
{
that
.
Error
(
'请先配置上传'
);
}
}).
always
(
function
()
{
//不管成功或失败,都会执行
})
}
else
{
if
(
upInfo
&&
upInfo
.
IsDefault
==
1
)
{
if
(
upInfo
.
StoreType
==
1
)
{
this
.
uploadStart
(
path
,
fileObj
,
callback
)
}
if
(
upInfo
.
StoreType
==
2
)
{
this
.
uploadToAli
(
path
,
fileObj
,
callback
)
}
}
else
{
this
.
Error
(
'请先配置上传'
);
}
}
},
Vue
.
prototype
.
uploadStart
=
function
(
path
,
fileObj
,
callback
)
{
let
that
=
this
var
upInfo
=
JSON
.
parse
(
localStorage
.
uploadInfo
);
//获取文件扩展名
var
filename
=
fileObj
.
name
;
var
index
=
filename
.
lastIndexOf
(
"."
);
var
suffix
=
filename
.
substr
(
index
);
var
timestamp1
=
Date
.
parse
(
new
Date
())
+
"_"
+
(
Math
.
ceil
(
Math
.
random
()
*
1000
));
let
str
=
''
;
if
(
this
.
isOnline
())
{
str
=
"/Test"
}
var
newFileName
=
str
+
'/Upload/'
+
path
+
"/"
+
timestamp1
+
""
+
suffix
;
var
uploadMsg
=
{
Bucket
:
upInfo
.
Bucket
,
Region
:
upInfo
.
Region
,
SecretId
:
upInfo
.
SecretId
,
SecretKey
:
upInfo
.
SecretKey
,
};
var
COS
=
require
(
'cos-js-sdk-v5'
);
var
cos
=
new
COS
({
SecretId
:
uploadMsg
.
SecretId
,
SecretKey
:
uploadMsg
.
SecretKey
,
});
that
.
Info
(
'上传中...'
)
cos
.
putObject
({
Bucket
:
uploadMsg
.
Bucket
,
Region
:
uploadMsg
.
Region
,
//存储桶所在地域,必须字段
Key
:
newFileName
,
//文件名
StorageClass
:
'STANDARD'
,
Body
:
fileObj
,
// 上传文件对象
onProgress
:
function
(
progressData
)
{
}
},
function
(
err
,
data
)
{
if
(
data
&&
data
.
statusCode
==
200
)
{
var
uploadResult
=
{
resultCode
:
1
,
FileName
:
fileObj
.
name
,
FileUrl
:
"https://"
+
data
.
Location
}
if
(
callback
)
{
callback
(
uploadResult
);
}
}
else
{
/*上传文件异常*/
console
.
log
(
err
||
data
);
}
});
},
//上传至阿里云
Vue
.
prototype
.
uploadToAli
=
function
(
path
,
fileObj
,
successCall
)
{
var
upInfo
=
JSON
.
parse
(
localStorage
.
uploadInfo
);
var
OSS
=
require
(
'ali-oss'
);
var
oss
=
new
OSS
({
region
:
upInfo
.
Region
,
accessKeyId
:
upInfo
.
SecretId
,
accessKeySecret
:
upInfo
.
SecretKey
,
bucket
:
upInfo
.
Bucket
})
//获取文件扩展名
var
filename
=
fileObj
.
name
;
var
index
=
filename
.
lastIndexOf
(
"."
);
var
suffix
=
filename
.
substr
(
index
);
var
timestamp1
=
Date
.
parse
(
new
Date
())
+
"_"
+
(
Math
.
ceil
(
Math
.
random
()
*
1000
));
let
str
=
''
;
if
(
this
.
isOnline
())
{
str
=
"/Test"
}
var
newFileName
=
str
+
'/Upload/'
+
path
+
"/"
+
timestamp1
+
""
+
suffix
;
this
.
Info
(
'上传中...'
)
var
result
=
oss
.
multipartUpload
(
newFileName
,
fileObj
,
{
progress
:
function
*
(
p
)
{
}
}).
then
(
res
=>
{
var
uploadResult
=
{
resultCode
:
1
,
FileName
:
fileObj
.
name
,
FileUrl
:
res
.
res
.
requestUrls
[
0
].
replace
(
'http'
,
'https'
)
}
successCall
(
uploadResult
);
})
},
//公用判断图片地址 判断是否包含http
Vue
.
prototype
.
getIconLink
=
function
(
url
)
{
let
str
=
''
...
...
@@ -591,30 +504,7 @@ export default {
Vue
.
prototype
.
isOnline
=
function
()
{
return
process
.
env
.
NODE_ENV
!==
'development'
;
},
//获取文件Blob
Vue
.
prototype
.
getFileBlob
=
function
(
objectKey
,
filename
)
{
var
co
=
require
(
'co'
);
var
OSS
=
require
(
'ali-oss'
);
var
oss
=
new
OSS
({
region
:
'oss-cn-hangzhou'
,
accessKeyId
:
'LTAIwE7l9dImZSa3'
,
accessKeySecret
:
'j47Ajn0d0WzUCIX8Biyj3P2r8QDltI'
,
bucket
:
'reborndev'
})
let
url
=
oss
.
signatureUrl
(
objectKey
);
let
getBlob
=
new
Promise
(
resolve
=>
{
const
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'GET'
,
url
,
true
);
xhr
.
responseType
=
'blob'
;
xhr
.
onload
=
()
=>
{
if
(
xhr
.
status
===
200
)
{
resolve
(
xhr
.
response
);
}
};
xhr
.
send
();
});
return
getBlob
},
Vue
.
prototype
.
getAnyFileBlob
=
function
(
url
)
{
let
getBlob
=
new
Promise
(
resolve
=>
{
const
xhr
=
new
XMLHttpRequest
();
...
...
@@ -628,20 +518,6 @@ export default {
xhr
.
send
();
});
return
getBlob
},
//Blob文件上传
Vue
.
prototype
.
uploadSelfBlob
=
function
(
path
,
files
,
successCall
)
{
let
that
=
this
;
var
uploadUrl
=
that
.
domainManager
().
VTUploadUrl
+
"/Upload/UploadBlob?fileType=1&fileLimit=5&&filePath="
+
path
;
var
formData
=
new
FormData
();
formData
.
append
(
"myfile"
,
files
[
0
]);
that
.
$http
.
post
(
uploadUrl
,
formData
,
{
'Content-Type'
:
'multipart/form-data'
})
.
then
(
res
=>
{
successCall
(
res
);
})
},
Vue
.
prototype
.
accAdd
=
function
(
arg1
,
arg2
)
{
//加法精密计算
var
r1
;
...
...
@@ -674,8 +550,6 @@ export default {
arg2
=
Number
(
arg2
.
toString
().
replace
(
'.'
,
''
));
}
return
(
arg1
+
arg2
)
/
m
;
},
// 减法
Vue
.
prototype
.
subtr
=
function
(
arg1
,
arg2
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment