<template>
|
<view class="container">
|
<view class="search-section">
|
<input class="search-input" type="text" v-model="companyName" placeholder="请输入公司名称" />
|
<button class="save-btn" @click="saveCompany">保存</button>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
components: {
|
},
|
data() {
|
return {
|
companyName: uni.getStorageSync('Address') || '',
|
userInfo: {},
|
};
|
},
|
onLoad() {
|
// 可以在这里调用获取用户信息的方法
|
this.getUserInfo();
|
},
|
methods: {
|
saveCompany() {
|
// 保存公司名称到本地存储
|
let data = {
|
Address: this.companyName,
|
LoginName: this.userInfo.LoginName,
|
Mail: this.userInfo.Mail,
|
Mobile: this.userInfo.Mobile,
|
QQ: this.userInfo.QQ,
|
RealName: this.userInfo.RealName,
|
Wechat: this.userInfo.Wechat,
|
id: this.userInfo.Id
|
}
|
this.$http.post('/user/UpdateAccountBasic', data).then(res => {
|
if (res.Check) {
|
// uni.showToast({
|
// title: '保存成功'
|
// });
|
this.$msg('保存成功');
|
}
|
});
|
|
},
|
async getUserInfo() {
|
let userInfoRes = await this.$http.post('/User/GetUserInfo', {
|
token: uni.getStorageSync('token'),
|
id: uni.getStorageSync('userId')
|
});
|
if (userInfoRes.Check) {
|
this.userInfo = userInfoRes.Data;
|
uni.setStorageSync('Address', this.userInfo.Address);
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
page {
|
background-color: #F7F7F7;
|
}
|
|
.search-section {
|
display: flex;
|
align-items: center;
|
padding: 20upx;
|
|
.search-input {
|
flex: 1;
|
height: 80upx;
|
padding: 0 20upx;
|
background-color: #fff;
|
border: 1px solid #ddd;
|
border-radius: 10upx;
|
margin-right: 20upx;
|
}
|
|
.save-btn {
|
width: 160upx;
|
height: 80upx;
|
background-color: #1aad19;
|
color: #fff;
|
border: none;
|
border-radius: 10upx;
|
font-size: 32upx;
|
}
|
}
|
</style>
|