Showing
3 changed files
with
86 additions
and
6 deletions
| ... | @@ -10,6 +10,8 @@ declare module 'vue' { | ... | @@ -10,6 +10,8 @@ declare module 'vue' { |
| 10 | Danmaku: typeof import('./src/components/danmaku.vue')['default'] | 10 | Danmaku: typeof import('./src/components/danmaku.vue')['default'] |
| 11 | RouterLink: typeof import('vue-router')['RouterLink'] | 11 | RouterLink: typeof import('vue-router')['RouterLink'] |
| 12 | RouterView: typeof import('vue-router')['RouterView'] | 12 | RouterView: typeof import('vue-router')['RouterView'] |
| 13 | + VanActionSheet: typeof import('vant/es')['ActionSheet'] | ||
| 14 | + VanField: typeof import('vant/es')['Field'] | ||
| 13 | VanIcon: typeof import('vant/es')['Icon'] | 15 | VanIcon: typeof import('vant/es')['Icon'] |
| 14 | VanImage: typeof import('vant/es')['Image'] | 16 | VanImage: typeof import('vant/es')['Image'] |
| 15 | VanLoading: typeof import('vant/es')['Loading'] | 17 | VanLoading: typeof import('vant/es')['Loading'] | ... | ... |
| 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-10 14:22:14 | 4 | + * @LastEditTime: 2024-04-11 14:19:23 |
| 5 | * @FilePath: /fxPark/src/components/danmaku.vue | 5 | * @FilePath: /fxPark/src/components/danmaku.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div class="danmaku-page"> | 9 | <div class="danmaku-page"> |
| 10 | - <vue-danmaku ref="danmaku" v-model:danmus="danmus" useSlot loop :channels="4" :speeds="50" :top="20" style="height:12rem; width:100vw; position: absolute; top:0; z-index: 10;"> | 10 | + <vue-danmaku ref="danmaku" v-model:danmus="danmus" useSlot loop :channels="2" :speeds="50" :top="0" style="height:15rem; width:100vw; position: absolute; top:0; z-index: 10; padding-top: 1rem;"> |
| 11 | <template v-slot:dm="{ index, danmu }"> | 11 | <template v-slot:dm="{ index, danmu }"> |
| 12 | - <span style="background-color: rgba(48, 48, 48, 0.50); padding: 0.25rem 1rem; border-radius: 14px;">{{ index }}{{ danmu.name }}:{{ danmu.text }}</span> | 12 | + <div style="background-color: rgba(48, 48, 48, 0.50); padding: 0.25rem 1rem; border-radius: 14px; margin-top: 1rem;">{{ danmu.text }}</div> |
| 13 | </template> | 13 | </template> |
| 14 | </vue-danmaku> | 14 | </vue-danmaku> |
| 15 | </div> | 15 | </div> |
| ... | @@ -28,8 +28,21 @@ const $route = useRoute(); | ... | @@ -28,8 +28,21 @@ const $route = useRoute(); |
| 28 | const $router = useRouter(); | 28 | const $router = useRouter(); |
| 29 | useTitle($route.meta.title); | 29 | useTitle($route.meta.title); |
| 30 | 30 | ||
| 31 | +const props = defineProps({ | ||
| 32 | + text: { | ||
| 33 | + type: Object, | ||
| 34 | + default: {} | ||
| 35 | + } | ||
| 36 | +}); | ||
| 37 | + | ||
| 38 | +watch(() => props.text, (v) => { | ||
| 39 | + if (v.text) { | ||
| 40 | + danmaku.value.add(v) | ||
| 41 | + } | ||
| 42 | +}); | ||
| 43 | + | ||
| 31 | const danmaku = ref(null) | 44 | const danmaku = ref(null) |
| 32 | -const danmus = ref([{ avatar: 'http://a.com/a.jpg', name: 'a', text: 'aaa' }, { avatar: 'http://a.com/b.jpg', name: 'b', text: 'bbb' }]) | 45 | +const danmus = ref([{ name: 'a', text: 'aaa' }, { name: 'b', text: 'bbb' }]) |
| 33 | 46 | ||
| 34 | </script> | 47 | </script> |
| 35 | 48 | ... | ... |
| 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-10 15:01:38 | 4 | + * @LastEditTime: 2024-04-11 14:52:47 |
| 5 | * @FilePath: /fxPark/src/views/fxPark/index.vue | 5 | * @FilePath: /fxPark/src/views/fxPark/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div class="fxPark-page"> | 9 | <div class="fxPark-page"> |
| 10 | - <danmaku /> | 10 | + <danmaku :text="add_text" /> |
| 11 | <div class="quick-entrance-wrapper"> | 11 | <div class="quick-entrance-wrapper"> |
| 12 | <div class="quick-entrance-item" style=""> | 12 | <div class="quick-entrance-item" style=""> |
| 13 | <van-icon name="chat-o" /> <span>植物之声</span> | 13 | <van-icon name="chat-o" /> <span>植物之声</span> |
| ... | @@ -16,6 +16,37 @@ | ... | @@ -16,6 +16,37 @@ |
| 16 | <div class="container" v-for="(item, index) in img_list" :key="index" @click="onClick(item)"> | 16 | <div class="container" v-for="(item, index) in img_list" :key="index" @click="onClick(item)"> |
| 17 | <img :src="item.src" class="img"> | 17 | <img :src="item.src" class="img"> |
| 18 | </div> | 18 | </div> |
| 19 | + <div style="position: fixed; bottom: 1rem; left: 0; right: 0; display: flex; z-index: 25;justify-content: space-evenly;"> | ||
| 20 | + <div style="display: inline-flex; padding: 0.6rem 2rem; color: #F68015; background-color: #fff; align-items: center; border-radius: 1.5rem;">分享海报</div> | ||
| 21 | + <div @click="commentsBtn" style="display: inline-flex; padding: 0.6rem 2rem; color: #fff; background-color: #F68015;align-items: center; border-radius: 1.5rem;">弹幕留言</div> | ||
| 22 | + </div> | ||
| 23 | + | ||
| 24 | + <van-action-sheet v-model:show="show_danmu" title="留言" :round="false" :close-on-click-overlay="false" @cancel="onCancel"> | ||
| 25 | + <div style="padding: 1rem 0; height: 10vh; display: flex; padding: 0.5rem;"> | ||
| 26 | + <!-- <van-field | ||
| 27 | + v-model="message" | ||
| 28 | + rows="3" | ||
| 29 | + autosize | ||
| 30 | + label="" | ||
| 31 | + type="textarea" | ||
| 32 | + placeholder="请输入留言" | ||
| 33 | + @blur="onBlur" | ||
| 34 | + /> --> | ||
| 35 | + <van-field | ||
| 36 | + v-model="message" | ||
| 37 | + rows="3" | ||
| 38 | + autosize | ||
| 39 | + label="" | ||
| 40 | + type="textarea" | ||
| 41 | + placeholder="请输入留言" | ||
| 42 | + @blur="onBlur" | ||
| 43 | + @focus="onFocus" | ||
| 44 | + style="background-color: #F3F3F3; padding: 1rem; border-radius: 5px; flex: 1; margin-right: 1rem;" | ||
| 45 | + /> | ||
| 46 | + <div @click="sendMessage" style="display: flex; align-items: flex-end; justify-content: center; margin-right: 0.5rem;">发送</div> | ||
| 47 | + </div> | ||
| 48 | + <div v-if="spaceDiv" style="height: 10vh;"></div> | ||
| 49 | + </van-action-sheet> | ||
| 19 | </div> | 50 | </div> |
| 20 | </template> | 51 | </template> |
| 21 | 52 | ||
| ... | @@ -36,6 +67,10 @@ const $route = useRoute(); | ... | @@ -36,6 +67,10 @@ const $route = useRoute(); |
| 36 | const $router = useRouter(); | 67 | const $router = useRouter(); |
| 37 | useTitle($route.meta.title); | 68 | useTitle($route.meta.title); |
| 38 | 69 | ||
| 70 | +const show_danmu = ref(false); | ||
| 71 | +const message = ref(''); | ||
| 72 | +const add_text = ref({}); | ||
| 73 | + | ||
| 39 | const img_list = ref([{ | 74 | const img_list = ref([{ |
| 40 | src:'https://cdn.ipadbiz.cn/tmp/fx_park/s1.png' , | 75 | src:'https://cdn.ipadbiz.cn/tmp/fx_park/s1.png' , |
| 41 | }, { | 76 | }, { |
| ... | @@ -63,10 +98,40 @@ const onClick = (item) => { | ... | @@ -63,10 +98,40 @@ const onClick = (item) => { |
| 63 | } | 98 | } |
| 64 | }); | 99 | }); |
| 65 | } | 100 | } |
| 101 | + | ||
| 102 | +const commentsBtn = () => { | ||
| 103 | + show_danmu.value = true; | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | +const spaceDiv = ref(false); | ||
| 107 | + | ||
| 108 | +const sendMessage = () => { | ||
| 109 | + show_danmu.value = false; | ||
| 110 | + console.warn(message.value); | ||
| 111 | + add_text.value = { | ||
| 112 | + name: '123', | ||
| 113 | + text: message.value | ||
| 114 | + } | ||
| 115 | + // | ||
| 116 | + message.value = ''; | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | +const onBlur = () => { | ||
| 120 | + spaceDiv.value = false; | ||
| 121 | +} | ||
| 122 | + | ||
| 123 | +const onFocus = () => { | ||
| 124 | + spaceDiv.value = true; | ||
| 125 | +} | ||
| 126 | + | ||
| 127 | +const onCancel = () => { | ||
| 128 | + console.warn(0); | ||
| 129 | +} | ||
| 66 | </script> | 130 | </script> |
| 67 | 131 | ||
| 68 | <style lang="less" scoped> | 132 | <style lang="less" scoped> |
| 69 | .fxPark-page { | 133 | .fxPark-page { |
| 134 | + position: relative; | ||
| 70 | .quick-entrance-wrapper { | 135 | .quick-entrance-wrapper { |
| 71 | .quick-entrance-item { | 136 | .quick-entrance-item { |
| 72 | position: absolute; | 137 | position: absolute; | ... | ... |
-
Please register or login to post a comment