优化头像bug

This commit is contained in:
java110 2022-08-31 11:15:34 +08:00
parent 778bbf4d97
commit 1b9cb39ff4
5 changed files with 39 additions and 15 deletions

View File

@ -71,6 +71,11 @@ export function getCurOwner() {
export function refreshOwner() {
return new Promise(
(resolve, reject) => {
let _userInfo = wx.getStorageSync(mapping.USER_INFO);
if (!_userInfo) {
reject();
return;
}
request({
url: url.queryAppUserBindingOwner,
data: {
@ -78,8 +83,8 @@ export function refreshOwner() {
},
success: function(res) {
let _json = res.data;
if (_json.code == 0) {
_ownerInfo = _json.data[0];
if (_json.code == 0 && _json.data && _json.data.length >0) {
let _ownerInfo = _json.data[0];
if (_ownerInfo == null || _ownerInfo == undefined) {
//没有业主信息
reject();

View File

@ -50,13 +50,14 @@
import context from '@/lib/java110/Java110Context.js';
const factory = context.factory; //app
const constant = context.constant;
import conf from '@/conf/config.js'
export default {
name: "my-person",
data() {
return {
userInfo: {},
headerImg: this.imgUrl+'/h5/images/serve/head.png',
topImg: this.imgUrl+'/h5/images/serve/bg.png',
headerImg: conf.imgUrl+'/h5/images/serve/head.png',
topImg: conf.imgUrl+'/h5/images/serve/bg.png',
userName: '',
userPhone: '',
communityName: '',
@ -111,7 +112,7 @@
if(_owner.headImgUrl){
_that.headerImg = _owner.headImgUrl;
}else{
_that.headerImg = '/static/images/serve/head.png';
_that.headerImg =conf.imgUrl+'/h5/images/serve/head.png';
}
_that.userName = _owner.appUserName;
_that.userPhone = _owner.link;

View File

@ -146,6 +146,13 @@ const getCurrentCommunity = function() {
const getRooms = function() {
return new Promise((resolve, reject) => {
if(!_owner.ownerId || _owner.ownerId == '-1'){
resolve({
data:{rooms:[]}
});
}
getOwner(function(_owner) {
request({
url: constant.url.queryRoomsByOwner,

View File

@ -3,7 +3,7 @@
<!--index.wxml-->
<my-person ref="myPersonRef"></my-person>
<my-menu ></my-menu>
<my-menu></my-menu>
<my-system ref="mySystem"></my-system>
</view>
@ -64,8 +64,13 @@
},
onShow: function() {
let _that = this; //
this.$refs.myPersonRef.refreshPageLoginInfo();
this.$refs.mySystem._judgeHasLogin();
if (this.$refs.myPersonRef) {
this.$refs.myPersonRef.refreshPageLoginInfo();
}
if (this.$refs.mySystem) {
this.$refs.mySystem._judgeHasLogin();
}
},
methods: {
// onShow

View File

@ -88,10 +88,11 @@
import context from '../../lib/java110/Java110Context.js'
import * as TanslateImage from '../../lib/java110/utils/translate-image.js';
import {refreshOwner} from '@/api/owner/ownerApi.js'
import {refreshOwner} from '@/api/owner/ownerApi.js';
import conf from '@/conf/config.js';
const constant = context.constant;
const factory = context.factory;
export default {
data() {
return {
@ -134,14 +135,12 @@
//#ifdef H5
TanslateImage.translate(tempFilePaths, (_baseInfo) => {
_that.headerImg = _baseInfo;
_that._uploadOwnerHeaderImg();
wx.hideLoading()
})
//#endif
//#ifdef MP-WEIXIN
factory.base64.urlTobase64(tempFilePaths[0]).then(function(_baseInfo) {
_that.headerImg = _baseInfo;
_that._uploadOwnerHeaderImg();
wx.hideLoading()
});
//#endif
@ -152,9 +151,14 @@
* 查询业主头像
*/
loadOwnerHeaderImg: function() {
console.log('loadOwnerHeaderImg')
let _that = this;
refreshOwner().then(_owner=>{
_that.headerImg = _owner.headerImgUrl;
if(_owner.headImgUrl ){
_that.headerImg = _owner.headImgUrl;
}else{
_that.headerImg = conf.imgUrl+'/h5/images/serve/head.png';
}
},err=>{
});
@ -184,6 +188,8 @@
});
return;
}
_that.loadOwnerHeaderImg();
},
fail: function(e) {
wx.showToast({