商品详情. 新闻详情和厂家详情登录拦截
This commit is contained in:
@@ -55,6 +55,11 @@
|
||||
<text>{{detailList.pub_time}}</text>
|
||||
</view>
|
||||
<u-parse :content="detailList.desc" @preview="preview" @navigate="navigate"></u-parse>
|
||||
<view style="margin:0 20rpx;">
|
||||
<u-overlay :show="!isLoad">
|
||||
<login @success="reOnLoad()" @fail="failToLoad()"></login>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -63,26 +68,40 @@
|
||||
import {
|
||||
dateFormatDetail
|
||||
} from '../../../utills/date.js'
|
||||
import login from 'pages/my/login/login'
|
||||
export default {
|
||||
components: {
|
||||
login
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
imgUrl: '',
|
||||
tagsArray: [],
|
||||
showHeart: false,
|
||||
detailList: []
|
||||
detailList: [],
|
||||
isLoad: true
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id
|
||||
this.getProductDetail()
|
||||
this.imgUrl = uni.getStorageSync('img_url')
|
||||
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
|
||||
console.log(uni.getStorageSync('token'))
|
||||
this.isLoad = false
|
||||
// uni.navigateTo({
|
||||
// url: '../../pages/my/login/login'
|
||||
// })
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
},
|
||||
methods: {
|
||||
//获取详情信息
|
||||
getProductDetail() {
|
||||
this.$apiServe.getProductDetail(this.id).then(res => {
|
||||
// console.log('产品详情页', res.data.data)
|
||||
console.log('产品详情页', res.data)
|
||||
if (res.data.data.thumb) {
|
||||
this.isThumb = true
|
||||
}
|
||||
@@ -101,15 +120,35 @@
|
||||
//收藏按钮
|
||||
starTap() {
|
||||
this.detailList.type = !this.detailList.type
|
||||
// this.$apiServe.collect(this.id).then(res => {
|
||||
// console.log('收藏成功', res.data)
|
||||
|
||||
// this.detailList.type = 1
|
||||
// }).finally(_ => {})
|
||||
this.$apiServe.collect(this.id).then(res => {
|
||||
console.log('收藏成功', res.data)
|
||||
if (res.data.code == 1) {
|
||||
this.detailList.type = 1
|
||||
this.$toast.warn('收藏成功')
|
||||
} else {
|
||||
this.$toast.warn('收藏失败')
|
||||
}
|
||||
}).finally(_ => {})
|
||||
},
|
||||
//点赞按钮
|
||||
heartTap() {
|
||||
this.showHeart = !this.showHeart
|
||||
},
|
||||
reOnLoad() {
|
||||
console.log('----------------true')
|
||||
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
|
||||
this.$toast.warn('登录失败请重试')
|
||||
this.isLoad = false
|
||||
// uni.navigateTo({
|
||||
// url: '../../pages/my/login/login'
|
||||
// })
|
||||
return
|
||||
}
|
||||
this.isLoad = true
|
||||
},
|
||||
failToLoad() {
|
||||
console.log('----------------false')
|
||||
this.$toast.warn('登录失败请重试')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user