二手车交易,测试优化
This commit is contained in:
@ -53,6 +53,7 @@
|
||||
<script>
|
||||
import {myMixins} from "@/utils/myMixins"
|
||||
import {carInfoDetail, saveRecord} from "@/api/secondHandCar";
|
||||
import {Dialog} from "vant";
|
||||
export default {
|
||||
name: "wantBuySale",
|
||||
mixins:[myMixins],
|
||||
@ -74,7 +75,7 @@ export default {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
this.id=this.$route.query.id || urlParams.get('id');
|
||||
this.queryType=this.$route.query.queryType || urlParams.get('queryType');
|
||||
this.isList=this.$route.query.isList
|
||||
this.isList=this.$route.query.isList || urlParams.get('isList');
|
||||
if( this.id) {
|
||||
let res = await carInfoDetail({
|
||||
id: this.id,
|
||||
@ -83,15 +84,13 @@ export default {
|
||||
this.detailInfo = res?.data
|
||||
}
|
||||
},
|
||||
beforeUnmount() {
|
||||
destroyed() {
|
||||
this.getDuration()
|
||||
},
|
||||
methods:{
|
||||
getDuration(){
|
||||
// 页面卸载时记录离开时间并计算浏览时长
|
||||
const endTime = new Date();
|
||||
const duration = (endTime - this.startTime) / 1000; // 计算时长(秒)
|
||||
// console.log('页面卸载时间:', endTime);
|
||||
console.log('浏览时长:', duration, '秒');
|
||||
this.saveRecord(duration);
|
||||
},
|
||||
@ -99,9 +98,15 @@ export default {
|
||||
await saveRecord({type:this.recordType,carInfoId:this.id,duration})
|
||||
},
|
||||
handle(){
|
||||
this.recordType=2
|
||||
this.getDuration()
|
||||
window.location.href = `tel:${this.detailInfo.contactNumber}`;
|
||||
Dialog.alert({
|
||||
message:this.detailInfo.contactNumber ,
|
||||
confirmButtonText:'拨打电话',
|
||||
showCancelButton:true,
|
||||
}).then(() => {
|
||||
this.recordType=2
|
||||
this.getDuration()
|
||||
window.location.href = `tel:${this.detailInfo.contactNumber}`;
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user