Browse Source

123

data-page-lingshan
是小王呀\24601 6 months ago
parent
commit
83439b304a
  1. 61
      components/custom-tab-bar/index.js
  2. 8
      pages/mine/mine.wxml
  3. 3
      utils/api.js
  4. 4
      utils/statisticsApi.js

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

@ -1,10 +1,11 @@
import {getStaffbasicinfo} from "../../utils/api"; import {getStaffbasicinfo} from "../../utils/api";
const app = getApp() const app = getApp()
import {getOwnedRolesOfStaffId} from '../../utils/statisticsApi.js' import {getOwnedRolesOfStaffId,editstaffinit} from '../../utils/statisticsApi.js'
Component({ Component({
data: { data: {
manageOrgNameList:[],
selected: 0, selected: 0,
color: "#999", color: "#999",
selectedColor: "#3A80E7", selectedColor: "#3A80E7",
@ -52,28 +53,58 @@ 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 管理员
console.log( app.globalData.roleList.filter(item => item.roleKey === 'secretary'))
if(app.globalData.roleList.length <= 0) { if(app.globalData.roleList.length <= 0) {
const res = await getStaffbasicinfo();
getStaffbasicinfo().then(res=>{ // 处理员工信息
getOwnedRolesOfStaffId(res.data.id).then(res2 => { const res4 = await editstaffinit({
app.globalData.user = res.data agencyId: res.data.agencyId,
this.setData({ staffId: res.data.id
"list[3].show": res2.data.filter(item => item.roleKey === 'secretary' || item.roleKey === 'administrator' || item.roleKey === 'street_secretary').length > 0 });
}) console.log(res4.data.manageOrgNameList, "dsfkljdsf");
}) // 确保数据是数组,避免 undefined
}) this.setData({
manageOrgNameList: res4.data.manageOrgNameList || []
});
console.log(this.data.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 => {
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: 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
});
});
});
} }
console.log(app.globalData.roleList, 'userss')
}, },
methods: { methods: {
switchTab(e) { switchTab(e) {

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>

3
utils/api.js

@ -90,7 +90,7 @@ module.exports = {
Enterpriseambiguity, Enterpriseambiguity,
hotResidentSearch, hotResidentSearch,
hotHouseSearch, hotHouseSearch,
customerlist customerlist,
} }
// 获取公钥 // 获取公钥
@ -144,6 +144,7 @@ function getCommunityHouse(para) {
function getStaffbasicinfo(para) { function getStaffbasicinfo(para) {
return fly.post('epmetuser/customerstaff/staffbasicinfo', para) return fly.post('epmetuser/customerstaff/staffbasicinfo', para)
} }
// 新增居民 // 新增居民
function resiAdd(para) { function resiAdd(para) {
return fly.post('actual/base/residentBaseInfo/save', para) return fly.post('actual/base/residentBaseInfo/save', para)

4
utils/statisticsApi.js

@ -277,6 +277,10 @@ export function dwdEventEventList(params) {
export function getOwnedRolesOfStaffId(id) { export function getOwnedRolesOfStaffId(id) {
return request.get('gov/access/govroleuser/getOwnedRolesOfStaffId/'+id) return request.get('gov/access/govroleuser/getOwnedRolesOfStaffId/'+id)
} }
//修改信息
export function editstaffinit(para) {
return request.post('gov/org/staff/editstaffinit', para)
}
// 房屋性质 // 房屋性质
export function getHouseType(params) { export function getHouseType(params) {
return request.post('sys/dict/data/house',params) return request.post('sys/dict/data/house',params)

Loading…
Cancel
Save