Commit a5ba1c03 by 李伟康

commit 提交

1 parent c7678733
<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" :id="`menu-${item.id}`">{{ item.headings }}</view> :key="index"
>
<view
:class="['name', isLast(index), isActive(item)]"
@click="menuClick(item)"
>
<view
class="text"
: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>
{{ i.headings }} {{ i.headings }}
</view> </view>
...@@ -29,36 +60,78 @@ ...@@ -29,36 +60,78 @@
</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" scroll-with-animation enable-flex> <scroll-view
class="right-content"
scroll-y
:scroll-into-view="`case-${contentId}`"
@scroll="contentScroll"
scroll-with-animation
enable-flex
>
<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.id)" :ref="`audio-${item.id}`" /> <audio-component
:src="item.audio"
@onPlay="onPlay(item.id)"
:ref="`audio-${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.pictureList"> <template v-for="(i, ind) in item.pictureList">
<image :key="`img-${index}-${ind}`" :src="i" class="item-img" mode="widthFix" @load="imgLoad"></image> <image
:key="`img-${index}-${ind}`"
:src="i"
class="item-img"
mode="widthFix"
@load="imgLoad"
></image>
</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.id)" :ref="`audio-${i.id}`" /> <audio-component
:src="i.audio"
@onPlay="onPlay(i.id)"
:ref="`audio-${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.pictureList"> <template v-for="(c, k) in i.pictureList">
<image :key="k" :src="c" class="item-img" mode="widthFix" @load="imgLoad"></image> <image
:key="k"
:src="c"
class="item-img"
mode="widthFix"
@load="imgLoad"
></image>
</template> </template>
</view> </view>
</template> </template>
...@@ -89,13 +162,12 @@ export default { ...@@ -89,13 +162,12 @@ export default {
topList: [], topList: [],
itemList: [], itemList: [],
contentId: '', contentId: '',
caseObject: { caseObject: {},
imgLength: 0
}
} }
}, },
onLoad (options) { onLoad (options) {
this.visitsId = options.visitsId this.visitsId = options.visitsId
this.goodsId = options.id this.goodsId = options.id
this.getMaterialDetail(options.id) this.getMaterialDetail(options.id)
this.addRecord() this.addRecord()
...@@ -112,28 +184,28 @@ export default { ...@@ -112,28 +184,28 @@ export default {
}, },
computed: { computed: {
}, },
onUnload() { onUnload () {
const params = { const params = {
id: this.addId, id: this.addId,
visitsId:this.visitsId visitsId: this.visitsId
} }
uni.$api.commonApi.leaveRecord(params).then(res=>{ uni.$api.commonApi.leaveRecord(params).then(res => {
console.log(res,888) console.log(res, 888)
}) })
}, },
methods: { methods: {
addRecord() { addRecord () {
const { shopMerchantId:merchantId ,shopMerchantName:merchantName} = uni.$storage.get('userInfo') const { shopMerchantId: merchantId, shopMerchantName: merchantName } = uni.$storage.get('userInfo')
const params = { const params = {
goodsId: this.goodsId, goodsId: this.goodsId,
goodsType: 0, goodsType: 0,
merchantId, merchantId,
merchantName, merchantName,
visitsId:this.visitsId visitsId: this.visitsId
} }
uni.$api.commonApi.addRecord(params).then(res=>{ uni.$api.commonApi.addRecord(params).then(res => {
this.addId = res this.addId = res
console.log(this.addId,'this.addId') console.log(this.addId, 'this.addId')
}) })
}, },
...@@ -145,10 +217,12 @@ export default { ...@@ -145,10 +217,12 @@ export default {
const res = await uni.$api.customerApi.getMaterialDetail({ const res = await uni.$api.customerApi.getMaterialDetail({
id id
}) })
let detailInfo = [] let detailInfo = [],
imgLength = 0
this.caseObject = res this.caseObject = res
res.richTextInfoList?.map(e => { res.richTextInfoList?.map(e => {
if (e.content) e.content = this.highlightText(e.content) if (e.content) e.content = this.highlightText(e.content)
if (e.pictureList && e.pictureList.length) imgLength += e.pictureList.length
if (e.level == 1) detailInfo.push({ if (e.level == 1) detailInfo.push({
...e, ...e,
children: [] children: []
...@@ -160,9 +234,9 @@ export default { ...@@ -160,9 +234,9 @@ export default {
if (index > -1) detailInfo[index].children.push(e) if (index > -1) detailInfo[index].children.push(e)
} }
}) })
this.imgLength = imgLength
this.detailInfo = detailInfo this.detailInfo = detailInfo
this.$nextTick(() => this.initScrollListTop()) this.$nextTick(() => this.initScrollListTop())
uni.hideLoading()
} catch (error) { } catch (error) {
uni.hideLoading() uni.hideLoading()
console.log(error) console.log(error)
...@@ -218,6 +292,7 @@ export default { ...@@ -218,6 +292,7 @@ export default {
}).exec() }).exec()
}) })
}) })
console.log(topList)
this.topList = topList this.topList = topList
this.itemList = itemList this.itemList = itemList
if (!this.currentId) this.currentId = detailInfo[0].id if (!this.currentId) this.currentId = detailInfo[0].id
...@@ -260,6 +335,8 @@ export default { ...@@ -260,6 +335,8 @@ export default {
this.$refs[`audio-${id}`][0]?.innerAudioContext?.play() this.$refs[`audio-${id}`][0]?.innerAudioContext?.play()
}, },
imgLoad () { imgLoad () {
this.imgLength -= 1
if (this.imgLength == 0) uni.hideLoading()
this.initScrollListTop() this.initScrollListTop()
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!