This commit is contained in:
zw199166
2026-01-23 17:20:44 +08:00
parent 9f1fd3ffe0
commit 30d2ec5823
493 changed files with 45879 additions and 10 deletions

View File

@@ -0,0 +1,186 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const request_api = require("../../../request/api.js");
require("../../../request/http.js");
const common_assets = require("../../../common/assets.js");
const _sfc_main = {
data() {
return {
avatarTop: "",
contentTop: "",
avatar: "",
//选择头像临时地址
avatarUrl: "",
//已上传的链接
nickname: "",
//昵称
mobile: "",
//手机号
sexList: ["男", "女"],
sex: "",
profile: ""
//个人简介
};
},
onLoad() {
this.avatarTop = common_vendor.inject("navHeight") + 60 / 750 * common_vendor.inject("windowWidth");
this.contentTop = this.avatarTop + 75 / 750 * common_vendor.inject("windowWidth");
this.getUserInfoData();
},
methods: {
/**
* 点击选择头像
* @param {Object} e
*/
chooseAvatar(e) {
common_vendor.index.__f__("log", "at pages/mine/basicInfo/basicInfo.vue:71", e);
this.avatar = e.detail.avatarUrl;
},
/**
* 点击选择性别
* @param {Object} e
*/
sexChange(e) {
common_vendor.index.__f__("log", "at pages/mine/basicInfo/basicInfo.vue:80", e);
let value = e.detail.value;
this.sex = this.sexList[value];
},
/**
* 获取手机号
* @param {Object} e
*/
getPhoneNumData(e) {
common_vendor.index.__f__("log", "at pages/mine/basicInfo/basicInfo.vue:90", e);
if (e.detail.errMsg == "getPhoneNumber:ok") {
let param = { code: e.detail.code };
request_api.wxBindPhone(param).then((res) => {
if (res.code == 200) {
common_vendor.index.showToast({
title: res.message
});
this.mobile = res.data.phone;
} else
common_vendor.index.showToast({
title: res.message,
icon: "none"
});
}).catch((error) => {
});
}
},
/**
* 点击完成或下一步
*/
clickFinishOrNext(type) {
if (!this.avatar && !this.avatarUrl) {
common_vendor.index.showToast({
title: "请选择头像",
icon: "none"
});
return;
}
if (!this.nickname) {
common_vendor.index.showToast({
title: "请输入昵称",
icon: "none"
});
return;
}
if (!this.sex) {
common_vendor.index.showToast({
title: "请选择性别",
icon: "none"
});
return;
}
if (this.avatar) {
let param = {
avatar: this.avatar,
nickname: this.nickname,
gender: this.sex == "男" ? "male" : "female",
phone: this.mobile,
bio: this.profile,
isFile: 1
};
request_api.updateBasicInfo(param).then((res) => {
if (type == 1) {
common_vendor.index.navigateTo({
url: "/pages/mine/investPreference/investPreference"
});
} else
common_vendor.index.navigateBack();
}).catch((error) => {
});
} else {
let param = {
nickname: this.nickname,
gender: this.sex == "男" ? "male" : "female",
phone: this.mobile,
bio: this.profile
};
request_api.updateBasicInfo(param).then((res) => {
if (type == 1) {
common_vendor.index.navigateTo({
url: "/pages/mine/investPreference/investPreference"
});
} else
common_vendor.index.navigateBack();
}).catch((error) => {
});
}
},
/**
* 获取用户信息数据
*/
getUserInfoData() {
request_api.userInfo().then((res) => {
if (res.code == 200) {
this.avatarUrl = res.data.basic_info.avatar_url;
this.nickname = res.data.basic_info.nickname;
this.mobile = res.data.basic_info.phone;
this.sex = res.data.basic_info.gender == "male" ? "男" : "女";
this.profile = res.data.basic_info.bio;
} else
common_vendor.wx$1.showToast({
title: res.message,
icon: "none"
});
}).catch((error) => {
});
}
}
};
if (!Array) {
const _easycom_navBar2 = common_vendor.resolveComponent("navBar");
_easycom_navBar2();
}
const _easycom_navBar = () => "../../../components/navBar/navBar.js";
if (!Math) {
_easycom_navBar();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
leftText: "信息完善"
}),
b: common_assets._imports_0,
c: $data.avatar ? $data.avatar : $data.avatarUrl,
d: common_assets._imports_1$4,
e: common_vendor.o((...args) => $options.chooseAvatar && $options.chooseAvatar(...args)),
f: common_vendor.s("top:" + $data.avatarTop + "px;"),
g: $data.nickname,
h: common_vendor.o(($event) => $data.nickname = $event.detail.value),
i: common_vendor.t($data.mobile),
j: common_vendor.o((...args) => $options.getPhoneNumData && $options.getPhoneNumData(...args)),
k: common_vendor.t($data.sex),
l: common_assets._imports_2$6,
m: $data.sexList,
n: common_vendor.o((...args) => $options.sexChange && $options.sexChange(...args)),
o: common_vendor.s("top:" + $data.contentTop + "px;"),
p: common_vendor.o(($event) => $options.clickFinishOrNext(0)),
q: common_vendor.o(($event) => $options.clickFinishOrNext(1))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/mine/basicInfo/basicInfo.js.map

View File

@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "",
"usingComponents": {
"nav-bar": "../../../components/navBar/navBar"
}
}

View File

@@ -0,0 +1 @@
<view><nav-bar wx:if="{{a}}" u-i="0bdd913e-0" bind:__l="__l" u-p="{{a}}"></nav-bar><image class="topBg absolute" src="{{b}}" mode="widthFix"></image><view class="avatarC fixed" style="{{f}}"><image class="avatar" src="{{c}}" mode="aspectFill"></image><image class="icon absolute" src="{{d}}" mode="widthFix"></image><button class="absolute" open-type="chooseAvatar" bindchooseavatar="{{e}}"></button></view><view class="basicInfoC fixed" style="{{o}}"><view class="title">基本信息</view><view class="section">昵称</view><view class="inputC"><input type="nickname" value="{{g}}" bindinput="{{h}}"/></view><view class="section">手机号</view><view class="selectC flex relative">{{i}} <button class="absolute" open-type="getPhoneNumber" bindgetphonenumber="{{j}}"></button></view><view class="section">性别</view><picker mode="selector" range="{{m}}" bindchange="{{n}}"><view class="selectC flex"><view class="flex1">{{k}}</view><image class="arrow" src="{{l}}" mode="widthFix"></image></view></picker></view><view class="bottomC fixed flex"><view class="finish btn" bindtap="{{p}}">完成</view><view class="next btn flex1" bindtap="{{q}}">下一步</view></view></view>

View File

@@ -0,0 +1,119 @@
.topBg {
top: 0;
left: 0;
width: 100%;
height: auto;
}
.avatarC {
left: 0;
margin-left: calc((100% - 150rpx)/2);
width: 150rpx;
z-index: 10;
}
.avatarC .avatar {
width: 100%;
height: 150rpx;
border-radius: 50%;
border: solid 2rpx white;
}
.avatarC .icon {
right: 20rpx;
bottom: 0;
width: 40rpx;
height: auto;
}
.avatarC button {
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.basicInfoC {
background-color: white;
left: 0;
right: 0;
bottom: calc(73rpx + 17rpx + 80rpx);
border-radius: 20rpx 20rpx 0 0;
overflow-y: scroll;
}
.basicInfoC .title {
margin: 150rpx 0 0 60rpx;
font-size: 36rpx;
font-weight: bold;
}
.basicInfoC .section {
margin: 0 60rpx;
line-height: 66rpx;
font-size: 26rpx;
font-weight: bold;
}
.basicInfoC .inputC {
background-color: #FBFBFD;
margin: 0 60rpx;
padding: 0 28rpx;
height: 78rpx;
border: solid 2rpx #EFEFF2;
border-radius: 10rpx;
}
.basicInfoC .inputC input {
height: 100%;
font-size: 24rpx;
font-weight: 500;
color: #555;
}
.basicInfoC .selectC {
background-color: #FBFBFD;
margin: 0 60rpx;
padding: 0 25rpx 0 28rpx;
height: 78rpx;
border: solid 2rpx #EFEFF2;
border-radius: 10rpx;
font-size: 24rpx;
font-weight: 500;
color: #555;
}
.basicInfoC .selectC .arrow {
width: 16rpx;
height: auto;
}
.basicInfoC .selectC button {
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.basicInfoC .textareaC {
background-color: #FBFBFD;
margin: 0 60rpx;
padding: 20rpx 0 0 28rpx;
border: solid 2rpx #EFEFF2;
border-radius: 2rpx;
}
.basicInfoC .textareaC textarea {
height: 200rpx;
font-size: 24rpx;
font-weight: 500;
color: #555;
}
.bottomC {
left: 0;
right: 0;
bottom: 73rpx;
margin: 0 25rpx;
}
.bottomC .btn {
line-height: 80rpx;
border-radius: 20rpx;
font-size: 26rpx;
text-align: center;
}
.bottomC .finish {
background-color: #FFE9D9;
width: 226rpx;
color: #F97316;
}
.bottomC .next {
background-color: #F97316;
margin-left: 20rpx;
color: white;
}