295 lines
6.9 KiB
Vue
Executable File
295 lines
6.9 KiB
Vue
Executable File
<template>
|
|
<view class="container">
|
|
<view class="main" style="margin-top: 36.23rpx; height: 181.15rpx;">
|
|
<view class="title"><text>头 像</text></view>
|
|
<view class="u-img">
|
|
<view>
|
|
<!-- #ifdef H5 -->
|
|
<image @tap="SelectH5Img" :src="avatar"></image>
|
|
<!-- #endif -->
|
|
<!-- #ifndef H5 -->
|
|
<image @tap="SelectImg" :src="avatar"></image>
|
|
<!-- #endif -->
|
|
</view>
|
|
</view>
|
|
<!-- <image style="width: 25.36upx;height: 25.36upx;"></image> -->
|
|
</view>
|
|
<view class="main">
|
|
<view class="title"><text> 姓 名</text></view>
|
|
<view class="uni-form-item uni-column input">
|
|
<input class="uni-input" focus placeholder="请输入姓名" v-model="name" disabled="true" />
|
|
</view>
|
|
</view>
|
|
<view class="main">
|
|
<view class="title"><text>用户名</text></view>
|
|
<view class="uni-form-item uni-column input">
|
|
<input class="uni-input" focus placeholder="请输入用户名" v-model="username" disabled="true" />
|
|
</view>
|
|
</view>
|
|
<view class="main">
|
|
<view class="title"><text>企业名称</text></view>
|
|
<view class="uni-form-item uni-column input">
|
|
<input class="uni-input" focus placeholder="请输入微信号" v-model="company" disabled="true" />
|
|
</view>
|
|
</view>
|
|
<view>
|
|
<view class="saveBtn" @click="btnSave">保存</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState,
|
|
mapMutations
|
|
} from 'vuex';
|
|
export default {
|
|
data() {
|
|
return {
|
|
name: '',
|
|
username: '',
|
|
company: '江苏欧软信息科技有限公司',
|
|
// weChatNum:'',
|
|
avatar: '',
|
|
disabled: true,
|
|
isEdit: false
|
|
}
|
|
},
|
|
computed: {
|
|
...mapState(['hasLogin', 'userInfo'])
|
|
},
|
|
onLoad: function() {
|
|
this.name = uni.getStorageSync('loginInfo').UserName;
|
|
this.username = uni.getStorageSync('userName');
|
|
// this.company = this.userInfo.OrgStructures.FName;
|
|
// if(this.userInfo.avatar!=null)
|
|
// {
|
|
// this.avatar=this.userInfo.avatar
|
|
// }
|
|
|
|
},
|
|
methods: {
|
|
btnSave: function() {
|
|
uni.showModal({
|
|
content:"功能正在开发中",
|
|
showCancel:false
|
|
});
|
|
// uni.request({
|
|
// url: this.$config_url+'Login/UserInfoEdit',
|
|
// method: 'POST',
|
|
// data: {
|
|
// userId:this.userInfo.UserID,
|
|
// userName:this.name,
|
|
// UserID:this.mail,
|
|
// avatar:this.avatar
|
|
// },
|
|
// success: res => {
|
|
// if(res.data.status === 1)
|
|
// {
|
|
// let userlist={
|
|
// user_id:this.userInfo.user_id,
|
|
// user_name:this.name,
|
|
// email:this.mail,
|
|
// pr_password:this.userInfo.pr_password,
|
|
// phone:this.phone,
|
|
// is_pda:this.userInfo.is_pda,
|
|
// photo:this.userInfo.photo,
|
|
// open_id:this.weChatNum,
|
|
// avatar:this.avatar,
|
|
// group_userpole:this.userInfo.group_userpole
|
|
// };
|
|
// this.login(userlist);
|
|
// this.ChangeEditStatus();
|
|
// //本地缓存
|
|
// uni.setStorage({
|
|
// key:'Avatar',
|
|
// data:this.avatar
|
|
// });
|
|
// uni.showModal({
|
|
// content: '基本信息修改成功!',
|
|
// showCancel:false,
|
|
// confirmText: '确定',
|
|
// confirmColor:'#007BFF',
|
|
// success: res => {
|
|
// if(res.confirm)
|
|
// {
|
|
// uni.switchTab({
|
|
// url:'../../../pages/myabout/myindex'
|
|
// })
|
|
// }
|
|
// },
|
|
// fail: () => {},
|
|
// complete: () => {}
|
|
// });
|
|
|
|
// }
|
|
// else{
|
|
// uni.showToast({
|
|
// icon:'none',
|
|
// title: res.data.message
|
|
// });
|
|
// }
|
|
// },
|
|
// fail: () => {
|
|
// uni.showToast({
|
|
// icon:'none',
|
|
// title: '数据加载错误!'
|
|
// });
|
|
// },
|
|
// complete: () => {}
|
|
// });
|
|
let userInfos = this.userInfo
|
|
userInfos.avatarUrl = this.avatar
|
|
this.login(userInfos)
|
|
uni.showToast({
|
|
title: '保存成功!'
|
|
});
|
|
},
|
|
ChangeEditStatus: function() {
|
|
if (this.isEdit) {
|
|
this.isEdit = false;
|
|
this.disabled = true;
|
|
} else {
|
|
this.isEdit = true;
|
|
this.disabled = false;
|
|
}
|
|
},
|
|
SelectImg: function(e) {
|
|
// if (!this.isEdit) {
|
|
// return;
|
|
// }
|
|
var that = this;
|
|
//选择图片
|
|
uni.chooseImage({
|
|
count: 1,
|
|
sizeType: ['compressed'],
|
|
sourceType: ['ablum', 'camera'], //从相册选择
|
|
success: function(res) {
|
|
console.log("选择的图片:" + res.tempFilePaths);
|
|
//that.avatar = res.tempFilePaths;
|
|
const tempPath = res.tempFilePaths[0];
|
|
|
|
|
|
//保存图片
|
|
uni.saveFile({
|
|
tempFilePath: res.tempFilePaths[0],
|
|
success: function(resavedFile) {
|
|
var savedFilePath = resavedFile.savedFilePath;
|
|
that.avatar = savedFilePath;
|
|
}
|
|
});
|
|
}
|
|
})
|
|
},
|
|
SelectH5Img() {
|
|
//选择图片
|
|
uni.chooseImage({
|
|
count: 1,
|
|
sizeType: ['compressed'],
|
|
sourceType: ['ablum', 'camera'], //从相册选择
|
|
success: function(res) {
|
|
console.log("选择的图片:" + res.tempFilePaths);
|
|
//that.avatar = res.tempFilePaths;
|
|
const tempPath = res.tempFilePaths[0];
|
|
uni.getImageInfo({
|
|
src: tempPath,
|
|
success: function(image) {
|
|
this.avatar=image.path
|
|
console.log(image);
|
|
}
|
|
|
|
});
|
|
}
|
|
})
|
|
},
|
|
...mapMutations(['login'])
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
page {
|
|
background: #F2F2F2;
|
|
}
|
|
|
|
.main {
|
|
background: #FFFFFF;
|
|
display: flex;
|
|
flex-direction: row;
|
|
border-bottom: 0.5px solid #F2F2F2;
|
|
padding-right: 43.47upx;
|
|
}
|
|
|
|
.main view {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.title {
|
|
font-size: 120%;
|
|
flex: 1;
|
|
padding-left: 43.47upx;
|
|
}
|
|
.title text{
|
|
font-size: 32.6upx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #232323;
|
|
}
|
|
.uni-input{
|
|
|
|
font-size: 32.6upx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #686868;
|
|
}
|
|
.input {
|
|
flex: 3;
|
|
}
|
|
|
|
.u-img {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
flex: 3;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
input {
|
|
text-align: right;
|
|
width: 100%;
|
|
}
|
|
|
|
button {
|
|
width: 50%;
|
|
color: white;
|
|
font-weight: bold;
|
|
margin-top: 25%;
|
|
}
|
|
|
|
image {
|
|
width: 144.92upx;
|
|
height: 144.92rpx;
|
|
/* border-radius: 30upx; */
|
|
background: url('../../../static/headNew.png');
|
|
background-repeat: no-repeat;
|
|
background-size: 100% 100%;
|
|
}
|
|
.saveBtn{
|
|
height: 86.95upx;
|
|
line-height: 86.95upx;
|
|
background: #035DFF;
|
|
border-radius: 43.47upx;
|
|
text-align: center;
|
|
opacity: 0.71;
|
|
|
|
font-size: 32.6upx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #FFFFFF;
|
|
margin-left: 43.47upx;
|
|
margin-right: 43.47upx;
|
|
margin-top: 65.21upx;
|
|
}
|
|
</style>
|