mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 16:39:37 +08:00
描述:修改个人信息
This commit is contained in:
parent
453a519a09
commit
1c06538e9d
13
miniprogram/api/user/user.js
Normal file
13
miniprogram/api/user/user.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import {
|
||||||
|
request
|
||||||
|
} from '../selfRequest';
|
||||||
|
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
export function userProfile(id) {
|
||||||
|
return request({
|
||||||
|
url: '/user/profile?id=' + id,
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -127,7 +127,7 @@ App({
|
|||||||
});
|
});
|
||||||
var that = this
|
var that = this
|
||||||
wx.uploadFile({
|
wx.uploadFile({
|
||||||
url: that.DOMAIN_NAME + '/dfs/upload',
|
url: that.DOMAIN_NAME + '/api/dfs/upload',
|
||||||
header: {
|
header: {
|
||||||
'Authorization': 'Bearer ' + that.Getopenid()
|
'Authorization': 'Bearer ' + that.Getopenid()
|
||||||
},
|
},
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
let app = getApp()
|
let app = getApp()
|
||||||
|
|
||||||
|
import {
|
||||||
|
userProfile
|
||||||
|
} from "../../api/user/user.js"
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
DOMAIN_NAME: app.IMG_NAME,
|
||||||
|
userDetail: {},
|
||||||
// tabBar param
|
// tabBar param
|
||||||
tabBarParam: {
|
tabBarParam: {
|
||||||
selected: 2,
|
selected: 2,
|
||||||
@ -33,46 +40,31 @@ Page({
|
|||||||
"text": "我的"
|
"text": "我的"
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
DOMAIN_NAME: app.IMG_NAME,
|
customerPages: [{
|
||||||
customerPages: [
|
name: "我的活动",
|
||||||
[{
|
|
||||||
listIcon: "icontubiao-1",
|
|
||||||
zh: "我的活动",
|
|
||||||
url: "/pages/myActivities/myActivities",
|
url: "/pages/myActivities/myActivities",
|
||||||
borderRadius: '20rpx 20rpx 0 0'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
listIcon: "iconqiyexinxi",
|
name: "业务申请",
|
||||||
zh: "业务申请",
|
url: "/pages/my/serviceApply/serviceApply"
|
||||||
url: "../my/serviceApply/serviceApply"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
listIcon: "iconqiyexinxi",
|
name: "园区建议",
|
||||||
zh: "园区建议",
|
|
||||||
url: "/pages/complaint/complaint",
|
url: "/pages/complaint/complaint",
|
||||||
borderRadius: '0 0 20rpx 20rpx',
|
|
||||||
marginbottom: true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
listIcon: "iconzhanghaoshezhi",
|
name: "账号设置",
|
||||||
zh: "账号设置",
|
|
||||||
url: "/pages/my/accountSetting/accountSetting",
|
url: "/pages/my/accountSetting/accountSetting",
|
||||||
borderRadius: '20rpx 20rpx 0 0'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
listIcon: "iconfuwu",
|
name: "我的服务",
|
||||||
zh: "我的服务",
|
|
||||||
url: "/pages/enterpriseServices/myServiceList/myServiceList"
|
url: "/pages/enterpriseServices/myServiceList/myServiceList"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
listIcon: "iconguzhangbaoxiu",
|
name: "我的报修",
|
||||||
zh: "我的报修",
|
|
||||||
url: "/pages/parkRepair/parkRepair",
|
url: "/pages/parkRepair/parkRepair",
|
||||||
borderRadius: '0 0 20rpx 20rpx'
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
],
|
],
|
||||||
memberInfo: {}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 切换tabbar
|
// 切换tabbar
|
||||||
@ -94,29 +86,27 @@ Page({
|
|||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {},
|
onLoad(options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
let that = this
|
let _this = this
|
||||||
if (wx.getStorageSync('token')) {
|
let userId = wx.getStorageSync('userId');
|
||||||
app.AjaxRequest('get', {
|
if (userId) {
|
||||||
'content-type': 'application/json',
|
userProfile(userId).then(res => {
|
||||||
'Authorization': 'Bearer ' + app.Getopenid()
|
console.log('userProfile', res);
|
||||||
}, '/user/profile', {}, function (res) {
|
_this.setData({
|
||||||
that.setData({
|
userDetail: res.data
|
||||||
memberInfo: res.data
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
app.getlogin()
|
app.getlogin()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navDetail(e) {
|
|
||||||
wx.navigateTo({
|
|
||||||
url: e.currentTarget.dataset.url,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
navigateTo(e) {
|
navigateTo(e) {
|
||||||
if (wx.getStorageSync('token')) {
|
if (wx.getStorageSync('userId')) {
|
||||||
if (e.currentTarget.dataset.url == '/pages/parkRepair/parkRepair') {
|
if (e.currentTarget.dataset.url == '/pages/parkRepair/parkRepair') {
|
||||||
wx.switchTab({
|
wx.switchTab({
|
||||||
url: e.currentTarget.dataset.url,
|
url: e.currentTarget.dataset.url,
|
||||||
@ -130,15 +120,17 @@ Page({
|
|||||||
app.getlogin()
|
app.getlogin()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
navpersonalData() {
|
navpersonalData() {
|
||||||
if (wx.getStorageSync('token')) {
|
if (wx.getStorageSync('userId')) {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '../my/personalData/personalData',
|
url: '/pages/my/personalData/personalData',
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/login/login',
|
url: '/pages/login/login',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
})
|
})
|
@ -1,3 +1,6 @@
|
|||||||
{
|
{
|
||||||
"navigationBarTitleText": "我的"
|
"navigationBarTitleText": "我的",
|
||||||
|
"usingComponents": {
|
||||||
|
"van-icon": "@vant/weapp/icon/index"
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,30 +1,23 @@
|
|||||||
<view class="page">
|
<view class="containerView public">
|
||||||
<view bindtap="navpersonalData" style="padding: 24rpx;background:white;display: flex;margin-top:20rpx;border-radius: 20rpx;padding-right: 0;">
|
|
||||||
<view style="width:164rpx;height:164rpx;border-radius:50%;overflow:hidden;">
|
<!-- 个人 -->
|
||||||
<image src="{{memberInfo.avatar? memberInfo.avatar:'/images/user-unlogin.jpg'}}" mode="widthFix" style="width: 100%;"></image>
|
<view class="itemView" bindtap="navpersonalData">
|
||||||
</view>
|
<view class="itemData">
|
||||||
<view style="font-size:12pt;line-height:164rpx;width: 66%;text-indent: 40rpx;">{{memberInfo.nickname? memberInfo.nickname:'登录'}}</view>
|
<image class="avatarImg" src="{{userDetail.avatar? DOMAIN_NAME + userDetail.avatar : DOMAIN_NAME + '/profile/static/user/headImg.png'}}" mode="aspectFill"></image>
|
||||||
<view class="iconBox">
|
<view class="label">{{userDetail.username? userDetail.username:'登录'}}</view>
|
||||||
<text class="iconfont iconyou" style="color:#939393;line-height:164rpx;"></text>
|
<view class="propOpen"></view>
|
||||||
|
<van-icon name="arrow" size="40rpx" color="gray" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="my-page">
|
<!-- 菜单 -->
|
||||||
|
<view class="itemView">
|
||||||
<view class="my-mainfun-moudel1">
|
<view class="itemData" wx:for="{{customerPages}}" wx:key="*this" bindtap='navigateTo' data-url="{{item.url}}">
|
||||||
<block wx:for="{{customerPages[0]}}" wx:for-item="list" wx:key="i">
|
<view class="label">{{item.name}}</view>
|
||||||
<view class="main-item2" bindtap='navigateTo' data-url="{{list.url}}" style="{{list.marginbottom?'margin-bottom:25rpx;':''}};{{list.bordernone?'border-bottom:none':''}};border-radius:{{list.borderRadius}}" hidden='{{list.hide}}'>
|
<view class="propOpen"></view>
|
||||||
<view class="main-item-text1">
|
<van-icon name="arrow" size="40rpx" color="gray" />
|
||||||
<view class="text-titl1">{{list.zh}}</view>
|
|
||||||
</view>
|
|
||||||
<view class="iconBox">
|
|
||||||
<text class="iconfont iconyou" style="color:#939393"></text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- tabBar -->
|
<!-- tabBar -->
|
||||||
<view class="tab-bar">
|
<view class="tab-bar">
|
||||||
|
@ -1,60 +1,40 @@
|
|||||||
@import "../../tabBar.wxss";
|
@import "../../tabBar.wxss";
|
||||||
|
|
||||||
.page {
|
.containerView.public {
|
||||||
overflow: auto;
|
background: #f1f1f1;
|
||||||
height: 100%;
|
padding: 0 20rpx;
|
||||||
padding: 0 24rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconsize{
|
.itemView {
|
||||||
font-size: 20pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topBox {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topBox>view {
|
|
||||||
flex: 1;
|
|
||||||
text-align: center;
|
|
||||||
color: black;
|
|
||||||
border-right: 1rpx solid #cccccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topBox>view:last-child {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btext {
|
|
||||||
font-size: 20pt;
|
|
||||||
font-weight: 550;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btext1 {
|
|
||||||
font-size: 10pt;
|
|
||||||
margin-top: 10rpx;
|
|
||||||
color: #4C4C4C;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-mainfun-moudel1 {
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
border-radius: 20rpx;
|
||||||
|
|
||||||
.main-item2 {
|
|
||||||
font-size: 10pt;
|
|
||||||
padding: 4% 0;
|
|
||||||
padding-left: 24rpx;
|
|
||||||
border-bottom: 1rpx solid #F1F1F1;
|
|
||||||
display: flex;
|
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconBox {
|
.itemView .itemData {
|
||||||
text-align: center;
|
display: flex;
|
||||||
width: 10%;
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
padding: 28rpx 24rpx;
|
||||||
|
border-bottom: 1px solid rgb(126, 126, 126, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-item-text1 {
|
.itemView .itemData:last-of-type {
|
||||||
width: 90%;
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.itemView .avatarImg {
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
border-radius: 120rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.itemView .label {
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.itemView .propOpen {
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
@ -1,15 +1,17 @@
|
|||||||
let app = getApp()
|
let app = getApp()
|
||||||
|
|
||||||
|
import {
|
||||||
|
userProfile
|
||||||
|
} from "../../../api/user/user.js"
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面的初始数据
|
|
||||||
*/
|
|
||||||
data: {
|
data: {
|
||||||
sex: ['男', '女'],
|
sex: ['男', '女'],
|
||||||
sexindex: 0,
|
sexindex: 0,
|
||||||
showDialog: false,
|
showDialog: false,
|
||||||
ifName: true,
|
ifName: true,
|
||||||
DOMAIN_NAME: '',
|
DOMAIN_NAME: app.IMG_NAME,
|
||||||
park: [],
|
park: [],
|
||||||
parkindex: 0
|
parkindex: 0
|
||||||
},
|
},
|
||||||
@ -136,7 +138,7 @@ Page({
|
|||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
'Authorization': 'Bearer ' + app.Getopenid()
|
'Authorization': 'Bearer ' + app.Getopenid()
|
||||||
}, '/user/profile/update', {
|
}, '/user/profile/update', {
|
||||||
nickname: that.data.nickname
|
username: that.data.nickname
|
||||||
}, function (ret) {
|
}, function (ret) {
|
||||||
that.setData({
|
that.setData({
|
||||||
ifName: true
|
ifName: true
|
||||||
@ -175,10 +177,7 @@ Page({
|
|||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
let that = this
|
let that = this
|
||||||
app.AjaxRequest('get', {
|
userProfile(wx.getStorageSync('userId')).then(res => {
|
||||||
'content-type': 'application/json',
|
|
||||||
'Authorization': 'Bearer ' + app.Getopenid()
|
|
||||||
}, '/user/profile', {}, function (res) {
|
|
||||||
that.setData({
|
that.setData({
|
||||||
memberInfo: res.data,
|
memberInfo: res.data,
|
||||||
sexindex: res.data.sex
|
sexindex: res.data.sex
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class='toast-main'>
|
<view class='toast-main'>
|
||||||
<view class='toast-input'>
|
<view class='toast-input'>
|
||||||
<input placeholder='请输入{{name}}' value="{{name=='姓名'? memberInfo.nickname:memberInfo.post}}"
|
<input placeholder='请输入{{name}}' value="{{name=='姓名'? memberInfo.nickname:memberInfo.post}}" bindinput='setValue' data-name='stuEidtName'></input>
|
||||||
bindinput='setValue' data-name='stuEidtName'></input>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='toast-button'>
|
<view class='toast-button'>
|
||||||
@ -25,8 +24,7 @@
|
|||||||
<view style="padding:4% 0;background:white;display:flex;border-bottom:1rpx solid #E5E5E5;" bindtap="navCropper">
|
<view style="padding:4% 0;background:white;display:flex;border-bottom:1rpx solid #E5E5E5;" bindtap="navCropper">
|
||||||
<view style="font-size:28rpx;width:24%;line-height: 100rpx;">头像</view>
|
<view style="font-size:28rpx;width:24%;line-height: 100rpx;">头像</view>
|
||||||
<view style="font-size:28rpx;width:70%;text-align:right">
|
<view style="font-size:28rpx;width:70%;text-align:right">
|
||||||
<image src="{{memberInfo.avatar? memberInfo.avatar:'/images/t.jpg'}}" mode="widthFix"
|
<image src="{{memberInfo.avatar? DOMAIN_NAME + memberInfo.avatar : DOMAIN_NAME + '/profile/static/user/headImg.png'}}" mode="widthFix" style="width:100rpx;height:100rpx;border-radius:10rpx;">
|
||||||
style="width:100rpx;height:100rpx;border-radius:10rpx;">
|
|
||||||
</image>
|
</image>
|
||||||
</view>
|
</view>
|
||||||
<view style="width:6%;line-height: 100rpx;text-align:right">
|
<view style="width:6%;line-height: 100rpx;text-align:right">
|
||||||
@ -35,15 +33,14 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="listBox" bindtap='change' data-name="姓名">
|
<view class="listBox" bindtap='change' data-name="姓名">
|
||||||
<view style="width:24%;">姓名</view>
|
<view style="width:24%;">姓名</view>
|
||||||
<view style="width:70%;text-align:right;color:#888888">{{memberInfo.nickname}}</view>
|
<view style="width:70%;text-align:right;color:#888888">{{memberInfo.username}}</view>
|
||||||
<view style="width:6%;text-align:right">
|
<view style="width:6%;text-align:right">
|
||||||
<text class="iconfont iconyou" style="font-size:28rpx;color:#B2B2B2"></text>
|
<text class="iconfont iconyou" style="font-size:28rpx;color:#B2B2B2"></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="listBox">
|
<view class="listBox">
|
||||||
<view style="width:24%;">性别</view>
|
<view style="width:24%;">性别</view>
|
||||||
<picker bindchange="sexChange" value="{{sexindex}}" range="{{sex}}"
|
<picker bindchange="sexChange" value="{{sexindex}}" range="{{sex}}" style="width:70%;text-align:right;color:#888888">
|
||||||
style="width:70%;text-align:right;color:#888888">
|
|
||||||
<view>
|
<view>
|
||||||
{{sex[sexindex]}}
|
{{sex[sexindex]}}
|
||||||
</view>
|
</view>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user