优化代码

This commit is contained in:
wuxw 2023-12-05 11:28:42 +08:00
parent 6d7935a40a
commit 7eadec3836
2 changed files with 19 additions and 6 deletions

View File

@ -365,3 +365,13 @@ export function getUserId(){
return _userInfo.userId; return _userInfo.userId;
} }
export function getUserName(){
let _userInfo = uni.getStorageSync("userInfo");
if(!_userInfo){
return null;
}
return _userInfo.userName;
}

View File

@ -37,7 +37,8 @@
import SxRate from '@/components/sx-rate' import SxRate from '@/components/sx-rate'
import {appraiseRepair} from '../../api/repair/repairApi.js' import {appraiseRepair} from '../../api/repair/repairApi.js'
import {getCurOwner} from '../../api/owner/ownerApi.js' import {getCurOwner} from '../../api/owner/ownerApi.js';
import {getUserId,getUserName} from '../../api/user/userApi.js'
export default { export default {
data() { data() {
return { return {
@ -62,11 +63,13 @@
let _that = this; let _that = this;
let _repairId = options.repairId; let _repairId = options.repairId;
this.repairId = _repairId; this.repairId = _repairId;
getCurOwner() this.userId = getUserId();
.then(function(_owner) { this.userName = getUserName();
_that.userId = _owner.userId; // getCurOwner()
_that.userName = _owner.userName; // .then(function(_owner) {
}); // _that.userId = _owner.userId;
// _that.userName = _owner.userName;
// });
}, },
methods: { methods: {
appraiseScoreChange(e) { appraiseScoreChange(e) {