梁航:个人信息动态展示

This commit is contained in:
hot777zz
2023-11-15 23:40:11 +08:00
4 changed files with 103 additions and 5 deletions

View File

@@ -163,7 +163,16 @@
"enablePullDownRefresh": false
}
}
],
,{
"path" : "pages/my/edit/edit",
"style" :
{
"navigationBarTitleText": "修改个人信息",
"enablePullDownRefresh": false
}
}
],
"tabBar": {
"color": "#CCCCCC",
"borderStyle": "white",

66
pages/my/edit/edit.vue Normal file
View File

@@ -0,0 +1,66 @@
<template>
<view>
<view class="avatar">
<u-avatar @click="changeAvatar()" :src="avatar"></u-avatar>
</view>
<view class="name-edit">
<text>用户名</text>
<u-input border="surround" v-model="username"></u-input>
</view>
<view class="send">
<u-button @click="editInfo" color="linear-gradient(to right, #E86262, #CC3333)">提交</u-button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
username:'',
avatar:''
}
},
methods: {
changeAvatar(){
// uni.uploadFile()
console.log(111);
},
editInfo(){
this.$api.editPersonInfo({
nickname:this.$data.nickname,
avatar:this.$data.avatar,
Headers:wx.getStorageSync('token')
}).then(res => {
console.log(res);
})
}
},
onLoad() {
let that = this
this.$data.username = wx.getStorageSync('nickname')
this.$data.avatar = wx.getStorageSync('avatar')
}
}
</script>
<style>
.avatar{
width: 100%;
height: 200rpx;
display: flex;
justify-content: center;
align-items: center;
}
.name-edit{
display: flex;
flex-direction: column;
justify-content: center;
}
.send{
width: 50%;
transform: translateX(50%) translateY(50%);
}
</style>

View File

@@ -7,7 +7,8 @@
<u-avatar :src="src"></u-avatar>
</view>
<view class="username">{{username}}</view>
<view class="account">账号:{{account}}</view>
<view class="account">账号:{{account}} <u-icon name="edit-pen" class="edit-icon" size="20" @click="toEdit"></u-icon></view>
</view>
<view class="publish">
<u-cell-group>
@@ -42,8 +43,8 @@
data() {
return {
src: 'https://cdn.uviewui.com/uview/album/2.jpg',
account: '123456',
username: '用户名',
account: '',
username: '',
isLoad: true
}
},
@@ -53,6 +54,8 @@
return
}
this.isLoad = true
this.$data.account = wx.getStorageSync('account')
this.$data.username = wx.getStorageSync('nickname')
},
methods: {
reOnLoad() {
@@ -83,7 +86,17 @@
url: '/pages/Partnerships/Partnerships'
})
},
toEdit(){
uni.navigateTo({
url:'/pages/my/edit/edit'
})
}
//---------页面调用接口示例------------
// getInfo() {
// this.$api.getUserInfo().then(res => {
// console.log('userInfo', res);
// })
// }
}
}
</script>
@@ -119,6 +132,10 @@
.account {
font-size: 15px;
font-weight: 1rpx;
display: flex;
}
.edit-icon{
}
}

View File

@@ -213,6 +213,12 @@ const apiService = {
resolve(service.get(url))
>>>>>>> remotes/origin/master
})
},
editPersonInfo(data){
const url = `/center/userupdate`
return new Promise((resolve,reject) => {
resolve(service.post(url,data))
})
}
}
export {