梁航:修改页面

This commit is contained in:
hot777zz
2023-11-15 23:16:26 +08:00
parent e3a78be387
commit 88e2d6542b
4 changed files with 93 additions and 2 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>
@@ -85,6 +86,11 @@
uni.navigateTo({
url: '/pages/Partnerships/Partnerships'
})
},
toEdit(){
uni.navigateTo({
url:'/pages/my/edit/edit'
})
}
//---------页面调用接口示例------------
// getInfo() {
@@ -127,6 +133,10 @@
.account {
font-size: 15px;
font-weight: 1rpx;
display: flex;
}
.edit-icon{
}
}

View File

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