123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- frameStyle: { useTop: true, name: '羽校详细信息', leftArrow: true, useBar: false },
- school_id: '',
- form: {},
- },
- // 返回
- back: function () {
- wx.navigateBack({ delta: 1 })
- },
- // 图片预览
- imgView: function (e) {
- const that = this;
- const { item } = e.currentTarget.dataset;
- if (item && item.length > 0) {
- wx.previewImage({
- current: '',
- urls: [item[0].url]
- })
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: async function (options) {
- const that = this;
- that.setData({ school_id: options.school_id || '' });
- // 监听用户是否登录
- await that.watchLogin();
- },
- // 监听用户是否登录
- watchLogin: async function () {
- const that = this;
- wx.getStorage({
- key: 'user',
- success: async res => {
- let arr;
- arr = await app.$get(`/school/${that.data.school_id}`,);
- if (arr.errcode == '0') { that.setData({ form: arr.data }) }
- },
- fail: async res => {
- wx.redirectTo({ url: '/pages/index/index' })
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () { },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|