dengjie commit : 修改部分存在问题

This commit is contained in:
邓洁
2023-02-03 01:00:26 +08:00
parent 9b7fccdd53
commit d76675a66a
9 changed files with 135 additions and 96 deletions

View File

@@ -3,19 +3,22 @@
<view :key="index">
<u-image :src="imgUrl+detailList.cover" width="750rpx" height="530rpx">
</u-image>
<view class="collect" @click="starTap">
<view class="collect" v-if="detailList.is_fav==0||!detailList.is_fav" @click="starTap">
<view class="star">
<u-image v-if="detailList.is_fav==0||!detailList.is_fav" src="/static/detail/xp_icon_wstar.png"
width="28rpx" height="28rpx">
</u-image>
<u-image v-if="detailList.is_fav==1" src="/static/detail/xp_icon_star.png" width="28rpx"
height="28rpx">
<u-image src="/static/detail/xp_icon_wstar.png" width="28rpx" height="28rpx">
</u-image>
</view>
<u-image src="/static/detail/xiangqing_icon_shoucang.png" width="119rpx" height="48rpx">
</u-image>
</view>
<view class="collect" v-if="detailList.is_fav==1" @click="cancelStarTap(detailList.id)">
<view class="star">
<u-image src="/static/detail/xp_icon_star.png" width="28rpx" height="28rpx">
</u-image>
</view>
<u-image src="/static/detail/xiangqing_icon_shoucang.png" width="119rpx" height="48rpx">
</u-image>
</view>
<view class="content">
<view class="title_box">
<text class="title">{{detailList.name}}</text>
@@ -55,6 +58,10 @@
<text>{{detailList.pub_time}}</text>
</view>
<u-parse :content="detailList.desc" @preview="preview" @navigate="navigate"></u-parse>
<view class="footer">
<u-icon name="kefu-ermai" color="#fff" size="30rpx"></u-icon>
<text>联系客服</text>
</view>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
@@ -81,7 +88,6 @@
return {
id: '',
imgUrl: '',
tagsArray: [],
showHeart: false,
detailList: [],
isLoad: true,
@@ -116,30 +122,37 @@
if (res.data.data) {
let detail = res.data.data
detail.pub_time = dateFormatDetail(detail.pub_time)
let tag = detail.tags
this.tagsArray = tag.split(',')
detail.tags = this.tagsArray
this.detailList = res.data.data
detail.tags = detail.tags.split(',')
this.detailList = detail
} else {
this.$toast.warn('没有更多详情了')
}
}).finally(_ => {})
},
//收藏按钮
//点击star收藏
starTap() {
if (this.detailList.is_fav === 1) {
this.$toast.warn('已收藏')
} else if (this.detailList.is_fav === 0) {
this.$apiServe.collect(this.id).then(res => {
// console.log('收藏成功', res.data)
if (res.data.code == 1) {
this.detailList.is_fav = 1
this.$toast.warn('收藏成功')
} else {
this.$toast.warn('收藏失败')
}
}).finally(_ => {})
}
this.$apiServe.collect(this.id).then(res => {
// console.log('收藏成功', res.data)
if (res.data.code == 1) {
this.$toast.warn('收藏成功')
this.getProductDetail()
} else {
this.$toast.warn('收藏失败')
}
}).finally(_ => {})
},
//点击star取消收藏
cancelStarTap(id) {
// console.log('this.detailList.id', id);
// this.$apiServe.deleteHistoryOrCollection(id).then(res => {
// console.log('取消收藏', res.data);
// // if (res.data.code == 1) {
// // this.$toast.warn('取消收藏')
// // this.getProductDetail()
// // } else {
// // this.$toast.warn('收藏失败')
// // }
// }).finally(_ => {})
},
//点赞按钮
heartTap() {
@@ -167,7 +180,9 @@
this.getProductDetail()
},
failToLoad() {
this.$toast.warn('登录失败请重试')
uni.reLaunch({
url: '/pages/index/index'
})
},
confirm() {
uni.navigateTo({
@@ -300,4 +315,29 @@
padding: 0 10rpx 0 6rpx;
}
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 100rpx;
background: #0EBB5B;
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
text-align: center;
.u-icon {
justify-content: center;
}
text {
font-size: 20rpx;
font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
font-weight: bold;
color: #FFFFFF;
line-height: 26rpx;
}
}
</style>

View File

@@ -54,9 +54,6 @@
this.$refs.myavatar.getUser()
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
@@ -119,9 +116,6 @@
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
@@ -130,10 +124,9 @@
}
},
failToLoad() {
// uni.navigateBack({
// url: '/pages/my/my'
// })
this.$toast.warn('登录失败请重试')
uni.reLaunch({
url: '/pages/index/index'
})
}
}
}

View File

@@ -32,7 +32,7 @@
</view>
<!-- 认证厂家 -->
<view>
<view v-if="token">
<view class="subtitle">
<u--image src="/static/report/hy_icon_cjx.png" width="24rpx" height="24rpx" :lazy-load="true">
</u--image>
@@ -40,13 +40,24 @@
</view>
<certifiedCj></certifiedCj>
</view>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view>
</template>
<script>
import login from 'pages/my/login/login'
export default {
components: {
login
},
data() {
return {
isLoad: true,
token: '',
classifyList: [{
src: '/static/report/hy_icon_xw.png',
title: '行业新闻'
@@ -60,9 +71,11 @@
title: '认证厂家'
},
],
}
},
onLoad() {
this.token = uni.getStorageSync('loginToken')
},
methods: {
//点击一级分类
click(listIndex) {
@@ -76,12 +89,33 @@
url: '../../packageReport/newProductRelease/newProductRelease'
})
} else if (listIndex == 2) {
if (uni.getStorageSync('loginToken')) {
uni.navigateTo({
url: '../../packageReport/certifiedCj/certifiedCj'
})
} else {
this.isLoad = false
}
}
},
reOnLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
return
}
this.isLoad = true
if (this.isLoad) {
uni.navigateTo({
url: '../../packageReport/certifiedCj/certifiedCj'
})
}
},
failToLoad() {
uni.reLaunch({
url: '/pages/report/report'
})
}
}
}