Showing
2 changed files
with
44 additions
and
12 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-04-10 14:16:36 | 2 | * @Date: 2024-04-10 14:16:36 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-04-12 23:15:09 | 4 | + * @LastEditTime: 2024-04-13 10:40:09 |
| 5 | * @FilePath: /fxPark/src/components/danmaku.vue | 5 | * @FilePath: /fxPark/src/components/danmaku.vue |
| 6 | * @Description: 弹幕组件 | 6 | * @Description: 弹幕组件 |
| 7 | --> | 7 | --> |
| ... | @@ -52,9 +52,11 @@ watch(() => props.text, (v) => { | ... | @@ -52,9 +52,11 @@ watch(() => props.text, (v) => { |
| 52 | watch(() => props.show, (v) => { | 52 | watch(() => props.show, (v) => { |
| 53 | nextTick(() => { | 53 | nextTick(() => { |
| 54 | if (v) { | 54 | if (v) { |
| 55 | - danmakuRef.value.show() | 55 | + danmakuRef.value.show(); |
| 56 | + $('.danmu-boxer').css('zIndex', '10'); | ||
| 56 | } else { | 57 | } else { |
| 57 | - danmakuRef.value.hide() | 58 | + danmakuRef.value.hide(); |
| 59 | + $('.danmu-boxer').css('zIndex', '0'); | ||
| 58 | } | 60 | } |
| 59 | }) | 61 | }) |
| 60 | }, { | 62 | }, { | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-04-07 10:15:55 | 2 | * @Date: 2024-04-07 10:15:55 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-04-13 08:46:06 | 4 | + * @LastEditTime: 2024-04-14 10:05:55 |
| 5 | * @FilePath: /fxPark/src/views/fxPark/index.vue | 5 | * @FilePath: /fxPark/src/views/fxPark/index.vue |
| 6 | * @Description: 首页 | 6 | * @Description: 首页 |
| 7 | --> | 7 | --> |
| ... | @@ -23,12 +23,10 @@ | ... | @@ -23,12 +23,10 @@ |
| 23 | </div> | 23 | </div> |
| 24 | </div> | 24 | </div> |
| 25 | <div class="container" v-for="(item, index) in data_list" :key="index" @click="onChipClick()"> | 25 | <div class="container" v-for="(item, index) in data_list" :key="index" @click="onChipClick()"> |
| 26 | - <img :src="item.chip_src" class="img"> | 26 | + <img :src="item.chip_src" class="img" :style="{ zIndex: index }"> |
| 27 | + <!-- 示例范围标记 --> | ||
| 28 | + <!-- <div class="range"></div> --> | ||
| 27 | </div> | 29 | </div> |
| 28 | - <!-- <div style="position: fixed; bottom: 1rem; left: 0; right: 0; display: flex; z-index: 25;justify-content: space-evenly;"> --> | ||
| 29 | - <!-- <div v-if="all_actived" @click="onShare" style="display: inline-flex; padding: 0.6rem 2rem; color: #F68015; background-color: #fff; align-items: center; border-radius: 1.5rem;">分享海报</div> --> | ||
| 30 | - <!-- <div @click="commentsBtn" style="display: inline-flex; padding: 0.6rem 2rem; color: #fff; background-color: #F68015;align-items: center; border-radius: 1.5rem;">弹幕留言</div> --> | ||
| 31 | - <!-- </div> --> | ||
| 32 | 30 | ||
| 33 | <van-action-sheet v-model:show="show_danmu_message" title="留言" :round="false" :close-on-click-overlay="false" :closeable="false"> | 31 | <van-action-sheet v-model:show="show_danmu_message" title="留言" :round="false" :close-on-click-overlay="false" :closeable="false"> |
| 34 | <div class="danmu-input-wrapper" :style="{ height: space_height }"> | 32 | <div class="danmu-input-wrapper" :style="{ height: space_height }"> |
| ... | @@ -46,7 +44,11 @@ | ... | @@ -46,7 +44,11 @@ |
| 46 | <div v-if="spaceDiv" :style="{ height: space_height }"></div> | 44 | <div v-if="spaceDiv" :style="{ height: space_height }"></div> |
| 47 | </van-action-sheet> | 45 | </van-action-sheet> |
| 48 | 46 | ||
| 49 | - <van-floating-bubble icon="chat" @click="onCloseDanmu" /> | 47 | + <van-floating-bubble v-model:offset="offset" axis="xy" :gap="10" @click="onCloseDanmu"> |
| 48 | + <div style="font-size: 0.7rem;"> | ||
| 49 | + 弹幕<br/>开关 | ||
| 50 | + </div> | ||
| 51 | + </van-floating-bubble> | ||
| 50 | 52 | ||
| 51 | <div v-if="show_danmu" class="danmu-boxer"> | 53 | <div v-if="show_danmu" class="danmu-boxer"> |
| 52 | <div class="danmu-boxer-btn" @click="commentsBtn">发一条友好的弹幕吧</div> | 54 | <div class="danmu-boxer-btn" @click="commentsBtn">发一条友好的弹幕吧</div> |
| ... | @@ -102,6 +104,8 @@ const TREE_CHIP = { // 碎片图结构 | ... | @@ -102,6 +104,8 @@ const TREE_CHIP = { // 碎片图结构 |
| 102 | }, | 104 | }, |
| 103 | }; | 105 | }; |
| 104 | 106 | ||
| 107 | +const offset = ref({ x: -10, y: 500 }); | ||
| 108 | + | ||
| 105 | const data_list = ref([]); | 109 | const data_list = ref([]); |
| 106 | const all_actived = ref(false); // 全部激活 | 110 | const all_actived = ref(false); // 全部激活 |
| 107 | 111 | ||
| ... | @@ -132,6 +136,20 @@ onMounted(async () => { | ... | @@ -132,6 +136,20 @@ onMounted(async () => { |
| 132 | // | 136 | // |
| 133 | data_list.value = data; | 137 | data_list.value = data; |
| 134 | } | 138 | } |
| 139 | + // | ||
| 140 | + // nextTick(() => { | ||
| 141 | + // $('.container').on('click', function(event) { | ||
| 142 | + // const rect = event.target.getBoundingClientRect(); // 获取图片位置信息 | ||
| 143 | + // const x = event.clientX - rect.left; // 鼠标点击位置相对于图片左边的距离 | ||
| 144 | + // const y = event.clientY - rect.top; // 鼠标点击位置相对于图片顶部的距离 | ||
| 145 | + // // 示例范围标记位置 | ||
| 146 | + // $('.range').css({ left: x + 'px', top: y + 'px' }).show(); // 更新范围标记位置并显示 | ||
| 147 | + // // 判断点击范围是否在图片的矩形内 | ||
| 148 | + // if (x >= 0 && x <= 50 && y >= 0 && y <= 50) { | ||
| 149 | + // alert('点击了图片的矩形范围内'); | ||
| 150 | + // } | ||
| 151 | + // }); | ||
| 152 | + // }); | ||
| 135 | }); | 153 | }); |
| 136 | 154 | ||
| 137 | const RefDanmu = ref(null); | 155 | const RefDanmu = ref(null); |
| ... | @@ -241,10 +259,10 @@ const onCloseDanmu = () => { // 弹幕开关 | ... | @@ -241,10 +259,10 @@ const onCloseDanmu = () => { // 弹幕开关 |
| 241 | } | 259 | } |
| 242 | .container { | 260 | .container { |
| 243 | width: 100%; | 261 | width: 100%; |
| 244 | - height: 100%; | 262 | + height: 100vh; |
| 245 | background-size: contain; | 263 | background-size: contain; |
| 246 | position: absolute; | 264 | position: absolute; |
| 247 | - z-index: 1; | 265 | + // z-index: 1; |
| 248 | top: 0; | 266 | top: 0; |
| 249 | left: 0; | 267 | left: 0; |
| 250 | background-repeat: no-repeat; | 268 | background-repeat: no-repeat; |
| ... | @@ -256,6 +274,18 @@ const onCloseDanmu = () => { // 弹幕开关 | ... | @@ -256,6 +274,18 @@ const onCloseDanmu = () => { // 弹幕开关 |
| 256 | object-fit: cover; | 274 | object-fit: cover; |
| 257 | } | 275 | } |
| 258 | } | 276 | } |
| 277 | + /* 示例范围标记 */ | ||
| 278 | + .range { | ||
| 279 | + position: absolute; | ||
| 280 | + top: 0; | ||
| 281 | + left: 0; | ||
| 282 | + width: 50px; | ||
| 283 | + height: 50px; | ||
| 284 | + border: 2px solid red; | ||
| 285 | + pointer-events: none; /* 防止遮挡点击事件 */ | ||
| 286 | + display: none; /* 初始隐藏 */ | ||
| 287 | + z-index: 999; | ||
| 288 | + } | ||
| 259 | } | 289 | } |
| 260 | 290 | ||
| 261 | .danmu-input-wrapper { | 291 | .danmu-input-wrapper { | ... | ... |
-
Please register or login to post a comment