File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 1111 :on-exceeded-size =" handleMaxSize"
1212 :before-upload =" handleBeforeUpload"
1313 :headers =" headers"
14- action =" //localhost:3002/apis/v1/ files" >
14+ : action =" `${consts.API_URL}/ files` " >
1515 <Button type =" ghost" icon =" ios-cloud-upload-outline" >上传文件</Button >
1616 </Upload >
1717 <Modal title =" 查看图片" v-model =" visible" >
3232 </div >
3333</template >
3434<script >
35+ import consts from ' @/utils/consts'
36+ import helpers from ' @/utils/helpers/base'
3537 import restHelpers from ' @/utils/helpers/restHelpers'
3638
3739 export default {
3840 data () {
3941 return {
42+ consts,
4043 defaultList: [],
4144 imgURL: ' ' ,
4245 visible: false ,
6871 this .$emit (' on-change' , null )
6972 },
7073 handleSuccess (res , file ) {
71- file .url = ' https://o5wwk8baw.qnssl.com/7eb99afb9d5f317c912f08b5212fd69a/avatar '
72- file .name = ' '
74+ file .url = helpers . getImageURL ( res . data )
75+ file .name = res . data . title
7376
7477 if (this .uploadList .length > 1 ) {
7578 this ._remove (this .uploadList [0 ])
Original file line number Diff line number Diff line change 1+ import consts from '@/utils/consts'
2+
3+ export default {
4+ /**
5+ * 获取图片地址
6+ */
7+ getImageURL ( data ) {
8+ return `${ consts . BASE_URL } /files/${ data . dir } /${ data . uuid } .${ data . ext } `
9+ }
10+ }
You can’t perform that action at this time.
0 commit comments