|
@@ -6,31 +6,72 @@ Page({
|
|
|
*/
|
|
|
data: {
|
|
|
frameStyle: { useTop: true, name: '信息管理', leftArrow: true, useBar: false },
|
|
|
- list: [
|
|
|
- {
|
|
|
- status: '0',
|
|
|
- icon: [{ url: "http://broadcast.waityou24.cn/files/court/elimg/20220728102205.jpg" }],
|
|
|
- name: '2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛2021南宁·LYB李永波全球业余羽毛球锦标赛-南宁分站赛',
|
|
|
- sign_end_time: '2021/10/12-2022/07/15',
|
|
|
- start_time: '2021/10/12',
|
|
|
- end_time: '2021/10/12',
|
|
|
- address: '吉林省长春市朝阳区前进大街1244号'
|
|
|
- },
|
|
|
- ]
|
|
|
+ list: [],
|
|
|
+ searchInfo: {}
|
|
|
},
|
|
|
// 跳转菜单
|
|
|
back(e) {
|
|
|
wx.navigateBack({ delta: 1 })
|
|
|
},
|
|
|
+ search: function (e) {
|
|
|
+ const that = this;
|
|
|
+ that.setData({ 'searchInfo.name': e.detail.value });
|
|
|
+ that.watchLogin()
|
|
|
+ },
|
|
|
toAdd: function () {
|
|
|
wx.navigateTo({ url: `/pages/match/matchadd` })
|
|
|
},
|
|
|
+ toView: function (e) {
|
|
|
+ const { item } = e.currentTarget.dataset;
|
|
|
+ console.log(item);
|
|
|
+ },
|
|
|
+ toEdit: function (e) {
|
|
|
+ const { item } = e.currentTarget.dataset;
|
|
|
+ wx.navigateTo({ url: `/pages/match/matchadd?id=${item._id}` })
|
|
|
+ },
|
|
|
+ toDel: async function (e) {
|
|
|
+ const { item } = e.currentTarget.dataset;
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '您确定要删除该条数据吗?',
|
|
|
+ async success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ const arr = await app.$delete(`/newCourt/api/match/${item._id}`);
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 });
|
|
|
+ that.watchLogin()
|
|
|
+ } else {
|
|
|
+ wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
const that = this;
|
|
|
-
|
|
|
+ // 监听用户是否登录
|
|
|
+ that.watchLogin();
|
|
|
+ },
|
|
|
+ watchLogin: function () {
|
|
|
+ const that = this;
|
|
|
+ let searchInfo = that.data.searchInfo;
|
|
|
+ wx.getStorage({
|
|
|
+ key: 'user',
|
|
|
+ success: async (res) => {
|
|
|
+ let info = {};
|
|
|
+ if (searchInfo && searchInfo.name) info.name = searchInfo.name;
|
|
|
+ const arr = await app.$get(`/newCourt/api/match`, { ...info });
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ that.setData({ list: arr.data })
|
|
|
+ } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
|
|
|
+ },
|
|
|
+ fail: async (res) => {
|
|
|
+ wx.redirectTo({ url: '/pages/index/index' });
|
|
|
+ },
|
|
|
+ });
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
@@ -43,7 +84,9 @@ Page({
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
-
|
|
|
+ const that = this;
|
|
|
+ // 监听用户是否登录
|
|
|
+ that.watchLogin();
|
|
|
},
|
|
|
|
|
|
/**
|