feat: 调试完善信息页

This commit is contained in:
mayubo@gmail.com 2025-06-19 16:24:52 +08:00
parent ea5311be5b
commit c019e03db8
9 changed files with 273 additions and 230 deletions

View File

@ -1,3 +1,4 @@
export const apiArr = {
getUserInfo: '/api/v2/wechat/mpuser-crud/info', // 获取城市列表
userInfoUpdate: '/api/v2/wechat/mpuser-crud/update', // 会员信息更新
}

View File

@ -9,7 +9,47 @@ align-items: center;
height: 130rpx;
border-radius: 50%;
}
.item{
.main {
margin: 45rpx 20rpx 62rpx;
background: #FFFFFF;
background: yellow;
border-radius: 20rpx 20rpx 20rpx 20rpx;
}
.tabel {
height: 100rpx;
display: flex;
align-items: center;
}
.left {
font-size: 28rpx;
color: #999999;
margin-right: 68rpx;
}
.right {
display: flex;
align-items: center;
height: 100rpx;
flex: 1;
border-bottom: 1rpx solid #EBEBEB;
}
.right_radio {
margin-left: 45rpx;
}
.no_border{
border-bottom: none;
}
.btn {
margin: 62rpx 75rpx 60rpx;
height: 90rpx;
line-height: 90rpx;
background: linear-gradient( 91deg, #FF7658 0%, #FF370B 100%);
border-radius: 100rpx 100rpx 100rpx 100rpx;
text-align: center;
font-weight: 600;
font-size: 36rpx;
color: #FFFFFF;
}
/* .item{
display:flex;
border-bottom:1px solid #e6e6e6;
height: 90rpx;
@ -35,7 +75,6 @@ align-items: center;
}
.item-right {
/* flex: 1; */
text-align: right;
font-size: 26rpx;
font-weight: 400;
@ -48,12 +87,9 @@ align-items: center;
.item-right-icon {
width: 13rpx;
height: 26rpx;
}
} */
/*
/* TODO: 为什么不生效? */
.not-border{
border-bottom: none;
}
.item:last-child{
border-bottom:none
}
@ -75,7 +111,7 @@ align-items: center;
font-size: 36rpx;
font-weight: 400;
line-height: 80rpx;
}
} */
.u-upload__wrap__preview {
width: 130rpx;
height: 130rpx;

View File

@ -1,173 +1,175 @@
<template>
<view class="container">
<view class="header">
<u-upload @afterRead="afterReadImg" :deletable="false" :maxCount="1">
<!-- <u-upload :fileList="avatarInfo" @afterRead="afterReadImg" :deletable="false" :maxCount="1"> -->
<!-- <view class="imgCon">
<image class="avatar_pic" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_422.png" mode="widthFix"></image>
</view> -->
<image class="avatar_pic" :src="avatarInfo.url" alt="" />
</u-upload>
<view>点击更换头像</view>
</view>
<view class="item" data-url="/packages/user/uploadAvatar/index" data-title="上传头像" @click="handleSelectClick">
<view class="item-left">
<image class="item-icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_422.png" />
<view class="item-title">上传头像</view>
<view class="container">
<view class="header">
<u-upload @afterRead="afterReadImg" :deletable="false" :maxCount="1">
<image class="avatar_pic" :src="avatarInfo.url" alt="" />
</u-upload>
<view>点击更换头像</view>
</view>
<view class="main">
<view class="tabel">
<view class="left">姓名</view>
<view class="right">
<input
type="text"
placeholder="请填写昵称"
:value="name"
:data-name="name"
@input="headerInputClick"
/>
</view>
</view>
<van-icon name="arrow" color="#D5AC66" />
</view>
<view class="item">
<view class="item-left">
<image class="item-icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Classroom.png" />
<view class="item-title">当前账户</view>
<view class="tabel">
<view class="left">性别</view>
<view class="right">
<radio
value="2"
:checked="sex == 2"
@click="headerRadioClick(2)"
/>
<view class="right_radio">
<radio
value="1"
:checked="sex == 1"
@click="headerRadioClick(1)"
/>
</view>
</view>
</view>
<view class="item-right">{{userInfo.user_name}}</view>
</view>
<view class="item" data-url="/packages/user/resetPwd/index" data-title="修改登录密码" data-type="login"
@click="handleSelectClick">
<view class="item-left">
<image class="item-icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_423.png" />
<view class="item-title">修改登录密码</view>
<view class="tabel">
<view class="left">Email</view>
<view class="right no_border">
<input
type="text"
placeholder="请填写邮箱地址"
:value="eMail"
:data-name="eMail"
@input="headerInputClick"
/>
</view>
</view>
<van-icon name="arrow" color="#D5AC66" />
</view>
<view class="item not-border" data-url="/packages/user/resetPwd/index" data-title="修改支付密码" data-type="pay"
@click="handleSelectClick">
<view class="item-left">
<image class="item-icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_424.png" />
<view class="item-title">修改支付密码</view>
<view class="btn">保存设置</view>
<view class="main">
<view class="tabel">
<view class="left">刷新登录</view>
<view class="right">
<u-icon name="arrow-right" />
</view>
</view>
<van-icon name="arrow" color="#D5AC66" />
</view>
<!-- 灰色分割线 -->
<view class="line"></view>
<view class="item not-border">
<view class="item-left">
<image class="item-icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_425.png" />
<view class="item-title">绑定手机</view>
<view class="tabel no_border" @click="headerSettingClick">
<view class="left">设置授权</view>
<view class="right">
<u-icon name="arrow-right" />
</view>
</view>
<view class="item-right desc">{{phoneNum}}</view>
</view>
<button class="quit_login" @click="handleQuitLoginClick">退出登录</button>
<nav-footer />
</view>
<nav-footer />
</view>
</template>
<script>
import { NavgateTo, request, picUrl, upload } from '../../../utils/index';
import { apiArr } from '../../../api/login';
export default {
data() {
return {
avatarInfo: {},
userInfoList: [{
pic: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_422.png',
desc: '上传头像',
url: "/packages/user/uploadAvatar/index",
isShowPic: true,
},
{
pic: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Classroom.png',
desc: '当前账户',
url: "",
text: "微信用户"
},
{
pic: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_423.png',
desc: '修改登录密码',
type: 'login',
url: "/packages/user/resetPwd/index",
isShowPic: true,
},
{
pic: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_424.png',
desc: '修改支付密码',
type: 'pay',
url: "/packages/user/resetPwd/index",
isShowPic: true,
isLast: true,
},
],
userInfo: {},
phoneNum: uni.getStorageSync('phone'),
}
},
methods: {
//
async afterReadImg(e){
console.log('eeee', e);
const { file} = e;
upload(file.url, res => {
console.log('1111', res);
this.avatarInfo = {
url: picUrl + res.data.path,
picUrl: res.data.path,
}
})
uni.showToast({
title: '上传成功',
icon: 'success'
});
},
async init() {
const res = await request(apiArr.loginInfo, 'POST', {});
console.log('111211', res);
this.avatarInfo = {
url: res.img ? picUrl + res.img : 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_309.png',
picUrl: res.img
import { NavgateTo, request, picUrl, upload } from "../../../utils/index";
import { apiArr } from "../../../api/login";
import { apiArr as apiArr2 } from "../../../api/v2User";
export default {
data() {
return {
avatarInfo: {},
userInfoList: [
{
pic: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_422.png",
desc: "上传头像",
url: "/packages/user/uploadAvatar/index",
isShowPic: true,
},
{
pic: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Classroom.png",
desc: "当前账户",
url: "",
text: "微信用户",
},
{
pic: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_423.png",
desc: "修改登录密码",
type: "login",
url: "/packages/user/resetPwd/index",
isShowPic: true,
},
{
pic: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_424.png",
desc: "修改支付密码",
type: "pay",
url: "/packages/user/resetPwd/index",
isShowPic: true,
isLast: true,
},
],
name: "",
mobile: "",
eMail: "",
sex: 2,
};
},
methods: {
//
async afterReadImg(e) {
console.log("eeee", e);
const { file } = e;
upload(file.url, (res) => {
console.log("1111", res);
this.avatarInfo = {
url: picUrl + res.data.path,
picUrl: res.data.path,
};
});
uni.showToast({
title: "上传成功",
icon: "success",
});
},
headerInputClick(e) {
console.log("ee", e);
const { name } = e.currentTarget.dataset;
const { value } = e.detail;
this[name] = value;
},
headerSettingClick() {
uni.openSetting({
success(res) {
console.log(res.authSetting)
}
this.userInfo = res;
},
// uni.openSetting({
// success(res) {
// console.log(res.authSetting)
// }
// });
// url
handleSelectClick(event) {
const { url, title, type } = event.currentTarget.dataset
if (!url) return;
NavgateTo(`${url}?title=${title}&type=${type}`)
},
/**
* 退出登录
*/
handleQuitLoginClick() {
console.log('退出登录');
uni.removeStorageSync('ctoken');
uni.removeStorageSync('userId');
uni.removeStorageSync('phone');
uni.removeStorageSync('device_id');
uni.removeStorageSync('dealerId');
uni.removeStorageSync('is_deal');
uni.removeStorageSync('is_dev');
uni.removeStorageSync('is_shop');
uni.removeStorageSync('openId');
uni.removeStorageSync('shopArea');
uni.removeStorageSync('shopId');
uni.reLaunch({
url: '/pages/index/index'
})
},
});
},
onLoad() {
this.init();
}
}
headerRadioClick(item) {
console.log("item", item);
this.sex = item;
},
async init() {
const res = await request(apiArr2.getUserInfo, "POST", {});
console.log("111211", res);
this.avatarInfo = {
url: res.avatar
? picUrl + res.avatar
: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_309.png",
picUrl: res.avatar,
};
this.name = res.nick_name;
this.mobile = res.mobile;
this.sex = res.gender;
this.eMail = res.email;
},
},
onLoad() {
this.init();
},
};
</script>
<style>
@import url("./index.css");
</style>
</style>

View File

@ -20,10 +20,8 @@ justify-content: space-between;
align-items: center;
margin-left: 78rpx;
margin-right: 72rpx;
/* padding-bottom: 40rpx; */
height: 122rpx;
border-bottom: 1px solid #EBEBEB;
border-bottom: 1px solid red;
}
.left {
font-size: 26rpx;

View File

@ -18,7 +18,6 @@
<view class="label">昵称</view>
</view>
<view class="right">
<!-- <input type="text" :value="name" @input="headerInputClick"> -->
<input type="text" placeholder="请填写昵称" :value="name" @input="headerInputClick">
</view>
</view>
@ -27,7 +26,7 @@
<view class="label">手机号</view>
</view>
<view class="right">
<view>{{ phoneNum }}</view>
<view>{{ mobile }}</view>
<button
type="default"
class="desc"
@ -44,15 +43,16 @@
<script>
import { request } from '../../../utils';
import { request, upload, picUrl } from '../../../utils';
import { apiArr } from '../../../api/login';
import { apiArr as apiArr2 } from '../../../api/v2User';
export default {
data() {
return {
avatarInfo: {},
name: '',
phoneNum: uni.getStorageSync('phone'),
mobile: '',
}
},
methods: {
@ -60,39 +60,69 @@
const { value} = e.detail;
this.name = value;
},
heandleChangePhoneClick() {
},
heandleChangePhoneClick() {},
//
getPhoneNumber(event) {
console.log('获取手机号', event);
if (event.detail.errMsg === "getPhoneNumber:ok") {
request(apiArr.loginGetPhone, 'POST', {
request(apiArr.loginGetUserPhone, 'POST', {
code: event.detail.code
}, { silent: false }).then((res) => {
}).then((res) => {
console.log('111', res);
uni.hideLoading();
this.mobile = res.phone;
})
} else {
console.error('用户拒绝授权:', event.detail.errMsg);
}
},
headerSubmitClick() {
console.log('提交', this.name);
//
async afterReadImg(e){
console.log('eeee', e);
const { file} = e;
upload(file.url, res => {
console.log('1111', res);
this.avatarInfo = {
url: picUrl + res.data.path,
picUrl: res.data.path,
}
})
uni.showToast({
title: '上传成功',
icon: 'success'
});
},
async headerSubmitClick() {
console.log('提交', this.name);
const res = await request(apiArr2.userInfoUpdate, 'POST', {
avatar: this.avatarInfo.picUrl,
nick_name: this.name,
mobile: this.mobile
});
console.log('111111111', res)
uni.showToast({
title: '保存成功',
icon: 'success',
mask: true
})
setTimeout(() => {
uni.navigateBack({ delta: 1 })
}, 2000)
},
async init() {
const res = await request(apiArr.loginInfo, 'POST', {});
const res = await request(apiArr2.getUserInfo, 'POST', {});
console.log('111211', res);
this.avatarInfo = {
url: res.img ? picUrl + res.img : 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_309.png',
picUrl: res.img
url: res.avatar ? picUrl + res.avatar : 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_309.png',
picUrl: res.avatar
}
this.name = res.user_name;
this.name = res.nick_name;
this.mobile = res.mobile;
},
},
onLoad() {

View File

@ -241,19 +241,19 @@
"pages": [{
"path": "index/index",
"style": {
"navigationBarTitleText": "账户信息",
"navigationBarTitleText": "个人设置",
"navigationBarBackgroundColor": "#F9F9F9",
"usingComponents": {
"nav-footer": "/components/nav/nav"
}
}
},
{
"path": "replenishInfo/index",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#F9F9F9"
}
},
{
"path": "replenishInfo/index",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#F9F9F9"
}
},
{
"path": "uploadAvatar/index",
@ -456,13 +456,13 @@
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#fff"
}
},
{
"path": "detail_msg/index",
"style": {
"navigationBarTitleText": "商家详情",
"navigationBarBackgroundColor": "#fff"
}
},
{
"path": "detail_msg/index",
"style": {
"navigationBarTitleText": "商家详情",
"navigationBarBackgroundColor": "#fff"
}
},
{
"path": "UserComment/index",

File diff suppressed because one or more lines are too long

View File

@ -19874,7 +19874,9 @@ Object.defineProperty(exports, "__esModule", {
});
exports.apiArr = void 0;
var apiArr = {
getUserInfo: '/api/v2/wechat/mpuser-crud/info' // 获取城市列表
getUserInfo: '/api/v2/wechat/mpuser-crud/info',
// 获取城市列表
userInfoUpdate: '/api/v2/wechat/mpuser-crud/update' // 会员信息更新
};
exports.apiArr = apiArr;

View File

@ -3,41 +3,15 @@
"miniprogram": {
"list": [
{
<<<<<<< HEAD
"name": "packages/user/replenishInfo/index",
"pathName": "packages/user/replenishInfo/index",
"name": "个人设置",
"pathName": "packages/user/index/index",
"query": "",
"scene": null,
"launchMode": "default"
},
{
"name": "packages/user/",
"pathName": "packages/community/oneRepair/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "packages/user/index/index",
"pathName": "packages/user/index/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/user/index",
"pathName": "pages/user/index",
=======
"name": "packages/localLife/pay/index",
"pathName": "packages/localLife/pay/index",
>>>>>>> 1d53d4c5cbe85927ed45a3f295ad2fa0c801fc0f
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "packages/localLife/index/index",
"pathName": "packages/localLife/shopList/index",
"name": "完善注册信息",
"pathName": "packages/user/replenishInfo/index",
"query": "",
"launchMode": "default",
"scene": null