172 lines
4.3 KiB
Vue
172 lines
4.3 KiB
Vue
|
<template style="position: relative;">
|
||
|
<!-- 顶部导航栏 -->
|
||
|
<up-navbar leftText="" title="" :placeholder="true" :safeAreaInsetTop="true" :bgColor="bgColor"
|
||
|
@leftClick="leftClick">
|
||
|
<template #center>
|
||
|
<div class="navbarcenter">
|
||
|
<span v-if="type == '1'">修改昵称</span>
|
||
|
<span v-else>编辑个人简介</span>
|
||
|
</div>
|
||
|
</template>
|
||
|
</up-navbar>
|
||
|
<view v-if="type == '1'" class="nickname1">
|
||
|
<up-input type="text" v-model="ninfo" placeholder="昵称"
|
||
|
placeholderStyle="font-size: 30rpx;text-align: left;color: #999999 100%;" color="#333333" border="none"
|
||
|
fontSize="30rpx" inputAlign="left">
|
||
|
</up-input>
|
||
|
</view>
|
||
|
<view v-if="type == '2'" class="nickname2">
|
||
|
<up-textarea type="text" v-model="ninfo" placeholder="介绍一下自己吧,让大家更好的认识你!" height="252rpx"
|
||
|
placeholderStyle="font-size: 30rpx;text-align: left;color: #999999 100%; padding:0" color="#333333" border="none"
|
||
|
fontSize="30rpx" inputAlign="left">
|
||
|
</up-textarea>
|
||
|
</view>
|
||
|
<view class="btn" @click="upInfo()">
|
||
|
<view class="text1">确认</view>
|
||
|
</view>
|
||
|
|
||
|
</template>
|
||
|
|
||
|
<script setup>
|
||
|
import {updateUserinfo} from "@/api/system/userinfo"
|
||
|
import {updateUserProfile} from "@/api/system/user"
|
||
|
import avatarInfo from "@/pages/common/avatar/index"
|
||
|
import { useStore } from 'vuex'
|
||
|
import { getUserInfo } from "@/api/login";
|
||
|
import { useRouter } from 'vue-router'
|
||
|
import { ref, getCurrentInstance } from 'vue';
|
||
|
import { getDicts } from "@/api/system/dict/data";
|
||
|
import { onShow, onLoad } from '@dcloudio/uni-app'
|
||
|
import image from 'uview-plus/libs/config/props/image';
|
||
|
const { proxy } = getCurrentInstance();
|
||
|
const bgColor = ref('#ffffff')
|
||
|
const ninfo = ref('')
|
||
|
const QNDomain = proxy.$store.state.user.QNDomain
|
||
|
const iconConfig = proxy.iconConfig;
|
||
|
const xsz1 = iconConfig.xsz1;
|
||
|
const nickName = ref(proxy.$store.state.user.nickName)
|
||
|
const remark = ref(proxy.$store.state.userInfo.remark)//签名
|
||
|
const type = ref();
|
||
|
const form1 = ref({
|
||
|
userId: null,
|
||
|
doingsStatus: null,
|
||
|
newUser: null,
|
||
|
birthday: null,
|
||
|
infoName: null,
|
||
|
infoSchool: null,
|
||
|
infoDepartment: null,
|
||
|
infoGrade: null,
|
||
|
infoCode: null,
|
||
|
infoDocument: null,
|
||
|
codeDocument: null,
|
||
|
codeInfo: null,
|
||
|
backgroundImage: null,
|
||
|
auditInfo: null,
|
||
|
auditTime: null,
|
||
|
auditUserId: null,
|
||
|
area: null,
|
||
|
infoRank: null,
|
||
|
infoCoin: null,
|
||
|
infoActive: null,
|
||
|
infoAssist: null,
|
||
|
followCount: null,
|
||
|
fanCount: null,
|
||
|
createBy: null,
|
||
|
createTime: null,
|
||
|
updateBy: null,
|
||
|
updateTime: null,
|
||
|
remark: null
|
||
|
})
|
||
|
const form2 = ref({
|
||
|
|
||
|
nickName: undefined,
|
||
|
sex: undefined,
|
||
|
})
|
||
|
onLoad((options) => {
|
||
|
type.value = options.type;
|
||
|
console.log(options.type);
|
||
|
})
|
||
|
const leftClick = () => {
|
||
|
proxy.$tab.navigateBack(1);
|
||
|
};
|
||
|
const upInfo = () => {
|
||
|
if(ninfo.value == ''){
|
||
|
proxy.$modal.msgError('信息不能为空');
|
||
|
}else{
|
||
|
proxy.$modal.loading('正在提交数据,请稍候...');
|
||
|
upInfo2();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
const upInfo2 = ()=>{
|
||
|
if(type.value == 1){
|
||
|
form2.value.nickName = ninfo.value;
|
||
|
updateUserProfile(form2.value).then( e => {
|
||
|
|
||
|
proxy.$modal.closeLoading();
|
||
|
proxy.$modal.msgSuccess("修改成功");
|
||
|
proxy.$store.commit("SET_NICKNAME",ninfo.value)
|
||
|
proxy.$tab.navigateBack(1);
|
||
|
})
|
||
|
|
||
|
}else if(type.value == 2){
|
||
|
|
||
|
form1.value.remark = ninfo.value
|
||
|
updateUserinfo(form1.value).then( e => {
|
||
|
proxy.$modal.closeLoading();
|
||
|
proxy.$modal.msgSuccess("修改成功");
|
||
|
proxy.$store.commit("SET_remark",ninfo.value)
|
||
|
proxy.$tab.navigateBack(1);
|
||
|
})
|
||
|
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
page {
|
||
|
background-color: #F4F5F6;
|
||
|
}
|
||
|
|
||
|
.navbarcenter {
|
||
|
font-weight: 600;
|
||
|
font-size: 36rpx;
|
||
|
text-align: left;
|
||
|
color: #000000 !important;
|
||
|
}
|
||
|
|
||
|
.nickname1 {
|
||
|
padding-left: 33rpx;
|
||
|
margin-top: 24rpx;
|
||
|
width: 750rpx;
|
||
|
height: 112rpx;
|
||
|
background-color: #ffffff;
|
||
|
display: flex;
|
||
|
justify-content: center;
|
||
|
align-items: center;
|
||
|
}
|
||
|
.nickname2{
|
||
|
padding-left: 10rpx;
|
||
|
margin-top: 24rpx;
|
||
|
width: 750rpx;
|
||
|
height: 300rpx;
|
||
|
background-color: #ffffff;
|
||
|
|
||
|
}
|
||
|
|
||
|
.btn {
|
||
|
width: 686rpx;
|
||
|
height: 88rpx;
|
||
|
border-radius: 44rpx 44rpx 44rpx 44rpx;
|
||
|
background: #7945a7;
|
||
|
display: flex;
|
||
|
justify-content: center;
|
||
|
align-items: center;
|
||
|
margin: 48rpx auto;
|
||
|
.text1 {
|
||
|
font-weight: 400;
|
||
|
font-size: 32rpx;
|
||
|
color: #FFFFFF !important;
|
||
|
}
|
||
|
}
|
||
|
</style>
|