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

@@ -2,10 +2,10 @@
<view> <view>
<view class="products_box"> <view class="products_box">
<u-grid :border="false" col="2"> <u-grid :border="false" col="2">
<u-grid-item v-for="(item,index) in productList" :key="index" @click="toDetailPage(item)"> <u-grid-item v-for="(item,index) in productList" :key="index">
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true"> <u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
</u-image> </u-image>
<view class="bgContent"> <view class="bgContent" @click="toDetailPage(item)">
<view> <view>
<u-image :src="imgUrl+item.cover" width="346rpx" height="320rpx" :lazy-load="true" <u-image :src="imgUrl+item.cover" width="346rpx" height="320rpx" :lazy-load="true"
@click="toDetailPage()"> @click="toDetailPage()">
@@ -41,7 +41,6 @@
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;" <view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-if="type==2&&productList.length==0"> v-if="type==2&&productList.length==0">
暂无更多浏览记录</view> 暂无更多浏览记录</view>
</view> </view>
</view> </view>
</template> </template>
@@ -57,9 +56,7 @@
imgUrl: '', imgUrl: '',
tagsArray: [], tagsArray: [],
productList: [], productList: [],
// showM: false, content: '您确定移除吗?'
content: '您确定移除吗?',
productList: []
} }
}, },
props: { props: {
@@ -83,8 +80,8 @@
item.tags = this.tagsArray[0] item.tags = this.tagsArray[0]
item.create_time = dateFormatHistory(item.create_time) item.create_time = dateFormatHistory(item.create_time)
} }
console.log('获取历史记录', data);
this.productList = data this.productList = data
console.log('获取历史记录', this.productList);
}).finally(_ => { }).finally(_ => {
}) })
@@ -132,7 +129,7 @@
//点击图片跳转到详情页 //点击图片跳转到详情页
toDetailPage(item) { toDetailPage(item) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/detail/productsDetail/productsDetail?id=' + item.id url: '/pages/detail/productsDetail/productsDetail?id=' + item.product_id
}) })
} }
} }

2
package-lock.json generated
View File

@@ -4,7 +4,7 @@
"dependencies": { "dependencies": {
"uview-ui": { "uview-ui": {
"version": "2.0.35", "version": "2.0.35",
"resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-2.0.35.tgz", "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.35.tgz",
"integrity": "sha512-OfMttN3XkHvQosXfd8bjz8ASTvypPoGzBWmQZBJ871bYMCA7t2bDFPlzjbxUj/5ykAjKnZ8zMUapSwSisVt99g==" "integrity": "sha512-OfMttN3XkHvQosXfd8bjz8ASTvypPoGzBWmQZBJ871bYMCA7t2bDFPlzjbxUj/5ykAjKnZ8zMUapSwSisVt99g=="
} }
} }

View File

@@ -24,6 +24,10 @@
handleSureClick() { handleSureClick() {
let name = this.$refs.nameAndphone.model.userInfo.name let name = this.$refs.nameAndphone.model.userInfo.name
let phone = this.$refs.nameAndphone.model.userInfo.phone let phone = this.$refs.nameAndphone.model.userInfo.phone
if (!/^1[3456789]\d{9}$/.test(phone)) {
this.$toast.warn('请输入正确的手机号')
return false
}
this.$apiServe.bindComponyAndUpdate({ this.$apiServe.bindComponyAndUpdate({
uid: 1, uid: 1,
type: 1, type: 1,
@@ -39,10 +43,9 @@
}).finally(_ => {}) }).finally(_ => {})
}, },
confirm() { confirm() {
this.showM = false uni.reLaunch({
// uni.switchTab({ url: '/pages/my/my'
// url: '/pages/my/my' })
// })
} }
} }
} }

View File

@@ -42,6 +42,10 @@
handleSureClick() { handleSureClick() {
let name = this.$refs.nameAndphone.model.userInfo.name let name = this.$refs.nameAndphone.model.userInfo.name
let phone = this.$refs.nameAndphone.model.userInfo.phone let phone = this.$refs.nameAndphone.model.userInfo.phone
if (!/^1[3456789]\d{9}$/.test(phone)) {
this.$toast.warn('请输入正确的手机号')
return false
}
this.$apiServe.bindComponyAndUpdate({ this.$apiServe.bindComponyAndUpdate({
uid: 1, uid: 1,
type: 2, type: 2,
@@ -57,9 +61,11 @@
}).finally(_ => {}) }).finally(_ => {})
}, },
confirm() { confirm() {
this.showM = false uni.reLaunch({
url: '/pages/my/my'
})
if (this.needAsk == 1) { if (this.needAsk == 1) {
uni.switchTab({ uni.reLaunch({
url: '/pages/index/index' url: '/pages/index/index'
}) })
} }

View File

@@ -53,9 +53,6 @@
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return return
} }
this.isLoad = true this.isLoad = true
@@ -78,16 +75,15 @@
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
this.isLoad = false this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return return
} }
this.isLoad = true this.isLoad = true
this.getCertifiedCjDetail() this.getCertifiedCjDetail()
}, },
failToLoad() { failToLoad() {
this.$toast.warn('登录失败请重试') uni.reLaunch({
url: '/pages/index/index'
})
} }
} }
} }
@@ -160,6 +156,9 @@
} }
.footer { .footer {
position: absolute;
bottom: 0;
width: 100%;
height: 100rpx; height: 100rpx;
background: #0EBB5B; background: #0EBB5B;
display: flex; display: flex;

View File

@@ -14,11 +14,6 @@
<view class="xwD_content"> <view class="xwD_content">
<u-parse :content="detailList.content" @preview="preview" @navigate="navigate"></u-parse> <u-parse :content="detailList.content" @preview="preview" @navigate="navigate"></u-parse>
</view> </view>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view> </view>
</template> </template>
@@ -26,29 +21,16 @@
import { import {
dateFormatXwDetail dateFormatXwDetail
} from '../../utills/date.js' } from '../../utills/date.js'
import login from 'pages/my/login/login'
export default { export default {
components: {
login
},
data() { data() {
return { return {
id: '', id: '',
detailList: [], detailList: []
isLoad: true
} }
}, },
onLoad(option) { onLoad(option) {
this.id = option.id this.id = option.id
this.getNewsDetail() this.getNewsDetail()
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
}, },
methods: { methods: {
//获取行业新闻详情 //获取行业新闻详情
@@ -63,21 +45,6 @@
this.$toast.warn('没有更多详情了') this.$toast.warn('没有更多详情了')
} }
}).finally(_ => {}) }).finally(_ => {})
},
reOnLoad() {
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
this.getNewsDetail()
},
failToLoad() {
this.$toast.warn('登录失败请重试')
} }
} }
} }

View File

@@ -3,19 +3,22 @@
<view :key="index"> <view :key="index">
<u-image :src="imgUrl+detailList.cover" width="750rpx" height="530rpx"> <u-image :src="imgUrl+detailList.cover" width="750rpx" height="530rpx">
</u-image> </u-image>
<view class="collect" @click="starTap"> <view class="collect" v-if="detailList.is_fav==0||!detailList.is_fav" @click="starTap">
<view class="star"> <view class="star">
<u-image v-if="detailList.is_fav==0||!detailList.is_fav" src="/static/detail/xp_icon_wstar.png" <u-image src="/static/detail/xp_icon_wstar.png" width="28rpx" height="28rpx">
width="28rpx" height="28rpx"> </u-image>
</u-image> </view>
<u-image v-if="detailList.is_fav==1" src="/static/detail/xp_icon_star.png" width="28rpx" <u-image src="/static/detail/xiangqing_icon_shoucang.png" width="119rpx" height="48rpx">
height="28rpx"> </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> </u-image>
</view> </view>
<u-image src="/static/detail/xiangqing_icon_shoucang.png" width="119rpx" height="48rpx"> <u-image src="/static/detail/xiangqing_icon_shoucang.png" width="119rpx" height="48rpx">
</u-image> </u-image>
</view> </view>
<view class="content"> <view class="content">
<view class="title_box"> <view class="title_box">
<text class="title">{{detailList.name}}</text> <text class="title">{{detailList.name}}</text>
@@ -55,6 +58,10 @@
<text>{{detailList.pub_time}}</text> <text>{{detailList.pub_time}}</text>
</view> </view>
<u-parse :content="detailList.desc" @preview="preview" @navigate="navigate"></u-parse> <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;"> <view style="margin:0 20rpx;">
<u-overlay :show="!isLoad"> <u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login> <login @success="reOnLoad()" @fail="failToLoad()"></login>
@@ -81,7 +88,6 @@
return { return {
id: '', id: '',
imgUrl: '', imgUrl: '',
tagsArray: [],
showHeart: false, showHeart: false,
detailList: [], detailList: [],
isLoad: true, isLoad: true,
@@ -116,30 +122,37 @@
if (res.data.data) { if (res.data.data) {
let detail = res.data.data let detail = res.data.data
detail.pub_time = dateFormatDetail(detail.pub_time) detail.pub_time = dateFormatDetail(detail.pub_time)
let tag = detail.tags detail.tags = detail.tags.split(',')
this.tagsArray = tag.split(',') this.detailList = detail
detail.tags = this.tagsArray
this.detailList = res.data.data
} else { } else {
this.$toast.warn('没有更多详情了') this.$toast.warn('没有更多详情了')
} }
}).finally(_ => {}) }).finally(_ => {})
}, },
//收藏按钮 //点击star收藏
starTap() { starTap() {
if (this.detailList.is_fav === 1) {
this.$toast.warn('已收藏')
} else if (this.detailList.is_fav === 0) {
this.$apiServe.collect(this.id).then(res => { this.$apiServe.collect(this.id).then(res => {
// console.log('收藏成功', res.data) // console.log('收藏成功', res.data)
if (res.data.code == 1) { if (res.data.code == 1) {
this.detailList.is_fav = 1
this.$toast.warn('收藏成功') this.$toast.warn('收藏成功')
this.getProductDetail()
} else { } else {
this.$toast.warn('收藏失败') this.$toast.warn('收藏失败')
} }
}).finally(_ => {}) }).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() { heartTap() {
@@ -167,7 +180,9 @@
this.getProductDetail() this.getProductDetail()
}, },
failToLoad() { failToLoad() {
this.$toast.warn('登录失败请重试') uni.reLaunch({
url: '/pages/index/index'
})
}, },
confirm() { confirm() {
uni.navigateTo({ uni.navigateTo({
@@ -300,4 +315,29 @@
padding: 0 10rpx 0 6rpx; 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> </style>

View File

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

View File

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