hookehuyr

✨ feat(选择幼儿园): 新需求样式调整,列表变成排行榜形式

...@@ -2,35 +2,41 @@ ...@@ -2,35 +2,41 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-05-30 10:20:34 3 * @Date: 2022-05-30 10:20:34
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-05-31 11:56:24 5 + * @LastEditTime: 2022-05-31 16:30:54
6 * @FilePath: /tswj/src/components/RankingList/index.vue 6 * @FilePath: /tswj/src/components/RankingList/index.vue
7 --> 7 -->
8 <template> 8 <template>
9 - <!-- TODO: 捐赠排行榜item组件完善 --> 9 + <div class="wrapper">
10 - <div style="margin: 1rem 0; background-color: #FFF; position: relative;">
11 <van-row> 10 <van-row>
12 - <van-col span="2" style="position: relative;"> 11 + <van-col span="2" class="rank">
13 - <div style="position: absolute; top: 0; left: 20%;"> 12 + <div v-if="indexKey < 3" class="avatar">
14 - <van-icon :name="icon_ranking" size="1.25rem" /> 13 + <van-icon v-if="indexKey === 0" :name="icon_ranking1" size="1.75rem" />
14 + <van-icon v-if="indexKey === 1" :name="icon_ranking2" size="1.75rem" />
15 + <van-icon v-if="indexKey === 2" :name="icon_ranking3" size="1.75rem" />
15 </div> 16 </div>
16 - <div style="position: absolute; top: 0; left: 40%;">1</div> 17 + <div v-else class="text">{{ indexKey + 1 }}</div>
17 </van-col> 18 </van-col>
18 - <van-col span="18" style="padding: 1rem 0;"> 19 + <van-col span="18" style="padding: 1rem 0.5rem 1rem 0;">
19 - <!-- 如果多个学校遍历包裹结构 --> 20 + <div :class="[rankInfo.multi_name ? 'height6rem' : 'height3rem', 'kg-name']" @click="go('/client/chooseBook', { kg_id: rankInfo.id })">
20 - <div style="position: relative; height: 3rem;" @click="go('/client/chooseBook', { kg_id: item.id })">
21 <van-row align="center" justify="center" style="position: relative; top: 50%; transform: translateY(-50%);"> 21 <van-row align="center" justify="center" style="position: relative; top: 50%; transform: translateY(-50%);">
22 <van-col span="4"> 22 <van-col span="4">
23 - <van-image round width="3rem" height="3rem" :src="item.avatar ? item.avatar : icon_avatar" style="vertical-align: text-bottom;" /> 23 + <van-image round width="3rem" height="3rem" :src="rankInfo.avatar ? rankInfo.avatar : icon_avatar" style="vertical-align: text-bottom;" />
24 </van-col> 24 </van-col>
25 <van-col span="20"> 25 <van-col span="20">
26 - <p class="title">{{ item.name }}</p> 26 + <div v-if="rankInfo.multi_name" style="margin-left: 0.5rem;">
27 + <p>{{ rankInfo.multi_name[0] }}</p>
28 + <p>{{ rankInfo.multi_name[1] }}</p>
29 + </div>
30 + <p v-else style="margin-left: 0.5rem;">
31 + {{ rankInfo.name }}
32 + </p>
27 </van-col> 33 </van-col>
28 </van-row> 34 </van-row>
29 </div> 35 </div>
30 </van-col> 36 </van-col>
31 <van-col span="2"> 37 <van-col span="2">
32 - <div style="text-align: center; position: absolute; top: 40%;" @click="go('/client/donateList', { kg_id: item.id })"> 38 + <div class="flower" @click="go('/client/donateList', { kg_id: rankInfo.id })">
33 - <van-icon name="arrow" color="#c5c5c5" size="1.25rem" />3000 39 + <van-icon :name="icon_flower" color="#c5c5c5" size="1.25rem" style="vertical-align: bottom;" />&nbsp;3000
34 </div> 40 </div>
35 </van-col> 41 </van-col>
36 </van-row> 42 </van-row>
...@@ -39,7 +45,13 @@ ...@@ -39,7 +45,13 @@
39 45
40 <script setup> 46 <script setup>
41 import icon_avatar from '@images/que-logo@2x.png' 47 import icon_avatar from '@images/que-logo@2x.png'
42 -import icon_ranking from '@images/icon-shoucang02@2x.png' 48 +import icon_ranking1 from '@images/1@2x.png'
49 +import icon_ranking2 from '@images/2@2x.png'
50 +import icon_ranking3 from '@images/3@2x.png'
51 +import icon_flower from '@images/xiaohua@2x.png'
52 +
53 +import { ref } from 'vue'
54 +import _ from 'lodash'
43 55
44 import { useGo } from '@/hooks/useGo' 56 import { useGo } from '@/hooks/useGo'
45 const go = useGo() 57 const go = useGo()
...@@ -51,30 +63,65 @@ const props = defineProps({ ...@@ -51,30 +63,65 @@ const props = defineProps({
51 default(rawProps) { 63 default(rawProps) {
52 return rawProps 64 return rawProps
53 } 65 }
66 + },
67 + indexKey: {
68 + type: Number,
69 + default(rawProps) {
70 + return rawProps
71 + }
54 } 72 }
55 }) 73 })
56 const emit = defineEmits(['on-icon-click']); 74 const emit = defineEmits(['on-icon-click']);
57 const handle = () => { 75 const handle = () => {
58 emit('on-icon-click', '') 76 emit('on-icon-click', '')
59 } 77 }
78 +const rankInfo = ref('');
79 +rankInfo.value = _.cloneDeep(props.item);
80 +// TEMP: 测试数据
81 +// rankInfo.value.name = rankInfo.value.name + ' ' + rankInfo.value.name;
82 +// 有空格分割name
83 +if (rankInfo.value.name.indexOf(' ') > -1) {
84 + rankInfo.value.multi_name = rankInfo.value.name.split(' ');
85 +}
60 </script> 86 </script>
61 87
62 <style lang="less" scoped> 88 <style lang="less" scoped>
63 .wrapper { 89 .wrapper {
64 - background-color: #fff; 90 + margin: 1rem 0;
65 - margin: 2rem 0; 91 + background-color: #FFF;
66 - height: 3rem; 92 + position: relative;
67 - // overflow: auto; 93 +
94 + .rank {
95 + position: relative;
96 +
97 + .avatar {
98 + position: absolute;
99 + top: 0;
100 + left: 20%;
101 + }
102 +
103 + .text {
104 + position: absolute;
105 + top: 0.5rem;
106 + left: 40%;
107 + color: #84909F;
108 + }
109 + }
110 + .flower {
111 + text-align: center; position: absolute; top: 40%; color: #713610;
112 + }
113 +
114 + .kg-name {
115 + position: relative;
116 + height: 3rem;
117 + }
68 118
69 - .avatar { 119 + .height3rem {
70 - vertical-align: middle; 120 + height: 3rem;
71 } 121 }
72 122
73 - .title { 123 + .height6rem {
74 - color: #222222; 124 + height: 6rem;
75 - display: inline-block;
76 - vertical-align: super;
77 - margin-left: 2rem;
78 } 125 }
79 } 126 }
80 </style> 127 </style>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-04-21 11:21:39 3 * @Date: 2022-04-21 11:21:39
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-05-31 11:30:12 5 + * @LastEditTime: 2022-05-31 15:52:12
6 * @FilePath: /tswj/src/views/client/chooseSchool.vue 6 * @FilePath: /tswj/src/views/client/chooseSchool.vue
7 * @Description: 选择学校列表 7 * @Description: 选择学校列表
8 --> 8 -->
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
11 <div class="modify-top" /> 11 <div class="modify-top" />
12 <div class="wrapper-content"> 12 <div class="wrapper-content">
13 <template v-for="(item, key) in schoolList" :key="key"> 13 <template v-for="(item, key) in schoolList" :key="key">
14 - <ranking-item :item="item" /> 14 + <ranking-item :item="item" :index-key="key" />
15 </template> 15 </template>
16 </div> 16 </div>
17 </div> 17 </div>
......