Files
vpUni/.svn/pristine/86/866dc0e014e3999b40c95ab7e83c591f6bc92883.svn-base
2026-03-09 16:39:03 +08:00

155 lines
4.1 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>
<ImageCropperFunc :show="upImgShow" :url="upImgUrl" :imgName="imgName" :width="upImgwidth" :height="upImgheight"
:upType="upImgType" :retFun="upImgData"></ImageCropperFunc>
</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';
import ImageCropperFunc from "@/components/ImageCropper";
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,
}
])
// 裁剪图片参数
let upImgShow = ref<boolean>(false)
let upImgUrl = ref<string>('')
let upImgwidth = ref<number>(0)
let upImgheight = ref<number>(0)
let upImgType = ref<string>('')
let imgName = ref<string>('')
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
},
fail: function (err) {
console.error('选择失败:', err.errMsg);
}
})
}
const upImgData = (e : any) => {
upImgShow.value = false
// if (e.name == "showImg") {
// userInfo.value.showImg = e.url
// }
// if (e.name == "headimg") {
// userInfo.value.logo = e.url
// }
}
</script>
<style lang="scss">
page {
background-color: #fff;
}
</style>