新增签名。

This commit is contained in:
张凯 2025-06-13 15:15:38 +08:00
parent 5844d45e65
commit b147206385
4 changed files with 88 additions and 23 deletions

View File

@ -17,13 +17,24 @@
<view class="left"> <view class="left">
昵称设置 昵称设置
</view> </view>
<view class="right" @click="toName"> <view class="right" @click="toName('nc')">
<!-- <u--input color="#000000" v-model="niName" placeholder="请输入昵称" disabled border="none" <!-- <u--input color="#000000" v-model="niName" placeholder="请输入昵称" disabled border="none"
inputAlign="right"></u--input> --> inputAlign="right"></u--input> -->
<text>{{niName}}</text> <text>{{niName}}</text>
<u-icon name="arrow-right"></u-icon> <u-icon name="arrow-right"></u-icon>
</view> </view>
</view> </view>
<view class="list-item">
<view class="left">
签名
</view>
<view class="right" @click="toName('qm')">
<!-- <u--input color="#000000" v-model="niName" placeholder="请输入昵称" disabled border="none"
inputAlign="right"></u--input> -->
<text>{{signature}}</text>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
<view class="list-item" @click="openUrl('/packageB/wallet/add_bank')"> <view class="list-item" @click="openUrl('/packageB/wallet/add_bank')">
<view class="left"> <view class="left">
银行卡 银行卡
@ -159,7 +170,10 @@
border: 'none', border: 'none',
fontFamily: "YouSheBiaoTiHei" fontFamily: "YouSheBiaoTiHei"
}, },
//
niName: '', niName: '',
//
signature: '带着热爱,在搭子圈里撒野~',
realname: '', realname: '',
gender: '', gender: '',
// ages: '', // ages: '',
@ -228,6 +242,7 @@
} }
}, },
onLoad(options) { onLoad(options) {
debugger
if (options) { if (options) {
this.typeop = options.type; this.typeop = options.type;
} }
@ -236,7 +251,8 @@
this.niName = userInfo.nickname this.niName = userInfo.nickname
this.realname = userInfo.username this.realname = userInfo.username
this.avatar = userInfo.avatar this.avatar = userInfo.avatar
this.$refs.datetimePicker.setFormatter(this.formatter) this.signature = userInfo.bio != '' ? userInfo.bio : '带着热爱,在搭子圈里撒野~'
// this.$refs.datetimePicker.setFormatter(this.formatter)
// this.handelData() // this.handelData()
// this.getDetail() // this.getDetail()
}, },
@ -259,9 +275,10 @@
url: '/packageB/card/index' url: '/packageB/card/index'
}) })
}, },
toName(){ toName(e){
debugger;
uni.navigateTo({ uni.navigateTo({
url: '/packageB/names/index' url: '/packageB/names/index?type='+ e
}) })
}, },
getSfInfo() { getSfInfo() {

View File

@ -1,12 +1,23 @@
<template> <template>
<view class="page"> <view class="page">
<view style="padding:30rpx;"> <view class="nav">
<u-navbar :is-back="true" leftIconColor="#000000" :autoBack="true" :bgColor="'#ffffff'" :title="title"
></u-navbar>
</view>
<view style="padding:30rpx;margin-top: 180rpx;" v-if="istype">
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<view style="width: 100%;"> <view style="width: 100%;">
<input placeholder-class="plasty" placeholder="输入您的昵称" class="input" v-model="form.nickname" /> <input placeholder-class="plasty" placeholder="输入您的昵称" class="input" v-model="form.nickname" />
</view> </view>
</view> </view>
</view> </view>
<view style="padding:30rpx;margin-top: 180rpx;" v-else>
<view style="display: flex;align-items: center;">
<view style="width: 100%;">
<input placeholder-class="plasty" placeholder="输入您的签名" class="input" v-model="form.bio" />
</view>
</view>
</view>
<view class="btn_1" @click="save()">保存</view> <view class="btn_1" @click="save()">保存</view>
</view> </view>
</template> </template>
@ -15,17 +26,30 @@
export default { export default {
data() { data() {
return { return {
istype:false,
title:"",
form: { form: {
nickname: '', nickname: '',
bio: ''
}, },
} }
}, },
onLoad() { onLoad(options) {
if (options.type == 'nc') {
this.istype = true;
this.title = '修改昵称'
this.form.nickname = uni.getStorageSync('userInfo').nickname; this.form.nickname = uni.getStorageSync('userInfo').nickname;
}else{
this.istype = false;
this.title = '修改签名'
this.form.bio = uni.getStorageSync('userInfo').bio;
}
}, },
methods: { methods: {
save() { save() {
if (this.istype) {
if (this.form.nickname == '') { if (this.form.nickname == '') {
uni.showToast({ uni.showToast({
title: '请输入昵称', title: '请输入昵称',
@ -34,11 +58,25 @@ export default {
}); });
return; return;
} }
}else{
if (this.form.bio == '') {
uni.showToast({
title: '请输入签名',
icon: "none",
duration: 1500,
});
return;
}
}
let nickname = this.form.nickname; let nickname = this.form.nickname;
let bio = this.form.bio;
uni.$u.http uni.$u.http
.post("/api/user/profile", { .post("/api/user/profile", {
nickname: nickname, nickname: nickname,
update_fields: ['nickname'] bio: bio,
update_fields: ['nickname','bio']
}) })
.then((res) => { .then((res) => {
console.log(res); console.log(res);
@ -53,11 +91,18 @@ export default {
}, 1500); }, 1500);
} }
}); });
if (this.istype) {
uni.setStorageSync('userInfo', { uni.setStorageSync('userInfo', {
...uni.getStorageSync('userInfo'), ...uni.getStorageSync('userInfo'),
nickname: nickname nickname: nickname
}); });
uni.setStorageSync('niName', nickname); uni.setStorageSync('niName', nickname);
}else{
uni.setStorageSync('userInfo', {
...uni.getStorageSync('userInfo'),
bio: bio
});
}
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,

View File

@ -314,7 +314,8 @@
{ {
"path": "names/index", "path": "names/index",
"style": { "style": {
"navigationBarTitleText": "昵称修改" "navigationBarTitleText": "",
"navigationStyle": "custom"
} }
},{ },{
"path": "wallet/index", "path": "wallet/index",

View File

@ -12,11 +12,11 @@
style="display: flex;align-items: center;;margin-bottom: 20rpx;font-weight: 800;font-size: 34rpx;color: #181818;"> style="display: flex;align-items: center;;margin-bottom: 20rpx;font-weight: 800;font-size: 34rpx;color: #181818;">
<view>{{ userName }}</view> <view>{{ userName }}</view>
<view style="padding-left: 20rpx; height: 35rpx;"> <view style="padding-left: 20rpx; height: 35rpx;">
<image v-if="shop_auth_info.auth_status==1" src="/static/my/owenr.png" mode="" style="width: 35rpx; height: 35rpx;"> <image v-if="shop_auth_info.auth_status == 1" src="/static/my/owenr.png" mode="" style="width: 35rpx; height: 35rpx;">
</image> </image>
</view> </view>
</view> </view>
<view style="color: #909090; font-size: 24rpx;">带着热爱在搭子圈里撒野~</view> <view style="color: #909090; font-size: 24rpx;">{{ bio || '带着热爱,在搭子圈里撒野~'}}</view>
</view> </view>
<image src="../../static/shezhi.png" mode="" <image src="../../static/shezhi.png" mode=""
style="width: 50rpx; height: 50rpx;position: absolute;right: 0;" @click="clickTop"> style="width: 50rpx; height: 50rpx;position: absolute;right: 0;" @click="clickTop">
@ -195,6 +195,7 @@
hotList: [], hotList: [],
showPopup: false, showPopup: false,
userName: '请登录', userName: '请登录',
bio:'',
actives: 0, actives: 0,
pushActives: 0, pushActives: 0,
show: false, show: false,
@ -753,6 +754,7 @@
this.showPopup = false this.showPopup = false
this.userName = res.data.user_info.nickname; this.userName = res.data.user_info.nickname;
this.bio = res.data.user_info.bio;
this.avatar = res.data.user_info.avatar; this.avatar = res.data.user_info.avatar;
this.actives = res.data.activity_info.join_num; this.actives = res.data.activity_info.join_num;
this.pushActives = res.data.activity_info.release_num; this.pushActives = res.data.activity_info.release_num;