Skip to content

Commit

Permalink
Merge pull request #33 from School-of-Website-Engineering/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mason369 authored Jan 19, 2023
2 parents a703fc3 + 33614dd commit 2bf5d4c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/components/home/List.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<ul class="list">
<li v-for="item in [10, 20, 30, 40]" :key="item">
<li v-for="(item,index) in arr" :key="item.id" v-show="index<4">
<section>
<img src="../../assets/img/listimg.jpg" alt="" />
<img :src="`http://sc.wolfcode.cn${item.coverImg}`" alt="" />
<div class="bottom-box">
<h3>商品标题</h3>
<p>200 积分</p>
<h3>{{item.name}}</h3>
<p>{{ item.coin }} 积分</p>
<div class="btn">立即兑换</div>
</div>
<img
Expand All @@ -25,6 +25,7 @@

<script>
export default {
props: ["arr"],
data() {
return {};
},
Expand All @@ -41,6 +42,10 @@ export default {
flex-wrap: wrap;
li {
& section :nth-child(1) {
width: 285px;
height: 330px;
}
&:nth-of-type(4n) {
margin-right: 0px;
}
Expand Down
3 changes: 3 additions & 0 deletions src/request/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import qs from "qs";
//精品推荐
export const reqGetRecommended = () => request.get("/products/recommend");

//热门兑换
export const reqGetHot = () => request.get("/products/hot");

//短信验证码
export const reqGetSmsCode = (params) => request.post("/sendSMS", qs.stringify( params ));

Expand Down
10 changes: 9 additions & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<script>
import JfTitle from "@/components/home/JfTitle";
import List from "@/components/home/List";
import { reqGetHot, reqGetRecommended } from "@/request/api";
export default {
name : "Home",
components: { JfTitle, List },
Expand All @@ -59,7 +60,14 @@ export default {
remenArr : []
};
},
created() {}
async created() {
// 精品
const { data: boutique } = await reqGetRecommended();
this.jingpinArr = boutique.data.records;
// 热门
const { data: popular } = await reqGetHot();
this.remenArr = popular.data.records;
}
};
</script>

Expand Down

0 comments on commit 2bf5d4c

Please sign in to comment.