Showing
2 changed files
with
35 additions
and
9 deletions
| ... | @@ -45,7 +45,7 @@ | ... | @@ -45,7 +45,7 @@ |
| 45 | </van-row> | 45 | </van-row> |
| 46 | </div> | 46 | </div> |
| 47 | <template v-for="(item, key) in kgInfo.book" :key="key"> | 47 | <template v-for="(item, key) in kgInfo.book" :key="key"> |
| 48 | - <book-card :item="item" type="B" @on-click="onClick(item)"></book-card> | 48 | + <book-card :item="item" type="B" :user_id="kgInfo.user_id" @on-click="onClick(item)"></book-card> |
| 49 | </template> | 49 | </template> |
| 50 | </div> | 50 | </div> |
| 51 | <div style="height: 1rem;"></div> | 51 | <div style="height: 1rem;"></div> | ... | ... |
| ... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
| 10 | <p style=" margin-bottom: 0.5rem;">您是否愿意与偏远山区的小朋友</p> | 10 | <p style=" margin-bottom: 0.5rem;">您是否愿意与偏远山区的小朋友</p> |
| 11 | <p>共读这么精彩的书籍</p> | 11 | <p>共读这么精彩的书籍</p> |
| 12 | </div> | 12 | </div> |
| 13 | - <div style="padding: 0 15% 0.5rem 15%;"> | 13 | + <div v-if="book_id" style="padding: 0 15% 0.5rem 15%;"> |
| 14 | <my-button @on-click="toDonate" type="plain">我要爱心捐书</my-button> | 14 | <my-button @on-click="toDonate" type="plain">我要爱心捐书</my-button> |
| 15 | </div> | 15 | </div> |
| 16 | <div style="padding: 0 15% 1rem 15%;"> | 16 | <div style="padding: 0 15% 1rem 15%;"> |
| ... | @@ -36,20 +36,43 @@ const $route = useRoute(); | ... | @@ -36,20 +36,43 @@ const $route = useRoute(); |
| 36 | const $router = useRouter(); | 36 | const $router = useRouter(); |
| 37 | 37 | ||
| 38 | /*************** 捐书模块START ***************/ | 38 | /*************** 捐书模块START ***************/ |
| 39 | + | ||
| 39 | const donateItem = ref({}) | 40 | const donateItem = ref({}) |
| 41 | +const book_id = $route.query.x_field_1 ? $route.query.x_field_1.split('-')[1] : ''; | ||
| 42 | +if (!book_id) { | ||
| 43 | + Toast.fail('书籍数据不全'); | ||
| 44 | +} | ||
| 45 | +axios.get('/srv/?a=default_perf', { | ||
| 46 | + params: { | ||
| 47 | + book_id | ||
| 48 | + } | ||
| 49 | +}) | ||
| 50 | +.then(res => { | ||
| 51 | + if (res.data.code === 1) { | ||
| 52 | + donateItem.value = res.data.data; | ||
| 53 | + } else { | ||
| 54 | + console.warn(res); | ||
| 55 | + Toast({ | ||
| 56 | + icon: 'close', | ||
| 57 | + message: res.data.msg | ||
| 58 | + }); | ||
| 59 | + } | ||
| 60 | +}) | ||
| 61 | +.catch(err => { | ||
| 62 | + console.error(err); | ||
| 63 | +}); | ||
| 40 | 64 | ||
| 41 | -// TODO: 作品上传完成后,回调到成功页面,需要返回书籍的详情 | ||
| 42 | // 弹出捐赠弹框模块 | 65 | // 弹出捐赠弹框模块 |
| 43 | const showDonate = ref(false); | 66 | const showDonate = ref(false); |
| 44 | 67 | ||
| 45 | const toDonate = () => { | 68 | const toDonate = () => { |
| 46 | showDonate.value = true; | 69 | showDonate.value = true; |
| 47 | - // TODO: 这些信息到时候需要后台带过来 | 70 | + // 生成捐赠数据 |
| 48 | donateItem.value = { | 71 | donateItem.value = { |
| 49 | - book_id: '314134', | 72 | + book_id: donateItem.value.book_id, |
| 50 | - avatar: 'https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPngc434046fdf1f9499d251b280af2568ddbe64839799d00a9aee226edbeb710aed', | 73 | + avatar: donateItem.value.book_cover, |
| 51 | - name: '逃家小兔绘本', | 74 | + name: donateItem.value.book_name, |
| 52 | - price: '59' | 75 | + price: donateItem.value.book_price |
| 53 | } | 76 | } |
| 54 | } | 77 | } |
| 55 | 78 | ||
| ... | @@ -60,7 +83,10 @@ const closeDonate = (v) => { | ... | @@ -60,7 +83,10 @@ const closeDonate = (v) => { |
| 60 | 83 | ||
| 61 | const goBack = () => { | 84 | const goBack = () => { |
| 62 | $router.push({ | 85 | $router.push({ |
| 63 | - path: '/client/bookDetail' | 86 | + path: '/client/bookDetail', |
| 87 | + query: { | ||
| 88 | + id: donateItem.value.book_id | ||
| 89 | + } | ||
| 64 | }) | 90 | }) |
| 65 | } | 91 | } |
| 66 | 92 | ... | ... |
-
Please register or login to post a comment