Commit df57eff3 by 李伟康

refactor(components): 移除首页轨迹追踪功能

- 注释掉 HomeFrame 组件中的轨迹追踪相关代码
- 在 SwiperComponent
1 parent 44ddf271
...@@ -134,8 +134,8 @@ export default { ...@@ -134,8 +134,8 @@ export default {
}, },
messageTotal: 0, messageTotal: 0,
readCount: 0, readCount: 0,
trackId: 0, // trackId: 0,
trackInterval: null, // trackInterval: null,
collectTrack: false, collectTrack: false,
hasPerson: false, hasPerson: false,
messageType: 'study', messageType: 'study',
...@@ -146,11 +146,11 @@ export default { ...@@ -146,11 +146,11 @@ export default {
userInfo (n) { userInfo (n) {
if (n.shopMerchantId) this.haveCustomerAccess(n) if (n.shopMerchantId) this.haveCustomerAccess(n)
}, },
trackId (n) { // trackId (n) {
if (!n) { // if (!n) {
clearInterval(this.trackInterval) // clearInterval(this.trackInterval)
} // }
} // }
}, },
computed: { computed: {
perRecordNumber () { perRecordNumber () {
...@@ -218,28 +218,28 @@ export default { ...@@ -218,28 +218,28 @@ export default {
}, 1e3) }, 1e3)
}) })
}, },
addTrack () { // addTrack () {
const { merchantId, merchantName } = uni.$storage.get("userInfo") // const { merchantId, merchantName } = uni.$storage.get("userInfo")
const params = { // const params = {
goodsType: 1, // goodsType: 1,
merchantId, // merchantId,
merchantName // merchantName
} // }
uni.$api.commonApi.dynamicrecordAdd(params).then(res => { // uni.$api.commonApi.dynamicrecordAdd(params).then(res => {
this.trackId = res // this.trackId = res
}) // })
}, // },
leaveTrack () { // leaveTrack () {
if (!this.trackId) return // if (!this.trackId) return
uni.$api.commonApi.dynamicrecordLeave({ id: this.trackId }).then(res => { // uni.$api.commonApi.dynamicrecordLeave({ id: this.trackId }).then(res => {
}) // })
}, // },
startTrack () { // startTrack () {
if (this.trackInterval) clearInterval(this.trackInterval) // if (this.trackInterval) clearInterval(this.trackInterval)
this.trackInterval = setInterval(() => { // this.trackInterval = setInterval(() => {
this.leaveTrack() // this.leaveTrack()
}, 5000) // }, 5000)
}, // },
clickHome () { clickHome () {
if (this.tabs[this.tabIndex].isTrack) if (this.tabs[this.tabIndex].isTrack)
this.changeIndex(0, this.tabs[0]) this.changeIndex(0, this.tabs[0])
...@@ -274,15 +274,15 @@ export default { ...@@ -274,15 +274,15 @@ export default {
// } catch (error) { // } catch (error) {
// } // }
// if (jumpUrl) { // if (jumpUrl) {
this.addTrack() // this.addTrack()
this.startTrack() // this.startTrack()
// } // }
} else { } else {
this.leaveTrack() // this.leaveTrack()
this.trackId = 0 // this.trackId = 0
clearInterval(this.trackInterval) // clearInterval(this.trackInterval)
this.trackInterval = null // this.trackInterval = null
} }
this.$emit('update:tabIndex', index) this.$emit('update:tabIndex', index)
this.$emit("changeTab", { this.$emit("changeTab", {
...@@ -431,12 +431,12 @@ export default { ...@@ -431,12 +431,12 @@ export default {
} }
}, },
beforeCreate () { beforeCreate () {
clearInterval(this.trackInterval) // clearInterval(this.trackInterval)
this.trackInterval = null // this.trackInterval = null
}, },
beforeDestroy () { beforeDestroy () {
clearInterval(this.trackInterval) // clearInterval(this.trackInterval)
this.trackInterval = null // this.trackInterval = null
}, },
} }
</script> </script>
......
...@@ -59,12 +59,16 @@ ...@@ -59,12 +59,16 @@
</template> </template>
<template v-else> <template v-else>
<view class="loading flex"> <view class="loading flex">
<uni-icons <image
class="gif"
src="../assets/images/common/loadding.gif"
/>
<!-- <uni-icons
class="icon" class="icon"
type="refreshempty" type="refreshempty"
:size="120" :size="120"
color="#3773f8" color="#3773f8"
></uni-icons> ></uni-icons> -->
</view> </view>
</template> </template>
</view> </view>
...@@ -285,6 +289,10 @@ export default { ...@@ -285,6 +289,10 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
justify-content: center; justify-content: center;
.gif{
width: toRpx(180);
height: toRpx(180);
}
.icon { .icon {
animation: rotate 1s infinite; animation: rotate 1s infinite;
} }
......
{ {
"dependencies": { "dependencies": {
"@js-preview/docx": "^1.6.4",
"@js-preview/excel": "^1.7.14",
"@js-preview/pdf": "^2.0.10",
"core-js": "^3.44.0",
"dayjs": "^1.11.11", "dayjs": "^1.11.11",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
</view> </view>
{{ title }} {{ title }}
</view> </view>
<web-view :src="url"></web-view> <!-- <web-view :src="url"></web-view> -->
<view :class="['file-box',{'has-ai':AIUrl}]">
<lk-preview-office :url="url"></lk-preview-office>
</view>
<view <view
class="AI-window" class="AI-window"
v-if="AIUrl" v-if="AIUrl"
...@@ -26,10 +28,10 @@ ...@@ -26,10 +28,10 @@
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import { aiUrlMixin, report } from '@/mixin/index.js' import { report } from '@/mixin/index.js'
export default { export default {
name: '', name: '',
mixins: [report, aiUrlMixin], mixins: [report],
data () { data () {
return { return {
url: '', url: '',
...@@ -40,11 +42,13 @@ export default { ...@@ -40,11 +42,13 @@ export default {
}, },
onLoad (options) { onLoad (options) {
console.log(options) console.log(options)
if (options.fileUrl) this.url = `${this.viewerUrl}?file=${options.fileUrl}` // if (options.fileUrl) this.url = `https://view.officeapps.live.com/op/view.aspx?src=${options.fileUrl}`
if (options.fileUrl) this.url = `${options.fileUrl}`
// if (options.fileUrl) this.url = `${this.viewerUrl}?file=${options.fileUrl}`
else this.url = options.url else this.url = options.url
if (options.title) this.title = options.title if (options.title) this.title = options.title
if (options.specialFlag == 1) this.getAiagent(options) if (options.specialFlag == 1) this.getAiagent(options)
else this.setWv() // else this.setWv()
}, },
mounted () { mounted () {
}, },
...@@ -56,17 +60,44 @@ export default { ...@@ -56,17 +60,44 @@ export default {
animationDuration: 100 animationDuration: 100
}) })
}, },
setWv () { async getAiagent (options, agentCode = 'AI6') {
const { phone } = uni.$storage.get('userInfo'),
[data] = await uni.$api.sceneMarketApi.getAiagent({
ownerShipType: 1,
accountPhone: phone,
agentCode
})
if (data) {
const { sceneType, uuid, phone, channelType = 1 } = uni.$storage.get('userInfo'),
bussinessType = sceneType == 0 ? 1 : 2,// sceneType 0延保 1精品。 bussinessType 1.延保 2.轻改
brand = {
1: '问界',
2: '比亚迪',
3: '其他'
}[channelType]
let title = options.directoryName
if (options.title) title += `-${options.title}`
let { agentUrl, domainName } = data,
url = `${agentUrl}?no_header=1&business_type=${bussinessType}&phone=${phone}&brand=${brand}&one_id=${uuid}&platformType=1&domain=${domainName}&presuppositionProblem=${title}`
if (options.id) url += `&enter_id=${options.id}`
this.AIUrl = url
this.setWebviewStyle()
} else uni.showToast({
title: '获取智能体失败',
icon: 'error'
})
},
setWebviewStyle () {
const setWebviewStyleWithRetry = () => { const setWebviewStyleWithRetry = () => {
const currentWebview = this.$scope.$getAppWebview() const currentWebview = this.$scope.$getAppWebview()
let [wv] = currentWebview.children(), let [wv] = currentWebview.children(),
wvFlag = false wvFlag = false
if (wv) { if (wv) {
wv.setStyle({ wv.setStyle({
left: '0', left: '71.9%',
top: '9.37%', top: '17.18%',
height: '90.63%', height: '82.82%',
width: '100%' width: '28.3%'
}) })
wvFlag = true; wvFlag = true;
} }
...@@ -112,6 +143,16 @@ export default { ...@@ -112,6 +143,16 @@ export default {
justify-content: center; justify-content: center;
} }
} }
.file-box {
position: fixed;
top: 5.2vh;
height: 94.8vh;
left: 0;
width: 100vw;
}
.has-ai{
width: 71.36vw;
}
.AI-window { .AI-window {
width: 28.3vw; width: 28.3vw;
height: 90.63vh; height: 90.63vh;
......
...@@ -184,6 +184,16 @@ export default { ...@@ -184,6 +184,16 @@ export default {
return this.$refs.qualityRef return this.$refs.qualityRef
} }
}, },
onBackPress (options) {
if (options.from === 'backbutton') {
// 物理返回按钮触发
// 阻止默认行为,即不执行页面返回
this.back()
return true
}
// 其他情况允许正常返回
return false
},
methods: { methods: {
onHandle (e) { onHandle (e) {
let { let {
...@@ -259,6 +269,7 @@ export default { ...@@ -259,6 +269,7 @@ export default {
this.qualityAudio.seek(time) this.qualityAudio.seek(time)
}, },
back () { back () {
uni.$emit('refreshRecord')
if (this.qualityAudio) this.qualityAudio?.pause() if (this.qualityAudio) this.qualityAudio?.pause()
uni.navigateBack() uni.navigateBack()
}, },
...@@ -266,8 +277,6 @@ export default { ...@@ -266,8 +277,6 @@ export default {
const res = await uni.$api.receptionApi.findCheckResultByBatchId({ const res = await uni.$api.receptionApi.findCheckResultByBatchId({
batchId batchId
}) })
uni.$emit('refreshRecord')
console.log(JSON.parse(JSON.stringify(res)))
res.map(item => { res.map(item => {
item.formatScore = `${item.score || item.score === 0 ? item.score : '-'}/${item.sumScore || item.sumScore === 0 ? item.sumScore : '-'}` item.formatScore = `${item.score || item.score === 0 ? item.score : '-'}/${item.sumScore || item.sumScore === 0 ? item.sumScore : '-'}`
let hitTextList = JSON.parse(item.hitText), let hitTextList = JSON.parse(item.hitText),
......
...@@ -16,7 +16,8 @@ $detailVW: 100vmin * (1173 / 768); ...@@ -16,7 +16,8 @@ $detailVW: 100vmin * (1173 / 768);
$margin: 0 calc((100vmax - #{$detailVW}) / 2); $margin: 0 calc((100vmax - #{$detailVW}) / 2);
@import "./assets/css/sprite.scss"; @import "./assets/css/sprite.scss";
@import '@js-preview/docx/lib/index.css';
@import '@js-preview/excel/lib/index.css';
@font-face { @font-face {
font-family: "number-700"; font-family: "number-700";
src: url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-700-Bold.ttf"); src: url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-700-Bold.ttf");
......
## 1.0.0(2025-03-30)
组件发布
<!-- Ofiice文件在线预览组件 -->
<template>
<scroll-view style="width: 100%; height: 100%;" scroll-x scroll-y>
<view class="office-content" :id="viewerId" :prop="prop" :change:prop="officeModule.initOffice"></view>
</scroll-view>
</template>
<script>
export default {
name: 'lk-preview-office',
data() {
return {
prop: null,
}
},
props: {
// 容器id
viewerId: {
type: String,
default: Math.random().toString(16).substring(2, 15)
},
// 文件地址
url: {
type: String,
default: ''
},
// 文件类型
fileType: {
type: String,
default: ''
},
},
mounted() {
const url = this.url
this.$nextTick(() => this.prop = {
url,
fileType: this.fileType || url.substring(url.lastIndexOf('.') + 1).toLowerCase(),
viewerId: this.viewerId,
})
},
methods: {
getError(msg) {
console.log(msg)
},
}
}
</script>
<script module="officeModule" lang="renderjs">
import jsPreviewDocx from '@js-preview/docx'
import jsPreviewExcel from '@js-preview/excel'
import jsPreviewPdf from '@js-preview/pdf'
export default {
methods: {
initOffice(params) {
if (!params) {
return
}
const { url, fileType, viewerId } = params
this.$nextTick(() => {
const officeRef = document.getElementById(viewerId)
if (officeRef) {
let myOfficePreviewer;
if (fileType === 'docx') {
myOfficePreviewer = jsPreviewDocx.init(officeRef);
} else if (fileType === 'xlsx') {
myOfficePreviewer = jsPreviewExcel.init(officeRef);
} else if (fileType === 'pdf') {
myOfficePreviewer = jsPreviewPdf.init(officeRef);
} else {
this.$ownerInstance.callMethod('getError', '文件类型错误')
return
}
myOfficePreviewer.preview(url).catch(e => {
this.$ownerInstance.callMethod('getError', '预览失败:' + e.message)
})
} else {
this.$ownerInstance.callMethod('getError', '无法找到预览容器元素')
}
})
}
},
}
</script>
<style>
.office-content {
width: 100%;
height: 100%;
padding-top: var(--status-bar-height);
}
</style>
\ No newline at end of file \ No newline at end of file
{
"id": "lk-preview-office",
"displayName": "lk-preview-office 基于js-preview的office文件预览组件",
"version": "1.0.0",
"description": "基于js-preview的office文件预览组件",
"keywords": [
"预览",
"office"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "插件不采集任何数据",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y",
"alipay": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-vue": "y",
"app-nvue": "n",
"app-uvue": "n",
"app-harmony": "u"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "n",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "n",
"阿里": "n",
"百度": "n",
"字节跳动": "n",
"QQ": "n",
"钉钉": "n",
"快手": "n",
"飞书": "n",
"京东": "n"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
\ No newline at end of file \ No newline at end of file
# 文档
## 属性说明
| 属性名 | 类型 | 默认值 | 说明 |
| ----- | ---- | ------ |:-------------:|
| viewerId | String | 随机字符串 | 容器id |
| url | String | '' | 文件访问地址 |
| fileType | String | '' | 文件类型,可选值包括:docx、xlsx、pdf,可以不传,组件会自动从url中推导文件类型 |
## 注意事项
* 本组件是基于renderjs技术,所以不支持小程序
* url 文件访问地址必须是无访问限制的线上地址,不支持本地地址
* 需要安装以下依赖包
```
npm install core-js @js-preview/docx @js-preview/excel @js-preview/pdf
```
* 按装依赖包后,需要在App.vue中添加以下引入插件样式的代码,否则会导致docx、xlsx文件显示不全
```
@import '@js-preview/docx/lib/index.css';
@import '@js-preview/excel/lib/index.css';
```
## 示例代码
```
<template>
<lk-preview-office :url="url" :file-type="fileType" v-if="url"></lk-preview-office>
</template>
<script>
export default {
data() {
return {
url: 'https://static-mp-4b5404ae-3773-4f5e-bc20-1912bf5fa489.next.bspapp.com/static/文字文稿.docx',
fileType: ''
};
}
}
</script>
```
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!