Showing
5 changed files
with
373 additions
and
5 deletions
apps/pages/home/channel/channel.vue
0 → 100644
1 | +<template> | ||
2 | + <!-- <LayoutApp :show-back="true"> | ||
3 | + <div class="body" ref="body"> | ||
4 | + <List></List> | ||
5 | + </div> | ||
6 | + <Footer class="footer"></Footer> | ||
7 | + </LayoutApp> --> | ||
8 | + <div>wdwqdwqdwq </div> | ||
9 | +</template> | ||
10 | + | ||
11 | +<script> | ||
12 | +import Footer from './components/footer'; | ||
13 | +import List from './components/list'; | ||
14 | + | ||
15 | +export default { | ||
16 | + components: { | ||
17 | + Footer, | ||
18 | + List | ||
19 | + } | ||
20 | +}; | ||
21 | +</script> | ||
22 | + | ||
23 | +<style lang="scss" scoped> | ||
24 | +.footer { | ||
25 | + position: absolute; | ||
26 | + bottom: 0; | ||
27 | + width: 100%; | ||
28 | + z-index: 100; | ||
29 | +} | ||
30 | + | ||
31 | +.body { | ||
32 | + height: 100%; | ||
33 | + overflow-y: auto; | ||
34 | +} | ||
35 | +</style> |
1 | +<template> | ||
2 | + <div class="banner"> | ||
3 | + <img :src="resource" alt=""> | ||
4 | + <div class="link" @click="onClick"></div> | ||
5 | + </div> | ||
6 | +</template> | ||
7 | + | ||
8 | +<script> | ||
9 | +import {createNamespacedHelpers} from 'vuex'; | ||
10 | + | ||
11 | +const {mapState} = createNamespacedHelpers('gain'); | ||
12 | + | ||
13 | +export default { | ||
14 | + computed: { | ||
15 | + ...mapState(['resource']) | ||
16 | + }, | ||
17 | + methods: { | ||
18 | + onClick() { | ||
19 | + this.$yoho.goNewPage({ | ||
20 | + url: 'https://activity.yoho.cn/feature/5729.html?title=活动规则&openby:yohobuy={"action":"go.h5","params":{"title":"活动规则","url":"https://activity.yoho.cn/feature/5729.html"}}' | ||
21 | + }); | ||
22 | + } | ||
23 | + } | ||
24 | +}; | ||
25 | +</script> | ||
26 | + | ||
27 | +<style lang="scss" scoped> | ||
28 | +.banner { | ||
29 | + font-size: 0; | ||
30 | + padding-bottom: 20px; | ||
31 | + background-color: #f0f0f0; | ||
32 | + | ||
33 | + img { | ||
34 | + position: relative; | ||
35 | + width: 100%; | ||
36 | + } | ||
37 | + | ||
38 | + .link { | ||
39 | + position: absolute; | ||
40 | + width: 200px; | ||
41 | + height: 200px; | ||
42 | + top: 0; | ||
43 | + right: 0; | ||
44 | + } | ||
45 | +} | ||
46 | +</style> |
1 | +<template> | ||
2 | + <div> | ||
3 | + <div ref='copy' class="btn" @click="onClick"> | ||
4 | + 立即邀请 | ||
5 | + </div> | ||
6 | + </div> | ||
7 | +</template> | ||
8 | + | ||
9 | +<script> | ||
10 | +import {createNamespacedHelpers} from 'vuex'; | ||
11 | +import { get } from 'lodash'; | ||
12 | +import Clipboard from 'clipboard'; | ||
13 | + | ||
14 | +const {mapActions} = createNamespacedHelpers('gain'); | ||
15 | + | ||
16 | +export default { | ||
17 | + name: 'GainFooter', | ||
18 | + data() { | ||
19 | + return { | ||
20 | + isUnionType: false, | ||
21 | + shareUrl: 'https://activity.yoho.cn/feature/5475.html?share_id=8169&title=新人礼遇' | ||
22 | + }; | ||
23 | + }, | ||
24 | + mounted() { | ||
25 | + let vm = this; | ||
26 | + | ||
27 | + this.copyBtn = new Clipboard(this.$refs.copy, { | ||
28 | + text() { | ||
29 | + return vm.shareUrl + `&union_type=${vm.isUnionType}`; | ||
30 | + } | ||
31 | + }); | ||
32 | + | ||
33 | + this.copyBtn.on('success', function() { | ||
34 | + if (vm.isUnionType) { | ||
35 | + vm.$createToast({ | ||
36 | + txt: '邀请链接已复制,快去粘贴吧~', | ||
37 | + type: 'txt' | ||
38 | + }).show(); | ||
39 | + } | ||
40 | + }); | ||
41 | + | ||
42 | + this.copyBtn.on('error', function() { | ||
43 | + }); | ||
44 | + | ||
45 | + this.fetchUnionStatus().then(result => { | ||
46 | + this.isUnionType = get(result, 'data.unionType', false); | ||
47 | + }); | ||
48 | + }, | ||
49 | + methods: { | ||
50 | + ...mapActions(['fetchUnionStatus']), | ||
51 | + | ||
52 | + async onClick() { | ||
53 | + let vm = this; | ||
54 | + | ||
55 | + const user = await this.$sdk.getUser(); | ||
56 | + | ||
57 | + if (!user.uid) { | ||
58 | + this.$sdk.goLogin(); | ||
59 | + return; | ||
60 | + } | ||
61 | + | ||
62 | + if (!vm.isUnionType) { | ||
63 | + this.$yoho.goNewPage({ | ||
64 | + url: 'http://m.yohobuy.com/activity/have-gain/apply?title=有货有赚介绍&openby:yohobuy={"action":"go.h5","params":{"title":"有货有赚介绍","url":"http://m.yohobuy.com/activity/have-gain/apply"}}' | ||
65 | + }); | ||
66 | + return; | ||
67 | + } | ||
68 | + }, | ||
69 | + } | ||
70 | + | ||
71 | +}; | ||
72 | +</script> | ||
73 | + | ||
74 | +<style lang="scss" scoped> | ||
75 | + .btn { | ||
76 | + font-size: 32px; | ||
77 | + width: 100%; | ||
78 | + height: 98px; | ||
79 | + line-height: 98px; | ||
80 | + color: white; | ||
81 | + text-align: center; | ||
82 | + background: #444; | ||
83 | + } | ||
84 | +</style> |
apps/pages/home/channel/components/list.vue
0 → 100644
1 | +<template> | ||
2 | + <div class="list-wrapper"> | ||
3 | + <div class="header-wrapper header-padding" v-if="fixed"> | ||
4 | + <div class="header"> | ||
5 | + <div style="width: 25%; text-align: left;">我邀请的好友</div> | ||
6 | + <div class="register-time">注册时间</div> | ||
7 | + <div style="width: 20%; text-align: right;">我的佣金</div> | ||
8 | + </div> | ||
9 | + </div> | ||
10 | + | ||
11 | + <Scroll ref="scroll" class="list" :options="scrollOptions" :scrollEvents="['scroll']" :data="list" | ||
12 | + @scroll="scroll" | ||
13 | + @pulling-up="onPullingUp"> | ||
14 | + <Banner ref="banner"></Banner> | ||
15 | + | ||
16 | + <div class="list-comp" ref="header"> | ||
17 | + <div class="title">邀请记录</div> | ||
18 | + <div class="header-wrapper"> | ||
19 | + <div class="header"> | ||
20 | + <div style="width: 25%; text-align: left;">我邀请的好友</div> | ||
21 | + <div class="register-time">注册时间</div> | ||
22 | + <div style="width: 20%; text-align: right;">我的佣金</div> | ||
23 | + </div> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + | ||
27 | + <template v-if="list.length"> | ||
28 | + <div class="item" v-for="item in list"> | ||
29 | + <div class="name" | ||
30 | + style="width: 25%; text-align: center; text-overflow:ellipsis; overflow: hidden; white-space: nowrap;"> | ||
31 | + {{item.nickname}} | ||
32 | + </div> | ||
33 | + <div class="register-time">{{item.dateStr}}</div> | ||
34 | + <div class="amount" style="width: 20%; text-align: center;">{{item.amountStr}}</div> | ||
35 | + </div> | ||
36 | + </template> | ||
37 | + | ||
38 | + <div class="empty" v-else> | ||
39 | + 快去邀请好友吧! | ||
40 | + </div> | ||
41 | + | ||
42 | + <div class="footer"> | ||
43 | + </div> | ||
44 | + </Scroll> | ||
45 | + </div> | ||
46 | +</template> | ||
47 | + | ||
48 | +<script> | ||
49 | +import { Scroll } from 'cube-ui'; | ||
50 | +import Banner from './banner'; | ||
51 | +import { createNamespacedHelpers } from 'vuex'; | ||
52 | + | ||
53 | +const { mapState, mapActions } = createNamespacedHelpers('gain'); | ||
54 | + | ||
55 | +export default { | ||
56 | + data() { | ||
57 | + return { | ||
58 | + scrollOptions: { | ||
59 | + bounce: { | ||
60 | + top: false | ||
61 | + }, | ||
62 | + pullUpLoad: true | ||
63 | + }, | ||
64 | + fixed: false | ||
65 | + }; | ||
66 | + }, | ||
67 | + mounted() { | ||
68 | + this.fetchList(); | ||
69 | + this.fetchResource().then(() => { | ||
70 | + this.$nextTick(() => { | ||
71 | + this.$refs.scroll.$forceUpdate(); | ||
72 | + }); | ||
73 | + }); | ||
74 | + }, | ||
75 | + methods: { | ||
76 | + ...mapActions(['fetchList', 'fetchResource']), | ||
77 | + | ||
78 | + async onPullingUp() { | ||
79 | + const result = await this.fetchList(); | ||
80 | + | ||
81 | + if (!result) { | ||
82 | + this.$refs.scroll.$forceUpdate(); | ||
83 | + } | ||
84 | + }, | ||
85 | + scroll({ y }) { | ||
86 | + const height = this.$refs.banner.$el.offsetHeight + this.$refs.header.offsetHeight; | ||
87 | + | ||
88 | + if (-y >= height) { | ||
89 | + this.fixed = true; | ||
90 | + } else { | ||
91 | + this.fixed = false; | ||
92 | + } | ||
93 | + } | ||
94 | + }, | ||
95 | + computed: { | ||
96 | + ...mapState(['list']), | ||
97 | + }, | ||
98 | + components: { | ||
99 | + Scroll, | ||
100 | + Banner | ||
101 | + } | ||
102 | +}; | ||
103 | +</script> | ||
104 | + | ||
105 | +<style lang="scss" scoped> | ||
106 | + .list-comp { | ||
107 | + padding: 40px 30px 0 30px; | ||
108 | + } | ||
109 | + | ||
110 | + .header-padding { | ||
111 | + margin: 0 30px 0 30px; | ||
112 | + z-index: 100; | ||
113 | + background-color: white; | ||
114 | + width: calc(100% - 60px); | ||
115 | + } | ||
116 | + | ||
117 | + .list-wrapper { | ||
118 | + height: 100%; | ||
119 | + } | ||
120 | + | ||
121 | + .list-comp { | ||
122 | + height: 100%; | ||
123 | + } | ||
124 | + | ||
125 | + .title { | ||
126 | + font-size: 34px; | ||
127 | + color: #222; | ||
128 | + text-align: center; | ||
129 | + font-weight: bold; | ||
130 | + margin-bottom: 20px; | ||
131 | + } | ||
132 | + | ||
133 | + .header-wrapper { | ||
134 | + position: relative; | ||
135 | + height: 100px; | ||
136 | + } | ||
137 | + | ||
138 | + .header { | ||
139 | + display: flex; | ||
140 | + font-size: 28px; | ||
141 | + color: #b0b0b0; | ||
142 | + justify-content: space-between; | ||
143 | + height: 100px; | ||
144 | + line-height: 100px; | ||
145 | + | ||
146 | + .fixed { | ||
147 | + position: absolute; | ||
148 | + } | ||
149 | + } | ||
150 | + | ||
151 | + .header:before { | ||
152 | + content: " "; | ||
153 | + position: absolute; | ||
154 | + left: 0; | ||
155 | + bottom: 0; | ||
156 | + width: 100%; | ||
157 | + height: 1px; | ||
158 | + border-top: 1px solid #b0b0b0; | ||
159 | + -webkit-transform-origin: 0 0; | ||
160 | + transform-origin: 0 0; | ||
161 | + -webkit-transform: scaleY(0.5); | ||
162 | + transform: scaleY(0.5); | ||
163 | + } | ||
164 | + | ||
165 | + .register-time { | ||
166 | + position: absolute; | ||
167 | + width: 100%; | ||
168 | + text-align: center; | ||
169 | + } | ||
170 | + | ||
171 | + .list { | ||
172 | + height: 100%; | ||
173 | + } | ||
174 | + | ||
175 | + .item { | ||
176 | + height: 100px; | ||
177 | + font-size: 28px; | ||
178 | + color: #444; | ||
179 | + display: flex; | ||
180 | + border-bottom: 0.5PX solid #e0e0e0; | ||
181 | + line-height: 100px; | ||
182 | + position: relative; | ||
183 | + justify-content: space-between; | ||
184 | + margin: 0 30px 0 30px; | ||
185 | + } | ||
186 | + | ||
187 | + .empty { | ||
188 | + width: 100%; | ||
189 | + height: 150px; | ||
190 | + font-size: 28px; | ||
191 | + color: #b0b0b0; | ||
192 | + line-height: 150px; | ||
193 | + text-align: center; | ||
194 | + } | ||
195 | + | ||
196 | + .footer { | ||
197 | + height: 98px; | ||
198 | + width: 100%; | ||
199 | + } | ||
200 | + | ||
201 | +</style> |
1 | -export default [{ | ||
2 | - // name: 'GainShow', | ||
3 | - // path: '/xianyu/order/show.html', | ||
4 | - // component: () => import(/* webpackChunkName: "gain" */ './order') | ||
5 | -}]; | 1 | +export default [ |
2 | + { | ||
3 | + name: 'channel', | ||
4 | + path: '/xianyu/channel', | ||
5 | + component: () => import('./channel/channel') | ||
6 | + }, | ||
7 | +]; |
-
Please register or login to post a comment