Files
vpUni/.svn/pristine/f3/f342726cdc082739185cbee24c294d1bfef9607d.svn-base
2026-03-09 16:39:03 +08:00

133 lines
3.6 KiB
Plaintext

<template>
<view style=" margin: 20rpx; padding: 20rpx;">
<view @click="uploadFImg()" class=""
style=" display: flex; flex-direction: column; justify-content: center; align-items: center; ">
<img v-if="userInfo.headImg!=''" :src="Service.GetMateUrlByImg(userInfo.headImg)" style="width: 140rpx; height: 140rpx; border-radius: 50%; " alt="" />
<view v-else class=""
style="background-color: #EBEBEB; width: 140rpx; height: 140rpx; border-radius: 50%; display: flex; align-items: center; justify-content: center; ">
<img :src="Service.GetIconImg('/static/userFunc/photo.png')" style="width: 50rpx; height: 50rpx; "
alt="" />
</view>
<view class="" style="margin-top: 15rpx; font-size: 26rpx; color: #999999; ">
点击更换头像
</view>
</view>
<view class="" style=" margin-top: 30rpx; ">
<up-form labelWidth='90' labelPosition="left" :model="userInfo" ref="form1">
<up-form-item label="昵称" prop="userInfo.name" :borderBottom="true" ref="item1">
<up-input inputAlign='right' v-model="userInfo.nick" border="none"></up-input>
</up-form-item>
<up-form-item label="性别" prop="userInfo.sex" :borderBottom="true">
<view class="" style="position: relative; width: 100%;" >
<view class="" style=" position: absolute; top: -8rpx; right: 0; ">
<up-radio-group style="width: 300rpx;" v-model="userInfo.sex" placement="row">
<up-radio v-for="(item, index) in radiolist1" activeColor='#FF6A00' :key="index"
iconPlacement="right" :label="item.name" :name="item.name">
</up-radio>
</up-radio-group>
</view>
</view>
</up-form-item>
<up-form-item label="手机号" prop="userInfo.sex" :borderBottom="true">
<up-input inputAlign='right' v-model="userInfo.phone" border="none"></up-input>
</up-form-item>
</up-form>
</view>
<view class="" style="width: 100%; height: 200rpx;">
</view>
<view class="" style=" width: 100% ; background-color: #fff; position: fixed; bottom: 15rpx; left: 0; ">
<view class=""
style=" margin: 0 20rpx; padding: 20rpx 0; color: #fff; display: flex; align-items: center; justify-content: center; border-radius: 10rpx; background-color: #FF6A00;">
保存信息
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app";
import { Service } from '@/Service/Service';
import { ref } from "vue";
import { vpUserService } from '@/Service/vp/vpUserService'
interface userInfo{
nick:string
sex:string
phone:string
headImg:string
}
let showDate=ref(false)
const userInfo = ref<userInfo>({
nick:'',
sex:'',
phone:'',
headImg:''
})
let nowDate=ref()
const radiolist1 = ref([
{
name: '男',
disabled: false,
},
{
name: '女',
disabled: false,
}
]);
onLoad(() => {
nowDate.value=new Date()
});
onShow(() => {
});
const getUserinfo=()=>{
vpUserService.GetUserInfo().then(res=>{
userInfo.value=res.data.userInfo
})
}
const uploadFImg = () => {
uni.chooseImage({
count: 1, // 最多选择3张图片
sizeType: ['original', 'compressed'], // 支持原图和压缩图
sourceType: ['album', 'camera'], // 可从相册选择或使用相机拍照
success: function (res) {
let path = res.tempFiles[0].path
Service.uploadH5(path, 'Avatar', data => {
console.log(data);
// userInfo.value.headImg = data.split(',')[2].split(':')[1].split('"')[1]
})
},
fail: function (err) {
console.error('选择失败:', err.errMsg);
}
})
}
</script>
<style lang="scss">
page {
background-color: #fff;
}
</style>