修改
This commit is contained in:
+72
-11
@@ -9,11 +9,11 @@
|
||||
<text class="name">{{ detail.product_name }}</text>
|
||||
</view>
|
||||
<view class="kv">
|
||||
<view class="kv-item" @click="copyIfHas('车辆识别码', detail.vin)">
|
||||
<!-- <view class="kv-item" @click="copyIfHas('车辆识别码', detail.vin)">
|
||||
<text class="k">车辆识别码</text>
|
||||
<text class="v ellipsis">{{ detail.vin }}</text>
|
||||
<text class="copy" v-if="detail.vin">复制</text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="kv-item">
|
||||
<text class="k">车价(¥)</text>
|
||||
@@ -25,10 +25,10 @@
|
||||
<text class="v">{{ detail.source_place}}</text>
|
||||
</view>
|
||||
|
||||
<view class="kv-item">
|
||||
<!-- <view class="kv-item">
|
||||
<text class="k">上牌地</text>
|
||||
<text class="v">{{ detail.plate_place }}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="kv-item">
|
||||
<text class="k">上牌时间</text>
|
||||
@@ -44,10 +44,13 @@
|
||||
<text class="k">里程</text>
|
||||
<text class="v">{{ detail.mileage }}</text>
|
||||
</view>
|
||||
|
||||
<view class="kv-item">
|
||||
<text class="k">马力</text>
|
||||
<text class="v">{{ detail.power }}</text>
|
||||
</view>
|
||||
<view class="kv-item">
|
||||
<text class="k">车身颜色</text>
|
||||
<text class="v">{{ detail.color }}</text>
|
||||
<text class="v">{{ detail.body_color }}</text>
|
||||
</view>
|
||||
|
||||
<view class="kv-item">
|
||||
@@ -56,6 +59,15 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 车况介绍 -->
|
||||
<view class="card">
|
||||
<view class="section-title">车况介绍</view>
|
||||
<text class="desc" v-if="detail.condition_desc!=''">{{ detail.condition_desc }}</text>
|
||||
<view class="noneview" v-else>
|
||||
<img src="/static/image/none.png" alt="">
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="hero">
|
||||
<view class="section-title">产品图</view>
|
||||
<!-- 有图:九宫格/多行平铺;无图:占位 -->
|
||||
@@ -70,11 +82,17 @@
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 车况介绍 -->
|
||||
<view class="card">
|
||||
<view class="section-title">车况介绍</view>
|
||||
<text class="desc">{{ detail.condition_desc }}</text>
|
||||
<view class="hero">
|
||||
<view class="section-title">附件</view>
|
||||
<view v-if="detail.attachment_pull.length>0">
|
||||
<view v-for="(file, i) in detail.attachment_pull" :key="i" class="fujian" @click="reviewFile(file)">
|
||||
<p>{{file.name}}</p>
|
||||
<view>查看</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="noneview" v-else>
|
||||
<img src="/static/image/none.png" alt="">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -86,6 +104,7 @@
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
appid: '',
|
||||
detail: {},
|
||||
currentImageIndex: 0
|
||||
}
|
||||
@@ -111,6 +130,20 @@
|
||||
onLoad(options) {
|
||||
// 1) 支持通过 id 打开:/pages/index/detils?id=123
|
||||
this.id = options?.id || ''
|
||||
// 2) 分享链接里会带 appid,用于未登录时拉起飞书免登
|
||||
const appid = options?.appid || uni.getStorageSync('fsappid') || ''
|
||||
if (appid) uni.setStorageSync('fsappid', appid)
|
||||
// 3) 如果未登录:先去登录页,登录成功后再回到当前详情页
|
||||
const token = uni.getStorageSync('token')
|
||||
if (!token) {
|
||||
const redirect = `/pages/index/detils?id=${this.id}${appid ? `&appid=${encodeURIComponent(appid)}` : ''}`
|
||||
uni.setStorageSync('post_login_redirect', redirect)
|
||||
// 使用 reLaunch,避免用户打开分享链接后历史栈混乱
|
||||
uni.reLaunch({
|
||||
url: `/pages/login/index?appid=${encodeURIComponent(appid)}&redirect=${encodeURIComponent(redirect)}`
|
||||
})
|
||||
return
|
||||
}
|
||||
this.getshows()
|
||||
},
|
||||
methods: {
|
||||
@@ -146,6 +179,23 @@
|
||||
current: this.images[this.currentImageIndex],
|
||||
urls: this.images
|
||||
})
|
||||
},
|
||||
downloadByAnchor(url, filename) {
|
||||
try {
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = filename || ''
|
||||
a.target = '_blank'
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
} catch (e) {
|
||||
// 兜底:直接打开
|
||||
if (typeof window !== 'undefined') window.open(url, '_blank')
|
||||
}
|
||||
},
|
||||
reviewFile(file){
|
||||
this.downloadByAnchor(file.src, file.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -329,4 +379,15 @@
|
||||
color: #ff972f;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.fujian{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border: 1px solid #ebebeb;
|
||||
padding: 8px 10px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.noneview{
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user