diff --git a/src/components/one-invite-btn.wpy b/src/components/one-invite-btn.wpy index e078d77..4202c84 100644 --- a/src/components/one-invite-btn.wpy +++ b/src/components/one-invite-btn.wpy @@ -77,6 +77,16 @@ align-items: center; justify-content: center; white-space: pre-line; + text-align:center; + } + button::after{ border: none;} + .gray { + -webkit-filter: grayscale(100%); + -moz-filter: grayscale(100%); + -ms-filter: grayscale(100%); + -o-filter: grayscale(100%); + filter: grayscale(100%); + filter: gray; } @@ -49,6 +50,7 @@ import recentGame from '../components/recent-game'; import zanLoadmore from '../components/zan-loadmore'; import inviteView from '../components/invite-view'; + import zanToptips from '../components/zan-toptips' import jcEvent from '../common/jc-event'; import image from '../common/images'; import global from '../common/global'; @@ -69,7 +71,8 @@ recentGame: recentGame, myGame: recentGame, zanLoadmore: zanLoadmore, - inviteView: inviteView + inviteView: inviteView, + zanToptips: zanToptips }; data = { @@ -114,8 +117,10 @@ }, async showInviteView() { let userList = []; + let gameList = []; try { userList = await this.$parent.getShareDetail(); + gameList = await this.myAchieveGames(); } catch (err) { console.log('error get invite user list'); } @@ -131,6 +136,11 @@ status = 1; contentTxt = '点击领取游戏' } + // if (i < gameList.length) { + // status = 2; + // contentTxt = '已领取'; + // btnTitle = '已领取' + // } this.inviteBtns.push({ index: indexList[i], btnTitle: btnTitle, @@ -148,6 +158,7 @@ }, inviteBtnClick(index) { console.log(`invite btn clicked: ${index}`); + this.getRandomGame(); } }; onPullDownRefresh() { @@ -274,6 +285,9 @@ this.current = 0; this.records = []; } + showTopTips(msg, type = 'info') { + this.$invoke('zanToptips', 'showZanTopTips', { content: msg, type: type}) + } async getRecendGames() { try { let res = await http.post('/api/emulated/recent_games'); @@ -284,6 +298,21 @@ console.log('error get recent games'); } } + async getRandomGame() { + let self = this; + try { + let res = await http.post('/api/emulated/give_me_game'); + console.log(res.record); + self.showTopTips('获取游戏成功'); + } catch (err) { + console.log('error get recent games'); + self.showTopTips('获取游戏失败', 'error'); + } + } + async myAchieveGames() { + let res = await http.post('/api/emulated/my_achieve_game'); + return res.records; + } async getMyGames() { try { let res = await http.post('/api/emulated/my_games'); diff --git a/src/style/zanui/btn.wxss b/src/style/zanui/btn.wxss index 0a3b263..a38413f 100644 --- a/src/style/zanui/btn.wxss +++ b/src/style/zanui/btn.wxss @@ -29,6 +29,13 @@ border-color: #0a0; } +.zan-btn--info { + color: #fff; + background-color: #3598dc; + border-color: #3598dc; +} + + .zan-btn--warn { color: #fff; background-color: #f85; @@ -41,6 +48,12 @@ border-color: #e33; } +.zan-btn--error { + color: #fff; + background-color: #f44; + border-color: #e33; +} + /* size */ .zan-btn--small { display: inline-block;