Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
msjf-customized
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
刘旭
msjf-customized
Commits
f7657580
提交
f7657580
authored
9月 20, 2022
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
解决上传修改
上级
6f0199cf
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
93 行增加
和
110 行删除
+93
-110
my.vue
src/pages/customized/my.vue
+4
-33
uploadImageVideo.vue
src/pages/customized/uploadImageVideo.vue
+89
-77
没有找到文件。
src/pages/customized/my.vue
浏览文件 @
f7657580
...
@@ -34,17 +34,14 @@
...
@@ -34,17 +34,14 @@
</
template
>
</
template
>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
reactive
}
from
'vue'
;
import
{
ref
}
from
'vue'
;
import
{
getHavePage
,
getPageComponent
}
from
'@/services/api'
;
import
{
getHavePage
,
getPageComponent
}
from
'@/services/api'
;
import
headerVue
from
'@/pages/header/index.vue'
;
import
headerVue
from
'@/pages/header/index.vue'
;
import
uploadPreview
from
'./uploadPreview.vue'
;
import
uploadPreview
from
'./uploadPreview.vue'
;
let
color
=
ref
(
'#a27443'
);
let
color
=
ref
(
'#a27443'
);
let
imageData
=
ref
([]
as
any
);
let
videoData
=
ref
();
// 通用模板初始数据
// 通用模板初始数据
let
currencyPage
=
ref
();
let
currencyPage
=
ref
();
let
popup
=
ref
();
let
openSetting
=
()
=>
{
let
openSetting
=
()
=>
{
uni
.
navigateTo
({
uni
.
navigateTo
({
...
@@ -52,33 +49,6 @@ let openSetting = () => {
...
@@ -52,33 +49,6 @@ let openSetting = () => {
});
});
};
};
// 上传图片
let
uploadImage
=
()
=>
{
uni
.
chooseImage
({
success
(
res
:
any
)
{
imageData
.
value
=
res
.
tempFiles
;
console
.
log
(
res
);
uni
.
navigateTo
({
url
:
`./uploadImage?imageData=
${
encodeURIComponent
(
JSON
.
stringify
(
res
.
tempFiles
))}
&imageArr=
${
encodeURIComponent
(
JSON
.
stringify
(
res
.
tempFilePaths
))}
`
});
}
});
};
// 上传视频
let
uploadVideo
=
()
=>
{
uni
.
chooseVideo
({
sourceType
:
[
'camera'
,
'album'
],
success
(
res
:
any
)
{
console
.
log
(
res
);
videoData
.
value
=
res
;
uni
.
navigateTo
({
url
:
`./uploadVideo?videoData=
${
encodeURIComponent
(
JSON
.
stringify
(
res
))}
`
});
}
});
};
// 通用
// 通用
let
currencyTemplate
=
async
()
=>
{
let
currencyTemplate
=
async
()
=>
{
let
res
:
any
=
await
getPageComponent
({
pageId
:
currencyPage
.
value
[
0
].
id
});
let
res
:
any
=
await
getPageComponent
({
pageId
:
currencyPage
.
value
[
0
].
id
});
...
@@ -100,8 +70,9 @@ let initHavePage = async () => {
...
@@ -100,8 +70,9 @@ let initHavePage = async () => {
title
:
'加载中...'
title
:
'加载中...'
});
});
let
res
:
any
=
await
getHavePage
();
let
res
:
any
=
await
getHavePage
();
console
.
log
(
res
,
'模板数据'
);
if
(
res
.
data
)
{
uni
.
hideLoading
();
uni
.
hideLoading
();
}
currencyPage
.
value
=
res
.
data
.
currencyPage
;
currencyPage
.
value
=
res
.
data
.
currencyPage
;
uni
.
$emit
(
'previewData'
,
{
previewData
:
res
.
data
});
uni
.
$emit
(
'previewData'
,
{
previewData
:
res
.
data
});
};
};
...
...
src/pages/customized/uploadImageVideo.vue
浏览文件 @
f7657580
...
@@ -37,7 +37,6 @@ onLoad((options: any) => {
...
@@ -37,7 +37,6 @@ onLoad((options: any) => {
// 通用定制模板
// 通用定制模板
let
currencyPage
=
JSON
.
parse
(
options
.
currencyPage
);
let
currencyPage
=
JSON
.
parse
(
options
.
currencyPage
);
templateId
.
value
=
JSON
.
parse
(
options
.
id
);
templateId
.
value
=
JSON
.
parse
(
options
.
id
);
console
.
log
(
currencyPage
);
for
(
let
s
in
currencyPage
)
{
for
(
let
s
in
currencyPage
)
{
imageVideoData
.
value
.
push
({
imageVideoData
.
value
.
push
({
path
:
baseURL
+
downUrl
+
currencyPage
[
s
].
pageComponent
,
path
:
baseURL
+
downUrl
+
currencyPage
[
s
].
pageComponent
,
...
@@ -76,10 +75,22 @@ let uploadImage = () => {
...
@@ -76,10 +75,22 @@ let uploadImage = () => {
uni
.
chooseImage
({
uni
.
chooseImage
({
success
(
res
:
any
)
{
success
(
res
:
any
)
{
for
(
let
i
=
0
;
i
<
res
.
tempFilePaths
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
res
.
tempFilePaths
.
length
;
i
++
)
{
imageVideoData
.
value
.
push
({
uni
.
uploadFile
({
path
:
res
.
tempFilePaths
[
i
],
url
:
baseURL
+
'/wx/storage/upload'
,
type
:
res
.
tempFiles
[
i
].
type
,
filePath
:
res
.
tempFilePaths
[
i
],
sort
:
imageVideoData
.
value
.
length
name
:
'file'
,
success
:
(
res
:
any
)
=>
{
let
data
=
JSON
.
parse
(
res
.
data
).
data
;
imageVideoData
.
value
.
push
({
path
:
baseURL
+
data
.
url
,
type
:
data
.
type
,
sort
:
imageVideoData
.
value
.
length
});
console
.
log
(
imageVideoData
.
value
);
},
fail
(
res
:
any
)
{
console
.
log
(
res
);
}
});
});
}
}
}
}
...
@@ -104,10 +115,22 @@ let uploadVideo = () => {
...
@@ -104,10 +115,22 @@ let uploadVideo = () => {
uni
.
chooseVideo
({
uni
.
chooseVideo
({
sourceType
:
[
'camera'
,
'album'
],
sourceType
:
[
'camera'
,
'album'
],
success
(
res
:
any
)
{
success
(
res
:
any
)
{
imageVideoData
.
value
.
push
({
uni
.
uploadFile
({
path
:
res
.
tempFilePath
,
url
:
baseURL
+
'/wx/storage/upload'
,
type
:
res
.
tempFile
.
type
,
filePath
:
res
.
tempFilePath
,
sort
:
imageVideoData
.
value
.
length
+
1
name
:
'file'
,
success
:
(
res
:
any
)
=>
{
let
data
=
JSON
.
parse
(
res
.
data
).
data
;
imageVideoData
.
value
.
push
({
path
:
baseURL
+
data
.
url
,
type
:
data
.
type
,
sort
:
imageVideoData
.
value
.
length
});
console
.
log
(
imageVideoData
.
value
);
},
fail
(
res
:
any
)
{
console
.
log
(
res
);
}
});
});
}
}
});
});
...
@@ -124,72 +147,38 @@ let uploadVideo = () => {
...
@@ -124,72 +147,38 @@ let uploadVideo = () => {
}
}
};
};
let
kuaidata
=
ref
()
let
save
=
()
=>
{
let
save
=
()
=>
{
if
(
templateId
.
value
)
{
if
(
templateId
.
value
)
{
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
let
idArr
:
any
=
[];
let
idArr
:
any
=
[];
console
.
log
(
imageVideoData
.
value
);
console
.
log
(
imageVideoData
.
value
);
for
(
let
key
in
imageVideoData
.
value
)
{
for
(
let
key
in
imageVideoData
.
value
)
{
let
str
=
imageVideoData
.
value
[
key
].
path
.
split
(
'/'
);
if
(
imageVideoData
.
value
[
key
].
path
.
split
(
'.'
).
length
==
1
)
{
idArr
.
push
({
uni
.
uploadFile
({
pageComponent
:
str
[
str
.
length
-
1
],
url
:
baseURL
+
'/wx/storage/upload'
,
sort
:
imageVideoData
.
value
[
key
].
sort
filePath
:
imageVideoData
.
value
[
key
].
path
,
});
name
:
'file'
,
}
success
:
(
res
:
any
)
=>
{
if
(
type
.
value
==
'currency'
)
{
// console.log(imageVideoData.value, key);
console
.
log
(
idArr
,
'添加'
);
// console.log(JSON.parse(res.data).data.key);
setTimeout
(()
=>
{
if
(
res
.
data
.
errno
!=
502
)
{
templateAdd
({
pageComponentList
:
idArr
}).
then
((
res
:
any
)
=>
{
idArr
.
push
({
if
(
res
.
data
.
errno
==
0
)
{
pageComponent
:
JSON
.
parse
(
res
.
data
).
data
.
key
,
imageVideoData
.
value
=
[];
sort
:
imageVideoData
.
value
[
key
].
sort
close
();
});
}
}
});
},
},
50
);
fail
(
res
:
any
)
{
}
else
{
console
.
log
(
res
);
console
.
log
(
'編輯'
,
idArr
);
}
setTimeout
(()
=>
{
});
updateCustomPage
({
id
:
templateId
.
value
,
pageComponentList
:
idArr
}).
then
((
res
:
any
)
=>
{
}
else
{
if
(
res
.
data
.
errno
==
0
)
{
let
str
=
imageVideoData
.
value
[
key
].
path
.
split
(
'/'
);
imageVideoData
.
value
=
[];
idArr
.
push
({
close
();
pageComponent
:
str
[
str
.
length
-
1
],
}
sort
:
imageVideoData
.
value
[
key
].
sort
});
});
},
50
);
}
}
if
(
Number
(
key
)
==
imageVideoData
.
value
.
length
-
1
)
{
console
.
log
(
idArr
,
'resolve'
);
resolve
(
idArr
);
}
}
}).
then
((
idArr
:
any
)
=>
{
console
.
log
(
idArr
);
if
(
type
.
value
==
'currency'
)
{
console
.
log
(
idArr
,
'添加'
);
setTimeout
(()
=>
{
templateAdd
({
pageComponentList
:
idArr
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
errno
==
0
)
{
uni
.
hideLoading
();
// imageVideoData.value = [];
// close();
}
});
},
50
);
}
else
{
kuaidata
.
value
=
idArr
console
.
log
(
'編輯'
,
idArr
);
setTimeout
(()
=>
{
updateCustomPage
({
id
:
templateId
.
value
,
pageComponentList
:
kuaidata
.
value
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
errno
==
0
)
{
console
.
log
(
'你快一点吗!'
,
idArr
);
uni
.
hideLoading
();
// imageVideoData.value = [];
// close();
}
});
},
50
);
}
});
}
else
{
}
else
{
// 空白
// 空白
let
idArr
:
any
=
[];
let
idArr
:
any
=
[];
...
@@ -269,8 +258,20 @@ let replaceImg = (index: number) => {
...
@@ -269,8 +258,20 @@ let replaceImg = (index: number) => {
sizeType
:
[
'original'
,
'compressed'
],
//可以指定是原图还是压缩图,默认二者都有
sizeType
:
[
'original'
,
'compressed'
],
//可以指定是原图还是压缩图,默认二者都有
sourceType
:
[
'camera'
,
'album'
],
//从相册选择
sourceType
:
[
'camera'
,
'album'
],
//从相册选择
success
:
function
(
res
:
any
)
{
success
:
function
(
res
:
any
)
{
imageVideoData
.
value
[
index
][
'path'
]
=
res
.
tempFiles
[
0
].
path
;
console
.
log
(
res
);
console
.
log
(
imageVideoData
.
value
);
uni
.
uploadFile
({
url
:
baseURL
+
'/wx/storage/upload'
,
filePath
:
res
.
tempFilePaths
[
0
],
name
:
'file'
,
success
:
(
res
:
any
)
=>
{
let
data
=
JSON
.
parse
(
res
.
data
).
data
;
imageVideoData
.
value
[
index
][
'path'
]
=
baseURL
+
data
.
url
;
console
.
log
(
imageVideoData
.
value
);
},
fail
(
res
:
any
)
{
console
.
log
(
res
);
}
});
}
}
});
});
}
}
...
@@ -282,12 +283,23 @@ let replaceImg = (index: number) => {
...
@@ -282,12 +283,23 @@ let replaceImg = (index: number) => {
confirmText
:
'确认'
,
confirmText
:
'确认'
,
content
:
'确认替换视频?'
,
content
:
'确认替换视频?'
,
success
:
(
res
:
any
)
=>
{
success
:
(
res
:
any
)
=>
{
console
.
log
(
res
);
if
(
res
.
confirm
)
{
if
(
res
.
confirm
)
{
uni
.
chooseVideo
({
uni
.
chooseVideo
({
sourceType
:
[
'camera'
,
'album'
],
//从相册选择
sourceType
:
[
'camera'
,
'album'
],
//从相册选择
success
:
function
(
res
:
any
)
{
success
:
function
(
res
:
any
)
{
imageVideoData
.
value
[
index
][
'path'
]
=
res
.
tempFiles
[
0
].
path
;
uni
.
uploadFile
({
url
:
baseURL
+
'/wx/storage/upload'
,
filePath
:
res
.
tempFilePath
,
name
:
'file'
,
success
:
(
res
:
any
)
=>
{
let
data
=
JSON
.
parse
(
res
.
data
).
data
;
imageVideoData
.
value
[
index
][
'path'
]
=
baseURL
+
data
.
url
;
console
.
log
(
imageVideoData
.
value
);
},
fail
(
res
:
any
)
{
console
.
log
(
res
);
}
});
}
}
});
});
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论