Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
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
viitto
pptist
Commits
15ca1172
Commit
15ca1172
authored
May 20, 2024
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传图方法
parent
c89ea5ab
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
24 deletions
+107
-24
domainManager.ts
src/utils/domainManager.ts
+1
-1
aliyun.ts
src/utils/upload/aliyun.ts
+14
-7
UploadPicture.vue
src/views/Editor/CanvasTool/UploadPicture.vue
+2
-4
index.vue
src/views/Editor/Thumbnails/index.vue
+83
-8
ElementTemplateData.vue
src/views/Editor/Toolbar/ElementTemplateData.vue
+6
-4
index.vue
src/views/components/element/TextElement/index.vue
+1
-0
No files found.
src/utils/domainManager.ts
View file @
15ca1172
...
...
@@ -3,7 +3,7 @@ export const domainManager = () => {
const
obj
=
{
domainUrl
:
locationName
.
indexOf
(
'oytour'
)
!==
-
1
?
"http://reborn.oytour.com/api/common/post"
:
"http://192.168.10.214/api/common/post"
,
//上传站点
UploadUrl
:
locationName
.
indexOf
(
'oytour'
)
!==
-
1
?
"http://upload.oytour.com"
:
"http://192.168.
10.214
:8120"
,
UploadUrl
:
locationName
.
indexOf
(
'oytour'
)
!==
-
1
?
"http://upload.oytour.com"
:
"http://192.168.
5.46
:8120"
,
//文件站点
ViittoFileUrl
:
locationName
.
indexOf
(
'oytour'
)
!==
-
1
?
"http://imgfile.oytour.com"
:
'http://192.168.10.214:8130'
,
// 通知erp
...
...
src/utils/upload/aliyun.ts
View file @
15ca1172
import
{
domainManager
}
from
'@/utils/domainManager'
class
AliyunUpload
{
static
readonly
REGION
=
'oss-cn-chengdu'
static
readonly
ACCESS_KEY_ID
=
'LTAI5tFgqt1pwnoA35cigYTr'
...
...
@@ -18,12 +18,19 @@ class AliyunUpload {
static
UploadAsync
=
async
(
file
:
any
,
name
:
string
)
=>
{
try
{
const
oss
=
this
.
GetOSS
()
const
headers
=
{
'Cache-Control'
:
'public,max-age=31536000'
};
let
result
=
await
oss
.
put
(
name
,
file
,{
headers
})
return
'https://im.oytour.com/'
+
name
//result.url
let
path
=
"/Sale/Uploadvideo/"
const
formData
=
new
FormData
();
formData
.
append
(
'file'
,
file
);
const
response
=
await
fetch
(
`
${
domainManager
().
UploadUrl
}
/Upload/UploadToALiOSS?filePath=
${
path
}
`
,
{
method
:
'POST'
,
body
:
formData
,
});
if
(
response
.
ok
){
let
result
=
await
response
.
text
()
let
datas
=
JSON
.
parse
(
result
)
return
datas
.
FilePath
}
return
''
}
catch
(
error
)
{
return
''
}
...
...
src/views/Editor/CanvasTool/UploadPicture.vue
View file @
15ca1172
...
...
@@ -23,7 +23,7 @@
placeholder=
"输入关键字快速查找"
clearable
class=
"input-with-select q-pl-lg"
@
keyup
.
enter=
"SearchHandler()"
>
<template
#
append
>
<el-button
type=
"primary"
@
click=
"SearchHandler"
>
搜索
</el-button>
<el-button
style=
"color: #fff;"
type=
"primary"
@
click=
"SearchHandler"
>
搜索
</el-button>
</
template
>
</el-input>
</el-col>
...
...
@@ -44,9 +44,7 @@
<el-pagination
v-model:current-page=
"currentPage"
:page-size=
"datas.queryMsg.pageSize"
:small=
"small"
:disabled=
"disabled"
:background=
"background"
small=
"small"
layout=
"prev, pager, next"
:total=
"datas.queryMsg.total"
@
size-change=
"handleSizeChange"
...
...
src/views/Editor/Thumbnails/index.vue
View file @
15ca1172
...
...
@@ -72,6 +72,7 @@ import { ElLoading, ElMessageBox } from 'element-plus'
import
FileService
from
'@/services/FileService'
import
{
Slide
}
from
'@/types/slides'
import
{
uniqueId
}
from
'lodash'
import
{
useUserStore
}
from
"@/store"
;
const
mainStore
=
useMainStore
()
const
slidesStore
=
useSlidesStore
()
...
...
@@ -81,6 +82,7 @@ const { selectedSlidesIndex: _selectedSlidesIndex, thumbnailsFocus } = storeToRe
const
{
slides
,
currentSlide
,
slideIndex
,
layoutSlides
,
viewportRatio
}
=
storeToRefs
(
slidesStore
)
const
{
ctrlKeyState
,
shiftKeyState
}
=
storeToRefs
(
keyboardStore
)
const
{
SalesEditor
,
SalesBack
,
SalesTripId
}
=
storeToRefs
(
useSellTemplateStore
())
const
{
userInfo
}
=
storeToRefs
(
useUserStore
())
const
{
slidesLoadLimit
}
=
useLoadSlides
()
const
TemplateTypeStore
=
useScreenStore
()
...
...
@@ -113,6 +115,12 @@ const searchData = ref({} as any)
datas
.
DataSource
=
inject
(
injectKeyDataSource
)
searchData
.
value
=
inject
(
injectKeyTemplate
)
const
acquiesceLogo
=
ref
([
'https://im.oytour.com/pptist/static/logo1.png'
,
'https://im.oytour.com/pptist/static/logo2.png'
,
'https://im.oytour.com/pptist/static/logo3.png'
])
watch
(()
=>
slideIndex
.
value
,
()
=>
{
// 清除多选状态的幻灯片
if
(
selectedSlidesIndex
.
value
.
length
)
{
...
...
@@ -428,25 +436,41 @@ const GetTripTemplate = async () =>{
newSlides
=
SlidesData
}
let
IDs
=
[]
newSlides
.
forEach
((
x
,
index
)
=>
{
let
ids
=
x
.
id
.
split
(
'-'
)
let
existId
=
IDs
.
findIndex
(
y
=>
{
y
==
x
.
id
})
==
-
1
if
(
existId
)
IDs
.
push
(
x
.
id
)
for
(
let
i
=
0
;
i
<
newSlides
.
length
;
i
++
)
{
let
ids
=
newSlides
[
i
]
.
id
.
split
(
'-'
)
let
existId
=
IDs
.
findIndex
(
y
=>
{
y
==
newSlides
[
i
]
.
id
})
==
-
1
if
(
existId
)
IDs
.
push
(
newSlides
[
i
]
.
id
)
else
{
//Math.floor(Math.random() * newSlides.length)
//Math.floor(Math.random())+i
ndex
//Math.floor(Math.random())+i
let
id
=
generateUniqueId
()
x
.
id
=
`
${
ids
[
0
]}
-
${
ids
[
1
]}${
id
}
`
}
x
.
elements
.
forEach
(
y
=>
{
if
(
x
.
pageType
!=
1
&&
y
.
TemplateDataSource
&&
y
.
TemplateDataSource
.
index
==
null
){
newSlides
[
i
]
.
elements
.
forEach
(
y
=>
{
if
(
newSlides
[
i
]
.
pageType
!=
1
&&
y
.
TemplateDataSource
&&
y
.
TemplateDataSource
.
index
==
null
){
Reflect
.
set
(
y
.
TemplateDataSource
,
'index'
,
null
)
}
})
})
}
if
(
ConfigId
.
value
>
0
){
newSlides
=
newSlides
.
filter
((
x
:
Slide
)
=>!
x
.
isTripItems
)
}
// 根据集团渲染logo
if
(
userInfo
.
value
&&
userInfo
.
value
.
RB_Group_id
<=
1
){
for
(
let
i
=
0
;
i
<
newSlides
.
length
;
i
++
){
let
x
=
newSlides
[
i
]
let
index
=
null
x
.
elements
.
forEach
((
y
,
indexs
)
=>
{
if
(
y
.
layerName
&&
y
.
layerName
==
'logo'
)
index
=
indexs
})
let
eles
=
x
.
elements
.
filter
(
y
=>
y
.
layerName
&&
y
.
layerName
==
'logo'
)
let
newElements
=
await
ResolveTripLogoHandler
(
eles
,
i
)
x
.
elements
=
x
.
elements
.
concat
(
newElements
?.
elements
)
if
(
index
>=
0
)
x
.
elements
.
splice
(
index
,
1
)
}
}
layoutsStore
.
setLayouts
(
JSON
.
parse
(
JSON
.
stringify
(
newSlides
)))
if
(
searchData
.
value
.
sellId
&&!
searchData
.
value
.
TempId
)
return
slidesStore
.
setSlides
(
newSlides
)
...
...
@@ -495,6 +519,57 @@ const generateUniqueId = () => {
return
'-'
+
timestamp
+
'-'
+
randomNum
}
const
ResolveTripLogoHandler
=
async
(
items
:
any
,
slideIndex
:
number
)
=>
{
let
elements
=
[]
let
tempNewSlide
:
any
=
null
let
templateObj
=
JSON
.
parse
(
JSON
.
stringify
(
items
))
for
(
let
i
=
0
;
i
<
templateObj
.
length
;
i
++
){
try
{
let
y
=
templateObj
[
i
]
let
tempSize
=
await
FileService
.
getImageSizeWithoutDownloading
(
templateObj
[
i
].
src
)
let
scale
=
tempSize
.
width
/
tempSize
.
height
if
(
scale
==
1
)
templateObj
[
i
].
src
=
acquiesceLogo
.
value
[
0
]
if
(
scale
>
1
)
templateObj
[
i
].
src
=
acquiesceLogo
.
value
[
2
]
if
(
scale
<
1
)
templateObj
[
i
].
src
=
acquiesceLogo
.
value
[
1
]
if
(
tempNewSlide
){
tempNewSlide
.
elements
.
push
(...
templateObj
)
}
else
{
elements
.
push
(...
templateObj
)
tempNewSlide
=
copySlidHandlerLogo
(
slideIndex
)
}
let
newTempSize
=
await
FileService
.
getImageSizeWithoutDownloading
(
templateObj
[
i
].
src
)
let
width
=
0
let
height
=
0
//按照宽度进行缩放
let
ratio
=
newTempSize
.
width
/
y
.
width
width
=
y
.
width
height
=
newTempSize
.
height
/
ratio
if
(
height
<
y
.
height
){
ratio
=
height
/
y
.
height
height
=
y
.
height
width
=
width
/
ratio
}
y
.
height
=
height
y
.
width
=
width
}
catch
(
error
)
{
}
}
return
{
elements
,
newSlider
:
tempNewSlide
,
}
}
const
copySlidHandlerLogo
=
(
slideIndex
:
number
)
=>
{
let
newSlide
=
JSON
.
parse
(
JSON
.
stringify
(
slides
.
value
[
slideIndex
]))
newSlide
.
id
=
uniqueId
()
newSlide
.
elements
=
newSlide
.
elements
.
filter
((
y
:
any
)
=>!
y
.
layerName
||
y
.
layerName
!=
'logo'
)
return
newSlide
}
// 销售模版数据
const
sellGetTripTemplate
=
async
()
=>
{
try
{
...
...
src/views/Editor/Toolbar/ElementTemplateData.vue
View file @
15ca1172
...
...
@@ -679,10 +679,12 @@
const
GetTemplateColors
=
async
()
=>
{
let
pageRes
=
await
LineService
.
GetTemplateConfigDataList
(
queryColors
.
value
);
let
colorArr
=
pageRes
.
data
.
data
for
(
let
i
=
0
;
i
<
colorArr
.
length
;
i
++
){
if
(
colorArr
[
i
].
Content
==
queryObj
.
value
.
ColorStr
)
{
queryColor
.
value
.
Code
=
Number
(
colorArr
[
i
].
Code
)
getColor
()
if
(
colorArr
.
length
>
0
){
for
(
let
i
=
0
;
i
<
colorArr
.
length
;
i
++
){
if
(
colorArr
[
i
].
Content
==
queryObj
.
value
.
ColorStr
)
{
queryColor
.
value
.
Code
=
Number
(
colorArr
[
i
].
Code
)
getColor
()
}
}
}
}
...
...
src/views/components/element/TextElement/index.vue
View file @
15ca1172
...
...
@@ -235,5 +235,6 @@ watch(isHandleElement, () => {
}
.clip-box
{
-webkit-background-clip
:
text
!
important
;
cursor
:
pointer
;
}
</
style
>
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