Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cust-app
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
李伟
cust-app
Commits
ffdf5c8e
Commit
ffdf5c8e
authored
Jan 08, 2025
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接了oss上传的接口
parent
e85e4f41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
index.js
api/article/index.js
+11
-1
publishArticle.vue
pagesArticle/publishArticle.vue
+15
-8
No files found.
api/article/index.js
View file @
ffdf5c8e
import
{
request
}
from
'../../util/api'
import
{
request
}
from
'../../util/api'
//
banner
列表
//
动态
列表
export
function
articleList
(
query
)
{
export
function
articleList
(
query
)
{
return
request
({
return
request
({
url
:
'/app/open/opmArticle/queryArticleByPagination'
,
url
:
'/app/open/opmArticle/queryArticleByPagination'
,
...
@@ -9,3 +9,13 @@ export function articleList(query) {
...
@@ -9,3 +9,13 @@ export function articleList(query) {
method
:
'GET'
,
method
:
'GET'
,
})
})
}
}
// 动态列表
export
function
getOssUrl
(
id
)
{
return
request
({
url
:
'/common/getOssUrl?businessId='
+
id
,
method
:
'GET'
,
})
}
pagesArticle/publishArticle.vue
View file @
ffdf5c8e
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
<textarea
style=
"width: 100%;height: 260rpx;"
v-model=
"form.content"
:maxlength=
"-1"
:auto-height=
"false"
<textarea
style=
"width: 100%;height: 260rpx;"
v-model=
"form.content"
:maxlength=
"-1"
:auto-height=
"false"
:showConfirmBar=
"false"
:adjust-position=
"false"
@
focus=
"focusFn"
:focus=
"focus"
@
blur=
"blurFn"
:showConfirmBar=
"false"
:adjust-position=
"false"
@
focus=
"focusFn"
:focus=
"focus"
@
blur=
"blurFn"
border=
"none"
placeholder=
"分享生活、表达思考、提出困惑..."
></textarea>
border=
"none"
placeholder=
"分享生活、表达思考、提出困惑..."
></textarea>
<image
:src=
"img"
></image>
<view
class=
"upload"
>
<view
class=
"upload"
>
<u-upload
:fileList=
"fileList"
accept=
"image"
uploadIcon=
"plus"
:capture=
"['album', 'camera']"
<u-upload
:fileList=
"fileList"
accept=
"image"
uploadIcon=
"plus"
:capture=
"['album', 'camera']"
@
afterRead=
"afterRead"
@
delete=
"deletePic"
width=
"200rpx"
height=
"200rpx"
multiple
:maxCount=
"9"
@
afterRead=
"afterRead"
@
delete=
"deletePic"
width=
"200rpx"
height=
"200rpx"
multiple
:maxCount=
"9"
...
@@ -26,13 +27,14 @@
...
@@ -26,13 +27,14 @@
<
script
>
<
script
>
import
ELM
from
'@/components/elm-toast/index.vue'
;
import
ELM
from
'@/components/elm-toast/index.vue'
;
import
{
uploadPublic
}
from
'../api/article/index'
import
{
getOssUrl
,
uploadPublic
}
from
'../api/article/index'
export
default
{
export
default
{
components
:
{
components
:
{
ELM
ELM
},
},
data
()
{
data
()
{
return
{
return
{
img
:
''
,
form
:
{
form
:
{
content
:
''
,
content
:
''
,
img
:
[]
img
:
[]
...
@@ -53,12 +55,16 @@
...
@@ -53,12 +55,16 @@
methods
:
{
methods
:
{
//发布
//发布
submit
()
{
submit
()
{
this
.
form
.
img
=
this
.
fileList
.
map
(
item
=>
item
.
url
)
getOssUrl
(
109
).
then
(
res
=>
{
if
(
!
this
.
form
.
content
&&
!
this
.
fileList
.
length
)
{
this
.
img
=
res
.
data
.
data
.
replace
(
/
\\
/g
,
'/'
)
this
.
tipMsg
=
'请输入内容或上传图片后再点击发布'
console
.
log
(
this
.
img
)
this
.
$refs
.
elm
.
showDialog
();
})
return
;
// this.form.img = this.fileList.map(item => item.url )
}
// if (!this.form.content && !this.fileList.length) {
// this.tipMsg = '请输入内容或上传图片后再点击发布'
// this.$refs.elm.showDialog();
// return;
// }
},
},
// 删除图片
// 删除图片
deletePic
(
event
)
{
deletePic
(
event
)
{
...
@@ -95,7 +101,8 @@
...
@@ -95,7 +101,8 @@
filePath
:
file
.
url
,
filePath
:
file
.
url
,
formData
:
{
formData
:
{
file
:
file
,
//你要传的临时文件
file
:
file
,
//你要传的临时文件
temp
:
'opmArticle'
temp
:
'opmArticle'
,
bucket
:
'cust-91isoft'
},
},
header
:
{
header
:
{
Authorization
:
'Bearer '
+
uni
.
getStorageSync
(
"token"
),
Authorization
:
'Bearer '
+
uni
.
getStorageSync
(
"token"
),
...
...
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