This commit is contained in:
18631081161 2026-01-20 22:12:29 +08:00
parent 9cdd391a04
commit 1a2edfb356
4 changed files with 46 additions and 10 deletions

View File

@ -21,7 +21,7 @@ const ENV = {
} }
// 当前环境 - 开发时使用 development打包时改为 production // 当前环境 - 开发时使用 development打包时改为 production
const CURRENT_ENV = 'production' const CURRENT_ENV = 'development'
// 导出配置 // 导出配置
export const config = { export const config = {

View File

@ -257,8 +257,8 @@
</view> </view>
<!-- 城市选择弹窗 --> <!-- 城市选择弹窗 -->
<view class="picker-popup" v-if="showCityPopup" @click="closeCityPopup"> <view class="picker-popup" v-if="showCityPopup" @click="closeCityPopup" @touchmove.prevent.stop="onMaskTouchMove">
<view class="picker-content city-picker-content" @click.stop> <view class="picker-content city-picker-content" @click.stop @touchmove.stop>
<view class="picker-header"> <view class="picker-header">
<text class="picker-cancel" @click="showCityPopup = false">取消</text> <text class="picker-cancel" @click="showCityPopup = false">取消</text>
<text class="picker-title">选择地区</text> <text class="picker-title">选择地区</text>
@ -284,7 +284,11 @@
<!-- 省份列表 --> <!-- 省份列表 -->
<view class="province-section"> <view class="province-section">
<view class="section-title">按省份选择</view> <view class="section-title">按省份选择</view>
<scroll-view scroll-y class="province-scroll"> <scroll-view
scroll-y
class="province-scroll"
@touchmove.stop
>
<view <view
v-for="province in provinceData" v-for="province in provinceData"
:key="province.name" :key="province.name"
@ -627,6 +631,11 @@ const closeCityPopup = (e) => {
} }
} }
// touchmove
const onMaskTouchMove = () => {
//
}
// //
const toggleProvince = (provinceName) => { const toggleProvince = (provinceName) => {
if (expandedProvince.value === provinceName) { if (expandedProvince.value === provinceName) {
@ -1110,12 +1119,20 @@ onMounted(() => {
.province-scroll { .province-scroll {
flex: 1; flex: 1;
height: 500rpx; height: 400rpx;
min-height: 400rpx;
max-height: 50vh;
padding-bottom: 120rpx;
} }
.province-item { .province-item {
border-bottom: 1rpx solid #f5f5f5; border-bottom: 1rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
margin-bottom: 80rpx;
}
.province-name { .province-name {
display: flex; display: flex;
align-items: center; align-items: center;

View File

@ -62,9 +62,28 @@ public class ProfileController : ControllerBase
/// <param name="files">照片文件</param> /// <param name="files">照片文件</param>
/// <returns>上传结果</returns> /// <returns>上传结果</returns>
[HttpPost("photos")] [HttpPost("photos")]
public async Task<ApiResponse<UploadPhotoResponse>> UploadPhotos([FromForm] List<IFormFile> files) public async Task<ApiResponse<UploadPhotoResponse>> UploadPhotos([FromForm] IFormFile? files)
{ {
if (files == null || files.Count == 0) // 支持单文件上传(小程序 uni.uploadFile 每次只能上传一个文件)
var fileList = new List<IFormFile>();
if (files != null)
{
fileList.Add(files);
}
// 也支持多文件上传
if (Request.Form.Files.Count > 0)
{
foreach (var file in Request.Form.Files)
{
if (!fileList.Contains(file))
{
fileList.Add(file);
}
}
}
if (fileList.Count == 0)
{ {
return ApiResponse<UploadPhotoResponse>.Error(ErrorCodes.MissingParameter, "请选择要上传的照片"); return ApiResponse<UploadPhotoResponse>.Error(ErrorCodes.MissingParameter, "请选择要上传的照片");
} }
@ -72,7 +91,7 @@ public class ProfileController : ControllerBase
var userId = GetCurrentUserId(); var userId = GetCurrentUserId();
// 检查是否可以上传 // 检查是否可以上传
var canUpload = await _profileService.CanUploadPhotosAsync(userId, files.Count); var canUpload = await _profileService.CanUploadPhotosAsync(userId, fileList.Count);
if (!canUpload) if (!canUpload)
{ {
return ApiResponse<UploadPhotoResponse>.Error(ErrorCodes.PhotoLimitExceeded, "照片数量超过限制最多5张"); return ApiResponse<UploadPhotoResponse>.Error(ErrorCodes.PhotoLimitExceeded, "照片数量超过限制最多5张");
@ -80,7 +99,7 @@ public class ProfileController : ControllerBase
// 转换为Stream列表 // 转换为Stream列表
var streams = new List<Stream>(); var streams = new List<Stream>();
foreach (var file in files) foreach (var file in fileList)
{ {
var stream = file.OpenReadStream(); var stream = file.OpenReadStream();
streams.Add(stream); streams.Add(stream);

View File

@ -51,7 +51,7 @@
"SecretKey": "89GWr7JPWYTL8ueHlAYowGZnvzKZjqs9", "SecretKey": "89GWr7JPWYTL8ueHlAYowGZnvzKZjqs9",
"Region": "ap-shanghai", "Region": "ap-shanghai",
"BucketName": "miaoyu", "BucketName": "miaoyu",
"CdnDomain": "miaoyu-1308826010.cos.ap-shanghai.myqcloud.com" "CdnDomain": "https://miaoyu-1308826010.cos.ap-shanghai.myqcloud.com"
} }
}, },
"AliyunSms": { "AliyunSms": {