feat:v1.4前端更新

This commit is contained in:
超凡
2025-06-24 14:43:09 +08:00
parent 6282774be5
commit 3202f42aac
1026 changed files with 118424 additions and 56490 deletions

View File

@@ -0,0 +1,297 @@
<template>
<view :data-theme="theme">
<view class='newsDetail' :style="{backgroundColor:bgColor}">
<view class='title'>{{articleInfo.title}}</view>
<view class='list acea-row row-middle'>
<view class='label'>{{articleInfo.author}}</view>
<view class='item'></text>{{articleInfo.createTime}}</view>
<view class='item'><text class='iconfont icon-liulan'></text>{{articleInfo.visit}}</view>
</view>
<view class='conter'>
<jyf-parser :html="content" ref="article" :tag-style="tagStyle"></jyf-parser>
</view>
<view class="picTxt acea-row row-between-wrapper" v-if="store_info.id">
<view class="pictrue">
<image :src="store_info.image"></image>
</view>
<view class="text">
<view class="name line1">{{store_info.storeName}}</view>
<view class="money price_color">
<text class="num">{{store_info.price}}</text>
</view>
<view class="y_money">{{store_info.otPrice}}</view>
</view>
<navigator :url="'/pages/goods/goods_details/index?id='+store_info.id" hover-class="none" class="label"><text
class="span">查看商品</text></navigator>
</view>
<!-- #ifdef H5 -->
<button class="bnt bg_color" hover-class='none' @click="listenerActionSheet"
v-if="this.$wechat.isWeixin()">和好友一起分享</button>
<!-- #endif -->
<!-- #ifdef MP -->
<button class="bnt bg_color" open-type="share" hover-class='none'>和好友一起分享</button>
<!-- #endif -->
</view>
<shareInfo @setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></shareInfo>
<view class="article_theme">
</view>
</view>
</template>
<script>
import {
getArticleDetails
} from '@/api/api.js';
import {
getProductDetail
} from '@/api/store.js';
import shareInfo from '@/components/shareInfo';
import parser from "@/components/jyf-parser/jyf-parser";
let app = getApp();
export default {
components: {
shareInfo,
"jyf-parser": parser
},
data() {
return {
id: 0,
articleInfo: [],
store_info: {},
content: '',
shareInfoStatus: false,
tagStyle: {
img: 'width:100%;display:block;',
table: 'width:100%',
video: 'width:100%'
},
productId: 0,
theme: app.globalData.theme,
bgColor:'#ffffff'
};
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
if (options.hasOwnProperty('id')) {
this.id = options.id;
} else {
// #ifndef H5
uni.navigateBack({
delta: 1
});
// #endif
// #ifdef H5
history.back();
// #endif
}
},
onShow: function() {
this.getArticleOne();
},
/**
* 用户点击右上角分享
*/
// #ifdef MP
onShareAppMessage: function() {
return {
title: this.articleInfo.title,
imageUrl: this.articleInfo.imageInput.length ? this.articleInfo.imageInput : "",
desc: this.articleInfo.synopsis,
path: '/pages/news/news_details/index?id=' + this.id
};
},
// #endif
methods: {
getArticleOne: function() {
let that = this;
getArticleDetails({
id: that.id
}).then(res => {
uni.setNavigationBarTitle({
title: res.data.title.substring(0, 7) + "..."
});
that.$set(that, 'articleInfo', res.data);
that.$set(that, 'productId', res.data.productId);
if (res.data.productId) {
that.goodInfo(res.data.productId);
}
that.content = res.data.content;
// #ifdef H5
if (this.$wechat.isWeixin()) {
this.setShareInfo();
}
// #endif
});
},
goodInfo(id) {
getProductDetail(id).then(res => {
this.$set(this, 'store_info', res.data.storeInfo ? res.data.storeInfo : {});
})
},
listenerActionSheet() {
this.shareInfoStatus = true
},
setShareInfoStatus() {
this.shareInfoStatus = false
},
setShareInfo: function() {
let href = location.href;
let configAppMessage = {
desc: this.articleInfo.synopsis,
title: this.articleInfo.title,
link: href,
imgUrl: this.articleInfo.imageInput.length ? this.articleInfo.imageInput[0] : ""
};
this.$wechat.wechatEvevt(["updateAppMessageShareData", "updateTimelineShareData"], configAppMessage);
},
bgTheme(value){
this.bgColor = value;
}
}
}
</script>
<style lang="scss" scoped>
// page {
// background-color: #fff !important;
// }
.newsDetail {
// background-color: #fff;
// background-color: #D8EFD2;
// background-color: #F9F2E2;
// background-color: #D9EBED;
// background-color: #131313;
// color: #fff !important;
padding: 30rpx 0;
}
.newsDetail .title {
padding: 0 30rpx;
font-size: 34rpx;
color: #282828;
font-weight: bold;
line-height: 1.5;
}
.newsDetail .list {
margin: 28rpx 30rpx 0 30rpx;
padding-bottom: 25rpx;
}
.newsDetail .list .label {
font-size: 30rpx;
color: #B1B2B3;
}
.newsDetail .list .item {
margin-left: 27rpx;
font-size: 30rpx;
color: #B1B2B3;
}
.newsDetail .list .item .iconfont {
font-size: 28rpx;
margin-right: 10rpx;
}
.newsDetail .list .item .iconfont.icon-shenhezhong {
font-size: 26rpx;
}
.newsDetail .picTxt {
width: 690rpx;
height: 200rpx;
border-radius: 20rpx;
border: 1px solid #e1e1e1;
position: relative;
margin: 30rpx auto 0 auto;
}
.newsDetail .picTxt .pictrue {
width: 200rpx;
height: 200rpx;
}
.newsDetail .picTxt .pictrue image {
width: 100%;
height: 100%;
border-radius: 20rpx 0 0 20rpx;
display: block;
}
.newsDetail .picTxt .text {
width: 460rpx;
}
.newsDetail .picTxt .text .name {
font-size: 30rpx;
color: #282828;
}
.newsDetail .picTxt .text .money {
font-size: 24rpx;
margin-top: 40rpx;
font-weight: bold;
}
.price_color {
@include price_color(theme);
}
.newsDetail .picTxt .text .money .num {
font-size: 36rpx;
}
.newsDetail .picTxt .text .y_money {
font-size: 26rpx;
color: #999;
text-decoration: line-through;
}
.newsDetail .picTxt .label {
position: absolute;
background-color: #303131;
width: 160rpx;
height: 50rpx;
right: -7rpx;
border-radius: 25rpx 0 6rpx 25rpx;
text-align: center;
line-height: 50rpx;
bottom: 24rpx;
}
.newsDetail .picTxt .label .span {
background-image: linear-gradient(to right, #fff71e 0%, #f9b513 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.newsDetail .picTxt .label:after {
content: " ";
position: absolute;
width: 0;
height: 0;
border-bottom: 8rpx solid #303131;
border-right: 8rpx solid transparent;
top: -7rpx;
right: 0;
}
.newsDetail .bnt {
color: #fff;
font-size: 30rpx;
width: 690rpx;
height: 90rpx;
border-radius: 45rpx;
margin: 48rpx auto;
text-align: center;
line-height: 90rpx;
}
.bg_color {
@include main-bg_color(theme);
}
</style>

View File

@@ -0,0 +1,343 @@
<template>
<view :data-theme="theme">
<skeleton :show="showSkeleton" :isNodes="isNodes" ref="skeleton" loading="chiaroscuro" selector="skeleton"
bgcolor="#FFF"></skeleton>
<view class='newsList skeleton' :style="{visibility: showSkeleton ? 'hidden' : 'visible'}">
<view class='swiper skeleton-rect' v-if="imgUrls.length > 0">
<swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration"
indicator-color="rgba(102,102,102,0.3)" indicator-active-color="#666">
<block v-for="(item,index) in imgUrls" :key="index">
<swiper-item>
<navigator :url="'/pages/news/news_details/index?id='+item.id">
<image :src="item.imageInput" class="slide-image" mode="aspectFill" />
</navigator>
</swiper-item>
</block>
</swiper>
</view>
<view class='nav'>
<scroll-view class="scroll-view_x" scroll-x scroll-with-animation :scroll-left="scrollLeft" style="width:auto;overflow:hidden;">
<block v-for="(item,index) in navList" :key="index">
<view class='item borRadius14 skeleton-rect' :class='active==item.id?"on":""' @click='tabSelect(item.id, index)'>
<view>{{item.name}}</view>
<view class='line bg_color' v-if="active==item.id"></view>
</view>
</block>
</scroll-view>
</view>
<view class='list'>
<block v-for="(item,index) in articleList" :key="index">
<view class='item acea-row row-between-wrapper' @click="toNewDetail(item.id)">
<view class='text acea-row row-column-between'>
<view class='name line2 skeleton-rect'>{{item.title}}</view>
<view class="skeleton-rect">{{item.createTime}}</view>
</view>
<view class='pictrue skeleton-rect'>
<image :src='item.imageInput'></image>
</view>
</view>
</block>
</view>
</view>
<view class='noCommodity' v-if="articleList.length == 0 && (page != 1 || active== 0) && isShow">
<view class='pictrue'>
<image :src="urlDomain+'crmebimage/perset/staticImg/noNews.png'"></image>
</view>
</view>
</view>
</template>
<script>
import {
getArticleCategoryList,
getArticleList,
getArticleHotList,
getArticleBannerList,
} from '@/api/api.js';
import animationType from '@/utils/animationType.js'
let app = getApp();
export default {
data() {
return {
urlDomain: this.$Cache.get("imgHost"),
showSkeleton: true, //骨架屏显示隐藏
isNodes: 0, //控制什么时候开始抓取元素节点,只要数值改变就重新抓取
imgUrls: [{imageInput:''}],
articleList: [{imageInput:'',title: '占位占位',createTime:'占位'}],
indicatorDots: false,
circular: true,
autoplay: true,
interval: 3000,
duration: 500,
navList: [{id:0,name:'占位'},{id:0,name:'占位'},{id:0,name:'占位'}],
active: 0,
page: 1,
limit: 8,
status: false,
scrollLeft: 0,
isShow: false,
theme:app.globalData.theme,
};
},
onLoad(){
setTimeout(() => {
//this.couponsList = [{name:''}]
this.isNodes++;
// #ifdef H5
this.setShare();
// #endif
}, 500);
this.getArticleHot();
this.getArticleBanner();
this.getArticleCate();
this.status = false;
this.page = 1;
//this.articleList = [];
this.getCidArticle();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
// this.getArticleHot();
// this.getArticleBanner();
// this.getArticleCate();
// this.status = false;
// this.page = 1;
// //this.articleList = [];
// this.getCidArticle();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getCidArticle();
},
methods: {
getArticleHot: function() {
let that = this;
getArticleHotList().then(res => {
that.$set(that, 'articleList', res.data.list);
});
},
getArticleBanner: function() {
let that = this;
getArticleBannerList().then(res => {
that.imgUrls = res.data.list;
setTimeout(() => {
this.showSkeleton = false
}, 1000)
});
},
getCidArticle: function() {
let that = this;
if (that.active == 0) return;
let limit = that.limit;
let page = that.page;
let articleList = that.articleList;
if (that.status) return;
getArticleList(that.active, {
page: page,
limit: limit
}).then(res => {
let articleListNew = [];
let len = res.data.list.length;
articleListNew = articleList.concat(res.data.list);
that.page++;
that.$set(that, 'articleList', articleListNew);
that.status = limit > len;
that.page = that.page;
that.isShow = true;
});
},
getArticleCate: function() {
let that = this;
getArticleCategoryList().then(res => {
let list = res.data.list;
list.unshift({id:0,name:'热门'});
that.$set(that, 'navList', list);
setTimeout(() => {
this.showSkeleton = false
}, 1000)
});
},
tabSelect(active,e) {
this.active = active;
this.scrollLeft = e * 60;
// this.scrollLeft = (active - 1) * 50;
if (this.active == 0) this.getArticleHot();
else {
this.$set(this, 'articleList', []);
this.page = 1;
this.status = false;
this.getCidArticle();
}
},
// '"/pages/news_details/index?id="+item.id'
toNewDetail(id){
uni.navigateTo({
animationType: animationType.type, animationDuration: animationType.duration,
url:"/pages/news/news_details/index?id="+id
})
},
setShare: function() {
this.$wechat.isWeixin() &&
this.$wechat.wechatEvevt([
"updateAppMessageShareData",
"updateTimelineShareData",
"onMenuShareAppMessage",
"onMenuShareTimeline"
], {
desc: this.articleList[0].title,
title: this.articleList[0].title,
link: location.href,
imgUrl:this.articleList[0].imageInput
}).then(res => {
}).catch(err => {
console.log(err);
});
},
}
}
</script>
<style lang="scss">
page {
background-color: #fff !important;
}
.newsList .swiper {
width: 100%;
position: relative;
box-sizing: border-box;
padding: 0 30rpx;
}
.newsList .swiper swiper {
width: 100%;
height: 365rpx;
position: relative;
}
.newsList .swiper .slide-image {
width: 100%;
height: 335rpx;
border-radius: 14rpx;
}
// #ifdef MP-WEIXIN
.newsList .swiper .wx-swiper-dot {
width: 12rpx !important;
height: 12rpx !important;
border-radius: 0;
transform: rotate(-45deg);
transform-origin: 0 100%;
}
.newsList .swiper .wx-swiper-dot~.wx-swiper-dot {
margin-left: 5rpx;
}
.newsList .swiper .wx-swiper-dots.wx-swiper-dots-horizontal {
margin-bottom: -15rpx;
}
// #endif
// #ifdef APP-PLUS || H5
.newsList .swiper .uni-swiper-dot {
width: 12rpx !important;
height: 12rpx !important;
border-radius: 0;
transform: rotate(-45deg);
transform-origin: 0 100%;
}
.newsList .swiper .uni-swiper-dot~.uni-swiper-dot {
margin-left: 5rpx;
}
.newsList .swiper .uni-swiper-dots.uni-swiper-dots-horizontal {
margin-bottom: -15rpx;
}
// #endif
.newsList .nav {
padding: 0 24rpx;
width: 100%;
white-space: nowrap;
box-sizing: border-box;
margin-top: 43rpx;
}
.newsList .nav .item {
display: inline-block;
font-size: 32rpx;
color: #999;
}
.newsList .nav .item.on {
color: #282828;
}
.newsList .nav .item~.item {
margin-left: 46rpx;
}
.newsList .nav .item .line {
width: 24rpx;
height: 4rpx;
border-radius: 2rpx;
margin: 10rpx auto 0 auto;
@include main_bg_color(theme);
}
.newsList .list .item {
margin: 0 24rpx;
border-bottom: 1rpx solid #f0f0f0;
padding: 35rpx 0;
}
.newsList .list .item .pictrue {
width: 250rpx;
height: 156rpx;
}
.newsList .list .item .pictrue image {
width: 100%;
height: 100%;
border-radius: 14rpx;
}
.newsList .list .item .text {
width: 420rpx;
height: 156rpx;
font-size: 24rpx;
color: #999;
}
.newsList .list .item .text .name {
font-size: 30rpx;
color: #282828;
}
.newsList .list .item .picList .pictrue {
width: 335rpx;
height: 210rpx;
margin-top: 30rpx;
}
.newsList .list .item .picList.on .pictrue {
width: 217rpx;
height: 136rpx;
}
.newsList .list .item .picList .pictrue image {
width: 100%;
height: 100%;
border-radius: 6rpx;
}
.newsList .list .item .time {
text-align: right;
font-size: 24rpx;
color: #999;
margin-top: 22rpx;
}
</style>