Browse Source

根据角色切换tabBar

master
CODE 1 year ago
parent
commit
af9e128c8a
  1. 48
      weapp/app.js
  2. 145
      weapp/app.json
  3. 28
      weapp/app.wxss
  4. 32
      weapp/custom-tab-bar/index.js
  5. 3
      weapp/custom-tab-bar/index.json
  6. 8
      weapp/custom-tab-bar/index.wxml
  7. 38
      weapp/custom-tab-bar/index.wxss
  8. 135
      weapp/pages/home/home.js
  9. 287
      weapp/pages/index/index.js
  10. 2
      weapp/pages/index/index.wxss
  11. 229
      weapp/pages/login/login.js
  12. 170
      weapp/pages/myInfo/myInfo.js
  13. 209
      weapp/pages/myInfo/myInfo.wxss
  14. 166
      weapp/pages/overview/overview.js
  15. 3
      weapp/project.private.config.json

48
weapp/app.js

@ -6,15 +6,57 @@ App({
baseUrl: 'http://10.8.30.112:4900', //api 镇江本地环境 baseUrl: 'http://10.8.30.112:4900', //api 镇江本地环境
webUrl: "http://10.8.30.112:5900/", //web 镇江本地环境 webUrl: "http://10.8.30.112:5900/", //web 镇江本地环境
imgUrl: 'http://10.8.30.112:5900/_file-server/', //文件 镇江本地环境 imgUrl: 'http://10.8.30.112:5900/_file-server/', //文件 镇江本地环境
// baseUrl: 'http://10.8.16.102:4900', //api 南昌本地环境 // baseUrl: 'http://10.8.16.102:4900', //api 南昌本地环境
// webUrl: "http://10.8.16.102:5900/", //web 南昌本地环境 // webUrl: "http://10.8.16.102:5900/", //web 南昌本地环境
// imgUrl: 'http://10.8.16.102:5900/_file-server/', //文件 南昌本地环境 // imgUrl: 'http://10.8.16.102:5900/_file-server/', //文件 南昌本地环境
// baseUrl: 'http://127.0.0.1:6015', //api 测试环境 // baseUrl: 'http://127.0.0.1:6015', //api 测试环境
// webUrl: "http://127.0.0.1:6014/", //web 测试环境 // webUrl: "http://127.0.0.1:6014/", //web 测试环境
// imgUrl: 'http://127.0.0.1:6014/_file-server/', //文件 本测试环境 // imgUrl: 'http://127.0.0.1:6014/_file-server/', //文件 本测试环境
key: 'ODQBZ-3FZAU-6VIVL-2XXNM-F7CP7-WVFCY' //获取位置信息 key: 'ODQBZ-3FZAU-6VIVL-2XXNM-F7CP7-WVFCY', //获取位置信息
inspecterList: [ // 巡检人员tabBar / app.json 也要写
{
"pagePath": "/pages/index/index",
"iconPath": "/images/tabBar/icon_polling.png",
"selectedIconPath": "/images/tabBar/icon_polling_active.png",
"text": "巡检总览"
},
{
"pagePath": "/pages/overview/overview",
"iconPath": "/images/tabBar/icon_menu.png",
"selectedIconPath": "/images/tabBar/icon_menu_active.png",
"text": "工作台"
},
{
"pagePath": "/pages/myInfo/myInfo",
"iconPath": "/images/tabBar/icon_person.png",
"selectedIconPath": "/images/tabBar/icon_person_active.png",
"text": "我的"
}
],
managerList: [ // 管理人员tabBar / app.json 也要写
{
"pagePath": "/pages/home/home",
"iconPath": "/images/tabBar/icon_polling.png",
"selectedIconPath": "/images/tabBar/icon_polling_active.png",
"text": "首页"
},
{
"pagePath": "/pages/overview/overview",
"iconPath": "/images/tabBar/icon_menu.png",
"selectedIconPath": "/images/tabBar/icon_menu_active.png",
"text": "工作台"
},
{
"pagePath": "/pages/myInfo/myInfo",
"iconPath": "/images/tabBar/icon_person.png",
"selectedIconPath": "/images/tabBar/icon_person_active.png",
"text": "我的"
}
],
}, },
onShow (e) { onShow (e) {
// 检查是否有更新 // 检查是否有更新

145
weapp/app.json

@ -1,73 +1,76 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/login/login", "pages/login/login",
"pages/myInfo/myInfo", "pages/myInfo/myInfo",
"pages/overview/overview", "pages/overview/overview",
"pages/home/home" "pages/home/home",
], "custom-tab-bar/index"
"subPackages": [ ],
{ "subPackages": [
"root": "package", {
"pages": [ "root": "package",
"polling/polling", "pages": [
"polling/inspectionRecordDetail/inspectionRecordDetail", "polling/polling",
"basic/basic", "polling/inspectionRecordDetail/inspectionRecordDetail",
"startInspection/startInspection", "basic/basic",
"inspectionInput/inspectionInput", "startInspection/startInspection",
"troubleshooting/index", "inspectionInput/inspectionInput",
"troubleshooting/shootingForm/index", "troubleshooting/index",
"inspectionReport/inspectionReport", "troubleshooting/shootingForm/index",
"pointsStatus/pointsStatus", "inspectionReport/inspectionReport",
"homePage/homePage" "pointsStatus/pointsStatus",
] "homePage/homePage"
} ]
], }
"window": { ],
"backgroundTextStyle": "dark", "window": {
"navigationBarBackgroundColor": "#1979ff", "backgroundTextStyle": "dark",
"navigationBarTextStyle": "white" "navigationBarBackgroundColor": "#1979ff",
}, "navigationBarTextStyle": "white"
"tabBar": { },
"color": "#000000", "tabBar": {
"selectedColor": "#2F54FF", "custom": true,
"borderStyle": "black", "color": "#000000",
"backgroundColor": "#ffffff", "selectedColor": "#2F54FF",
"list": [ "borderStyle": "black",
{ "backgroundColor": "#ffffff",
"pagePath": "pages/index/index", "list": [
"iconPath": "images/tabBar/icon_polling.png", {
"selectedIconPath": "images/tabBar/icon_polling_active.png", "pagePath": "pages/index/index",
"text": "巡检总览" "iconPath": "images/tabBar/icon_polling.png",
}, "selectedIconPath": "images/tabBar/icon_polling_active.png",
{ "text": "巡检总览"
"pagePath": "pages/home/home", },
"iconPath": "images/tabBar/icon_polling.png", {
"selectedIconPath": "images/tabBar/icon_polling_active.png", "pagePath": "pages/overview/overview",
"text": "首页" "iconPath": "images/tabBar/icon_menu.png",
}, "selectedIconPath": "images/tabBar/icon_menu_active.png",
{ "text": "工作台"
"pagePath": "pages/overview/overview", },
"iconPath": "images/tabBar/icon_menu.png", {
"selectedIconPath": "images/tabBar/icon_menu_active.png", "pagePath": "pages/myInfo/myInfo",
"text": "工作台" "iconPath": "images/tabBar/icon_person.png",
}, "selectedIconPath": "images/tabBar/icon_person_active.png",
{ "text": "我的"
"pagePath": "pages/myInfo/myInfo", },
"iconPath": "images/tabBar/icon_person.png", {
"selectedIconPath": "images/tabBar/icon_person_active.png", "pagePath": "pages/home/home",
"text": "我的" "iconPath": "images/tabBar/icon_polling.png",
} "selectedIconPath": "images/tabBar/icon_polling_active.png",
] "text": "首页"
}, }
"permission": { ]
"scope.userLocation": { },
"desc": "你的位置信息将用于小程序位置接口的效果展示" "permission": {
} "scope.userLocation": {
}, "desc": "你的位置信息将用于小程序位置接口的效果展示"
"requiredPrivateInfos": [ }
"getLocation" },
], "requiredPrivateInfos": [
"sitemapLocation": "sitemap.json", "getLocation"
"lazyCodeLoading": "requiredComponents" ],
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents",
"usingComponents": {}
} }

28
weapp/app.wxss

@ -1,19 +1,19 @@
/**app.wxss**/ /**app.wxss**/
.page { .page {
/* vant 全局CSS变量 */ /* vant 全局CSS变量 */
/* DropdownMenu */ /* DropdownMenu */
--dropdown-menu-background-color: transparent; --dropdown-menu-background-color: transparent;
--dropdown-menu-box-shadow: none; --dropdown-menu-box-shadow: none;
--dropdown-menu-title-active-text-color: #1684FF; --dropdown-menu-title-active-text-color: #1684FF;
--dropdown-menu-option-active-color: #1684FF; --dropdown-menu-option-active-color: #1684FF;
} }
.container { .container {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 200rpx 0; padding: 200rpx 0;
box-sizing: border-box; box-sizing: border-box;
} }

32
weapp/custom-tab-bar/index.js

@ -0,0 +1,32 @@
Component({
data: {
selected: 0,
color: "#7A7E83",
selectedColor: "#1070E8",
list: []
},
attached () {
let userRole = wx.getStorageSync('userRole');
// 0 表示普通用户 1表示管理员
console.log('userRole', userRole);
if (userRole && userRole.includes('管理')) {
this.setData({
list: getApp().globalData.managerList
})
} else {
this.setData({
list: getApp().globalData.inspecterList
})
}
},
methods: {
switchTab (e) {
const data = e.currentTarget.dataset
const url = data.path
// this.setData({
// selected: data.index
// })
wx.switchTab({ url })
}
}
})

3
weapp/custom-tab-bar/index.json

@ -0,0 +1,3 @@
{
"component": true
}

8
weapp/custom-tab-bar/index.wxml

@ -0,0 +1,8 @@
<!-- miniprogram/custom-tab-bar/index.wxml -->
<view class="tab-bar">
<view class="tab-bar-border"></view>
<view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab">
<image src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image>
<view style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</view>
</view>
</view>

38
weapp/custom-tab-bar/index.wxss

@ -0,0 +1,38 @@
.tab-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 48px;
background: white;
display: flex;
padding-bottom: env(safe-area-inset-bottom);
}
.tab-bar-border {
background-color: rgba(0, 0, 0, 0.33);
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 1px;
transform: scaleY(0.5);
}
.tab-bar-item {
flex: 1;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.tab-bar-item image {
width: 27px;
height: 27px;
}
.tab-bar-item view {
font-size: 10px;
}

135
weapp/pages/home/home.js

@ -1,66 +1,77 @@
// pages/home/home.js // pages/home/home.js
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad (options) {
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { onReady () {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow () {
const userInfo = wx.getStorageSync('userInfo');
}, if (!userInfo || !userInfo.id) {
wx.reLaunch({
/** url: '/pages/login/login'
* 生命周期函数--监听页面隐藏 });
*/ } else {
onHide() { if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
}, selected: 0
})
/** }
* 生命周期函数--监听页面卸载 }
*/ },
onUnload() {
/**
}, * 生命周期函数--监听页面隐藏
*/
/** onHide () {
* 页面相关事件处理函数--监听用户下拉动作
*/ },
onPullDownRefresh() {
/**
}, * 生命周期函数--监听页面卸载
*/
/** onUnload () {
* 页面上拉触底事件的处理函数
*/ },
onReachBottom() {
/**
}, * 页面相关事件处理函数--监听用户下拉动作
*/
/** onPullDownRefresh () {
* 用户点击右上角分享
*/ },
onShareAppMessage() {
/**
} * 页面上拉触底事件的处理函数
*/
onReachBottom () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage () {
}
}) })

287
weapp/pages/index/index.js

@ -5,146 +5,151 @@ const moment = require("../../utils/moment");
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
project: [], project: [],
todayRecord: [], // 今日巡检记录 todayRecord: [], // 今日巡检记录
markers: [], markers: [],
isShowCallout: false, isShowCallout: false,
}, },
setMarkers(project, todayRecord) { setMarkers (project, todayRecord) {
const markers = project.map(p => { const markers = project.map(p => {
let todayCount = 0; let todayCount = 0;
todayRecord.forEach(r => { todayRecord.forEach(r => {
if (r.projectId === p.id) { todayCount += 1 } if (r.projectId === p.id) { todayCount += 1 }
}) })
return { return {
id: p.id, id: p.id,
latitude: p.latitude, latitude: p.latitude,
longitude: p.longitude, longitude: p.longitude,
name: p.name, name: p.name,
iconPath: '/images/gis.png', iconPath: '/images/gis.png',
width: 29, width: 29,
height: 44, height: 44,
callout: { callout: {
content: `${p.name}\n今日巡检:${todayCount}`, content: `${p.name}\n今日巡检:${todayCount}`,
padding: 10, padding: 10,
display: this.data.isShowCallout ? 'ALWAYS' : 'BYCLICK', display: this.data.isShowCallout ? 'ALWAYS' : 'BYCLICK',
borderColor: '#1684FF', borderColor: '#1684FF',
borderWidth: 1, borderWidth: 1,
}, },
} }
}) })
this.setData({ markers }) this.setData({ markers })
}, },
// 获取结构物和今日巡检次数 // 获取结构物和今日巡检次数
getData() { getData () {
const that = this; const that = this;
wx.showLoading({ title: '加载中' }) wx.showLoading({ title: '加载中' })
const promiseArr = []; const promiseArr = [];
promiseArr.push(Request.get(getProjectList(), {})); promiseArr.push(Request.get(getProjectList(), {}));
promiseArr.push(Request.get(getPatrolRecord('all', moment().format('YYYY-MM-DD') + ' 00:00:00', moment().format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null'))); promiseArr.push(Request.get(getPatrolRecord('all', moment().format('YYYY-MM-DD') + ' 00:00:00', moment().format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null')));
Promise.all(promiseArr).then(res => { Promise.all(promiseArr).then(res => {
wx.hideLoading() wx.hideLoading()
that.setData({ that.setData({
project: res[0].rows, project: res[0].rows,
todayRecord: res[1] todayRecord: res[1]
}) })
that.setMarkers(res[0].rows, res[1]); that.setMarkers(res[0].rows, res[1]);
// 缩放视野展示所有 markers // 缩放视野展示所有 markers
const mapCtx = wx.createMapContext('mapDom') const mapCtx = wx.createMapContext('mapDom')
mapCtx.includePoints({ mapCtx.includePoints({
points: res[0].rows, points: res[0].rows,
padding: [40, 40, 40, 40] padding: [40, 40, 40, 40]
}) })
}) })
}, },
showCallout() { showCallout () {
this.setData( this.setData(
{ isShowCallout: !this.data.isShowCallout }, { isShowCallout: !this.data.isShowCallout },
() => { this.setMarkers(this.data.markers, this.data.todayRecord); } () => { this.setMarkers(this.data.markers, this.data.todayRecord); }
); );
}, },
onRefresh() { onRefresh () {
this.getData(); this.getData();
}, },
onMarkerTap(e) { onMarkerTap (e) {
const describe = this.data.project.find(p => p.id === e.detail.markerId).describe || ''; const describe = this.data.project.find(p => p.id === e.detail.markerId).describe || '';
wx.navigateTo({url: `/package/pointsStatus/pointsStatus?projectId=${e.detail.markerId}&describe=${describe}`}) wx.navigateTo({ url: `/package/pointsStatus/pointsStatus?projectId=${e.detail.markerId}&describe=${describe}` })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad (options) {
const userInfo = wx.getStorageSync('userInfo'); const userInfo = wx.getStorageSync('userInfo');
if (!userInfo || !userInfo.id) { if (!userInfo || !userInfo.id) {
wx.reLaunch({ wx.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}); });
} }
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { onReady () {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow () {
const userInfo = wx.getStorageSync('userInfo'); const userInfo = wx.getStorageSync('userInfo');
if (!userInfo || !userInfo.id) { if (!userInfo || !userInfo.id) {
wx.reLaunch({ wx.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}); });
} else { } else {
this.getData(); this.getData();
} if (typeof this.getTabBar === 'function' && this.getTabBar()) {
}, this.getTabBar().setData({
selected: 0
/** })
* 生命周期函数--监听页面隐藏 }
*/ }
onHide() { },
}, /**
* 生命周期函数--监听页面隐藏
/** */
* 生命周期函数--监听页面卸载 onHide () {
*/
onUnload() { },
}, /**
* 生命周期函数--监听页面卸载
*/
onUnload () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage () {
/** }
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
}) })

2
weapp/pages/index/index.wxss

@ -1,7 +1,7 @@
/* pages/index/index.wxss */ /* pages/index/index.wxss */
.map { .map {
width: 100vw; width: 100vw;
height: 100vh; height: calc(100vh - 82px);
} }
.action-box { .action-box {

229
weapp/pages/login/login.js

@ -4,129 +4,142 @@ import { Request } from "../../common";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
scene: null, scene: null,
}, },
// 登录 // 登录
getLogin: function (e) { getLogin: function (e) {
if (e.detail.value.username.length == 0 || e.detail.value.password == 0) { if (e.detail.value.username.length == 0 || e.detail.value.password == 0) {
wx.showToast({ wx.showToast({
title: '请输入账号密码', title: '请输入账号密码',
icon: 'none', icon: 'none',
}) })
return return
} }
wx.showLoading() wx.showLoading()
Request.post(loginUrl(), { Request.post(loginUrl(), {
"username": e.detail.value.username, "username": e.detail.value.username,
"password": e.detail.value.password "password": e.detail.value.password
}).then((res) => { }).then((res) => {
if (!res.authorized) { if (!res.authorized) {
wx.showToast({ title: "登录失败", icon: "none" }); wx.showToast({ title: "登录失败", icon: "none" });
return; return;
} }
wx.setStorageSync('token', res.token); wx.setStorageSync('token', res.token);
wx.setStorageSync("userInfo", res); wx.setStorageSync("userInfo", res);
getApp().globalData.userInfo = res getApp().globalData.userInfo = res
wx.hideLoading() wx.setStorageSync('userRole', res.role)
if (this.data.scene) {
wx.redirectTo({ wx.hideLoading()
url: `/package/inspectionInput/inspectionInput?scene=${this.data.scene}`,
if (this.data.scene) {
wx.redirectTo({
url: `/package/inspectionInput/inspectionInput?scene=${this.data.scene}`,
})
return;
}
console.log(res.role);
setTimeout(() => {
console.log(`跳转`);
if (res.role.includes('管理')) {
wx.switchTab({
url: '/pages/home/home',
})
} else {
wx.switchTab({
url: '/pages/index/index',
})
}
}, 1000)
}) })
return; },
}
wx.switchTab({ bindForget () {
url: '/pages/index/index', wx.showModal({
}) title: '温馨提示',
}) content: '请联系管理员:18888888888',
}, confirmText: '拨打电话',
confirmColor: '#488EFF',
bindForget() { cancelColor: '#488EFF',
wx.showModal({ success (res) {
title: '温馨提示', if (res.confirm) {
content: '请联系管理员:18888888888', wx.makePhoneCall({
confirmText: '拨打电话', phoneNumber: "18888888888",
confirmColor: '#488EFF', success: function () {
cancelColor: '#488EFF', console.log("拨打电话成功!")
success(res) { },
if (res.confirm) { fail: function () {
wx.makePhoneCall({ console.log("拨打电话失败!")
phoneNumber: "18888888888", }
success: function () { })
console.log("拨打电话成功!") }
},
fail: function () {
console.log("拨打电话失败!")
} }
}) })
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
let that = this;
const { scene } = options;
if (scene) {
that.setData({
scene
})
} }
} },
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this;
const { scene } = options;
if (scene) {
that.setData({
scene
})
}
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { onReady () {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow () {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() { onHide () {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() { onUnload () {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() { onPullDownRefresh () {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() { onReachBottom () {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage () {
} }
}) })

170
weapp/pages/myInfo/myInfo.js

@ -4,99 +4,103 @@ import { Request } from "../../common";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
}, },
bindClick() { bindClick () {
wx.navigateTo({ wx.navigateTo({
url: '/package/basic/basic', url: '/package/basic/basic',
}) })
}, },
// 登出 // 登出
logout() { logout () {
wx.showModal({ wx.showModal({
title: '切换用户', title: '切换用户',
content: '将退出当前用户,重新登录', content: '将退出当前用户,重新登录',
confirmText: '切换用户', confirmText: '切换用户',
confirmColor: '#1979ff', confirmColor: '#1979ff',
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
wx.showLoading() wx.showLoading()
Request.put(logoutUrl(), {}).then((res) => { Request.put(logoutUrl(), {}).then((res) => {
wx.clearStorage(); wx.clearStorage();
getApp().globalData.userInfo = null; getApp().globalData.userInfo = null;
wx.reLaunch({ wx.reLaunch({
url: '../login/login', url: '../login/login',
})
wx.hideLoading()
})
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
let that = this;
let userInfo = wx.getStorageSync('userInfo');
that.setData({
userInfo
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
selected: 2
}) })
wx.hideLoading()
})
} }
} },
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面隐藏
*/ */
onLoad(options) { onHide () {
let that = this;
let userInfo = wx.getStorageSync('userInfo');
that.setData({
userInfo
})
},
/** },
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
}, /**
* 生命周期函数--监听页面卸载
*/
onUnload () {
/** },
* 生命周期函数--监听页面显示
*/
onShow() {
}, /**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh () {
/** },
* 生命周期函数--监听页面隐藏
*/
onHide() {
}, /**
* 页面上拉触底事件的处理函数
*/
onReachBottom () {
/** },
* 生命周期函数--监听页面卸载
*/
onUnload() {
}, /**
* 用户点击右上角分享
*/
onShareAppMessage () {
/** }
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
}) })

209
weapp/pages/myInfo/myInfo.wxss

@ -1,175 +1,176 @@
/* pages/myInfo/myInfo.wxss */ /* pages/myInfo/myInfo.wxss */
page { page {
background-color: #F7F7FA; background-color: #F7F7FA;
} }
.over-ellipsis { .over-ellipsis {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
word-break: break-all; word-break: break-all;
white-space: nowrap; white-space: nowrap;
} }
.bg { .bg {
position: absolute; position: absolute;
left: -25%; left: -25%;
width: 150%; width: 150%;
height: 145px; height: 145px;
background-color: #1979ff; background-color: #1979ff;
border-bottom-left-radius: 100%; border-bottom-left-radius: 100%;
border-bottom-right-radius: 100%; border-bottom-right-radius: 100%;
background-image: linear-gradient(0deg, #4E87FF, #1979ff 100%); background-image: linear-gradient(0deg, #4E87FF, #1979ff 100%);
z-index: -1; z-index: -1;
} }
/* 容器 */ /* 容器 */
.box { .box {
padding: 30rpx; padding-top: 42rpx;
font-family: 'PingFang SC-Medium'; padding: 30rpx;
font-family: 'PingFang SC-Medium';
} }
.header-item-container { .header-item-container {
width: 100%; width: 100%;
height: 165px; height: 165px;
border-radius: 10rpx; border-radius: 10rpx;
background-size: 100% 165px; background-size: 100% 165px;
} }
.info-box { .info-box {
width: 100%; width: 100%;
height: 127px; height: 127px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.avatar { .avatar {
width: 54px; width: 54px;
min-width: 54px; min-width: 54px;
height: 54px; height: 54px;
padding: 16px; padding: 16px;
margin-bottom: 30px; margin-bottom: 30px;
} }
.info { .info {
height: 100%; height: 100%;
min-width: 55%; min-width: 55%;
max-width: 60%; max-width: 60%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-evenly; justify-content: space-evenly;
} }
.userName { .userName {
font-size: 36rpx; font-size: 36rpx;
font-weight: 600; font-weight: 600;
} }
.contact { .contact {
display: flex; display: flex;
align-items: center; align-items: center;
min-width: 190px; min-width: 190px;
} }
.contact .icon { .contact .icon {
width: 20px; width: 20px;
min-width: 20px; min-width: 20px;
height: 20px; height: 20px;
} }
.contact .text { .contact .text {
min-width: 170px; min-width: 170px;
margin-left: 8px; margin-left: 8px;
font-size: 14px; font-size: 14px;
color: #00000080; color: #00000080;
} }
.post { .post {
border: 1px solid #006BE3; border: 1px solid #006BE3;
border-radius: 100px 0 0 100px; border-radius: 100px 0 0 100px;
min-width: 30px; min-width: 30px;
max-width: 60px; max-width: 60px;
height: 25px; height: 25px;
line-height: 25px; line-height: 25px;
color: #006BE3; color: #006BE3;
font-size: 14px; font-size: 14px;
padding: 0 7px; padding: 0 7px;
margin-top: 20px; margin-top: 20px;
} }
.dept-box { .dept-box {
height: 36px; height: 36px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
} }
.dept-box .dept { .dept-box .dept {
font-size: 14px; font-size: 14px;
color: #FFFFFF; color: #FFFFFF;
margin-right: 10px; margin-right: 10px;
} }
.company { .company {
font-size: 28rpx; font-size: 28rpx;
font-family: "PingFang SC"; font-family: "PingFang SC";
color: rgb(138, 138, 138); color: rgb(138, 138, 138);
margin-top: 14rpx; margin-top: 14rpx;
} }
.body-container { .body-container {
width: 100%; width: 100%;
background: rgb(255, 255, 255); background: rgb(255, 255, 255);
border-radius: 10rpx; border-radius: 10rpx;
flex-direction: column; flex-direction: column;
display: flex; display: flex;
margin-top: 30rpx; margin-top: 30rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.body-item { .body-item {
height: 110rpx; height: 110rpx;
flex-direction: row; flex-direction: row;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 0 30rpx; padding: 0 30rpx;
border-bottom: 1px solid #EFEFF4; border-bottom: 1px solid #EFEFF4;
} }
.body-info { .body-info {
font-size: 32rpx; font-size: 32rpx;
font-family: "PingFang SC"; font-family: "PingFang SC";
font-weight: 600; font-weight: 600;
} }
.body-number { .body-number {
font-size: 30rpx; font-size: 30rpx;
font-family: "PingFang SC"; font-family: "PingFang SC";
color: rgb(138, 138, 138); color: rgb(138, 138, 138);
} }
.foot-container { .foot-container {
position: absolute; position: absolute;
bottom: 50px; bottom: 140px;
width: 90%; width: 90%;
height: 42px; height: 42px;
border: 1px solid #006BE3; border: 1px solid #006BE3;
border-radius: 24px; border-radius: 24px;
} }
.foot-item { .foot-item {
font-weight: 600; font-weight: 600;
font-size: 16px; font-size: 16px;
color: #006BE3; color: #006BE3;
text-align: center; text-align: center;
line-height: 42px; line-height: 42px;
} }
.right { .right {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
display: block; display: block;
float: right; float: right;
margin: 38rpx 40rpx; margin: 38rpx 40rpx;
} }

166
weapp/pages/overview/overview.js

@ -1,85 +1,89 @@
// pages/overview/overview.js // pages/overview/overview.js
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
}, },
// 巡检 // 巡检
bindPolling() { bindPolling () {
wx.navigateTo({ wx.navigateTo({
url: '/package/polling/polling', url: '/package/polling/polling',
}) })
}, },
bindTroubleshooting() { bindTroubleshooting () {
wx.navigateTo({ wx.navigateTo({
url: '/package/troubleshooting/index', url: '/package/troubleshooting/index',
}) })
}, },
bindInspectionReport() { bindInspectionReport () {
wx.navigateTo({ wx.navigateTo({
url: '/package/inspectionReport/inspectionReport', url: '/package/inspectionReport/inspectionReport',
}) })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad (options) {
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { onReady () {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow () {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
}, this.getTabBar().setData({
selected: 1
/** })
* 生命周期函数--监听页面隐藏 }
*/ },
onHide() {
/**
}, * 生命周期函数--监听页面隐藏
*/
/** onHide () {
* 生命周期函数--监听页面卸载
*/ },
onUnload() {
/**
}, * 生命周期函数--监听页面卸载
*/
/** onUnload () {
* 页面相关事件处理函数--监听用户下拉动作
*/ },
onPullDownRefresh() {
/**
}, * 页面相关事件处理函数--监听用户下拉动作
*/
/** onPullDownRefresh () {
* 页面上拉触底事件的处理函数
*/ },
onReachBottom() {
/**
}, * 页面上拉触底事件的处理函数
*/
/** onReachBottom () {
* 用户点击右上角分享
*/ },
onShareAppMessage() {
/**
} * 用户点击右上角分享
*/
onShareAppMessage () {
}
}) })

3
weapp/project.private.config.json

@ -31,5 +31,6 @@
} }
] ]
} }
} },
"libVersion": "2.29.2"
} }
Loading…
Cancel
Save