更改首页

This commit is contained in:
魏啾
2024-07-05 18:26:46 +08:00
parent a40cfd9c5f
commit 380a6312f8
19 changed files with 3841 additions and 1179 deletions

View File

@@ -10,7 +10,8 @@
</button> -->
<!-- <image class="onecontentboximage" :src="userHeadImg" mode="" @click="uploadImg"></image> -->
<button type="default" class="btn" open-type="chooseAvatar" @chooseavatar="uploadImg">
<view class="" :style="'background-image:url('+userHeadImg+');'" style="width: 180rxp;height: 180rpx; background-position: center;"></view>
<view class="" :style="'background-image:url('+userHeadImg+');'"
style="width: 180rxp;height: 180rpx; background-position: center;"></view>
</button>
@@ -18,7 +19,9 @@
<view class="onecontentboxitemtext">
昵称
</view>
<input class="onecontentboxiteminput" v-model="userName" type="nickname" placeholder="请输入昵称">
<input class="onecontentboxiteminput" v-model="nickName" type="nickname"
@blur="bindblur" placeholder="请输入昵称" @input="bindinput" />
</view>
<view class="onecontentboxitem flex-between" style="border-top: 1rpx dotted #333333;">
<view class="onecontentboxitemtext">
@@ -42,11 +45,7 @@
components: {
navseat
},
onLoad() {
this.userInfo = uni.cache.get('userInfo')
this.userName = this.userInfo.nickName
this.userHeadImg = this.userInfo.headImg
},
data() {
return {
titlename: '完善信息',
@@ -62,9 +61,14 @@
},
userInfo: uni.cache.get('userInfo'),
userHeadImg: "",
userName: ''
nickName: ''
};
},
onLoad() {
this.userInfo = uni.cache.get('userInfo')
this.nickName = this.userInfo.nickName
this.userHeadImg = this.userInfo.headImg
},
onPageScroll(e) {
if (e.scrollTop <= 44) { //搜索导航栏
this.opacitys = false
@@ -73,6 +77,14 @@
}
},
methods: {
bindblur(e) {
console.log(e,11)
this.nickName = e.detail.value; // 获取微信昵称
},
bindinput(e) {
console.log(e,22)
this.nickName = e.detail.value; // 获取微信昵称
},
// uploadImg() {
// let _this = this
// uni.chooseImage({
@@ -111,32 +123,32 @@
console.log(e)
console.log(e.detail)
// this.userHeadImg = avatarUrl
uni.uploadFile({
url: 'https://wxcashiertest.sxczgkj.cn/cashierService/common/upload',
// url: uni.conf.baseUrl + '/common/upload',
filePath: avatarUrl,
header: {
environment: 'app',
type: 'android',
version: '1.7.3',
},
name: "file",
formData: {
file:avatarUrl,
},
success: (uploadFileRes) => {
let {
data
} = JSON.parse(uploadFileRes.data)
this.userHeadImg = data
},
});
uni.uploadFile({
url: 'https://wxcashiertest.sxczgkj.cn/cashierService/common/upload',
// url: uni.conf.baseUrl + '/common/upload',
filePath: avatarUrl,
header: {
environment: 'app',
type: 'android',
version: '1.7.3',
},
name: "file",
formData: {
file: avatarUrl,
},
success: (uploadFileRes) => {
let {
data
} = JSON.parse(uploadFileRes.data)
this.userHeadImg = data
},
});
},
async sumbit() {
let res = await this.api.upUserInfo({
headImg: this.userHeadImg,
nickName: this.userName
nickName: this.nickName
})
if (res.code == 0) {
uni.navigateBack()
@@ -217,12 +229,14 @@
}
}
}
.btn{
.btn {
width: 180rpx;
height: 180rpx;
border-radius: 100%;
padding: 0;
>view{
>view {
border-radius: 100%;
}
}

View File

@@ -23,7 +23,7 @@
<!-- #endif -->
<view class="boxtop_top flex-between">
<view class="boxtop_topleft">
<view class="flex-start" v-if="userInfo.nickName" @click="clickinformation">
<view class="flex-start" v-if="userInfo" @click="clickinformation">
<image style="width: 108rpx; height: 108rpx; border-radius: 50%;" v-if="userInfo.headImg"
:src="userInfo.headImg" mode="aspectFill">
</image>