guhongwei il y a 2 ans
Parent
commit
5e24b5237a
2 fichiers modifiés avec 17 ajouts et 2 suppressions
  1. 0 1
      pages/match/index.js
  2. 17 1
      pagesMatch/match/info.js

+ 0 - 1
pages/match/index.js

@@ -33,7 +33,6 @@ Page({
                         wx.navigateTo({ url: `/pagesMatch/system/index` })
                     } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }
                 }
-
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })

+ 17 - 1
pagesMatch/match/info.js

@@ -50,7 +50,23 @@ Page({
     //比赛报名
     toSign: function (e) {
         const { item } = e.currentTarget.dataset;
-        wx.navigateTo({ url: `/pagesMatch/match/sign?id=${item._id}` })
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                if (res.data.type == '10') {
+                    wx.showModal({ title: '提示', content: '游客不能进入比赛系统,请注册成为正式用户' })
+                } else {
+                    const arr = await app.$post(`/user/login`, { openid: res.data.openid }, 'race');
+                    if (arr.errcode == '0') {
+                        wx.setStorageSync('raceuser', arr.data);
+                        wx.navigateTo({ url: `/pagesMatch/match/sign?id=${item._id}` })
+                    } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }
+                }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
     },
     // 赛事项目详细信息
     toAchieve: function (e) {