1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee
epp/miniprogram/pages/home/home.js

165 lines
2.7 KiB
JavaScript
Raw Normal View History

const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
2022-11-05 15:28:03 +08:00
Page({
/**
* 页面的初始数据
*/
data: {
isManager: false,
isStudent: false,
notice: ''
2022-11-05 15:28:03 +08:00
},
goWebPage: function (event) {
wx.navigateTo({
url: '../webPage/' + event.target.dataset.web,
2022-11-05 15:28:03 +08:00
})
},
toRedList: function (event) {
wx.navigateTo({
url: '../other/redList'
})
},
goCode: function () {
2022-11-05 15:28:03 +08:00
wx.navigateTo({
url: '../other/redList2'
})
},
goCount: function () {
wx.navigateTo({
url: '../person/count'
})
},
goNotice: function () {
2022-11-05 15:28:03 +08:00
wx.navigateTo({
url: '../notice/notice'
})
},
goVisitor: function () {
2022-11-05 15:28:03 +08:00
wx.navigateTo({
url: '../visitor/visitorReplay'
})
},
goFeedback: function () {
wx.navigateTo({
url: '../other/feedback'
})
},
goFeedbackReplay: function () {
wx.navigateTo({
url: '../other/feedbackReplay'
})
},
goApply: function () {
wx.navigateTo({
url: '../apply/myapply'
})
},
goApplyReplay: function () {
wx.navigateTo({
url: '../apply/applyReplay'
})
},
goUpdPwd: function () {
wx.navigateTo({
url: '../other/password'
})
},
goKf: function () {
wx.navigateTo({
url: '../person/issues'
})
},
goReport: function () {
wx.switchTab({
url: '../report/report'
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
2022-11-05 15:28:03 +08:00
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (!wx.getStorageSync("username")) {
2022-11-05 15:28:03 +08:00
wx.navigateTo({
url: '../login/login'
})
}
if (wx.getStorageSync("role") == 2) {
2022-11-05 15:28:03 +08:00
this.setData({
isManager: false,
isStudent: true,
})
} else if (wx.getStorageSync("role") == 1) {
2022-11-05 15:28:03 +08:00
this.setData({
isManager: true,
isStudent: false,
})
}
var that = this;
wx.request({
url: `${baseUrl}/notice/noticeList`,
data: {
limit: 3
},
2022-11-05 15:28:03 +08:00
success: function (d) {
that.setData({
notice: d.data.data
})
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})