1111 </h1 >
1212 <div class =" fusion-champion" >
1313 <div class =" fusion-champion-item" >
14- <img :src =" results.top_two[0].image" >
15- <span >{{results.top_two[0].name}}</span >
14+ <img
15+ v-if =" results.match.oneNibble.image"
16+ :src =" results.match.oneNibble.image"
17+ >
18+ <span v-if =" results.match.oneNibble.name" >{{results.match.oneNibble.name}}</span >
1619 </div >
1720 <img
1821 class =" cross-mark"
1922 src =" ~/assets/images/cross-mark.png"
2023 alt =" ×"
2124 >
2225 <div class =" fusion-champion-item" >
23- <img :src =" results.top_two[1].image" >
24- <span >{{results.top_two[1].name}}</span >
26+ <img
27+ v-if =" results.match.twoNibble.image"
28+ :src =" results.match.twoNibble.image"
29+ >
30+ <span v-if =" results.match.twoNibble.name" >{{results.match.twoNibble.name}}</span >
2531 </div >
2632 </div >
2733 <div >
3137 alt =" with"
3238 >
3339 <img
34- class =" fusion-champion-candidate"
35- :src =" results.candidates[2].image"
40+ class =" fusion-champion-alcoholic-beverage"
41+ v-if =" results.match.alcoholicBeverage.image"
42+ :src =" results.match.alcoholicBeverage.image"
3643 >
44+ <span class =" fusion-champion-alcoholic-beverage-name" v-if =" results.match.alcoholicBeverage.name" >{{results.match.alcoholicBeverage.name}}</span >
3745 </div >
38- <button
46+ <!-- < button
3947 class="start-review-button"
4048 type="button"
41- >レビューする</button >
49+ >レビューする</button> -->
4250 </div >
4351 <div class =" result-others" >
4452 <h2 >その他のマッチする食事</h2 >
@@ -60,61 +68,54 @@ export default {
6068 data : () => ({
6169 results: [],
6270 }),
71+ watch: {
72+ results (newValue ) {
73+ console .log (newValue);
74+ this .results = this .fetchResults ();
75+ },
76+ },
6377 created () {
6478 this .results = this .fetchResults ();
6579 },
6680 methods: {
6781 fetchResults () {
82+ // console.log(this.$route.params.swipes);
83+
84+ const { alcoholicBeverage , selectNibbles } = this .$route .params .swipes ;
85+
86+ const likedNibbles = selectNibbles
87+ .map ((sn ) => {
88+ if (sn .likeLevel !== 0 ) return sn;
89+ })
90+ .filter ((v ) => v);
91+
92+ const sortedLikedNibbles = likedNibbles .sort ((ln1 , ln2 ) => {
93+ return (ln1 .likedLevel + Math .floor (Math .random () * 8 ) + 1 ) - (ln2 .likedLebel + Math .floor (Math .random () * 6 ) + 1 )
94+ });
95+ const [oneNibble , twoNibble , ... candicates ] = sortedLikedNibbles;
96+
97+ // const d = await this.$axios.$post("/nibbles/results", requestPayload);
98+ // console.log(d);
6899 // 結果を取得するAPIを叩く
69100 // バックエンド対応待ち
70101 // とりあえずダミーデータ
102+ console .log ({
103+ match: {
104+ id: 12 , // レビューページ用組み合わせID
105+ alcoholicBeverage: alcoholicBeverage,
106+ oneNibble: oneNibble,
107+ twoNibble: twoNibble,
108+ },
109+ candidates: candicates,
110+ });
71111 return {
72- top_two: [
73- {
74- id: 1 ,
75- name: " 餃子" ,
76- image:
77- " https://1.bp.blogspot.com/-JgCCcKaPehk/XuRAqUWJgLI/AAAAAAABZgQ/hY77s2QpJjQG1kk78jR91O4LRrinBRWaQCNcBGAsYHQ/s1600/food_jelly_fry.png" ,
78- },
79- {
80- id: 2 ,
81- name: " ごはん" ,
82- image:
83- " https://4.bp.blogspot.com/-S9iMvM5-DcI/VoX5L4XQDlI/AAAAAAAA2TA/JiN-OviBAcE/s800/food_mamegohan.png" ,
84- },
85- ],
86- candidates: [
87- {
88- id: 1 ,
89- name: " パスタ" ,
90- image: require (" ~/assets/images/red-wine.png" ),
91- },
92- {
93- id: 2 ,
94- name: " パスタ" ,
95- image: require (" ~/assets/images/red-wine.png" ),
96- },
97- {
98- id: 3 ,
99- name: " パスタ" ,
100- image: require (" ~/assets/images/red-wine.png" ),
101- },
102- {
103- id: 4 ,
104- name: " パスタ" ,
105- image: require (" ~/assets/images/red-wine.png" ),
106- },
107- {
108- id: 5 ,
109- name: " パスタ" ,
110- image: require (" ~/assets/images/red-wine.png" ),
111- },
112- {
113- id: 6 ,
114- name: " パスタ" ,
115- image: require (" ~/assets/images/red-wine.png" ),
116- },
117- ],
112+ match: {
113+ id: 12 , // レビューページ用組み合わせID
114+ alcoholicBeverage: alcoholicBeverage,
115+ oneNibble: oneNibble,
116+ twoNibble: twoNibble,
117+ },
118+ candidates: candicates,
118119 };
119120 },
120121 },
@@ -173,7 +174,7 @@ export default {
173174}
174175
175176.fusion-champion-item > span {
176- @apply my-2 font-bold;
177+ @apply block my-2 font-bold;
177178}
178179
179180.fusion-champion-item > img {
@@ -184,16 +185,21 @@ export default {
184185}
185186
186187.with-image {
187- @apply mx-auto my-8 h-8;
188+ @apply mx-auto my-6 h-8;
188189}
189190
190191.start-review-button {
191192 @apply block mx-auto mt-8 px-8 py-2 w-1/ 2 rounded-full text-center border-2 border-white;
192193 background : linear-gradient (to bottom right, #ff7186 , #ff7186 80 % , #ff7a5c );
193194}
194195
195- .fusion-champion-candidate {
196+ .fusion-champion-alcoholic-beverage {
196197 @apply block mx-auto my-4 rounded-lg shadow-lg;
198+ max-height : 240 px ;
199+ }
200+
201+ .fusion-champion-alcoholic-beverage-name {
202+ @apply block my-2 font-bold text-center text-lg;
197203}
198204
199205.result-others {
@@ -210,10 +216,14 @@ export default {
210216
211217.result-others-list > li {
212218 @apply w-2/ 5 mx-2 my-1 text-center font-bold relative;
219+ height : 120 px ;
213220}
214221
215222.result-others-list img {
216223 @apply rounded-lg;
224+ object-fit : cover;
225+ height : 100 % ;
226+ width : 100 % ;
217227}
218228
219229.result-others-list span {
0 commit comments