|
@@ -11,27 +11,18 @@ Page({
|
|
|
// 主体高度
|
|
|
infoHeight: '',
|
|
|
frameStyle: { useTop: true, name: '已上传图片', leftArrow: true, useBar: false },
|
|
|
- list: [
|
|
|
-
|
|
|
- {
|
|
|
- id: '1', name: '朝阳沟第三节力气大赛', time: '2020.11.12', shop1: '/image/shop1.png', shop2: '/image/shop2.png', shop3: '/image/shop3.png',
|
|
|
-
|
|
|
- },
|
|
|
- {
|
|
|
- id: '1', name: '朝阳沟第三节力气大赛', time: '2020.11.12', shop1: '/image/shop1.png', shop2: '/image/shop2.png', shop3: '/image/shop3.png',
|
|
|
-
|
|
|
- }
|
|
|
- ],
|
|
|
+ //赛程列表
|
|
|
+ photoList: [],
|
|
|
+ //比赛列表
|
|
|
+ match: []
|
|
|
|
|
|
},
|
|
|
back: function () {
|
|
|
wx.navigateBack({ url: '/pages/me/index' })
|
|
|
},
|
|
|
- //提交
|
|
|
+ //保存
|
|
|
formSubmit: function (e) {
|
|
|
},
|
|
|
-
|
|
|
- //实现全选的点击事件,首先要定义一个全局变量isAll=false,让复选框默认为不勾选状态
|
|
|
checkq: function () {
|
|
|
var list = this.data.list;
|
|
|
isAll = !isAll;
|
|
@@ -55,10 +46,8 @@ Page({
|
|
|
//删除
|
|
|
delList: function () {
|
|
|
var list = this.data.list;
|
|
|
- list.pop();
|
|
|
- this.setData({
|
|
|
- list: list,
|
|
|
- })
|
|
|
+ list.pop();
|
|
|
+ this.setData({ list: list, })
|
|
|
},
|
|
|
//删除图片
|
|
|
deleteImg: function (e) {
|
|
@@ -68,19 +57,42 @@ Page({
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
// 计算高度
|
|
|
- this.searchHeight()
|
|
|
+ this.searchHeight();
|
|
|
+ // 监听用户是否登录
|
|
|
+ this.watchLogin();
|
|
|
+ },
|
|
|
+ // 监听用户是否登录
|
|
|
+ watchLogin: async function () {
|
|
|
+ const that = this;
|
|
|
+ wx.getStorage({
|
|
|
+ key: 'token',
|
|
|
+ success: async res => {
|
|
|
+ const arr = await app.$get('/courtAdmin/api/match');
|
|
|
+ if (arr.errcode === 0) {
|
|
|
+ for (const val of arr.data) {
|
|
|
+ const arrs = await app.$get('/courtAdmin/api/schedule', { match_id: val._id });
|
|
|
+ if (arrs.errcode === 0) val.photoList = arrs.data;
|
|
|
+ that.setData({ photoList: val.photoList })
|
|
|
+ }
|
|
|
+ that.setData({ match: arr.data })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: res => {
|
|
|
+ wx.redirectTo({ url: '/pages/login/index', })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 计算高度
|
|
|
+ searchHeight: function () {
|
|
|
+ let frameStyle = this.data.frameStyle;
|
|
|
+ let client = app.globalData.client;
|
|
|
+ let infoHeight = client.windowHeight;
|
|
|
+ // 是否去掉状态栏
|
|
|
+ if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
|
|
|
+ // 是否减去底部菜单
|
|
|
+ if (frameStyle.useBar) infoHeight = infoHeight - 50;
|
|
|
+ if (infoHeight) this.setData({ infoHeight: infoHeight })
|
|
|
},
|
|
|
- // 计算高度
|
|
|
- searchHeight: function () {
|
|
|
- let frameStyle = this.data.frameStyle;
|
|
|
- let client = app.globalData.client;
|
|
|
- let infoHeight = client.windowHeight;
|
|
|
- // 是否去掉状态栏
|
|
|
- if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
|
|
|
- // 是否减去底部菜单
|
|
|
- if (frameStyle.useBar) infoHeight = infoHeight - 50;
|
|
|
- if (infoHeight) this.setData({ infoHeight: infoHeight })
|
|
|
-},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|