Commit a7b6720d by 前端

埋点

1 parent 13ceb338
export default {
data() {
return {
goodsId: '',
visitsId: ''
}
},
onLoad(options) {
this.visitsId = options.visitsId
this.goodsId = options.id
this.addRecord()
},
methods: {
addRecord() {
const { shopMerchantId: merchantId, shopMerchantName: merchantName } = uni.$storage.get('userInfo')
const params = {
goodsId: this.goodsId,
goodsType: 0,
merchantId,
merchantName,
visitsId: this.visitsId
}
uni.$api.commonApi.addRecord(params).then(res => {
this.addId = res
})
}
},
onUnload() {
const params = {
id: this.addId,
visitsId: this.visitsId
}
uni.$api.commonApi.leaveRecord(params).then(res => {
console.log(res, 888)
})
}
}
...@@ -7,19 +7,13 @@ ...@@ -7,19 +7,13 @@
<view class="title">{{ title }}</view> <view class="title">{{ title }}</view>
</view> </view>
<view class="popup-body"> <view class="popup-body">
<video <video ref="videoPlayer" :src="detailUrl" controls v-if="sourceType == 2"></video>
ref="videoPlayer" <view class="img-detail" v-else><image @click="back" :src="detailUrl" :style="{ width: width + 'px' }" /></view>
:src="detailUrl"
controls
v-if="sourceType == 2"
></video>
<view class="img-detail" v-else
><image @click="back" :src="detailUrl" :style="{ width: width + 'px' }"
/></view>
</view> </view>
</view> </view>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import report from "@/mixin/report.js";
export default { export default {
data () { data () {
return { return {
...@@ -29,6 +23,7 @@ export default { ...@@ -29,6 +23,7 @@ export default {
detailUrl: '' detailUrl: ''
} }
}, },
mixins:[report],
onLoad (options) { onLoad (options) {
const {tabName,sourceType,detailUrl} = options const {tabName,sourceType,detailUrl} = options
this.title = tabName this.title = tabName
......
<template> <template>
<view class="case-box"> <view class="case-box">
<view class="nav-bar"> <view class="nav-bar">
<view <view class="back" @click="back">
class="back" <uni-icons type="left" :size="20" color="#000"></uni-icons>
@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-view scroll-y class="scroll" :scroll-into-view="`menu-${currentId}`" @scroll="menuScroll">
scroll-y <view class="scroll-content" id="scroll-content">
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 <view class="item" :key="index">
class="item" <view :class="['name', isLast(index), isActive(item)]" @click="menuClick(item)">
:key="index" <view class="text" :id="`menu-${item.id}`">{{ item.headings }}</view>
>
<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 <view :class="['name', isLast(index, j, item.children), isActive(i)]" :key="j" @click="menuClick(i)">
:class="['name', isLast(index, j, item.children), isActive(i)]" <view class="text" :id="`menu-${i.id}`">
: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>
...@@ -60,78 +29,36 @@ ...@@ -60,78 +29,36 @@
</view> </view>
</template> </template>
<template v-if="currentId"> <template v-if="currentId">
<view <view class="block" :style="blockTop"></view>
class="block"
:style="blockTop"
></view>
</template> </template>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<scroll-view <scroll-view class="right-content" scroll-y :scroll-into-view="`case-${contentId}`" @scroll="contentScroll" scroll-with-animation enable-flex>
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 <view class="detail-item" :key="item.id">
class="detail-item" <view class="item-title" :id="`case-${item.id}`">{{ item.headings }}</view>
: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 <audio-component :src="item.audio" @onPlay="onPlay(item.id)" :ref="`audio-${item.id}`" />
: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 <image :key="`img-${index}-${ind}`" :src="i" class="item-img" mode="widthFix" @load="imgLoad"></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 <view class="sub-item-content" :key="s">
class="sub-item-content" <view class="item-title sub-item-title flex" :id="`case-${i.id}`">{{ i.headings }}</view>
: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 <audio-component :src="i.audio" @onPlay="onPlay(i.id)" :ref="`audio-${i.id}`" />
: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 <image :key="k" :src="c" class="item-img" mode="widthFix" @load="imgLoad"></image>
:key="k"
:src="c"
class="item-img"
mode="widthFix"
@load="imgLoad"
></image>
</template> </template>
</view> </view>
</template> </template>
...@@ -147,12 +74,14 @@ ...@@ -147,12 +74,14 @@
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import AudioComponent from './components/AudioComponent.vue' import AudioComponent from './components/AudioComponent.vue'
import report from "@/mixin/report.js";
const view_padding_top = 88, const view_padding_top = 88,
menuHeight = 68 menuHeight = 68
export default { export default {
components: { components: {
AudioComponent AudioComponent
}, },
mixins: [report],
data () { data () {
return { return {
detailInfo: [], detailInfo: [],
...@@ -167,10 +96,7 @@ export default { ...@@ -167,10 +96,7 @@ export default {
} }
}, },
onLoad (options) { onLoad (options) {
this.visitsId = options.visitsId
this.goodsId = options.id
this.getMaterialDetail(options.id) this.getMaterialDetail(options.id)
this.addRecord()
}, },
watch: { watch: {
currentId (n) { currentId (n) {
...@@ -184,30 +110,7 @@ export default { ...@@ -184,30 +110,7 @@ export default {
}, },
computed: { computed: {
}, },
onUnload () {
const params = {
id: this.addId,
visitsId: this.visitsId
}
uni.$api.commonApi.leaveRecord(params).then(res => {
console.log(res, 888)
})
},
methods: { methods: {
addRecord () {
const { shopMerchantId: merchantId, shopMerchantName: merchantName } = uni.$storage.get('userInfo')
const params = {
goodsId: this.goodsId,
goodsType: 0,
merchantId,
merchantName,
visitsId: this.visitsId
}
uni.$api.commonApi.addRecord(params).then(res => {
this.addId = res
console.log(this.addId, 'this.addId')
})
},
async getMaterialDetail (id) { async getMaterialDetail (id) {
try { try {
......
...@@ -237,7 +237,7 @@ export default { ...@@ -237,7 +237,7 @@ export default {
if (item.type != 3) { if (item.type != 3) {
let fileUrl = item?.detailInfos[0]?.image let fileUrl = item?.detailInfos[0]?.image
if (item.type == 2) url = `/pages/common/webview?url=${fileUrl}&title=${item.title}` if (item.type == 2) url = `/pages/common/webview?url=${fileUrl}&title=${item.title}`
if (item.type == 1 || item.type == 0) url = `/pages/boutique/preview?tabName=${item.title}&sourceType=${item.type == 1 ? 2 : 1}&detailUrl=${fileUrl}` if (item.type == 1 || item.type == 0) url = `/pages/boutique/preview?tabName=${item.title}&sourceType=${item.type == 1 ? 2 : 1}&detailUrl=${fileUrl}&id=${item.id}&visitsId=${this.visitsId}`
} }
uni.navigateTo({ uni.navigateTo({
url: `${url}` url: `${url}`
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!