Showing
7 changed files
with
85 additions
and
57 deletions
| ... | @@ -9,32 +9,7 @@ | ... | @@ -9,32 +9,7 @@ |
| 9 | </template> | 9 | </template> |
| 10 | 10 | ||
| 11 | <script setup> | 11 | <script setup> |
| 12 | -import Cookies from 'js-cookie' | ||
| 13 | 12 | ||
| 14 | -import axios from '@/utils/axios' | ||
| 15 | -import { Toast } from 'vant' | ||
| 16 | - | ||
| 17 | -/** | ||
| 18 | - * 获取默认儿童信息 | ||
| 19 | - * @returns name, perf_id, kg_id | ||
| 20 | - */ | ||
| 21 | -if (!Cookies.get('default_perf')) { | ||
| 22 | - axios.get('/srv/?a=default_perf') | ||
| 23 | - .then(res => { | ||
| 24 | - if (res.data.code === 1) { | ||
| 25 | - Cookies.set('default_perf', JSON.stringify(res.data.data)); | ||
| 26 | - } else { | ||
| 27 | - console.warn(res); | ||
| 28 | - Toast({ | ||
| 29 | - icon: 'close', | ||
| 30 | - message: res.data.msg | ||
| 31 | - }); | ||
| 32 | - } | ||
| 33 | - }) | ||
| 34 | - .catch(err => { | ||
| 35 | - console.error(err); | ||
| 36 | - }); | ||
| 37 | -} | ||
| 38 | </script> | 13 | </script> |
| 39 | 14 | ||
| 40 | <style lang="less"> | 15 | <style lang="less"> | ... | ... |
| ... | @@ -47,10 +47,13 @@ const onUpload = (v) => { | ... | @@ -47,10 +47,13 @@ const onUpload = (v) => { |
| 47 | // x_field_1是金数据表单传入的参数,老师上传的格式为:user_id-book_id-perf_id,perf_id 为 0 | 47 | // x_field_1是金数据表单传入的参数,老师上传的格式为:user_id-book_id-perf_id,perf_id 为 0 |
| 48 | let str = `${props.user_id}-${v.id}-0`; | 48 | let str = `${props.user_id}-${v.id}-0`; |
| 49 | location.href = `http://jsj.onwall.cn/f/g7D0MT?x_field_1=${str}`; | 49 | location.href = `http://jsj.onwall.cn/f/g7D0MT?x_field_1=${str}`; |
| 50 | + // BUG: 关闭loading临时处理 | ||
| 51 | + setTimeout(() => { | ||
| 52 | + show.value = false; | ||
| 53 | + }, 2000); | ||
| 50 | } | 54 | } |
| 51 | 55 | ||
| 52 | onBeforeRouteLeave(() => { | 56 | onBeforeRouteLeave(() => { |
| 53 | - show.value = false; | ||
| 54 | }) | 57 | }) |
| 55 | </script> | 58 | </script> |
| 56 | 59 | ... | ... |
| ... | @@ -20,7 +20,7 @@ | ... | @@ -20,7 +20,7 @@ |
| 20 | <van-row> | 20 | <van-row> |
| 21 | <van-col span="4" style="line-height: 2;">捐赠人<span style="color: red;">*</span></van-col> | 21 | <van-col span="4" style="line-height: 2;">捐赠人<span style="color: red;">*</span></van-col> |
| 22 | <van-col class="donate-input" span="18"> | 22 | <van-col class="donate-input" span="18"> |
| 23 | - <input v-model="donate_name" type="text" style="border: 0; padding: 0.25rem;" /> | 23 | + <input v-model="item.perf_name" type="text" style="border: 0; padding: 0.25rem;" /> |
| 24 | </van-col> | 24 | </van-col> |
| 25 | </van-row> | 25 | </van-row> |
| 26 | </div> | 26 | </div> |
| ... | @@ -79,13 +79,9 @@ export default { | ... | @@ -79,13 +79,9 @@ export default { |
| 79 | popupHeight: '60%', | 79 | popupHeight: '60%', |
| 80 | show: false, | 80 | show: false, |
| 81 | donate_number: 1, | 81 | donate_number: 1, |
| 82 | - donate_name: '' | ||
| 83 | } | 82 | } |
| 84 | }, | 83 | }, |
| 85 | mounted() { | 84 | mounted() { |
| 86 | - // 缺省儿童信息 | ||
| 87 | - const default_perf = Cookies.get('default_perf') ? JSON.parse(Cookies.get('default_perf')) : ''; | ||
| 88 | - this.donate_name = default_perf.name; | ||
| 89 | }, | 85 | }, |
| 90 | watch: { | 86 | watch: { |
| 91 | showPopup(value, pre) { | 87 | showPopup(value, pre) { |
| ... | @@ -112,7 +108,7 @@ export default { | ... | @@ -112,7 +108,7 @@ export default { |
| 112 | axios.post('/srv/?a=add_donate', { | 108 | axios.post('/srv/?a=add_donate', { |
| 113 | book_id: this.item.book_id, | 109 | book_id: this.item.book_id, |
| 114 | qty: this.donate_number, | 110 | qty: this.donate_number, |
| 115 | - donate_name: this.donate_name, | 111 | + donate_name: this.item.perf_name, |
| 116 | }) | 112 | }) |
| 117 | .then(res => { | 113 | .then(res => { |
| 118 | if (res.data.code === 1) { | 114 | if (res.data.code === 1) { | ... | ... |
| ... | @@ -184,19 +184,26 @@ const onSubscribe = () => { | ... | @@ -184,19 +184,26 @@ const onSubscribe = () => { |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | /*************** 捐书模块START ***************/ | 186 | /*************** 捐书模块START ***************/ |
| 187 | +// 金数据准备数据 | ||
| 188 | +const default_perf = ref({}); | ||
| 189 | +// x_field_1 是金数据表单传入的参数,家长上传的格式为:user_id-book_id-perf_id,perf_id是当前缺省的儿童id | ||
| 190 | +default_perf.value = Cookies.get('default_perf') ? JSON.parse(Cookies.get('default_perf')) : ''; | ||
| 191 | +const str = `${default_perf.value.user_id}-${$route.query.id}-${default_perf.value.perf_id}`; | ||
| 192 | + | ||
| 187 | const donateItem = ref({}) | 193 | const donateItem = ref({}) |
| 194 | +// 捐书数据 | ||
| 195 | +donateItem.value = { | ||
| 196 | + book_id: default_perf.value.book_id, | ||
| 197 | + avatar: default_perf.value.book_cover, | ||
| 198 | + name: default_perf.value.book_name, | ||
| 199 | + price: default_perf.value.book_price, | ||
| 200 | + perf_name: default_perf.value.perf_name | ||
| 201 | +} | ||
| 188 | // 弹出捐赠弹框模块 | 202 | // 弹出捐赠弹框模块 |
| 189 | const showDonate = ref(false); | 203 | const showDonate = ref(false); |
| 190 | 204 | ||
| 191 | const toDonate = () => { | 205 | const toDonate = () => { |
| 192 | showDonate.value = true; | 206 | showDonate.value = true; |
| 193 | - // 捐书数据 | ||
| 194 | - donateItem.value = { | ||
| 195 | - book_id: $route.query.id, | ||
| 196 | - avatar: bookInfo.value.cover, | ||
| 197 | - name: bookInfo.value.name, | ||
| 198 | - price: bookInfo.value.price | ||
| 199 | - } | ||
| 200 | } | 207 | } |
| 201 | 208 | ||
| 202 | const closeDonate = (v) => { | 209 | const closeDonate = (v) => { |
| ... | @@ -231,13 +238,17 @@ const uploadVideo = () => { | ... | @@ -231,13 +238,17 @@ const uploadVideo = () => { |
| 231 | // 已读隐私条例,直接跳转上传页面 | 238 | // 已读隐私条例,直接跳转上传页面 |
| 232 | if (Cookies.get('privacy_notice')) { | 239 | if (Cookies.get('privacy_notice')) { |
| 233 | show.value = true; | 240 | show.value = true; |
| 234 | - // x_field_1 是金数据表单传入的参数,家长上传的格式为:user_id-book_id-perf_id,perf_id是当前缺省的儿童id | ||
| 235 | - let default_perf = Cookies.get('default_perf') ? JSON.parse(Cookies.get('default_perf')) : ''; | ||
| 236 | - let str = `${$route.query.user_id}-${$route.query.id}-${default_perf.perf_id}` | ||
| 237 | location.href = `https://jsjs.onwall.cn/f/NAGn1D?x_field_1=${str}`; | 241 | location.href = `https://jsjs.onwall.cn/f/NAGn1D?x_field_1=${str}`; |
| 242 | + // BUG: 关闭loading临时处理 | ||
| 243 | + setTimeout(() => { | ||
| 244 | + show.value = false; | ||
| 245 | + }, 2000); | ||
| 238 | } else { | 246 | } else { |
| 239 | $router.push({ | 247 | $router.push({ |
| 240 | - path: '/client/privacyNotice' | 248 | + path: '/client/privacyNotice', |
| 249 | + query: { | ||
| 250 | + str | ||
| 251 | + } | ||
| 241 | }) | 252 | }) |
| 242 | } | 253 | } |
| 243 | } else { | 254 | } else { |
| ... | @@ -290,8 +301,6 @@ onActivated(() => { // keepAlive 重置后执行回调 | ... | @@ -290,8 +301,6 @@ onActivated(() => { // keepAlive 重置后执行回调 |
| 290 | } | 301 | } |
| 291 | }); | 302 | }); |
| 292 | } | 303 | } |
| 293 | - // 关闭等待提示 | ||
| 294 | - show.value = false; | ||
| 295 | }); | 304 | }); |
| 296 | 305 | ||
| 297 | const changeRouterKeepAlive = (path, keepAlive) => { | 306 | const changeRouterKeepAlive = (path, keepAlive) => { |
| ... | @@ -477,14 +486,4 @@ export default { | ... | @@ -477,14 +486,4 @@ export default { |
| 477 | text-align: center; | 486 | text-align: center; |
| 478 | } | 487 | } |
| 479 | 488 | ||
| 480 | -.block { | ||
| 481 | - width: 80%; | ||
| 482 | - // height: 25rem; | ||
| 483 | - background-color: #fff; | ||
| 484 | - border-radius: 10px; | ||
| 485 | - padding: 1rem; | ||
| 486 | - position: relative; | ||
| 487 | - margin-top: 1rem; | ||
| 488 | - margin-bottom: 5rem; | ||
| 489 | -} | ||
| 490 | </style> | 489 | </style> | ... | ... |
| ... | @@ -53,6 +53,7 @@ import { bookFn } from '@/composables/useBookList.js' | ... | @@ -53,6 +53,7 @@ import { bookFn } from '@/composables/useBookList.js' |
| 53 | import { ref, reactive } from 'vue' | 53 | import { ref, reactive } from 'vue' |
| 54 | import { useRoute, useRouter } from 'vue-router' | 54 | import { useRoute, useRouter } from 'vue-router' |
| 55 | import _ from 'lodash' | 55 | import _ from 'lodash' |
| 56 | +import axios from '@/utils/axios'; | ||
| 56 | 57 | ||
| 57 | const $route = useRoute(); | 58 | const $route = useRoute(); |
| 58 | const $router = useRouter(); | 59 | const $router = useRouter(); |
| ... | @@ -76,12 +77,36 @@ const styleObject = reactive({ | ... | @@ -76,12 +77,36 @@ const styleObject = reactive({ |
| 76 | 77 | ||
| 77 | // 跳转书籍详情页 | 78 | // 跳转书籍详情页 |
| 78 | const onClick = (item) => { | 79 | const onClick = (item) => { |
| 80 | + /** | ||
| 81 | + * 获取默认儿童信息 | ||
| 82 | + * @returns name, perf_id, kg_id | ||
| 83 | + */ | ||
| 84 | + axios.get('/srv/?a=default_perf', { | ||
| 85 | + params: { | ||
| 86 | + book_id: item.id | ||
| 87 | + } | ||
| 88 | + }) | ||
| 89 | + .then(res => { | ||
| 90 | + if (res.data.code === 1) { | ||
| 91 | + // 缓存缺省儿童信息 | ||
| 92 | + Cookies.set('default_perf', JSON.stringify(res.data.data)) | ||
| 79 | $router.push({ | 93 | $router.push({ |
| 80 | path: '/client/bookDetail', | 94 | path: '/client/bookDetail', |
| 81 | query: { | 95 | query: { |
| 82 | id: item.id | 96 | id: item.id |
| 83 | } | 97 | } |
| 84 | }); | 98 | }); |
| 99 | + } else { | ||
| 100 | + console.warn(res); | ||
| 101 | + Toast({ | ||
| 102 | + icon: 'close', | ||
| 103 | + message: res.data.msg | ||
| 104 | + }); | ||
| 105 | + } | ||
| 106 | + }) | ||
| 107 | + .catch(err => { | ||
| 108 | + console.error(err); | ||
| 109 | + }); | ||
| 85 | } | 110 | } |
| 86 | </script> | 111 | </script> |
| 87 | 112 | ... | ... |
| ... | @@ -42,6 +42,11 @@ const book_id = $route.query.x_field_1 ? $route.query.x_field_1.split('-')[1] : | ... | @@ -42,6 +42,11 @@ const book_id = $route.query.x_field_1 ? $route.query.x_field_1.split('-')[1] : |
| 42 | if (!book_id) { | 42 | if (!book_id) { |
| 43 | Toast.fail('书籍数据不全'); | 43 | Toast.fail('书籍数据不全'); |
| 44 | } | 44 | } |
| 45 | + | ||
| 46 | +/** | ||
| 47 | +* 获取默认儿童信息 | ||
| 48 | +* @returns name, perf_id, kg_id | ||
| 49 | +*/ | ||
| 45 | axios.get('/srv/?a=default_perf', { | 50 | axios.get('/srv/?a=default_perf', { |
| 46 | params: { | 51 | params: { |
| 47 | book_id | 52 | book_id |
| ... | @@ -72,7 +77,8 @@ const toDonate = () => { | ... | @@ -72,7 +77,8 @@ const toDonate = () => { |
| 72 | book_id: donateItem.value.book_id, | 77 | book_id: donateItem.value.book_id, |
| 73 | avatar: donateItem.value.book_cover, | 78 | avatar: donateItem.value.book_cover, |
| 74 | name: donateItem.value.book_name, | 79 | name: donateItem.value.book_name, |
| 75 | - price: donateItem.value.book_price | 80 | + price: donateItem.value.book_price, |
| 81 | + perf_name: donateItem.value.perf_name | ||
| 76 | } | 82 | } |
| 77 | } | 83 | } |
| 78 | 84 | ... | ... |
| ... | @@ -21,6 +21,12 @@ | ... | @@ -21,6 +21,12 @@ |
| 21 | </div> | 21 | </div> |
| 22 | </div> | 22 | </div> |
| 23 | </div> | 23 | </div> |
| 24 | + | ||
| 25 | + <van-overlay :show="show" z-index="9999"> | ||
| 26 | + <div class="wrapper" @click.stop> | ||
| 27 | + <van-loading size="24px">跳转中...</van-loading> | ||
| 28 | + </div> | ||
| 29 | + </van-overlay> | ||
| 24 | </template> | 30 | </template> |
| 25 | 31 | ||
| 26 | <script setup> | 32 | <script setup> |
| ... | @@ -37,9 +43,18 @@ const $router = useRouter(); | ... | @@ -37,9 +43,18 @@ const $router = useRouter(); |
| 37 | const disagree = () => { | 43 | const disagree = () => { |
| 38 | $router.go(-1) | 44 | $router.go(-1) |
| 39 | } | 45 | } |
| 46 | + | ||
| 47 | +const show = ref(false); // 跳转等待提示 | ||
| 48 | + | ||
| 40 | const agree = () => { | 49 | const agree = () => { |
| 50 | + show.value = true; | ||
| 41 | Cookies.set('privacy_notice', '1'); | 51 | Cookies.set('privacy_notice', '1'); |
| 42 | - location.href = 'https://jinshuju.net/f/NAGn1D'; | 52 | + // x_field_1 是金数据表单传入的参数,家长上传的格式为:user_id-book_id-perf_id,perf_id是当前缺省的儿童id |
| 53 | + location.href = `https://jsjs.onwall.cn/f/NAGn1D?x_field_1=${$route.query.str}`; | ||
| 54 | + // BUG: 关闭loading临时处理 | ||
| 55 | + setTimeout(() => { | ||
| 56 | + show.value = false; | ||
| 57 | + }, 2000); | ||
| 43 | } | 58 | } |
| 44 | </script> | 59 | </script> |
| 45 | 60 | ||
| ... | @@ -106,4 +121,13 @@ export default { | ... | @@ -106,4 +121,13 @@ export default { |
| 106 | } | 121 | } |
| 107 | } | 122 | } |
| 108 | } | 123 | } |
| 124 | + | ||
| 125 | +.wrapper { | ||
| 126 | + display: flex; | ||
| 127 | + align-items: center; | ||
| 128 | + justify-content: center; | ||
| 129 | + height: 100%; | ||
| 130 | + width: auto; | ||
| 131 | + text-align: center; | ||
| 132 | +} | ||
| 109 | </style> | 133 | </style> | ... | ... |
-
Please register or login to post a comment