Commit ffdf5c8e authored by liwei's avatar liwei

对接了oss上传的接口

parent e85e4f41
import {request} from '../../util/api'
// banner列表
// 动态列表
export function articleList(query) {
return request({
url: '/app/open/opmArticle/queryArticleByPagination',
......@@ -9,3 +9,13 @@ export function articleList(query) {
method: 'GET',
})
}
// 动态列表
export function getOssUrl(id) {
return request({
url: '/common/getOssUrl?businessId=' + id,
method: 'GET',
})
}
......@@ -4,6 +4,7 @@
<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"
border="none" placeholder="分享生活、表达思考、提出困惑..."></textarea>
<image :src="img"></image>
<view class="upload">
<u-upload :fileList="fileList" accept="image" uploadIcon="plus" :capture="['album', 'camera']"
@afterRead="afterRead" @delete="deletePic" width="200rpx" height="200rpx" multiple :maxCount="9"
......@@ -26,13 +27,14 @@
<script>
import ELM from '@/components/elm-toast/index.vue';
import {uploadPublic} from '../api/article/index'
import {getOssUrl, uploadPublic} from '../api/article/index'
export default {
components: {
ELM
},
data() {
return {
img:'',
form: {
content: '',
img: []
......@@ -53,12 +55,16 @@
methods: {
//发布
submit() {
this.form.img = this.fileList.map(item => item.url )
if (!this.form.content && !this.fileList.length) {
this.tipMsg = '请输入内容或上传图片后再点击发布'
this.$refs.elm.showDialog();
return;
}
getOssUrl(109).then(res=>{
this.img = res.data.data.replace(/\\/g, '/')
console.log(this.img)
})
// 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) {
......@@ -95,7 +101,8 @@
filePath: file.url,
formData: {
file: file,//你要传的临时文件
temp: 'opmArticle'
temp: 'opmArticle',
bucket:'cust-91isoft'
},
header: {
Authorization: 'Bearer ' + uni.getStorageSync("token"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment