Commit 31c7db49 by 李伟康

commit 修复

1 parent 07977df4
<template> <template>
<view class="case-box"> <view class="case-box">
<view class="nav-bar"> <view class="nav-bar">
<view class="back" @click="back"> <view
<uni-icons type="left" :size="20" color="#000"></uni-icons> class="back"
@click="back"
>
<uni-icons
type="left"
:size="20"
color="#000"
></uni-icons>
</view> </view>
{{ caseObject.title }} {{ caseObject.title }}
</view> </view>
<view class="case-content"> <view class="case-content">
<view class="left-menu"> <view class="left-menu">
<view class="title">方案目录</view> <view class="title">方案目录</view>
<scroll-view scroll-y class="scroll" :scroll-into-view="`menu-${currentId}`" @scroll="menuScroll"> <scroll-view
<view class="scroll-content" id="scroll-content"> scroll-y
class="scroll"
:scroll-into-view="`menu-${currentId}`"
@scroll="menuScroll"
>
<view
class="scroll-content"
id="scroll-content"
>
<template v-for="(item, index) in detailInfo"> <template v-for="(item, index) in detailInfo">
<view class="item" :key="index"> <view
<view :class="['name', isLast(index), isActive(item)]" @click="menuClick(item)"> class="item"
<view class="text text-hide" :id="`menu-${item.id}`">{{ item.headings }}</view> :key="index"
>
<view
:class="['name', isLast(index), isActive(item)]"
@click="menuClick(item)"
>
<view
class="text text-hide"
:id="`menu-${item.id}`"
>{{ item.headings }}</view>
</view> </view>
<template v-if="item.children && item.children.length"> <template v-if="item.children && item.children.length">
<template v-for="(i, j) in item.children"> <template v-for="(i, j) in item.children">
<view :class="['name', isLast(index, j, item.children), isActive(i)]" :key="j" @click="menuClick(i)"> <view
<view class="text" :id="`menu-${i.id}`"> :class="['name', isLast(index, j, item.children), isActive(i)]"
:key="j"
@click="menuClick(i)"
>
<view
class="text"
:id="`menu-${i.id}`"
>
<view class="icon"></view> <view class="icon"></view>
<view class="text-hide">{{ i.headings }}</view> <view class="text-hide">{{ i.headings }}</view>
</view> </view>
...@@ -29,40 +60,96 @@ ...@@ -29,40 +60,96 @@
</view> </view>
</template> </template>
<template v-if="currentId"> <template v-if="currentId">
<view class="block" :style="blockTop"></view> <view
class="block"
:style="blockTop"
></view>
</template> </template>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<scroll-view class="right-content" scroll-y :scroll-into-view="`case-${contentId}`" @scroll="contentScroll" enable-flex> <scroll-view
class="right-content"
scroll-y
:scroll-into-view="`case-${contentId}`"
@scroll="contentScroll"
enable-flex
>
<!-- scroll-with-animation --> <!-- scroll-with-animation -->
<template v-for="(item, index) in detailInfo"> <template v-for="(item, index) in detailInfo">
<view class="detail-item" :key="item.id"> <view
<view class="item-title" :id="`case-${item.id}`">{{ item.headings }}</view> class="detail-item"
:key="item.id"
>
<view
class="item-title"
:id="`case-${item.id}`"
>{{ item.headings }}</view>
<template v-if="item.audio"> <template v-if="item.audio">
<audio-component :src="item.audio" @onPlay="onPlay(item)" :ref="`audio-${item.id}`" :audioKey="`key${item.id}`" /> <audio-component
:src="item.audio"
@onPlay="onPlay(item)"
:ref="`audio-${item.id}`"
:audioKey="`key${item.id}`"
/>
</template> </template>
<view class="item-content"> <view class="item-content">
<rich-text :nodes="item.content"></rich-text> <rich-text :nodes="item.content"></rich-text>
</view> </view>
<template v-for="(i, ind) in item.imgList"> <template v-for="(i, ind) in item.imgList">
<view class="picture" :key="`img-${index}-${ind}`" :id="`img-${index}-${ind}`" :data-item="item" :data-index="ind"> <view
<image :src="i.url" class="item-img" mode="widthFix" @load="imgLoad" v-if="i.visible"></image> class="picture"
:key="`img-${index}-${ind}`"
:id="`img-${index}-${ind}`"
:data-item="item"
:data-index="ind"
>
<image
:src="i.url"
class="item-img"
mode="widthFix"
@load="imgLoad"
v-if="i.visible"
></image>
</view> </view>
</template> </template>
<template v-if="item.children && item.children.length"> <template v-if="item.children && item.children.length">
<template v-for="(i, s) in item.children"> <template v-for="(i, s) in item.children">
<view class="sub-item-content" :key="s"> <view
<view class="item-title sub-item-title flex" :id="`case-${i.id}`">{{ i.headings }}</view> class="sub-item-content"
:key="s"
>
<view
class="item-title sub-item-title flex"
:id="`case-${i.id}`"
>{{ i.headings }}</view>
<template v-if="i.audio"> <template v-if="i.audio">
<audio-component :src="i.audio" @onPlay="onPlay(i)" :ref="`audio-${i.id}`" :audioKey="`key${i.id}`" /> <audio-component
:src="i.audio"
@onPlay="onPlay(i)"
:ref="`audio-${i.id}`"
:audioKey="`key${i.id}`"
/>
</template> </template>
<view class="item-content"> <view class="item-content">
<rich-text :nodes="i.content"></rich-text> <rich-text :nodes="i.content"></rich-text>
</view> </view>
<template v-for="(c, k) in i.imgList"> <template v-for="(c, k) in i.imgList">
<view class="picture" :key="`cimg-${s}-${k}`" :id="`cimg-${s}-${k}`" :data-item="i" :data-index="k" data-is-child> <view
<image :src="c.url" class="item-img" mode="widthFix" @load="imgLoad" v-if="c.visible"></image> class="picture"
:key="`cimg-${s}-${k}`"
:id="`cimg-${s}-${k}`"
:data-item="i"
:data-index="k"
data-is-child
>
<image
:src="c.url"
class="item-img"
mode="widthFix"
@load="imgLoad"
v-if="c.visible"
></image>
</view> </view>
</template> </template>
</view> </view>
...@@ -230,17 +317,21 @@ export default { ...@@ -230,17 +317,21 @@ export default {
await detailInfo.map(async e => { await detailInfo.map(async e => {
let query = uni.createSelectorQuery() let query = uni.createSelectorQuery()
query.select(`#case-${e.id}`).boundingClientRect(data => { query.select(`#case-${e.id}`).boundingClientRect(data => {
if (data) {
topList.push(data.top - itemHeight + contentScrollNumber) topList.push(data.top - itemHeight + contentScrollNumber)
e.top = data.top - itemHeight + contentScrollNumber e.top = data.top - itemHeight + contentScrollNumber
itemList.push(e) itemList.push(e)
}
}).exec() }).exec()
if (e.children) e.children.map(i => { if (e.children) e.children.map(i => {
let c_query = uni.createSelectorQuery() let c_query = uni.createSelectorQuery()
c_query.select(`#case-${i.id}`).boundingClientRect((data) => { c_query.select(`#case-${i.id}`).boundingClientRect((data) => {
if (data) {
topList.push(data.top - itemHeight + contentScrollNumber) topList.push(data.top - itemHeight + contentScrollNumber)
i.top = data.top - itemHeight + contentScrollNumber i.top = data.top - itemHeight + contentScrollNumber
itemList.push(i) itemList.push(i)
}
}).exec() }).exec()
}) })
}) })
......
...@@ -44,12 +44,15 @@ export default { ...@@ -44,12 +44,15 @@ export default {
}, },
computed: { computed: {
}, },
destroyed () {
this.innerAudioContext[this.audioKey].destroy()
},
mounted () { mounted () {
}, },
methods: { methods: {
init (src) { init (src) {
const innerAudioContext = uni.createInnerAudioContext(), const innerAudioContext = uni.createInnerAudioContext(),
{audioKey} = this { audioKey } = this
innerAudioContext.src = src innerAudioContext.src = src
innerAudioContext.sessionCategory = 'soloAmbient' innerAudioContext.sessionCategory = 'soloAmbient'
innerAudioContext.onCanplay(this.onCanplay) innerAudioContext.onCanplay(this.onCanplay)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!