Browse Source

网格长

data-page
是小王呀\24601 6 months ago
parent
commit
15a1730a98
  1. 68
      components/custom-tab-bar/index.js
  2. 8
      pages/mine/mine.wxml

68
components/custom-tab-bar/index.js

@ -2,10 +2,12 @@ import {getStaffbasicinfo} from "../../utils/api";
const app = getApp() const app = getApp()
import {getOwnedRolesOfStaffId,editstaffinit} from '../../utils/statisticsApi.js' import {getOwnedRolesOfStaffId,editstaffinit} from '../../utils/statisticsApi.js'
import {getOwnedRolesOfStaffId,editstaffinit} from '../../utils/statisticsApi.js'
Component({ Component({
data: { data: {
manageOrgNameList:[], manageOrgNameList:[],
manageOrgNameList:[],
selected: 0, selected: 0,
color: "#999", color: "#999",
selectedColor: "#3A80E7", selectedColor: "#3A80E7",
@ -53,39 +55,57 @@ Component({
}, },
attached() { attached() {
}, },
ready: function () { ready: async function () {
this.setData({ this.setData({
selected: app.globalData.selected selected: app.globalData.selected
}) })
console.log(app.globalData.roleList,"dskldlsk");
// secretary 书记 admin 管理员 // secretary 书记 admin 管理员
if(app.globalData.roleList.length <= 0) { if(app.globalData.roleList.length <= 0) {
const res = await getStaffbasicinfo();
getStaffbasicinfo().then(res=>{ // 处理员工信息
editstaffinit({ const res4 = await editstaffinit({
agencyId: res.data.agencyId, agencyId: res.data.agencyId,
staffId: res.data.id staffId: res.data.id
}).then(res4 => { });
this.setData({ console.log(res4.data.manageOrgNameList, "dsfkljdsf");
manageOrgNameList: res4.data.manageOrgNameList // 确保数据是数组,避免 undefined
}) this.setData({
}) manageOrgNameList: res4.data.manageOrgNameList || []
getOwnedRolesOfStaffId(res.data.id).then(res2 => { });
app.globalData.user = res.data console.log(this.data.manageOrgNameList, "第二次");
this.setData({ // 获取角色信息
"list[3].show": res2.data.filter(item => item.roleKey === 'secretary' || item.roleKey === 'administrator' || item.roleKey === 'street_secretary').length > 0||manageOrgNameList const res2 = await getOwnedRolesOfStaffId(res.data.id);
}) // 更新全局数据
}) app.globalData.user = res.data;
}) // 更新 UI 数据
this.setData({
"list[3].show": res2.data.some(item =>
['secretary', 'administrator', 'street_secretary'].includes(item.roleKey)
) || this.data.manageOrgNameList.length > 0
});
console.log(
res2.data.some(item =>
['secretary', 'administrator', 'street_secretary'].includes(item.roleKey)
) || this.data.manageOrgNameList.length > 0,
"dskjvdsljk"
);
} else { } else {
editstaffinit({ agencyId:app.globalData.user.agencyId, staffId:app.globalData.user.id}).then(res4=>{ editstaffinit({
this.setData({ agencyId: app.globalData.user.agencyId,
manageOrgNameList:res4.data.manageOrgNameList staffId: app.globalData.user.id
}) }).then(res4 => {
})
this.setData({ this.setData({
"list[3].show": app.globalData.roleList.filter(item => item.roleKey === 'secretary' || item.roleKey === 'administrator' || item.roleKey === 'street_secretary').length > 0 ||manageOrgNameList manageOrgNameList: res4.data.manageOrgNameList || []
}) }, () => {
this.setData({
"list[3].show": app.globalData.roleList.some(item =>
['secretary', 'administrator', 'street_secretary'].includes(item.roleKey)
) || this.data.manageOrgNameList.length > 0
});
});
});
} }
}, },
methods: { methods: {

8
pages/mine/mine.wxml

@ -7,14 +7,6 @@
<view class="left"><image wx:if="{{avatar}}" src="{{avatar}}" mode="aspectFill"/></view> <view class="left"><image wx:if="{{avatar}}" src="{{avatar}}" mode="aspectFill"/></view>
<view class="right"> <view class="right">
<view class="top"> <b>{{userName}}</b> <text>{{agencyName}}</text></view> <view class="top"> <b>{{userName}}</b> <text>{{agencyName}}</text></view>
<view class="bto">
<view class="text-wrapper_24">
<text class="text_63">网格长</text>
</view>
<view class="text-wrapper_24">
<text class="text_63">楼长</text>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>

Loading…
Cancel
Save