Skip to content

Commit 76528bf

Browse files
committed
fix
1 parent adf08e5 commit 76528bf

File tree

11 files changed

+231
-89
lines changed

11 files changed

+231
-89
lines changed

src/i18n/zh/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ export default {
108108
add_with_lose: '一轮负',
109109
draws: '平局',
110110
invalid_score: '请输入有效的比分'
111+
},
112+
cards: {
113+
111114
}
112115
}
113116
}

src/pages/index.vue

+7-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
</i-grid-icon>
2626
<i-grid-label @click.stop="test">Grid</i-grid-label>
2727
</i-grid-item>
28-
<i-grid-item>
29-
<i-grid-icon>
30-
<i class="ms ms-2b ms-cost"></i>
28+
<i-grid-item @click.stop="test2">
29+
<i-grid-icon @click.stop="test2">
30+
<span class="iconfont gridicon icon-user" @click.stop="test2"></span>
3131
</i-grid-icon>
32-
<i-grid-label>Grid</i-grid-label>
32+
<i-grid-label @click.stop="test2">Grid</i-grid-label>
3333
</i-grid-item>
3434
</i-grid>
3535

@@ -177,6 +177,9 @@ export default {
177177
},
178178
test () {
179179
wx.navigateTo({url: '/subpackage/judge/tiebreaker'})
180+
},
181+
test2 () {
182+
wx.navigateTo({url: '/subpackage/cards/cards'})
180183
}
181184
}
182185
}

src/subpackage/cards/cards.vue

+86-85
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,76 @@
11
<template>
2-
<div class="bodydiv">
2+
<div class="flex-fullheight">
33
<mtHeader color="#353535" :showIcon="true"></mtHeader>
4-
<div class="upText">
5-
<scroll-view id="s_view" scroll-y="true" :scroll-top="scrolltop" >
6-
<div v-for="(item, index) in operList" :key="index" >
7-
<div v-if="index>=operList.length-10">
8-
{{index + 1}}: + {{item}}
4+
<i-tabs :current="currentTab" @change="changeTab">
5+
<i-tab key="tabOracle" :title="'  ORACLE  '"></i-tab>
6+
</i-tabs>
7+
8+
<div class="flex-fullheight" v-if="currentTab == 'tabOracle'">
9+
<i-sticky :scrollTop="oracleScrollTop">
10+
<i-sticky-item :fixedTop="sysinfo.headAreaHeight + 10 + sysinfo.headAreaMarTop + sysinfo.statusBarHeight+'px'" >
11+
<div slot="title">Oracle text:</div>
12+
<div slot="content">
13+
<div style="padding: 10px; line-height: 1.5">
14+
<div>Cave People</div>
15+
<div>{1}{R}{R}</div>
16+
<div>Creature — Human</div>
17+
<div>Whenever Cave People attacks, it gets +1/-2 until end of turn.
18+
{1}{R}{R}, {T}: Target creature gains mountainwalk until end of turn. (It can't be blocked as long as defending player controls a Mountain.)</div>
19+
</div>
20+
21+
<div style="padding: 10px; line-height: 1.5">
22+
<div>Cave People</div>
23+
<div>{1}{R}{R}</div>
24+
<div>Creature — Human</div>
25+
<div>Whenever Cave People attacks, it gets +1/-2 until end of turn.
26+
{1}{R}{R}, {T}: Target creature gains mountainwalk until end of turn. (It can't be blocked as long as defending player controls a Mountain.)</div>
27+
</div>
28+
929
</div>
10-
</div>
11-
</scroll-view>
12-
<div id="s_total">{{operTotal}}</div>
13-
</div>
14-
<div class="btnGroup">
15-
<button data-func="reset" @click="doFunc" class="btnFunc">{{t.common.reset}}</button>
16-
<button data-func="undo" @click="doFunc" class="btnFunc">{{t.common.revert}}</button>
17-
<button data-num="1" @click="addNum" class="btnNum">+1</button>
18-
<button data-num="2" @click="addNum" class="btnNum">+2</button>
19-
<button data-num="3" @click="addNum" class="btnNum">+3</button>
20-
<button data-num="4" @click="addNum" class="btnNum">+4</button>
30+
</i-sticky-item>
31+
32+
<i-sticky-item :fixedTop="sysinfo.headAreaHeight + 10 + sysinfo.headAreaMarTop + sysinfo.statusBarHeight+'px'">
33+
<div slot="title">Card-specific notes:</div>
34+
<div slot="content">
35+
<div style="padding: 10px; line-height: 1.5">
36+
<div>Cave People</div>
37+
<div>{1}{R}{R}</div>
38+
<div>Creature — Human</div>
39+
<div>Whenever Cave People attacks, it gets +1/-2 until end of turn.
40+
{1}{R}{R}, {T}: Target creature gains mountainwalk until end of turn. (It can't be blocked as long as defending player controls a Mountain.)</div>
41+
</div>
42+
43+
<div style="padding: 10px; line-height: 1.5">
44+
<div>Cave People</div>
45+
<div>{1}{R}{R}</div>
46+
<div>Creature — Human</div>
47+
<div>Whenever Cave People attacks, it gets +1/-2 until end of turn.
48+
{1}{R}{R}, {T}: Target creature gains mountainwalk until end of turn. (It can't be blocked as long as defending player controls a Mountain.)</div>
49+
</div>
50+
51+
<div style="padding: 10px; line-height: 1.5">
52+
<div>Cave People</div>
53+
<div>{1}{R}{R}</div>
54+
<div>Creature — Human</div>
55+
<div>Whenever Cave People attacks, it gets +1/-2 until end of turn.
56+
{1}{R}{R}, {T}: Target creature gains mountainwalk until end of turn. (It can't be blocked as long as defending player controls a Mountain.)</div>
57+
</div>
58+
59+
<div style="padding: 10px; line-height: 1.5">
60+
<div>Cave People</div>
61+
<div>{1}{R}{R}</div>
62+
<div>Creature — Human</div>
63+
<div>Whenever Cave People attacks, it gets +1/-2 until end of turn.
64+
{1}{R}{R}, {T}: Target creature gains mountainwalk until end of turn. (It can't be blocked as long as defending player controls a Mountain.)</div>
65+
</div>
66+
</div>
67+
</i-sticky-item>
68+
69+
<i-sticky-item :fixedTop="sysinfo.headAreaHeight + 10 + sysinfo.headAreaMarTop + sysinfo.statusBarHeight+'px'">
70+
<div slot="title">Format legality:</div>
71+
<div slot="content"></div>
72+
</i-sticky-item>
73+
</i-sticky>
2174
</div>
2275
</div>
2376
</template>
@@ -31,9 +84,8 @@ export default {
3184
mpType: 'page',
3285
data () {
3386
return {
34-
operTotal: 0,
35-
operList: [],
36-
scrolltop: 0
87+
currentTab: 'tabOracle',
88+
oracleScrollTop: 0
3789
}
3890
},
3991
computed: {
@@ -47,84 +99,33 @@ export default {
4799
config: {
48100
'usingComponents': {
49101
'i-drawer': '../../../static/iview/drawer/index',
50-
'i-action-sheet': '../../../static/iview/action-sheet/index'
102+
'i-action-sheet': '../../../static/iview/action-sheet/index',
103+
'i-tabs': '../../../static/iview/tabs/index',
104+
'i-tab': '../../../static/iview/tab/index',
105+
'i-modal': '../../../static/iview/modal/index',
106+
'i-message': '../../../static/iview/message/index',
107+
'i-sticky': '../../../static/iview/sticky/index',
108+
'i-sticky-item': '../../../static/iview/sticky-item/index'
51109
}
52110
},
53111
onLoad () {
54112
mta.Page.init()
55113
},
114+
onPageScroll (event) {
115+
console.log(this.oracleScrollTop)
116+
this.oracleScrollTop = event.scrollTop
117+
},
56118
components: {
57119
mtHeader
58120
},
59121
methods: {
60-
addNum (event) {
61-
var i = parseInt(event.target.dataset.num, 10)
62-
this.operTotal += i
63-
this.operList.push(i)
64-
if (this.operTotal === 60) {
65-
wx.vibrateLong({})
66-
}
67-
this.scrolltop = this.operList.length * 100
68-
},
69-
doFunc (event) {
70-
if (event.target.dataset.func === 'reset') {
71-
this.operTotal = 0
72-
this.operList = []
73-
} else {
74-
if (this.operList.length > 0) {
75-
let i = this.operList.pop()
76-
this.operTotal -= i
77-
this.scrolltop = this.operList.length * 100
78-
}
79-
}
122+
changeTab (e) {
123+
this.currentTab = e.mp.detail.key
80124
}
81125
}
82126
}
83127
</script>
84128

85129
<style scope>
86-
.bodydiv {
87-
display: flex;
88-
flex-direction: column;
89-
height: 100%;
90-
}
91-
.btnGroup{
92-
display: flex;
93-
align-self: flex-end;
94-
flex-wrap: wrap;
95-
flex-direction: row;
96-
width:100%;
97-
}
98-
button{
99-
margin-bottom: 1rpx;
100-
}
101-
.btnNum{
102-
width: 374rpx;
103-
height: 200rpx;
104-
font-size: 42px;
105-
}
106-
.btnFunc{
107-
width: 374rpx;
108-
height: 100rpx;
109-
}
110-
.upText{
111-
width: 750rpx;
112-
flex-grow: 1;
113-
display: flex;
114-
flex-wrap: nowrap;
115-
flex-direction: row;
116-
background-color: #353535;
117-
padding-bottom: 20px;
118-
}
119-
#s_total{
120-
color: #fff;
121-
font-size: 72px;
122-
padding-right: 10px;
123-
}
124-
#s_view{
125-
padding:10px;
126-
color: #fff;
127-
font-size: 20px;
128-
flex:1;
129-
}
130+
130131
</style>

static/iview/sticky-item/index.js

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Component({
2+
externalClasses: ['i-class'],
3+
properties: {
4+
fixedTop: {
5+
type: String,
6+
value: '0'
7+
}
8+
},
9+
options: {
10+
multipleSlots: true
11+
},
12+
relations: {
13+
'../sticky/index': {
14+
type: 'parent'
15+
}
16+
},
17+
data: {
18+
top: 0,
19+
height: 0,
20+
isFixed: false,
21+
index: -1
22+
},
23+
methods: {
24+
updateScrollTopChange (scrollTop) {
25+
const data = this.data
26+
let top = data.top
27+
28+
let fixed = parseFloat(this.data.fixedTop)
29+
if (isNaN(fixed)) {
30+
fixed = 0
31+
}
32+
const height = data.height
33+
this.setData({
34+
isFixed: !!((scrollTop >= top - fixed + 10 && scrollTop < top - fixed + height + 10))
35+
})
36+
},
37+
updateDataChange (index) {
38+
const className = '.i-sticky-item'
39+
const query = wx.createSelectorQuery().in(this)
40+
query.select(className).boundingClientRect((res) => {
41+
if (res) {
42+
console.log(res)
43+
this.setData({
44+
top: res.top,
45+
height: res.height,
46+
index: index
47+
})
48+
}
49+
}).exec()
50+
}
51+
}
52+
})

static/iview/sticky-item/index.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"component": true
3+
}

static/iview/sticky-item/index.wxml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<view class="i-sticky-item">
2+
<view class="i-sticky-item-header i-class {{ isFixed === true ? 'i-sticky-fixed' : '' }}">
3+
<view class="i-sticky-title" style="{{isFixed === true ? 'top: ' + fixedTop : ''}}">
4+
<slot name="title"></slot>
5+
</view>
6+
</view>
7+
<view class="i-index-item-content">
8+
<slot name="content"></slot>
9+
</view>
10+
</view>

static/iview/sticky-item/index.wxss

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.i-sticky-item-header{background:#eee;font-size:16px;font-weight:bold;width:100%;height:32px;line-height:32px}.i-sticky-item-content{font-size:14px}.i-sticky-title{width:100%;padding:0 15px;box-sizing:border-box;background:#eee}.i-sticky-fixed .i-sticky-title{position:fixed;}

static/iview/sticky/index.js

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Component({
2+
externalClasses: ['i-class'],
3+
properties : {
4+
scrollTop : {
5+
type : Number,
6+
observer(val){
7+
this._updateScrollTopChange();
8+
}
9+
}
10+
},
11+
relations : {
12+
'../sticky-item/index' : {
13+
type : 'child',
14+
linked(){
15+
this._updateDataChange();
16+
},
17+
linkChanged () {
18+
this._updateDataChange();
19+
},
20+
unlinked () {
21+
this._updateDataChange();
22+
}
23+
}
24+
},
25+
data : {
26+
timer : null,
27+
itemLength : 0,
28+
},
29+
methods : {
30+
_updateScrollTopChange(){
31+
const stickies = this.getRelationNodes('../sticky-item/index');
32+
if( stickies.length > 0 ){
33+
stickies.forEach((item) => {
34+
if( item ){
35+
item.updateScrollTopChange( this.data.scrollTop );
36+
}
37+
})
38+
}
39+
},
40+
_updateDataChange( ){
41+
const stickies = this.getRelationNodes('../sticky-item/index');
42+
if( stickies.length > 0 ){
43+
if( this.data.timer ){
44+
clearTimeout( this.data.timer )
45+
this.setData({
46+
timer : null
47+
})
48+
}
49+
this.data.timer = setTimeout(()=>{
50+
stickies.forEach((item,index) => {
51+
if( item ){
52+
item.updateDataChange(index);
53+
}
54+
})
55+
},0)
56+
this.setData({
57+
timer : this.data.timer
58+
})
59+
}
60+
}
61+
}
62+
63+
})

static/iview/sticky/index.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"component": true
3+
}

static/iview/sticky/index.wxml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<view class="i-sticky i-class">
2+
<slot></slot>
3+
</view>

static/iview/sticky/index.wxss

Whitespace-only changes.

0 commit comments

Comments
 (0)