Commit a5ba1c03 by 李伟康

commit 提交

1 parent c7678733
<template>
<view class="case-box">
<view class="nav-bar">
<view class="back" @click="back">
<uni-icons type="left" :size="20" color="#000"></uni-icons>
<view
class="back"
@click="back"
>
<uni-icons
type="left"
:size="20"
color="#000"
></uni-icons>
</view>
{{ caseObject.title }}
</view>
<view class="case-content">
<view class="left-menu">
<view class="title">方案目录</view>
<scroll-view scroll-y class="scroll" :scroll-into-view="`menu-${currentId}`" @scroll="menuScroll">
<view class="scroll-content" id="scroll-content">
<scroll-view
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">
<view class="item" :key="index">
<view :class="['name', isLast(index), isActive(item)]" @click="menuClick(item)">
<view class="text" :id="`menu-${item.id}`">{{ item.headings }}</view>
<view
class="item"
:key="index"
>
<view
:class="['name', isLast(index), isActive(item)]"
@click="menuClick(item)"
>
<view
class="text"
:id="`menu-${item.id}`"
>{{ item.headings }}</view>
</view>
<template v-if="item.children && item.children.length">
<template v-for="(i, j) in item.children">
<view :class="['name', isLast(index, j, item.children), isActive(i)]" :key="j" @click="menuClick(i)">
<view class="text" :id="`menu-${i.id}`">
<view
: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>
{{ i.headings }}
</view>
......@@ -29,36 +60,78 @@
</view>
</template>
<template v-if="currentId">
<view class="block" :style="blockTop"></view>
<view
class="block"
:style="blockTop"
></view>
</template>
</view>
</scroll-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">
<view class="detail-item" :key="item.id">
<view class="item-title" :id="`case-${item.id}`">{{ item.headings }}</view>
<view
class="detail-item"
:key="item.id"
>
<view
class="item-title"
:id="`case-${item.id}`"
>{{ item.headings }}</view>
<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>
<view class="item-content">
<rich-text :nodes="item.content"></rich-text>
</view>
<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 v-if="item.children && item.children.length">
<template v-for="(i, s) in item.children">
<view class="sub-item-content" :key="s">
<view class="item-title sub-item-title flex" :id="`case-${i.id}`">{{ i.headings }}</view>
<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">
<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>
<view class="item-content">
<rich-text :nodes="i.content"></rich-text>
</view>
<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>
</view>
</template>
......@@ -89,13 +162,12 @@ export default {
topList: [],
itemList: [],
contentId: '',
caseObject: {
}
caseObject: {},
imgLength: 0
}
},
onLoad (options) {
this.visitsId = options.visitsId
this.visitsId = options.visitsId
this.goodsId = options.id
this.getMaterialDetail(options.id)
this.addRecord()
......@@ -112,28 +184,28 @@ export default {
},
computed: {
},
onUnload() {
const params = {
id: this.addId,
visitsId:this.visitsId
}
uni.$api.commonApi.leaveRecord(params).then(res=>{
console.log(res,888)
})
onUnload () {
const params = {
id: this.addId,
visitsId: this.visitsId
}
uni.$api.commonApi.leaveRecord(params).then(res => {
console.log(res, 888)
})
},
methods: {
addRecord() {
const { shopMerchantId:merchantId ,shopMerchantName:merchantName} = uni.$storage.get('userInfo')
addRecord () {
const { shopMerchantId: merchantId, shopMerchantName: merchantName } = uni.$storage.get('userInfo')
const params = {
goodsId: this.goodsId,
goodsType: 0,
merchantId,
merchantName,
visitsId:this.visitsId
visitsId: this.visitsId
}
uni.$api.commonApi.addRecord(params).then(res=>{
uni.$api.commonApi.addRecord(params).then(res => {
this.addId = res
console.log(this.addId,'this.addId')
console.log(this.addId, 'this.addId')
})
},
......@@ -145,10 +217,12 @@ export default {
const res = await uni.$api.customerApi.getMaterialDetail({
id
})
let detailInfo = []
let detailInfo = [],
imgLength = 0
this.caseObject = res
res.richTextInfoList?.map(e => {
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({
...e,
children: []
......@@ -160,9 +234,9 @@ export default {
if (index > -1) detailInfo[index].children.push(e)
}
})
this.imgLength = imgLength
this.detailInfo = detailInfo
this.$nextTick(() => this.initScrollListTop())
uni.hideLoading()
} catch (error) {
uni.hideLoading()
console.log(error)
......@@ -218,6 +292,7 @@ export default {
}).exec()
})
})
console.log(topList)
this.topList = topList
this.itemList = itemList
if (!this.currentId) this.currentId = detailInfo[0].id
......@@ -260,6 +335,8 @@ export default {
this.$refs[`audio-${id}`][0]?.innerAudioContext?.play()
},
imgLoad () {
this.imgLength -= 1
if (this.imgLength == 0) uni.hideLoading()
this.initScrollListTop()
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!