hookehuyr

✨ feat(快捷访问组件): 页面拖动到底部后,动态切换快捷访问的高度

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-05-21 09:35:14 3 * @Date: 2022-05-21 09:35:14
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-22 19:47:53 5 + * @LastEditTime: 2022-06-24 14:26:37
6 * @FilePath: /tswj/src/views/client/bookDetail.vue 6 * @FilePath: /tswj/src/views/client/bookDetail.vue
7 * @Description: 7 * @Description:
8 --> 8 -->
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
105 <my-button type="primary" @on-click="toDonate">爱心助力</my-button> 105 <my-button type="primary" @on-click="toDonate">爱心助力</my-button>
106 </div> 106 </div>
107 </div> 107 </div>
108 - <shortcut-fixed :type="USER_ROLE.CLIENT" :item="['home', 'me']" /> 108 + <shortcut-fixed :type="USER_ROLE.CLIENT" :item="['home', 'me']" :custom-style="customStyle" />
109 </div> 109 </div>
110 110
111 <!-- 上传时,如果没有默认儿童提示弹框, 如果没有实名认证提示弹框 --> 111 <!-- 上传时,如果没有默认儿童提示弹框, 如果没有实名认证提示弹框 -->
...@@ -146,6 +146,9 @@ const $router = useRouter(); ...@@ -146,6 +146,9 @@ const $router = useRouter();
146 const { toggleLanguage, onLoad, columns, prod_list, finished, loading, bookInfo, showPicker, checkLocalism, checkMandarin, onConfirm, chooseLanguage, finishedTextStatus, emptyStatus } = useVideoList(); 146 const { toggleLanguage, onLoad, columns, prod_list, finished, loading, bookInfo, showPicker, checkLocalism, checkMandarin, onConfirm, chooseLanguage, finishedTextStatus, emptyStatus } = useVideoList();
147 let { userInfo } = useDefaultPerf($route.query.id); 147 let { userInfo } = useDefaultPerf($route.query.id);
148 148
149 +const customStyle = ref({
150 + bottom: '8rem'
151 +})
149 const donateInfo = ref({}) 152 const donateInfo = ref({})
150 const userType = Cookies.get('userType') 153 const userType = Cookies.get('userType')
151 // 判断是访客进入还是幼儿园进入 154 // 判断是访客进入还是幼儿园进入
...@@ -159,6 +162,22 @@ onMounted(async () => { ...@@ -159,6 +162,22 @@ onMounted(async () => {
159 // 判断是否显示简介的展开图标 162 // 判断是否显示简介的展开图标
160 hasToggle.value = hasEllipsis(`book-intro`); 163 hasToggle.value = hasEllipsis(`book-intro`);
161 }, 500); 164 }, 500);
165 + // 监听滚动到底部
166 + window.onscroll = function () {
167 + //变量scrollTop是滚动条滚动时,距离顶部的距离
168 + const scrollTop = document.documentElement.scrollTop||document.body.scrollTop;
169 + //变量windowHeight是可视区的高度
170 + const windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
171 + //变量scrollHeight是滚动条的总高度
172 + const scrollHeight = document.documentElement.scrollHeight||document.body.scrollHeight;
173 + //滚动条到底部的条件
174 + if(scrollTop + windowHeight === scrollHeight){
175 + // console.warn("距顶部"+scrollTop+"可视区高度"+windowHeight+"滚动条总高度"+scrollHeight);
176 + customStyle.value.bottom = '35%'
177 + } else {
178 + customStyle.value.bottom = '8rem'
179 + }
180 + }
162 }) 181 })
163 182
164 // 判断是否显示简介的展开图标 183 // 判断是否显示简介的展开图标
......