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

View File

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

View File

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

View File

@ -64,8 +64,13 @@
}, },
onShow: function() { onShow: function() {
let _that = this; // let _that = this; //
if (this.$refs.myPersonRef) {
this.$refs.myPersonRef.refreshPageLoginInfo(); this.$refs.myPersonRef.refreshPageLoginInfo();
}
if (this.$refs.mySystem) {
this.$refs.mySystem._judgeHasLogin(); this.$refs.mySystem._judgeHasLogin();
}
}, },
methods: { methods: {
// onShow // onShow

View File

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