Files
aishangjia-uniapp/api/upload.js
T
gxwebsoft 1bf7caf34e feat(house): 添加房源卖价和总价功能并优化分享流程
- 在房源添加页面添加卖价(元/平)和总价(万)输入字段
- 实现卖价变动时总价自动计算功能
- 在房源详情页显示卖价和总价信息
- 调整物业费显示位置提升界面布局合理性
- 更新服务器配置地址从gxwebsoft.com到websoft.top
- 替换必看好房标签为特价好房标签统一显示
- 修复房源详情页分享功能和海报生成流程
- 添加跟进记录页面和相应跳转功能
- 优化房源管理页面删除按钮显示逻辑
- 实现闪屏页跳过功能和登录状态记忆
- 添加房源海报生成组件支持分享推广
- 修复分享路径参数传递和用户信息存储
2026-02-13 19:37:24 +08:00

57 lines
1.6 KiB
JavaScript

import http from './index.js';
import {
fileUrl
} from '@/config.js';
import storage from '@/utils/storage'
import dayjs from "dayjs"
import appConfig from '@/config.js'
// 文件服务器
// export const uploadFile = (file) => http.upload(fileUrl + '/api/file/upload', file)
// 阿里云OSS
export const uploadFile = (file) => http.upload('https://server.websoft.top/api/oss/upload', file)
// export const uploadFile = async ({filePath}) => {
// // 获取临时凭证
// let sts = storage.get('sts');
// if(!sts){
// const stsRes = await http.get('/oss/getPostForm')
// sts = stsRes.data
// storage.set('sts', sts, 60)
// }
// const {polocyBase64,signature} = sts;
// var suffix = filePath.substring(filePath.lastIndexOf(".")); //.txt
// const fileName = dayjs().format('YYYYMMDD') + '/'+ uni.$u.guid() + suffix;
// return new Promise((reso, rej) => {
// uni.uploadFile({
// url: appConfig.fileUrl, // 开发者服务器的URL。
// filePath: filePath,
// name: 'file', // 必须填file。
// formData: {
// key: fileName,
// 'policy': polocyBase64,
// 'OSSAccessKeyId': 'LTAI5t8UTh8CTXEi2dYxobhj',
// 'success_action_status': '200', //让服务端返回200,不然,默认会返回204
// 'signature': signature,
// // 'x-oss-security-token': this.stsToken,
// },
// success: (res) => {
// const webUrl = appConfig.fileUrl + '/' + fileName;
// reso({data: {url: webUrl,thumb: webUrl}})
// },
// fail: err => {
// rej(err)
// }
// });
// })
// }
export const getTempOssToken = () => http.get('/oss/getTempToken')
export default {
uploadFile,
getTempOssToken
}