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