bltcn
2023-11-23 41c686109df0a7017fb8c82001496e7f04552504
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<template>
    <div class="page page-home">
        <header class="page-home-header">
            <img class="logo-img" src="./assets/images/logo.png" alt="">
            <ul>
                <li :ref="item.ref" v-for="(item, index) in headerList" :key="index" @click="anchorTo(item)">
                    <p>{{item.name}}</p>
                </li>
                <li @click="toPage({link: 'https://github.com/alibaba-damo-academy/FunASR'})">
                    Github
                </li>
                <li>
                    社区交流
                </li>
                <div :style="{width: lineWidth + 'px', left: lineLeft + 'px'}" class="line"></div>
            </ul>
            <div class="search-box">
                <img src="./assets/images/ss.png" alt="">
                <a-input placeholder="请输入关键字" />
            </div>
            <div class="language-box">
                中文/EN
            </div>
        </header>
 
        <banner-comp ref="funasrJs" />
 
        <hxgn-comp ref="hxgn" />
 
        <mxjs-comp ref="mxjs" />
 
        <lxwjzxfw-comp ref="lxwj" />
 
        <sstx-comp ref="sstx" />
 
        <footer class="page-home-footer">
            <div class="gywm">
                <img src="./assets/images/footer-logo.png" alt="">
                <ul v-for="(item, index) in footerList" :key="index">
                    <h3>{{item.title}}</h3>
                    <li @click="toPage(cItem)" v-for="(cItem, cIndex) in item.childer" :key="cIndex">
                        {{cItem.name}}
                    </li>
                </ul>
            </div>
 
            <!-- <div class="line-box">
                <div></div>
            </div>
 
            <div class="ba-box">
                <ul>
                    <li>
                        Copyright @ 1998 - 2023 Tancant. All Rights Reserved.北科软件公司 版权所有
                    </li>
                    <li>
                        公司地址:武汉市洪山区野芷湖西路16号创意天地10号高层13楼
                    </li>
                    <li>
                        联系电话: 400 862 6126
                    </li>
                </ul>
            </div> -->
        </footer>
 
    </div>
</template>
 
<script>
    import bannerComp from './banner.vue'
    import hxgnComp from './hxgn.vue'
    import mxjsComp from './mxjs.vue'
    import lxwjzxfwComp from './lxwjzxfw.vue'
    import sstxComp from './sstx.vue'
    export default {
        name: 'page-home',
        components: {
            bannerComp,
            hxgnComp,
            mxjsComp,
            lxwjzxfwComp,
            sstxComp
        },
        data () {
            return {
                headerList: [
                    {
                        name: 'funasr介绍',
                        ref: 'h-funasrJs',
                        isAnchor: true
                    },
                    {
                        name: '核心功能',
                        ref: 'h-hxgn',
                        isAnchor: true
                    },
                    {
                        name: 'Paraformer模型介绍',
                        ref: 'h-mxjs',
                        isAnchor: true
                    },
                    {
                        name: '离线文件转写服务',
                        ref: 'h-lxwj',
                        isAnchor: true
                    },
                    {
                        name: '实时听写',
                        ref: 'h-sstx',
                        isAnchor: true
                    }
                    // {
                    //     name: 'Github',
                    //     ref: 'h-github'
                    // },
                    // {
                    //     name: '社区交流',
                    //     ref: 'h-sqjl'
                    // }
                ],
                footerList: [
                    {
                        title: 'Funasr介绍',
                        childer: [
                            {
                                name: '关于我们',
                                link: 'https://www.baidu.com/'
                            }
                        ]
                    },
                    {
                        title: '核心功能',
                        childer: [
                            {
                                name: '核心介绍',
                                link: ''
                            }
                        ]
                    },
                    {
                        title: 'Paraformer模型介绍',
                        childer: [
                            {
                                name: '模型结构固',
                                link: ''
                            },
                            {
                                name: '模型介绍',
                                link: ''
                            }
                        ]
                    },
                    {
                        title: '离线文件转写服务',
                        childer: [
                            {
                                name: '原理图',
                                link: ''
                            },
                            {
                                name: '文字介绍',
                                link: ''
                            },
                            {
                                name: '安装',
                                link: ''
                            },
                            {
                                name: '使用',
                                link: ''
                            },
                            {
                                name: '视频教程链接',
                                link: ''
                            }
                        ]
                    },
                    {
                        title: '实时听写',
                        childer: [
                            {
                                name: '原理图',
                                link: ''
                            },
                            {
                                name: '文字介绍',
                                link: ''
                            },
                            {
                                name: '安装',
                                link: ''
                            },
                            {
                                name: '使用',
                                link: ''
                            },
                            {
                                name: '视频教程链接',
                                link: ''
                            }
                        ]
                    }
                ],
                headerActive: 'h-funasrJs',
                lineWidth: 0,
                lineLeft: 0
            }
        },
        created () {},
        mounted () {
            this.$nextTick(() => {
                this.getLineWidth()
                this.handlerNodeScroll()
                this.getAnchorDetails()
            })
        },
        methods: {
            // 底部跳转
            toPage (item) {
                if (item.link) window.open(item.link)
            },
            // 获取元素的高度,距离顶部距离
            getAnchorDetails () {
                for (let i = 0; i < this.headerList.length; i++) {
                    const item = this.headerList[i]
                    if (item.isAnchor) {
                        const refName = item.ref.split('-')[1]
                        const dom = this.$refs[refName].$el
                        item.height = dom.offsetHeight
                        item.top = dom.offsetTop
                    }
                }
            },
            // 头部锚点按钮
            anchorTo (item) {
                this.headerActive = item.ref
                this.getLineWidth()
                if (item.isAnchor) {
                    const refName = item.ref.split('-')[1]
                    this.scrollToFn(refName)
                }
            },
            // 设置滚动距离
            scrollToFn (refName) {
                const dom = this.$refs[refName].$el
                const top = dom.offsetTop
 
                const appContentScrollbar = document.getElementsByClassName('app-content-scrollbar')[0]
                const uiModalWrap = appContentScrollbar.getElementsByClassName('ui-scrollbar__wrap')[0]
 
                uiModalWrap.scrollTo({
                    top: top - 70,
                    left: 0,
                    behavior: 'smooth'
                })
            },
            // 获取头部选中样式
            getLineWidth () {
                const dom = this.$refs[this.headerActive][0]
                if (!dom) return
                this.lineWidth = dom.offsetWidth
                this.lineLeft = dom.offsetLeft
            },
            // 监听元素滚动
            handlerNodeScroll () {
                const self = this
                // 函数防抖
                const fun = self.debounce(e => {
                    // 距顶部
                    const scrollTop = e.target.scrollTop
                    let toActive = null
                    for (let i = 0; i < self.headerList.length; i++) {
                        const item = self.headerList[i]
                        if (scrollTop > (item.top - 90)) {
                            toActive = item
                        }
                    }
                    if (toActive && toActive.top) {
                        self.headerActive = toActive.ref
                        self.getLineWidth()
                    }
                }, 100)
 
                // 监听滚动
                const appContentScrollbar = document.getElementsByClassName('app-content-scrollbar')[0]
                const uiModalWrap = appContentScrollbar.getElementsByClassName('ui-scrollbar__wrap')[0]
                uiModalWrap.addEventListener('scroll', function (e) {
                    fun(e)
                })
            },
            // 函数防抖
            debounce (handle, delay) {
                let timer = null
                return function () {
                    const _self = this
                    const _args = arguments
                    clearTimeout(timer)
                    timer = setTimeout(function () {
                        handle.apply(_self, _args)
                    }, delay)
                }
            }
        }
    }
</script>
<style src="./assets/css/index.scss" lang="scss"></style>