2025-03-14 16:55:12 +08:00
|
|
|
<template>
|
|
|
|
|
<view>
|
2025-03-19 20:56:57 +08:00
|
|
|
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" :title="$t('navbar.persondata')"></uni-nav-bar>
|
2025-03-14 16:55:12 +08:00
|
|
|
<view class="content">
|
2025-03-14 17:32:45 +08:00
|
|
|
<view class="topimg">
|
2025-03-22 16:35:45 +08:00
|
|
|
<uni-file-picker fileMediatype="image" limit="1" :list-styles="imageStyles" :del-icon="false" disable-preview @select="select" @delete="delfn('picture')">
|
2025-03-24 11:13:13 +08:00
|
|
|
<image class="user" :src="userinfo.avatar"mode=""></image>
|
2025-03-22 16:35:45 +08:00
|
|
|
<!-- <image class="xj" src="/static/image/mine/xiangji.png" mode=""></image> -->
|
|
|
|
|
</uni-file-picker>
|
|
|
|
|
<view>{{$t('mine.changeavatar')}}</view>
|
2025-03-14 17:32:45 +08:00
|
|
|
</view>
|
|
|
|
|
<view class="cell1">
|
2025-03-20 17:35:53 +08:00
|
|
|
<view class="item">{{$t('gender')}}</view>
|
2025-03-14 16:55:12 +08:00
|
|
|
<view class="right">
|
2025-03-22 16:35:45 +08:00
|
|
|
<u-radio-group v-model="userinfo.sex">
|
|
|
|
|
<u-radio :name="Number(1)" class="m-r-10">{{$t('gender1')}}</u-radio>
|
|
|
|
|
<u-radio :name="Number(2)">{{$t('gender2')}}</u-radio>
|
2025-03-14 17:32:45 +08:00
|
|
|
</u-radio-group>
|
2025-03-14 16:55:12 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
2025-03-14 17:32:45 +08:00
|
|
|
<u-divider text=""></u-divider>
|
2025-03-14 16:55:12 +08:00
|
|
|
<view class="cell1">
|
2025-03-20 17:35:53 +08:00
|
|
|
<view class="item">{{$t('mine.nickname')}}</view>
|
2025-03-14 17:32:45 +08:00
|
|
|
<view class="right">
|
2025-03-22 16:35:45 +08:00
|
|
|
<input :placeholder="$t('mine.nicknameinputhd')" v-model="userinfo.name"></input>
|
2025-03-14 16:55:12 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
2025-03-14 17:32:45 +08:00
|
|
|
<u-divider text=""></u-divider>
|
2025-03-14 16:55:12 +08:00
|
|
|
<view class="cell1">
|
2025-03-20 17:35:53 +08:00
|
|
|
<view class="item">{{$t('mine.lxcall')}}</view>
|
2025-03-14 17:32:45 +08:00
|
|
|
<view class="right">
|
2025-03-22 16:35:45 +08:00
|
|
|
<input :placeholder="$t('mine.lxcallinputhd')" type="number" v-model="userinfo.mobile"></input>
|
2025-03-14 16:55:12 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
2025-03-14 17:32:45 +08:00
|
|
|
<u-divider text=""></u-divider>
|
2025-03-14 16:55:12 +08:00
|
|
|
<view class="cell1">
|
2025-03-22 16:35:45 +08:00
|
|
|
<view class="item">{{$t('mine.position')}}</view>
|
|
|
|
|
<view class="right">
|
|
|
|
|
<input :placeholder="$t('mine.positioninput')" type="text" v-model="userinfo.position"></input>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- <view class="cell1">
|
2025-03-20 17:35:53 +08:00
|
|
|
<view class="item">{{$t('Region')}}</view>
|
2025-03-14 16:55:12 +08:00
|
|
|
<view class="right select">
|
2025-03-15 17:27:14 +08:00
|
|
|
<input :placeholder="$t('Regioninputhd')" v-model="userinfo.company"></input>
|
2025-03-14 17:32:45 +08:00
|
|
|
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
|
2025-03-14 16:55:12 +08:00
|
|
|
</view>
|
2025-03-22 16:35:45 +08:00
|
|
|
</view> -->
|
|
|
|
|
<view class="cell1">
|
|
|
|
|
<view class="item">{{$t('customer.Company')}}</view>
|
|
|
|
|
<view class="right select" @click="showcomp = true">
|
|
|
|
|
<view class="" :class="['content2', { placeholder: !company_name }]">{{company_name || $t('inputnl')}}</view>
|
|
|
|
|
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<u-divider text=""></u-divider>
|
|
|
|
|
<view class="cell1">
|
|
|
|
|
<view class="item">{{$t('customer.Country')}}</view>
|
2025-03-28 14:46:49 +08:00
|
|
|
<view class="right select" @click="showPicker = true">
|
2025-03-22 16:35:45 +08:00
|
|
|
<view class="" :class="['content2', { placeholder: !country_name }]">{{country_name || $t('customer.Countryinput')}}</view>
|
|
|
|
|
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
|
|
|
|
|
</view>
|
2025-03-14 16:55:12 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="foot">
|
2025-03-19 21:57:16 +08:00
|
|
|
<button class="btn" @click="bcFn">{{$t('save')}}</button>
|
2025-03-14 16:55:12 +08:00
|
|
|
</view>
|
2025-03-22 16:35:45 +08:00
|
|
|
<u-picker closeOnClickOverlay :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :defaultIndex="defaultIndexgs" :show="showcomp" @cancel="cancel('showcomp')" @close="close('showcomp')" :columns="company" keyName="name" @confirm="companyChange"></u-picker>
|
|
|
|
|
|
2025-03-28 14:46:49 +08:00
|
|
|
<u-popup closeOnClickOverlay :show="showPicker" mode="bottom" :round="10" @close="close('showPicker')">
|
|
|
|
|
<view class="text">
|
|
|
|
|
<view class="qx" @click="close('showPicker') ">{{$t('cancel')}}</view>
|
|
|
|
|
<view class="qd" @click="arerfn">{{$t('confirm')}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="popup-content">
|
|
|
|
|
<!-- 搜索框 -->
|
|
|
|
|
<u-input
|
|
|
|
|
v-model="searchKeyword"
|
|
|
|
|
:placeholder="$t('keyword')"
|
|
|
|
|
@input="handleSearch"
|
|
|
|
|
></u-input>
|
|
|
|
|
|
|
|
|
|
<!-- 选项列表 -->
|
|
|
|
|
<scroll-view scroll-y class="option-list">
|
|
|
|
|
<view
|
|
|
|
|
v-for="(item, index) in filteredOptions"
|
|
|
|
|
:key="index"
|
|
|
|
|
class="option-item"
|
|
|
|
|
@click="handleSelect(item)"
|
|
|
|
|
:class="actives==item.id?'actives':''"
|
|
|
|
|
>
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="filteredOptions.length === 0" class="no-data">
|
|
|
|
|
{{$t('noresults')}}
|
|
|
|
|
</view>
|
|
|
|
|
</scroll-view>
|
|
|
|
|
</view>
|
|
|
|
|
</u-popup>
|
2025-03-14 16:55:12 +08:00
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
2025-03-28 14:46:49 +08:00
|
|
|
import { nextTick } from "vue"
|
2025-03-14 16:55:12 +08:00
|
|
|
import { request,showToast } from '@/api/apiT.js'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2025-03-28 14:46:49 +08:00
|
|
|
loca:uni.getLocale(),
|
|
|
|
|
actives:'',
|
|
|
|
|
showPicker: false, // 控制选择器显示
|
|
|
|
|
searchKeyword: "", // 搜索关键词
|
|
|
|
|
selectedLabel: "", // 选中的值(显示在输入框中)
|
|
|
|
|
filteredOptions: [], // 过滤后的数据
|
2025-03-22 16:35:45 +08:00
|
|
|
showarea: false,
|
|
|
|
|
showcomp: false,
|
|
|
|
|
country_name:'',
|
|
|
|
|
areaList1:[],
|
|
|
|
|
areaList:[],
|
|
|
|
|
defaultIndexgj:[0],
|
|
|
|
|
company_name:'',
|
|
|
|
|
defaultIndexgs:[0],
|
2025-03-14 16:55:12 +08:00
|
|
|
imageStyles: {
|
2025-03-22 16:35:45 +08:00
|
|
|
border: true,
|
2025-03-14 16:55:12 +08:00
|
|
|
},
|
2025-03-22 16:35:45 +08:00
|
|
|
userinfo:{},
|
2025-03-14 16:55:12 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
2025-03-22 16:35:45 +08:00
|
|
|
this.area()
|
|
|
|
|
this.companyfn()
|
2025-03-14 16:55:12 +08:00
|
|
|
this.getinfo()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2025-03-28 14:46:49 +08:00
|
|
|
// 搜索处理函数
|
|
|
|
|
handleSearch() {
|
|
|
|
|
var that = this
|
|
|
|
|
if (this.searchKeyword) {
|
|
|
|
|
console.log(this.searchKeyword)
|
|
|
|
|
this.filteredOptions = this.areaList1.filter((item) => item.name.includes(this.searchKeyword));
|
|
|
|
|
|
|
|
|
|
console.log(this.filteredOptions)
|
|
|
|
|
} else {
|
|
|
|
|
// 如果搜索框为空,显示全部数据
|
|
|
|
|
this.filteredOptions = this.areaList1;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 选择选项
|
|
|
|
|
handleSelect(item) {
|
|
|
|
|
this.selectedLabel = item.name; // 回显选中的值
|
|
|
|
|
// this.searchKeyword = item.name
|
|
|
|
|
this.actives = item.id
|
|
|
|
|
// this.showPicker = false; // 关闭弹窗
|
|
|
|
|
console.log("选中的值:", item.id);
|
|
|
|
|
console.log("选中的值:", item.name);
|
|
|
|
|
},
|
|
|
|
|
arerfn(){
|
|
|
|
|
this.showPicker = false; // 关闭弹窗
|
|
|
|
|
this.country_name = this.selectedLabel
|
|
|
|
|
this.userinfo.country_id = this.actives
|
|
|
|
|
|
|
|
|
|
},
|
2025-03-14 16:55:12 +08:00
|
|
|
getinfo(){
|
|
|
|
|
var that= this;
|
|
|
|
|
request({
|
2025-03-22 16:35:45 +08:00
|
|
|
url:'user/getInfo',
|
|
|
|
|
method:'get',
|
|
|
|
|
}).then(res => {
|
2025-03-24 11:13:13 +08:00
|
|
|
if(res.data.data.position=='null'){
|
|
|
|
|
res.data.data.position=''
|
|
|
|
|
}
|
2025-03-22 16:35:45 +08:00
|
|
|
that.userinfo = res.data.data;
|
2025-03-28 14:46:49 +08:00
|
|
|
this.actives = res.data.data.country_id
|
|
|
|
|
this.country_name = res.data.data.country_name
|
2025-03-22 16:35:45 +08:00
|
|
|
that.select1()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
select1(){
|
|
|
|
|
var that=this;
|
|
|
|
|
that.company1.forEach((item,index) => {
|
|
|
|
|
if(item.id == that.userinfo.sign){
|
|
|
|
|
that.company_name = item.name
|
|
|
|
|
that.defaultIndexgs=[index]
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//国家
|
|
|
|
|
area(){
|
|
|
|
|
request({
|
|
|
|
|
url:'area/getCountry',
|
|
|
|
|
method:'get',
|
2025-03-14 16:55:12 +08:00
|
|
|
}).then(res => {
|
2025-03-22 16:35:45 +08:00
|
|
|
var list = res.data.data
|
|
|
|
|
this.areaList1 = list
|
2025-03-28 14:46:49 +08:00
|
|
|
this.filteredOptions = list;
|
2025-03-22 16:35:45 +08:00
|
|
|
this.select1()
|
2025-03-14 16:55:12 +08:00
|
|
|
})
|
|
|
|
|
},
|
2025-03-22 16:35:45 +08:00
|
|
|
//公司
|
|
|
|
|
companyfn(){
|
|
|
|
|
request({
|
|
|
|
|
url:'feishu/getSign',
|
|
|
|
|
method:'get',
|
|
|
|
|
}).then(res => {
|
|
|
|
|
var list = res.data.data
|
|
|
|
|
this.company1 = list
|
|
|
|
|
this.company = [list]
|
|
|
|
|
this.select1()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
companyChange(val){
|
|
|
|
|
this.userinfo.sign = val.value[0].id
|
|
|
|
|
this.company_name = val.value[0].name
|
|
|
|
|
this.showcomp = false
|
|
|
|
|
},
|
2025-03-14 16:55:12 +08:00
|
|
|
uploadfn(imgUrl){
|
|
|
|
|
var that = this;
|
|
|
|
|
uni.uploadFile({
|
2025-03-22 16:35:45 +08:00
|
|
|
url: 'http://219.157.255.213:9007/upload/uploadImage',
|
2025-03-14 16:55:12 +08:00
|
|
|
filePath: imgUrl,
|
2025-03-22 17:32:44 +08:00
|
|
|
name: 'files',
|
2025-03-24 11:13:13 +08:00
|
|
|
header:{'Authorization': 'Bearer ' + uni.getStorageSync('token')},
|
2025-03-14 16:55:12 +08:00
|
|
|
success: (uploadFileRes) => {
|
|
|
|
|
const path=JSON.parse(uploadFileRes.data)
|
2025-03-22 17:32:44 +08:00
|
|
|
if(path.code==-1){
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: path.message,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
});
|
|
|
|
|
}else{
|
2025-03-23 01:15:13 +08:00
|
|
|
that.userinfo.avatar = path.data.image_url
|
|
|
|
|
that.userinfo.avatar_url = path.data.path
|
2025-03-22 17:32:44 +08:00
|
|
|
console.log(that.form)
|
|
|
|
|
}
|
2025-03-14 16:55:12 +08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2025-03-22 16:35:45 +08:00
|
|
|
cancel(val){
|
|
|
|
|
this[val] = false
|
|
|
|
|
},
|
|
|
|
|
close(val){
|
|
|
|
|
this[val] = false
|
|
|
|
|
},
|
2025-03-14 16:55:12 +08:00
|
|
|
delfn(){
|
|
|
|
|
that.userinfo.avatar =''
|
|
|
|
|
},
|
|
|
|
|
select(e){
|
|
|
|
|
const tempFilePaths = e.tempFilePaths;
|
|
|
|
|
const imgUrl=tempFilePaths[0]
|
|
|
|
|
this.uploadfn(imgUrl)
|
|
|
|
|
},
|
|
|
|
|
leftClick(){
|
|
|
|
|
uni.navigateBack({})
|
|
|
|
|
},
|
|
|
|
|
bcFn(){
|
2025-03-23 01:15:13 +08:00
|
|
|
console.log(this.userinfo)
|
2025-03-14 16:55:12 +08:00
|
|
|
request({
|
2025-03-22 16:35:45 +08:00
|
|
|
url:'user/save',
|
2025-03-14 16:55:12 +08:00
|
|
|
method:'POST',
|
|
|
|
|
data:{
|
|
|
|
|
avatar:this.userinfo.avatar,
|
2025-03-23 01:15:13 +08:00
|
|
|
avatar_url:this.userinfo.avatar_url,
|
2025-03-22 16:35:45 +08:00
|
|
|
sex:this.userinfo.sex,
|
|
|
|
|
name:this.userinfo.name,
|
|
|
|
|
mobile:this.userinfo.mobile,
|
|
|
|
|
position:this.userinfo.position,
|
|
|
|
|
country_id:this.userinfo.country_id,
|
|
|
|
|
sign:this.userinfo.sign,
|
2025-03-14 16:55:12 +08:00
|
|
|
}
|
|
|
|
|
}).then(res => {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.data.message,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
});
|
|
|
|
|
if(res.data.code ==0){
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.reLaunch({
|
|
|
|
|
url: '/pages/index/mine',// 替换为你要跳转的页面路径
|
|
|
|
|
});
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2025-03-14 17:32:45 +08:00
|
|
|
<style lang="scss">
|
2025-03-22 16:35:45 +08:00
|
|
|
.uni-file-picker {
|
|
|
|
|
margin-left: 33.3%;
|
|
|
|
|
}
|
2025-03-20 17:35:53 +08:00
|
|
|
.m-r-10{
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
}
|
2025-03-14 16:55:12 +08:00
|
|
|
.uniui-right{
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 2px;
|
|
|
|
|
}
|
2025-03-14 17:32:45 +08:00
|
|
|
.u-divider{
|
|
|
|
|
margin: 0px 0px !important;
|
|
|
|
|
}
|
|
|
|
|
.arrowright{
|
|
|
|
|
margin-right: -15px;
|
|
|
|
|
}
|
2025-03-14 16:55:12 +08:00
|
|
|
.content{
|
|
|
|
|
background: #FFFFFF;
|
2025-03-14 17:32:45 +08:00
|
|
|
.topimg{
|
|
|
|
|
text-align: center;
|
|
|
|
|
position: relative;
|
|
|
|
|
padding: 20px 0px;
|
|
|
|
|
color: #999999;
|
|
|
|
|
}
|
|
|
|
|
.user{
|
|
|
|
|
width: 200rpx;
|
|
|
|
|
height: 200rpx;
|
|
|
|
|
}
|
|
|
|
|
.xj{
|
|
|
|
|
width: 60rpx;
|
|
|
|
|
height: 52rpx;
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 46%;
|
|
|
|
|
top: 33%;
|
|
|
|
|
}
|
2025-03-14 16:55:12 +08:00
|
|
|
}
|
|
|
|
|
.cell1{
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content:space-between;
|
|
|
|
|
padding: 18px 20px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
font-weight: 500;
|
2025-03-20 17:35:53 +08:00
|
|
|
.item{
|
|
|
|
|
width: 90px;
|
|
|
|
|
}
|
2025-03-14 16:55:12 +08:00
|
|
|
}
|
|
|
|
|
.right{
|
|
|
|
|
text-align: right;
|
|
|
|
|
}
|
|
|
|
|
.select{
|
|
|
|
|
display: flex;
|
|
|
|
|
position: relative;
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
}
|
|
|
|
|
.foot{
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0px;
|
|
|
|
|
width: 100%;
|
2025-03-14 17:32:45 +08:00
|
|
|
height: 160rpx;
|
2025-03-14 16:55:12 +08:00
|
|
|
background: #FFFFFF;
|
|
|
|
|
}
|
|
|
|
|
.btn{
|
2025-03-14 17:32:45 +08:00
|
|
|
background: linear-gradient(to right, #3471FF, #6776FF);
|
2025-03-14 16:55:12 +08:00
|
|
|
color: white;
|
|
|
|
|
border-radius: 50px;
|
|
|
|
|
width: 84%;
|
|
|
|
|
margin: 20px 8%;
|
|
|
|
|
}
|
|
|
|
|
.addimg{
|
|
|
|
|
width: 35px;
|
|
|
|
|
height: 35px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
}
|
2025-03-28 14:46:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
.actives{
|
|
|
|
|
background-color: #dfdfdf;
|
|
|
|
|
}
|
|
|
|
|
.text{
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
padding: 10px 15px 0px;
|
|
|
|
|
.qd{
|
|
|
|
|
color: #3471FF;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.popup-content {
|
|
|
|
|
padding: 20px;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.option-list {
|
|
|
|
|
max-height: 400rpx;
|
|
|
|
|
margin-top: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.option-item {
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
border-bottom: 1rpx solid #eee;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.option-item:last-child {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.no-data {
|
|
|
|
|
text-align: center;
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
2025-03-14 16:55:12 +08:00
|
|
|
</style>
|