acdr-ui/dist/dev/mp-weixin/sheep/api/infra/file.js.map

1 line
2.1 KiB
Plaintext
Raw Normal View History

2024-09-19 07:20:14 +08:00
{"version":3,"file":"file.js","sources":["../../../../../../src/sheep/api/infra/file.js"],"sourcesContent":["import { baseUrl, apiPath, tenantId } from '@/sheep/config'\r\n\r\nconst FileApi = {\r\n // 上传文件\r\n uploadFile: (file) => {\r\n // TODO 芋艿:访问令牌的接入;\r\n const token = uni.getStorageSync('token')\r\n uni.showLoading({\r\n title: '上传中',\r\n })\r\n return new Promise((resolve, reject) => {\r\n uni.uploadFile({\r\n url: baseUrl + apiPath + '/infra/file/upload',\r\n filePath: file,\r\n name: 'file',\r\n header: {\r\n // Accept: 'text/json',\r\n Accept: '*/*',\r\n 'tenant-id': tenantId,\r\n // Authorization: 'Bearer test247',\r\n },\r\n success: (uploadFileRes) => {\r\n const result = JSON.parse(uploadFileRes.data)\r\n if (result.error === 1) {\r\n uni.showToast({\r\n icon: 'none',\r\n title: result.msg,\r\n })\r\n } else {\r\n return resolve(result)\r\n }\r\n },\r\n fail: (error) => {\r\n console.log('上传失败:', error)\r\n return resolve(false)\r\n },\r\n complete: () => {\r\n uni.hideLoading()\r\n },\r\n })\r\n })\r\n },\r\n}\r\n\r\nexport default FileApi\r\n"],"names":["uni","baseUrl","apiPath","tenantId"],"mappings":";;;AAEK,MAAC,UAAU;AAAA;AAAA,EAEd,YAAY,CAAC,SAAS;AAENA,kBAAG,MAAC,eAAe,OAAO;AACxCA,kBAAAA,MAAI,YAAY;AAAA,MACd,OAAO;AAAA,IACb,CAAK;AACD,WAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtCA,oBAAAA,MAAI,WAAW;AAAA,QACb,KAAKC,mBAAAA,UAAUC,mBAAAA,UAAU;AAAA,QACzB,UAAU;AAAA,QACV,MAAM;AAAA,QACN,QAAQ;AAAA;AAAA,UAEN,QAAQ;AAAA,UACR,aAAaC,mBAAQ;AAAA;AAAA,QAEtB;AAAA,QACD,SAAS,CAAC,kBAAkB;AAC1B,gBAAM,SAAS,KAAK,MAAM,cAAc,IAAI;AAC5C,cAAI,OAAO,UAAU,GAAG;AACtBH,0BAAAA,MAAI,UAAU;AAAA,cACZ,MAAM;AAAA,cACN,OAAO,OAAO;AAAA,YAC5B,CAAa;AAAA,UACb,OAAiB;AACL,mBAAO,QAAQ,MAAM;AAAA,UACtB;AAAA,QACF;AAAA,QACD,MAAM,CAAC,UAAU;AACf,kBAAQ,IAAI,SAAS,KAAK;AAC1B,iBAAO,QAAQ,KAAK;AAAA,QACrB;AAAA,QACD,UAAU,MAAM;AACdA,wBAAAA,MAAI,YAAa;AAAA,QAClB;AAAA,MACT,CAAO;AAAA,IACP,CAAK;AAAA,EACF;AACH;;"}