初始项目

This commit is contained in:
liupopo
2023-02-11 12:55:02 +08:00
parent 1748bda84a
commit 0b89e36064
3363 changed files with 506201 additions and 1 deletions

View File

@@ -0,0 +1,202 @@
<template>
<view>
<view class="notice-item" v-for="(item, index) in goodsList" :key="index">
<text class="time">{{ item.createTime |formatCreateTime}}</text>
<view class="content" @click="navToDetailPage(item)">
<text class="title">{{ item.title }}</text>
<view class="img-wrapper"><image :src="item.pic" mode="aspectFill" class="pic"></image></view>
<text class="introduce">{{ item.description }}</text>
<view class="bot b-t" @click="navToDetailPage(item)">
<text>查看详情</text>
<text class="more-icon yticon icon-you"></text>
</view>
</view>
</view>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import { formatDate } from '@/common/date';
import Api from '@/common/api';
export default {
components: {
mallplusCopyright
},
data() {
return {
pageNum: 1,
goodsList: []
};
},
onLoad() {
this.loadData();
},
onPageScroll(e) {
//兼容iOS端下拉时顶部漂移
if (e.scrollTop >= 0) {
this.headerPosition = 'fixed';
} else {
this.headerPosition = 'absolute';
}
},
//下拉刷新
onPullDownRefresh() {
this.pageNum = this.pageNum + 1;
this.loadData('refresh');
},
//加载更多
onReachBottom() {
this.pageNum = this.pageNum + 1;
this.loadData();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
},
methods: {
//加载商品 ,带下拉刷新和上滑加载
async loadData(type = 'add', loading) {
//没有更多直接返回
if (type === 'add') {
if (this.loadingType === 'nomore') {
return;
}
this.loadingType = 'loading';
} else {
this.loadingType = 'more';
}
let params;
if (this.cateId) {
params = { pageNum: this.pageNum, productCategoryId: this.cateId };
if (this.keyword) {
params = { pageNum: this.pageNum, productCategoryId: this.cateId, keyword: this.keyword };
}
}
if (this.keyword) {
params = { pageNum: this.pageNum, keyword: this.keyword };
} else {
params = { pageNum: this.pageNum };
}
let list = await Api.apiCall('get', Api.cms.subjectList, params);
let goodsList = list.records;
// let goodsList = await this.$api.json('goodsList');
if (type === 'refresh') {
this.goodsList = [];
}
this.goodsList = this.goodsList.concat(goodsList);
//判断是否还有下一页有是more 没有是nomore(测试数据判断大于20就没有了)
this.loadingType = this.goodsList.length > list.total ? 'nomore' : 'more';
if (type === 'refresh') {
if (loading == 1) {
uni.hideLoading();
} else {
uni.stopPullDownRefresh();
}
}
},
//详情
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
uni.navigateTo({
url: `../../pagesU/notice/subjectDetail?id=${id}`
});
}
}
};
</script>
<style lang="scss">
page {
background-color: #f7f7f7;
padding-bottom: 30upx;
}
.notice-item {
display: flex;
flex-direction: column;
align-items: center;
}
.time {
display: flex;
align-items: center;
justify-content: center;
height: 80upx;
padding-top: 10upx;
font-size: 26upx;
color: #7d7d7d;
}
.content {
width: 710upx;
padding: 0 24upx;
background-color: #fff;
border-radius: 4upx;
}
.title {
display: flex;
align-items: center;
height: 90upx;
font-size: 32upx;
color: #303133;
}
.img-wrapper {
width: 100%;
height: 260upx;
position: relative;
}
.pic {
display: block;
width: 100%;
height: 100%;
border-radius: 6upx;
}
.cover {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
font-size: 36upx;
color: #fff;
}
.introduce {
display: inline-block;
padding: 16upx 0;
font-size: 28upx;
color: #606266;
line-height: 38upx;
}
.bot {
display: flex;
align-items: center;
justify-content: space-between;
height: 80upx;
font-size: 24upx;
color: #707070;
position: relative;
}
.more-icon {
font-size: 32upx;
}
</style>

View File

@@ -0,0 +1,151 @@
<template>
<view>
<view class="notice-item">
<text class="time">11:30</text>
<view class="content">
<text class="title">新品上市全场满199减50</text>
<view class="img-wrapper">
<image
class="pic"
src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1556465765776&di=57bb5ff70dc4f67dcdb856e5d123c9e7&imgtype=0&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F01fd015aa4d95fa801206d96069229.jpg%401280w_1l_2o_100sh.jpg"
></image>
</view>
<text class="introduce">虽然做了一件好事但很有可能因此招来他人的无端猜测例如被质疑是否藏有其他利己动机等乃至谴责即便如此还是要做好事</text>
<view class="bot b-t">
<text>查看详情</text>
<text class="more-icon yticon icon-you"></text>
</view>
</view>
</view>
<view class="notice-item">
<text class="time">昨天 12:30</text>
<view class="content">
<text class="title">新品上市全场满199减50</text>
<view class="img-wrapper">
<image class="pic" src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3761064275,227090144&fm=26&gp=0.jpg"></image>
<view class="cover">活动结束</view>
</view>
<view class="bot b-t">
<text>查看详情</text>
<text class="more-icon yticon icon-you"></text>
</view>
</view>
</view>
<view class="notice-item">
<text class="time">2019-07-26 12:30</text>
<view class="content">
<text class="title">新品上市全场满199减50</text>
<view class="img-wrapper">
<image
class="pic"
src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1556465765776&di=57bb5ff70dc4f67dcdb856e5d123c9e7&imgtype=0&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F01fd015aa4d95fa801206d96069229.jpg%401280w_1l_2o_100sh.jpg"
></image>
<view class="cover">活动结束</view>
</view>
<text class="introduce">新品上市全场2折起新品上市全场2折起新品上市全场2折起新品上市全场2折起新品上市全场2折起</text>
<view class="bot b-t">
<text>查看详情</text>
<text class="more-icon yticon icon-you"></text>
</view>
</view>
</view>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
export default {
data() {
return {};
},
methods: {}
};
</script>
<style lang="scss">
page {
background-color: #f7f7f7;
padding-bottom: 30upx;
}
.notice-item {
display: flex;
flex-direction: column;
align-items: center;
}
.time {
display: flex;
align-items: center;
justify-content: center;
height: 80upx;
padding-top: 10upx;
font-size: 26upx;
color: #7d7d7d;
}
.content {
width: 710upx;
padding: 0 24upx;
background-color: #fff;
border-radius: 4upx;
}
.title {
display: flex;
align-items: center;
height: 90upx;
font-size: 32upx;
color: #303133;
}
.img-wrapper {
width: 100%;
height: 260upx;
position: relative;
}
.pic {
display: block;
width: 100%;
height: 100%;
border-radius: 6upx;
}
.cover {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
font-size: 36upx;
color: #fff;
}
.introduce {
display: inline-block;
padding: 16upx 0;
font-size: 28upx;
color: #606266;
line-height: 38upx;
}
.bot {
display: flex;
align-items: center;
justify-content: space-between;
height: 80upx;
font-size: 24upx;
color: #707070;
position: relative;
}
.more-icon {
font-size: 32upx;
}
</style>

View File

@@ -0,0 +1,655 @@
<template>
<view class="container">
<view class="carousel">
<swiper indicator-dots circular="true" duration="400">
<swiper-item class="swiper-item" v-for="(item, index) in detailData.pics" :key="index">
<view class="image-wrapper"><image :src="item" class="loaded" mode="aspectFill"></image></view>
</swiper-item>
</swiper>
</view>
<view class="introduce-section">
<text class="title">{{ detailData.title }}</text>
<view class="bot-row">
<text>收藏量: {{ detailData.collectCount }}</text>
<text>评论量: {{ detailData.commentCount }}</text>
<text>浏览量: {{ detailData.readCount }}</text>
</view>
</view>
<view class="c-list">
<view class="c-row b-b">
<view class="tip">
<text>{{ detailData.description }}</text>
</view>
</view>
</view>
<view class="detail-desc">
<view class="d-header"><text>图文详情</text></view>
<rich-text :nodes="desc"></rich-text>
</view>
<!-- 底部操作菜单 -->
<view class="page-bottom">
<navigator url="/pages/index/index" open-type="switchTab" class="p-b-btn">
<text class="yticon icon-xiatubiao--copy"></text>
<text>首页</text>
</navigator>
<view class="p-b-btn" :class="{ active: favorite }" @click="toFavorite(detailData)">
<text class="yticon icon-shoucang"></text>
<text>收藏</text>
</view>
</view>
<!-- 分享 -->
<share ref="share" :contentHeight="580" :shareList="shareList"></share>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import share from '@/components/share';
import { mapState } from 'vuex';
export default {
components: {
mallplusCopyright,
share
},
data() {
return {
specClass: 'none',
specSelected: [],
small: null,
sku: [],
detailData: [],
favorite: true,
shareList: [],
desc: `
`,
skuList: []
};
},
async onLoad(ops) {
//接收传值,id里面放的是标题因为测试数据并没写id
let id = ops.id;
if (id) {
this.logining = true;
let params = { id: ops.id };
let data = await Api.apiCall('get', Api.cms.subjectDetail, params);
this.logining = false;
if (data) {
let detailData = data;
this.detailData = detailData;
this.desc = data.content;
uni.setNavigationBarTitle({
title: detailData.name
});
}
}
this.shareList = await this.$api.json('shareList');
},
computed: {
...mapState(['hasLogin', 'userInfo'])
},
methods: {
//收藏
toFavorite(item) {
if (!this.hasLogin) {
let url = '/pages/public/login';
uni.navigateTo({
url
});
} else {
this.favorite = !this.favorite;
let params = { objId: item.id, type: 1, name: item.name, meno1: item.pic };
Api.apiCall('post', Api.goods.favoriteSave, params);
}
},
//分享
share() {
this.$refs.share.toggleMask();
},
//收藏
toFavorite(item) {
if (!this.hasLogin) {
let url = '/pages/public/login';
uni.navigateTo({
url
});
} else {
this.favorite = !this.favorite;
let params = { objId: item.id, type: 4, name: item.name, meno1: item.pic, meno2: item.price, meno3: item.sale };
Api.apiCall('post', Api.goods.favoriteSave, params);
}
},
async jifenPay(item) {
if (!this.hasLogin) {
let url = '/pages/public/login';
uni.navigateTo({
url
});
return false;
}
let id = item.id;
let data;
let params = { goodsId: id };
data = await Api.apiCall('post', Api.order.jifenPay, params);
if (data) {
this.$api.msg(data);
}
},
stopPrevent() {}
}
};
</script>
<style lang="scss">
page {
background: $page-color-base;
padding-bottom: 160upx;
}
.icon-you {
font-size: $font-base + 2upx;
color: #888;
}
.carousel {
height: 722upx;
position: relative;
swiper {
height: 100%;
}
.image-wrapper {
width: 100%;
height: 100%;
}
.swiper-item {
display: flex;
justify-content: center;
align-content: center;
height: 750upx;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
}
/* 标题简介 */
.introduce-section {
background: #fff;
padding: 20upx 30upx;
.title {
font-size: 32upx;
color: $font-color-dark;
height: 50upx;
line-height: 50upx;
}
.price-box {
display: flex;
align-items: baseline;
height: 64upx;
padding: 10upx 0;
font-size: 26upx;
color: $uni-color-primary;
}
.price {
font-size: $font-lg + 2upx;
}
.m-price {
margin: 0 12upx;
color: $font-color-light;
text-decoration: line-through;
}
.coupon-tip {
align-items: center;
padding: 4upx 10upx;
background: $uni-color-primary;
font-size: $font-sm;
color: #fff;
border-radius: 6upx;
line-height: 1;
transform: translateY(-4upx);
}
.bot-row {
display: flex;
align-items: center;
height: 50upx;
font-size: $font-sm;
color: $font-color-light;
text {
flex: 1;
}
}
}
/* 分享 */
.share-section {
display: flex;
align-items: center;
color: $font-color-base;
background: linear-gradient(left, #fdf5f6, #fbebf6);
padding: 12upx 30upx;
.share-icon {
display: flex;
align-items: center;
width: 70upx;
height: 30upx;
line-height: 1;
border: 1px solid $uni-color-primary;
border-radius: 4upx;
position: relative;
overflow: hidden;
font-size: 22upx;
color: $uni-color-primary;
&:after {
content: '';
width: 50upx;
height: 50upx;
border-radius: 50%;
left: -20upx;
top: -12upx;
position: absolute;
background: $uni-color-primary;
}
}
.icon-xingxing {
position: relative;
z-index: 1;
font-size: 24upx;
margin-left: 2upx;
margin-right: 10upx;
color: #fff;
line-height: 1;
}
.tit {
font-size: $font-base;
margin-left: 10upx;
}
.icon-bangzhu1 {
padding: 10upx;
font-size: 30upx;
line-height: 1;
}
.share-btn {
flex: 1;
text-align: right;
font-size: $font-sm;
color: $uni-color-primary;
}
.icon-you {
font-size: $font-sm;
margin-left: 4upx;
color: $uni-color-primary;
}
}
.c-list {
font-size: $font-sm + 2upx;
color: $font-color-base;
background: #fff;
.c-row {
display: flex;
align-items: center;
padding: 20upx 30upx;
position: relative;
}
.tit {
width: 140upx;
}
.con {
flex: 1;
color: $font-color-dark;
.selected-text {
margin-right: 10upx;
}
}
.bz-list {
height: 40upx;
font-size: $font-sm + 2upx;
color: $font-color-dark;
text {
display: inline-block;
margin-right: 30upx;
}
}
.con-list {
flex: 1;
display: flex;
flex-direction: column;
color: $font-color-dark;
line-height: 40upx;
}
.red {
color: $uni-color-primary;
}
}
/* 评价 */
.eva-section {
display: flex;
flex-direction: column;
padding: 20upx 30upx;
background: #fff;
margin-top: 16upx;
.e-header {
display: flex;
align-items: center;
height: 70upx;
font-size: $font-sm + 2upx;
color: $font-color-light;
.tit {
font-size: $font-base + 2upx;
color: $font-color-dark;
margin-right: 4upx;
}
.tip {
flex: 1;
text-align: right;
}
.icon-you {
margin-left: 10upx;
}
}
}
.eva-box {
display: flex;
padding: 20upx 0;
.portrait {
flex-shrink: 0;
width: 80upx;
height: 80upx;
border-radius: 100px;
}
.right {
flex: 1;
display: flex;
flex-direction: column;
font-size: $font-base;
color: $font-color-base;
padding-left: 26upx;
.con {
font-size: $font-base;
color: $font-color-dark;
padding: 20upx 0;
}
.bot {
display: flex;
justify-content: space-between;
font-size: $font-sm;
color: $font-color-light;
}
}
}
/* 详情 */
.detail-desc {
background: #fff;
margin-top: 16upx;
.d-header {
display: flex;
justify-content: center;
align-items: center;
height: 80upx;
font-size: $font-base + 2upx;
color: $font-color-dark;
position: relative;
text {
padding: 0 20upx;
background: #fff;
position: relative;
z-index: 1;
}
&:after {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%);
width: 300upx;
height: 0;
content: '';
border-bottom: 1px solid #ccc;
}
}
}
/* 规格选择弹窗 */
.attr-content {
padding: 10upx 30upx;
.a-t {
display: flex;
image {
width: 170upx;
height: 170upx;
flex-shrink: 0;
margin-top: -40upx;
border-radius: 8upx;
}
.right {
display: flex;
flex-direction: column;
padding-left: 24upx;
font-size: $font-sm + 2upx;
color: $font-color-base;
line-height: 42upx;
.price {
font-size: $font-lg;
color: $uni-color-primary;
margin-bottom: 10upx;
}
.selected-text {
margin-right: 10upx;
}
}
}
.attr-list {
display: flex;
flex-direction: column;
font-size: $font-base + 2upx;
color: $font-color-base;
padding-top: 30upx;
padding-left: 10upx;
}
.item-list {
padding: 20upx 0 0;
display: flex;
flex-wrap: wrap;
text {
display: flex;
align-items: center;
justify-content: center;
background: #eee;
margin-right: 20upx;
margin-bottom: 20upx;
border-radius: 100upx;
min-width: 60upx;
height: 60upx;
padding: 0 20upx;
font-size: $font-base;
color: $font-color-dark;
}
.selected {
background: #fbebee;
color: $uni-color-primary;
}
}
}
/* 弹出层 */
.popup {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 99;
&.show {
display: block;
.mask {
animation: showPopup 0.2s linear both;
}
.layer {
animation: showLayer 0.2s linear both;
}
}
&.hide {
.mask {
animation: hidePopup 0.2s linear both;
}
.layer {
animation: hideLayer 0.2s linear both;
}
}
&.none {
display: none;
}
.mask {
position: fixed;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
background-color: rgba(0, 0, 0, 0.4);
}
.layer {
position: fixed;
z-index: 99;
bottom: 0;
width: 100%;
min-height: 40vh;
border-radius: 10upx 10upx 0 0;
background-color: #fff;
.btn {
height: 66upx;
line-height: 66upx;
border-radius: 100upx;
background: $uni-color-primary;
font-size: $font-base + 2upx;
color: #fff;
margin: 30upx auto 20upx;
}
}
@keyframes showPopup {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes hidePopup {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes showLayer {
0% {
transform: translateY(120%);
}
100% {
transform: translateY(0%);
}
}
@keyframes hideLayer {
0% {
transform: translateY(0);
}
100% {
transform: translateY(120%);
}
}
}
/* 底部操作菜单 */
.page-bottom {
position: fixed;
left: 30upx;
bottom: 30upx;
z-index: 95;
display: flex;
justify-content: center;
align-items: center;
width: 690upx;
height: 100upx;
background: rgba(255, 255, 255, 0.9);
box-shadow: 0 0 20upx 0 rgba(0, 0, 0, 0.5);
border-radius: 16upx;
.p-b-btn {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: $font-sm;
color: $font-color-base;
width: 96upx;
height: 80upx;
.yticon {
font-size: 40upx;
line-height: 48upx;
color: $font-color-light;
}
&.active,
&.active .yticon {
color: $uni-color-primary;
}
.icon-fenxiang2 {
font-size: 42upx;
transform: translateY(-2upx);
}
.icon-shoucang {
font-size: 46upx;
}
}
.action-btn-group {
display: flex;
height: 76upx;
border-radius: 100px;
overflow: hidden;
box-shadow: 0 20upx 40upx -16upx #fa436a;
box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
background: linear-gradient(to right, #ffac30, #fa436a, #f56c6c);
margin-left: 20upx;
position: relative;
&:after {
content: '';
position: absolute;
top: 50%;
right: 50%;
transform: translateY(-50%);
height: 28upx;
width: 0;
border-right: 1px solid rgba(255, 255, 255, 0.5);
}
.action-btn {
display: flex;
align-items: center;
justify-content: center;
width: 180upx;
height: 100%;
font-size: $font-base;
padding: 0;
border-radius: 0;
background: transparent;
}
}
}
</style>

View File

@@ -0,0 +1,371 @@
<template>
<view class="content">
<view class="navbar" :style="{ position: headerPosition, top: headerTop }">
<view class="nav-item" v-for="(item, index) in cateList" :key="index" :class="{ current: filterIndex === item.id }" @click="tabClick(item.id)">{{item.name}}</view>
</view>
<view class="goods-list">
<view v-for="(item, index) in goodsList" :key="index" class="goods-item" @click="navToDetailPage(item)">
<view class="image-wrapper"><image :src="item.pic" mode="aspectFill"></image></view>
<text class="title clamp">{{ item.title }}</text>
<view class="price-box">
<text>收藏量 {{ item.collectCount }}</text>
<text>浏览量 {{ item.readCount }}</text>
</view>
</view>
</view>
<uni-load-more :status="loadingType"></uni-load-more>
<view class="cate-mask" :class="cateMaskState === 0 ? 'none' : cateMaskState === 1 ? 'show' : ''" @click="toggleCateMask">
<view class="cate-content" @click.stop.prevent="stopPrevent" @touchmove.stop.prevent="stopPrevent">
<scroll-view scroll-y class="cate-list">
<view v-for="item in cateList" :key="item.id">
<view class="cate-item b-b two">{{ item.name }}</view>
<view v-for="tItem in item.child" :key="tItem.id" class="cate-item b-b" :class="{ active: tItem.id == cateId }" @click="changeCate(tItem)">
{{ tItem.name }}
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
import Api from '@/common/api';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
export default {
components: {
mallplusCopyright,
uniLoadMore
},
data() {
return {
cateMaskState: 0, //分类面板展开状态
headerPosition: 'fixed',
headerTop: '0px',
categoryId: '',
loadingType: 'more', //加载更多状态
filterIndex: 0,
cateId: 0, //已选三级分类id
pageNum: 1,
cid: null,
priceOrder: 0, //1 价格从低到高 2价格从高到低
cateList: [],
goodsList: []
};
},
onLoad(options) {
// #ifdef H5
this.headerTop = document.getElementsByTagName('uni-page-head')[0].offsetHeight + 'px';
// #endif
this.cateId = options.sid;
this.loadCateList(options.fid, options.sid);
this.loadData();
},
onPageScroll(e) {
//兼容iOS端下拉时顶部漂移
if (e.scrollTop >= 0) {
this.headerPosition = 'fixed';
} else {
this.headerPosition = 'absolute';
}
},
//下拉刷新
onPullDownRefresh() {
this.pageNum = this.pageNum + 1;
this.loadData('refresh');
},
//加载更多
onReachBottom() {
this.pageNum = this.pageNum + 1;
this.loadData();
},
methods: {
//加载分类
async loadCateList() {
let params = {'showStatus':1};
let list = await Api.apiCall('get', Api.cms.subjectCategoryList, params);
this.cateList = list.records;
},
//加载商品 ,带下拉刷新和上滑加载
async loadData(type = 'add', loading) {
//没有更多直接返回
if (type === 'add') {
if (this.loadingType === 'nomore') {
return;
}
this.loadingType = 'loading';
} else {
this.loadingType = 'more';
}
let params;
if (this.categoryId) {
params = { pageNum: this.pageNum, categoryId: this.categoryId };
} else {
params = { pageNum: this.pageNum };
}
let list = await Api.apiCall('get', Api.cms.subjectList, params);
let goodsList = list.records;
// let goodsList = await this.$api.json('goodsList');
if (type === 'refresh') {
this.goodsList = [];
}
this.goodsList = this.goodsList.concat(goodsList);
//判断是否还有下一页有是more 没有是nomore(测试数据判断大于20就没有了)
this.loadingType = this.goodsList.length > list.total ? 'nomore' : 'more';
if (type === 'refresh') {
if (loading == 1) {
uni.hideLoading();
} else {
uni.stopPullDownRefresh();
}
}
},
//筛选点击
tabClick(index) {
console.log('tab='+index);
this.pageNum = 1;
this.categoryId = index;
uni.pageScrollTo({
duration: 300,
scrollTop: 0
});
this.loadData('refresh', 1);
},
//显示分类面板
toggleCateMask(type) {
let timer = type === 'show' ? 10 : 300;
let state = type === 'show' ? 1 : 0;
this.cateMaskState = 2;
setTimeout(() => {
this.cateMaskState = state;
}, timer);
},
//分类点击
changeCate(item) {
this.pageNum = 1;
this.cateId = item.id;
this.toggleCateMask();
uni.pageScrollTo({
duration: 300,
scrollTop: 0
});
this.loadData('refresh', 1);
},
//详情
navToDetailPage(item) {
//测试数据没有写id用title代替
let id = item.id;
let groupId = item.groupId;
uni.navigateTo({
url: `../../pagesU/notice/subjectDetail?id=${id}`
});
},
stopPrevent() {}
}
};
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
}
.content {
padding-top: 96upx;
}
.navbar {
position: fixed;
left: 0;
top: var(--window-top);
display: flex;
width: 100%;
height: 80upx;
background: #fff;
box-shadow: 0 2upx 10upx rgba(0, 0, 0, 0.06);
z-index: 10;
.nav-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 30upx;
color: $font-color-dark;
position: relative;
&.current {
color: $base-color;
&:after {
content: '';
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 120upx;
height: 0;
border-bottom: 4upx solid $base-color;
}
}
}
.p-box {
display: flex;
flex-direction: column;
.yticon {
display: flex;
align-items: center;
justify-content: center;
width: 30upx;
height: 14upx;
line-height: 1;
margin-left: 4upx;
font-size: 26upx;
color: #888;
&.active {
color: $base-color;
}
}
.xia {
transform: scaleY(-1);
}
}
.cate-item {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 80upx;
position: relative;
font-size: 44upx;
&:after {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
border-left: 1px solid #ddd;
width: 0;
height: 36upx;
}
}
}
/* 分类 */
.cate-mask {
position: fixed;
left: 0;
top: var(--window-top);
bottom: 0;
width: 100%;
background: rgba(0, 0, 0, 0);
z-index: 95;
transition: 0.3s;
.cate-content {
width: 630upx;
height: 100%;
background: #fff;
float: right;
transform: translateX(100%);
transition: 0.3s;
}
&.none {
display: none;
}
&.show {
background: rgba(0, 0, 0, 0.4);
.cate-content {
transform: translateX(0);
}
}
}
.cate-list {
display: flex;
flex-direction: column;
height: 100%;
.cate-item {
display: flex;
align-items: center;
height: 90upx;
padding-left: 30upx;
font-size: 28upx;
color: #555;
position: relative;
}
.two {
height: 64upx;
color: #303133;
font-size: 30upx;
background: #f8f8f8;
}
.active {
color: $base-color;
}
}
/* 商品列表 */
.goods-list {
display: flex;
flex-wrap: wrap;
padding: 0 30upx;
background: #fff;
.goods-item {
display: flex;
flex-direction: column;
width: 48%;
padding-bottom: 40upx;
&:nth-child(2n + 1) {
margin-right: 4%;
}
}
.image-wrapper {
width: 100%;
height: 330upx;
border-radius: 3px;
overflow: hidden;
image {
width: 100%;
height: 100%;
opacity: 1;
}
}
.title {
font-size: $font-lg;
color: $font-color-dark;
line-height: 80upx;
}
.price-box {
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 10upx;
font-size: 24upx;
color: $font-color-light;
}
.price {
font-size: $font-lg;
color: $uni-color-primary;
line-height: 1;
&:before {
content: '¥';
font-size: 26upx;
}
}
}
</style>