美化了样式
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
// pages/personCenter/accountSetting/accountSetting.js
|
||||
const { baseUrl, globalImgUrl } = require("../../../request");
|
||||
const { notLogin } = require('../../../utils/util')
|
||||
|
||||
|
||||
Page({
|
||||
|
||||
@ -76,6 +78,8 @@ Page({
|
||||
userAccount: res.data.data.userAccount,
|
||||
role:res.data.data.userRole,
|
||||
})
|
||||
} else {
|
||||
notLogin(res.data.message)
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
|
@ -5,7 +5,7 @@
|
||||
class="self-center image"
|
||||
src="{{globalImgUrl + userAvatar}}"
|
||||
/>
|
||||
<view class="flex-col items-start flex-1 self-start group_2 ml-8">
|
||||
<view class="flex-col items-start flex-1 self-start group_2 ml-16">
|
||||
<text class="text">{{ nickName }}</text>
|
||||
<text class="font text_2 mt-28">{{ phoneNumber }}</text>
|
||||
</view>
|
||||
|
49
pages/personCenter/component/modifyNamePop/modifyNamePop.js
Normal file
49
pages/personCenter/component/modifyNamePop/modifyNamePop.js
Normal file
@ -0,0 +1,49 @@
|
||||
Component({
|
||||
properties: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
nickname: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
data: {
|
||||
inputVal: ''
|
||||
},
|
||||
methods: {
|
||||
onInput(e) {
|
||||
this.setData({
|
||||
inputVal: e.detail.value
|
||||
});
|
||||
},
|
||||
onCancel() {
|
||||
this.triggerEvent('cancel');
|
||||
},
|
||||
onConfirm() {
|
||||
const newName = this.data.inputVal.trim();
|
||||
if (!newName) {
|
||||
wx.showToast({
|
||||
title: '昵称不能为空',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (newName.length > 20) {
|
||||
wx.showToast({
|
||||
title: '昵称最长不超过20个字符',
|
||||
icon: 'none'
|
||||
})
|
||||
return ;
|
||||
}
|
||||
this.triggerEvent('confirm', { nickname: newName });
|
||||
}
|
||||
},
|
||||
observers: {
|
||||
nickname(val) {
|
||||
this.setData({ inputVal: val });
|
||||
}
|
||||
}
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<view wx:if="{{show}}" class="popup-mask">
|
||||
<view class="popup-container">
|
||||
<text class="popup-title">修改昵称</text>
|
||||
<input
|
||||
class="popup-input"
|
||||
placeholder="请输入新的昵称"
|
||||
value="{{nickname}}"
|
||||
bindinput="onInput"
|
||||
/>
|
||||
<view class="popup-btns">
|
||||
<button class="btn cancel-btn" bindtap="onCancel">取消</button>
|
||||
<button class="btn confirm-btn" bindtap="onConfirm">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
@ -0,0 +1,57 @@
|
||||
.popup-mask {
|
||||
position: fixed;
|
||||
top: 0; left: 0; right: 0; bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.popup-container {
|
||||
width: 80%;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.popup-title {
|
||||
display: block;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.popup-input {
|
||||
width: 100%;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6rpx;
|
||||
padding: 10rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.popup-btns {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
margin: 0 10rpx;
|
||||
padding: 12rpx 0;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
background: #f5f5f5;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
background: #f5f5f5;
|
||||
color: #ff8d1a;
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
// pages/personCenter/mine/mine.js
|
||||
const { baseUrl } = require("../../../request");
|
||||
const { globalImgUrl } = require("../../../request")
|
||||
const { notLogin } = require('../../../utils/util')
|
||||
|
||||
|
||||
Page({
|
||||
|
||||
@ -20,7 +22,8 @@ Page({
|
||||
userRole: "",
|
||||
title: '查看绩效',
|
||||
id: 0,
|
||||
globalImgUrl
|
||||
globalImgUrl,
|
||||
showNicknamePopup: false
|
||||
},
|
||||
// 跳转课程订单页面
|
||||
courseOrder() {
|
||||
@ -170,10 +173,7 @@ Page({
|
||||
qrcode: globalImgUrl + result.inviteQrCode
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '获取个人信息失败',
|
||||
icon: 'none'
|
||||
})
|
||||
notLogin(res.data.message)
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
@ -297,6 +297,41 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
openNicknamePopup() {
|
||||
this.setData({ showNicknamePopup: true });
|
||||
},
|
||||
closeNicknamePopup() {
|
||||
this.setData({ showNicknamePopup: false });
|
||||
},
|
||||
updateNickname(e) {
|
||||
const { nickname } = e.detail;
|
||||
const token = wx.getStorageSync('token');
|
||||
wx.request({
|
||||
url: baseUrl + '/userInfo/modify/nickname',
|
||||
method: 'POST',
|
||||
header: {
|
||||
Authorization: token
|
||||
},
|
||||
data: { templateString: nickname },
|
||||
success: res => {
|
||||
if (res.data.code === 1) {
|
||||
wx.showToast({ title: '修改成功', icon: 'success' });
|
||||
this.setData({
|
||||
nickName: nickname,
|
||||
showNicknamePopup: false
|
||||
});
|
||||
} else {
|
||||
wx.showToast({ title: res.data.message || '修改失败', icon: 'none' });
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.showToast({ title: '网络错误', icon: 'none' });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"InvitationCodePop": "/pages/personCenter/component/InvitationCodePop/InvitationCodePop"
|
||||
"InvitationCodePop": "/pages/personCenter/component/InvitationCodePop/InvitationCodePop",
|
||||
"EditNicknamePopup": "/pages/personCenter/component/modifyNamePop/modifyNamePop"
|
||||
}
|
||||
}
|
||||
|
@ -219,8 +219,11 @@
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</button>
|
||||
<view class="flex-col ml-6">
|
||||
<text class="self-start font text">{{ nickName }}</text>
|
||||
<view class="flex-col ml-6">
|
||||
<view class="flex-row items-center justify-between" style="width: 250rpx;">
|
||||
<text class="self-start font text nickname-wrap">{{ nickName }}</text>
|
||||
<text class="self-start font text_2 ml-16" bindtap="openNicknamePopup">修改</text>
|
||||
</view>
|
||||
<view class="flex-row items-center self-stretch group_2 mt-9" bindtap="gotoCall">
|
||||
<image
|
||||
class="image_3"
|
||||
@ -318,4 +321,11 @@
|
||||
</view>
|
||||
|
||||
<!-- 调用弹窗组件 -->
|
||||
<InvitationCodePop show="{{showPopup}}" bind:close="closePopup" qrcode="{{qrcode}}"/>
|
||||
<InvitationCodePop show="{{showPopup}}" bind:close="closePopup" qrcode="{{qrcode}}"/>
|
||||
|
||||
<EditNicknamePopup
|
||||
show="{{showNicknamePopup}}"
|
||||
nickname="{{nickName}}"
|
||||
bind:cancel="closeNicknamePopup"
|
||||
bind:confirm="updateNickname"
|
||||
/>
|
||||
|
@ -64,9 +64,10 @@ button {
|
||||
}
|
||||
.text_2 {
|
||||
color: #808080;
|
||||
line-height: 17.08rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.section_2 {
|
||||
width: 230rpx;
|
||||
padding: 7.5rpx 13.13rpx 5.63rpx 14.03rpx;
|
||||
background-color: #fff6de;
|
||||
border-radius: 31.26rpx;
|
||||
@ -136,7 +137,7 @@ button {
|
||||
width: 224.59rpx;
|
||||
}
|
||||
.list {
|
||||
padding-top: 39.38rpx;
|
||||
padding-top: 19.38rpx;
|
||||
}
|
||||
.section_4 {
|
||||
padding: 31.88rpx 31.88rpx 30rpx 33.75rpx;
|
||||
@ -157,4 +158,11 @@ button {
|
||||
}
|
||||
.text_8 {
|
||||
line-height: 23.81rpx;
|
||||
}
|
||||
.nickname-wrap {
|
||||
display: block; /* 让它单独占一行 */
|
||||
max-width: 250rpx; /* 不超过容器宽度 */
|
||||
white-space: normal; /* 允许正常换行 */
|
||||
word-break: break-all; /* 长字符串也能断行 */
|
||||
line-height: 1.4;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
import { baseUrl } from "../../../request";
|
||||
import { formatPassword } from "../../../utils/util"
|
||||
const { notLogin } = require('../../../utils/util')
|
||||
|
||||
// pages/personCenter/resetPwd/resetPwd.js
|
||||
Page({
|
||||
@ -45,15 +46,12 @@ Page({
|
||||
})
|
||||
setTimeout(() => {
|
||||
wx.reLaunch({
|
||||
url: '/pages/loginModule/pwdLogin/pwdLogin',
|
||||
url: `/pages/loginModule/pwdLogin/pwdLogin?role=${role}`,
|
||||
})
|
||||
}, 1000); // 1000ms = 1秒
|
||||
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: res.data.message
|
||||
})
|
||||
notLogin(res.data.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user