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 = { export const apiArr = {
getUserInfo: '/api/v2/wechat/mpuser-crud/info', // 获取城市列表 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; height: 130rpx;
border-radius: 50%; 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; display:flex;
border-bottom:1px solid #e6e6e6; border-bottom:1px solid #e6e6e6;
height: 90rpx; height: 90rpx;
@ -35,7 +75,6 @@ align-items: center;
} }
.item-right { .item-right {
/* flex: 1; */
text-align: right; text-align: right;
font-size: 26rpx; font-size: 26rpx;
font-weight: 400; font-weight: 400;
@ -48,12 +87,9 @@ align-items: center;
.item-right-icon { .item-right-icon {
width: 13rpx; width: 13rpx;
height: 26rpx; height: 26rpx;
} } */
/*
/* TODO: 为什么不生效? */
.not-border{
border-bottom: none;
}
.item:last-child{ .item:last-child{
border-bottom:none border-bottom:none
} }
@ -75,7 +111,7 @@ align-items: center;
font-size: 36rpx; font-size: 36rpx;
font-weight: 400; font-weight: 400;
line-height: 80rpx; line-height: 80rpx;
} } */
.u-upload__wrap__preview { .u-upload__wrap__preview {
width: 130rpx; width: 130rpx;
height: 130rpx; height: 130rpx;

View File

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

View File

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

View File

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

View File

@ -241,19 +241,19 @@
"pages": [{ "pages": [{
"path": "index/index", "path": "index/index",
"style": { "style": {
"navigationBarTitleText": "账户信息", "navigationBarTitleText": "个人设置",
"navigationBarBackgroundColor": "#F9F9F9", "navigationBarBackgroundColor": "#F9F9F9",
"usingComponents": { "usingComponents": {
"nav-footer": "/components/nav/nav" "nav-footer": "/components/nav/nav"
} }
} }
}, },
{ {
"path": "replenishInfo/index", "path": "replenishInfo/index",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationBarBackgroundColor": "#F9F9F9" "navigationBarBackgroundColor": "#F9F9F9"
} }
}, },
{ {
"path": "uploadAvatar/index", "path": "uploadAvatar/index",
@ -456,13 +456,13 @@
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationBarBackgroundColor": "#fff" "navigationBarBackgroundColor": "#fff"
} }
}, },
{ {
"path": "detail_msg/index", "path": "detail_msg/index",
"style": { "style": {
"navigationBarTitleText": "商家详情", "navigationBarTitleText": "商家详情",
"navigationBarBackgroundColor": "#fff" "navigationBarBackgroundColor": "#fff"
} }
}, },
{ {
"path": "UserComment/index", "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; exports.apiArr = void 0;
var apiArr = { 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; exports.apiArr = apiArr;

View File

@ -3,41 +3,15 @@
"miniprogram": { "miniprogram": {
"list": [ "list": [
{ {
<<<<<<< HEAD "name": "个人设置",
"name": "packages/user/replenishInfo/index", "pathName": "packages/user/index/index",
"pathName": "packages/user/replenishInfo/index",
"query": "", "query": "",
"scene": null, "scene": null,
"launchMode": "default" "launchMode": "default"
}, },
{ {
"name": "packages/user/", "name": "完善注册信息",
"pathName": "packages/community/oneRepair/index", "pathName": "packages/user/replenishInfo/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",
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null