upload.js 728 B

1234567891011121314151617181920212223242526
  1. import request from '../utils/request.js'
  2. class uploadImg extends request {
  3. static async uploadCommentImgs(tempFilePaths) {
  4. wx.showLoading({
  5. title: '上传图片中...',
  6. mask: true
  7. });
  8. const res = await request.upload(`${this.BASE_URL}Common/upload`, 'image', tempFilePaths)
  9. wx.hideLoading()
  10. return res.data.url
  11. }
  12. static async uploadAvatar(tempFilePaths) {
  13. wx.showLoading({
  14. title: '上传图片中...',
  15. mask: true
  16. });
  17. const res = await request.upload(`${this.BASE_URL}Common/upload`, 'image', tempFilePaths)
  18. wx.hideLoading()
  19. return res.data.url
  20. }
  21. }
  22. export default uploadImg