Browse Source

[新增] 商品列表页面UI

[优化] 页面UI样式及做页面跳转
[新增] 标题组件
test
邓平艺 5 years ago
parent
commit
92d3b39953
  1. 67
      components/lf-title-line/lf-title-line.vue
  2. 1
      components/lf-waterfall/lf-waterfall.vue
  3. 6
      pages.json
  4. 15
      pages/channel/index.vue
  5. 10
      pages/discover/discover.vue
  6. 108
      pages/goodsList/index.vue
  7. 96
      pages/index/index.vue
  8. 38
      pages/user/user.vue
  9. BIN
      static/center/collect-active.png
  10. BIN
      static/center/collect.png
  11. BIN
      static/center/home.png
  12. BIN
      static/center/loginout.png
  13. BIN
      static/center/order.png
  14. BIN
      static/center/problem.png
  15. BIN
      static/center/scan.png
  16. BIN
      static/center/service.png
  17. BIN
      static/center/share.png
  18. BIN
      static/center/shop-logo.png
  19. BIN
      static/center/suggestion.png
  20. 2
      uview-ui/components/u-tabs/u-tabs.vue

67
components/lf-title-line/lf-title-line.vue

@ -0,0 +1,67 @@
<template>
<view class="decorative-box" :class="{'padding-tb': isPadding}" @click="onClick">
<view class="decorative-liner"></view>
<view class="lf-flex decorative-content">
<view class="rhombus lf-m-r-23" v-if="isRhombus"></view>
<view class="lf-font-32 lf-font-bold title">{{ title }}</view>
<view class="rhombus lf-m-l-23" v-if="isRhombus"></view>
</view>
<view class="decorative-liner"></view>
</view>
</template>
<script>
export default {
props: {
title: {
type: [String, Number], //
default: '猜你喜欢'
},
isRhombus: {
type: Boolean, //
default: true
},
isPadding: {
type: Boolean,
default: true
}
},
methods: {
onClick(event){
this.$emit('click', event);
}
}
}
</script>
<style lang="scss" scoped="scoped">
.decorative-box {
width: 100%;
height: max-content;
display: flex;
justify-content: center;
align-content: center;
align-items: center;
box-sizing: border-box;
.decorative-liner{
width: 110rpx;
height: 1rpx;
border: 1rpx solid #DCDCDC;
}
.decorative-content{
padding: 0 30rpx;
.rhombus{
width: 16rpx;
height: 16rpx;
transform: rotateZ(45deg);
background: #222;
}
.title{
max-width: 340rpx;
}
}
}
.padding-tb{
padding: 25rpx 0;
}
</style>

1
components/lf-waterfall/lf-waterfall.vue

@ -56,6 +56,7 @@
methods: {
onClick(){
console.log("aaaa");
this.$url('/pages/goodsDetail/index');
this.$emit('click');
}
}

6
pages.json

@ -115,6 +115,12 @@
"style": {
"navigationBarTitleText": "添加频道"
}
},
{
"path": "pages/goodsList/index",
"style": {
"navigationBarTitleText": "商品列表"
}
}
],
"globalStyle": {

15
pages/channel/index.vue

@ -17,7 +17,7 @@
<u-icon name="lock-fill"></u-icon>
<text class="lf-m-l-10">机票酒店</text>
</view>
<view class="lf-flex-wrap lf-p-l-5">
<view class="lf-flex-wrap lf-p-l-5 select-box">
<view class="select-item" hover-class="lf-opacity"
v-for="(item, index) in plane_ticket_list" :key="index"
v-if="!item.checked" @click="activaItem(item, index, 'plane_ticket_list')">{{ item.name }}
@ -28,7 +28,7 @@
<u-icon name="lock-fill"></u-icon>
<text class="lf-m-l-10">旅游度假</text>
</view>
<view class="lf-flex-wrap lf-p-l-5">
<view class="lf-flex-wrap lf-p-l-5 select-box">
<view class="select-item" hover-class="lf-opacity"
v-for="(item, index) in travel_list" :key="index"
v-if="!item.checked" @click="activaItem(item, index, 'travel_list')">{{ item.name }}
@ -39,7 +39,7 @@
<u-icon name="lock-fill"></u-icon>
<text class="lf-m-l-10">接送服务</text>
</view>
<view class="lf-flex-wrap lf-p-l-5">
<view class="lf-flex-wrap lf-p-l-5 select-box">
<view class="select-item" hover-class="lf-opacity"
v-for="(item, index) in jieson_list" :key="index"
v-if="!item.checked" @click="activaItem(item, index, 'jieson_list')">{{ item.name }}
@ -50,7 +50,7 @@
<u-icon name="lock-fill"></u-icon>
<text class="lf-m-l-10">其他精选</text>
</view>
<view class="lf-flex-wrap lf-p-l-5">
<view class="lf-flex-wrap lf-p-l-5 select-box">
<view class="select-item" hover-class="lf-opacity"
v-for="(item, index) in other_list" :key="index"
v-if="!item.checked" @click="activaItem(item, index, 'other_list')">{{ item.name }}
@ -216,4 +216,11 @@
.lf-p-l-5{
padding-left: 5rpx;
}
// .select-box{
// overflow: hidden;
// padding-top: 1rpx;
// width: 100%;
// height: max-content;
// border-radius: 5rpx;
// }
</style>

10
pages/discover/discover.vue

@ -2,11 +2,11 @@
<view class="page-color">
<view class="padding-lr lf-p-t-30 lf-p-b-30">
<view class="bg-red card-discover lf-m-b-30">
<view>
<view @click="$url('/pages/notice/article')">
<image src="../../static/images/empty.png" mode="aspectFill" style="width: 686rpx;height: 300rpx;"></image>
</view>
<view class="flex-direction bg-white discover-radius">
<view class="flex align-center text-center lf-p-30 solid-bottom" v-for="i of 3">
<view class="flex align-center text-center lf-p-30 solid-bottom" v-for="i of 3" @click="$url('/pages/notice/article')">
<view>
<image src="../../static/logo.png" mode="aspectFill" style="width: 100rpx;height: 100rpx;"></image>
</view>
@ -18,11 +18,11 @@
</view>
<view class="bg-red card-discover lf-m-b-30">
<view>
<view @click="$url('/pages/notice/article')">
<image src="../../static/images/empty.png" mode="aspectFill" style="width: 686rpx;height: 300rpx;"></image>
</view>
<view class="flex-direction bg-white discover-radius">
<view class="flex align-center text-center lf-p-30 solid-bottom" v-for="i of 3">
<view class="flex align-center text-center lf-p-30 solid-bottom" v-for="i of 3" @click="$url('/pages/notice/article')">
<view>
<image src="../../static/logo.png" mode="aspectFill" style="width: 100rpx;height: 100rpx;"></image>
</view>
@ -33,6 +33,8 @@
</view>
</view>
</view>
<!-- 回到顶部 -->
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
</view>
</template>

108
pages/goodsList/index.vue

@ -0,0 +1,108 @@
<template>
<view>
<!-- 活动列表 -->
<view class="content">
<view class="item" v-for="item in list" :key="item">
<view class="cover">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100" mode="aspectFill"></image>
</view>
<view style="width: 420rpx;">
<view class="lf-font-28 lf-color-333 lf-m-b-20 lf-line-2" style="height: 78rpx;">南胜地 身处亚热带风情/玩转南澳转南澳转南澳转南澳转转南澳转南澳</view>
<view class="lf-font-24 lf-color-gray">本套票只包含两个成人不可带小孩</view>
<view class="lf-flex lf-m-t-25">
<lf-price price="3599.00"></lf-price>
<text class="lf-font-24 lf-color-gray lf-line-through lf-m-l-15">¥4599.00</text>
</view>
</view>
</view>
</view>
<!-- 加载 -->
<view class="loading-more">
<text v-if="list.length" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text>
<lf-nocontent v-else></lf-nocontent>
</view>
<!-- 回到顶部 -->
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
</view>
</template>
<script>
export default {
data(){
return {
list: [1,2,3,4,5],
loadingClass: false,
loadingText: '已加载全部数据~',
page: 1,
isPage: true,
pageSize: 20
}
},
onLoad(){
// this.getActivityList();
},
methods: {
getActivityList(){
return;
this.$http(this.API.a).then(res => {
this.isPage = res.data.has_more_page;
let list = res.data.items;
if(!res.data.has_more_page){
this.loadingClass = false;
this.loadingText = '已加载全部数据~';
}
if(this.page == 1){
this.list = list;
}else{
this.list.push(...list);
}
})
},
//
enterDetail(index){
let goods_id = this.list[index].goods_id;
this.$url('/pages/goodsDetail/index?id='+ goods_id);
}
},
onReachBottom(){
if(this.isPage){
this.page = this.page + 1;
this.getActivityList();
}
},
onPullDownRefresh(){
this.page = 1;
this.isPage = true;
this.loadingClass = true;
this.loadingText = '正在加载中';
this.getActivityList();
uni.stopPullDownRefresh();
}
}
</script>
<style lang="scss" scoped="scoped">
.content{
padding: 0 32rpx;
box-sizing: border-box;
width: 750rpx;
height: max-content;
.item{
width: 100%;
height: auto;
border-bottom: 1rpx solid #E5E5E5;
padding: 30rpx 0;
display: flex;
&:last-child{
border-bottom: none;
}
.cover{
width: 250rpx;
height: 210rpx;
border-radius: 20rpx;
overflow: hidden;
margin-right: 15rpx;
}
}
}
</style>

96
pages/index/index.vue

@ -1,10 +1,10 @@
<template>
<view>
<swiper class="head" :current="banner_current" >
<swiper-item>
<swiper-item @click="clickBanner">
<image src="https://picsum.photos/375/360" class="swipe-img"></image>
</swiper-item>
<swiper-item>
<swiper-item @click="clickBanner">
<image src="https://picsum.photos/375/360" class="swipe-img"></image>
</swiper-item>
</swiper>
@ -15,7 +15,7 @@
<u-icon name="lock-fill lf-text-vertical"></u-icon>
<view class="lf-m-l-12 lf-line-1" style="max-width: 510rpx;">国庆优惠大促快来看看吧</view>
</view>
<view class="message-btn" hover-class="lf-opacity">详情</view>
<view class="message-btn" hover-class="lf-opacity" @click="$url('/pages/notice/article')">详情</view>
</view>
<!-- 频道 -->
<view class="lf-row-between lf-m-b-10">
@ -26,30 +26,31 @@
</view>
</view>
<view class="lf-flex-wrap">
<view class="channel-item" v-for="(item, index) in 8">
<view class="channel-item" v-for="(item, index) in 7" @click="$url('/pages/goodsList/index')">
<image src="../../static/logo.png" class="channel-mask" mode="aspectFill"></image>
<view>
<view class="lf-row-center channe-text">冲浪</view>
<!-- <view>
<u-icon name="lock-fill lf-text-vertical"></u-icon>
</view>
</view> -->
</view>
</view>
<!-- 中间广告模块 -->
<swiper class="lf-m-t-40 ad" :current="banner_current" >
<swiper-item>
<swiper-item @click="clickAD">
<image src="https://picsum.photos/375/230" class="lf-w-100 lf-h-100"></image>
</swiper-item>
</swiper>
<!-- 精品推荐 -->
<!-- 人气爆款 -->
<view class="lf-row-between lf-m-t-40">
<view class="lf-font-36 lf-font-bold lf-color-333">精品推荐</view>
<view class="lf-flex lf-color-555">
<view class="lf-font-36 lf-font-bold lf-color-333">人气爆款</view>
<view class="lf-flex lf-color-555" @click="$url('/pages/activityList/index')">
<view class="lf-m-r-10">更多</view>
<u-icon name="lock-fill lf-text-vertical"></u-icon>
</view>
</view>
<view class="recomm lf-m-t-20">
<view class="recomm lf-m-t-20 lf-m-b-30">
<view class="lf-row-between">
<view class="max-recomm-img">
<view class="max-recomm-img" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
<view class="recomm-title">
<view class="lf-line-2">土耳其双人游飞机往返酒店五星级各大热门景点豪华双人游纯江湖救急</view>
@ -57,22 +58,22 @@
</view>
</view>
<view>
<view class="recomm-img">
<view class="recomm-img" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
</view>
<view class="recomm-img lf-m-t-10">
<view class="recomm-img lf-m-t-10" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
</view>
</view>
</view>
<view class="lf-row-between lf-m-t-10">
<view class="recomm-img">
<view class="recomm-img" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
</view>
<view class="recomm-img">
<view class="recomm-img" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
</view>
<view class="recomm-img">
<view class="recomm-img" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
</view>
</view>
@ -82,14 +83,16 @@
<u-tabs :list="tab_list" :is-scroll="true" :current="current" @change="tabChange"></u-tabs>
</view> -->
<!-- 推荐 -->
<view class="lf-row-between lf-m-t-40 lf-m-b-10">
<!-- <view class="lf-row-between lf-m-t-40 lf-m-b-10">
<view class="lf-font-36 lf-font-bold lf-color-333">推荐</view>
<view class="lf-flex lf-color-555">
<view class="lf-m-r-10">更多</view>
<u-icon name="lock-fill lf-text-vertical"></u-icon>
</view>
</view>
</view> -->
</view>
<!-- 猜你喜欢 -->
<lf-title-line></lf-title-line>
<!-- 商品列表-瀑布流 -->
<view style="padding: 0 20rpx;">
<lf-waterfall :list="recomm_list"></lf-waterfall>
@ -102,11 +105,13 @@
</template>
<script>
import lfWaterfall from '../../components/lf-waterfall/lf-waterfall.vue';
import lfWaterfall from '@/components/lf-waterfall/lf-waterfall.vue';
import lfTitleLine from '@/components/lf-title-line/lf-title-line.vue';
export default {
components: {
lfWaterfall
lfWaterfall,
lfTitleLine
},
data() {
return {
@ -176,6 +181,7 @@
this.addRandomData();
},
methods: {
//
addRandomData() {
for(let i = 0; i < 10; i++) {
let index = this.$u.random(0, this.list.length - 1);
@ -185,12 +191,22 @@
this.recomm_list.push(item);
}
},
// tabs
tabChange(current){
this.current = current;
},
// swiper
pageChange(event){
console.log(event)
this.current = event.detail.current;
},
// banner
clickBanner(){
this.$msg('您点击了banner图')
},
// ad
clickAD(){
this.$msg('您点击了ad广告')
}
},
onReachBottom() {
@ -263,20 +279,20 @@
position: absolute;
z-index: 0;
}
view{
position: absolute;
right: 0;
bottom: 0;
background-color: rgba(255,255,255,0.5);
width: 42rpx;
height: 42rpx;
color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
border-radius: 10rpx 0rpx 15rpx 0rpx;
z-index: 2;
}
// view{
// position: absolute;
// right: 0;
// bottom: 0;
// background-color: rgba(255,255,255,0.5);
// width: 42rpx;
// height: 42rpx;
// color: #FFFFFF;
// display: flex;
// justify-content: center;
// align-items: center;
// border-radius: 10rpx 0rpx 15rpx 0rpx;
// z-index: 2;
// }
.channel-mask::after{
width: 100%;
height: 100%;
@ -287,6 +303,16 @@
top: 0;
left: 0;
}
.channe-text{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
color: #FFFFFF;
font-size: 28rpx;
}
}
.ad{

38
pages/user/user.vue

@ -2,14 +2,14 @@
<view>
<view class="flex-direction bg-blue justify-between align-center text-center lf-p-t-30 lf-p-b-30" style="height: 340rpx;">
<view>
<image src="../../static/logo.png" mode="aspectFill" style="width: 200rpx;height: 200rpx;border-radius: 50%;"></image>
<image src="../../static/logo.png" mode="aspectFill" style="width: 200rpx;height: 200rpx;border-radius: 50%;" @click="lookImg('')"></image>
</view>
<view class="lf-font-36 align-center text-center text-white lf-m-t-30">
小小的小可爱
</view>
</view>
<view class="list">
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/collect/index')">
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/order/order')">
<view class="lf-row-center">
<image class="icon-img" src="../../static/logo.png"></image>
<text class="lf-text-vertical lf-m-l-20 lf-font-28 lf-color-black">我的订单</text>
@ -18,7 +18,7 @@
<u-icon name="arrow-right" color="#777" size="28"></u-icon>
</view>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/contactService/index')">
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/message/index')">
<view class="lf-row-center">
<image class="icon-img" src="../../static/logo.png"></image>
<text class="lf-text-vertical lf-m-l-16 lf-font-28 lf-color-black">消息中心</text>
@ -37,7 +37,7 @@
</view>
<button class="feedback-btn" open-type="feedback"></button>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity">
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/collect/index')">
<view class="lf-row-center">
<image class="icon-img" src="../../static/logo.png"></image>
<text class="lf-text-vertical lf-m-l-16 lf-font-28 lf-color-black">我的收藏</text>
@ -45,9 +45,8 @@
<view>
<u-icon name="arrow-right" color="#777" size="28"></u-icon>
</view>
<button class="feedback-btn" open-type="feedback"></button>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity">
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/about/index')">
<view class="lf-row-center">
<image class="icon-img" src="../../static/logo.png"></image>
<text class="lf-text-vertical lf-m-l-16 lf-font-28 lf-color-black">关于我们</text>
@ -55,7 +54,6 @@
<view>
<u-icon name="arrow-right" color="#777" size="28"></u-icon>
</view>
<button class="feedback-btn" open-type="feedback"></button>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity">
<view class="lf-row-center">
@ -65,25 +63,33 @@
<view>
<u-icon name="arrow-right" color="#777" size="28"></u-icon>
</view>
<button class="feedback-btn" open-type="feedback"></button>
<button class="feedback-btn" open-type="contact"></button>
</view>
</view>
<view style="background-color: #F6F6F6;">
<view class="lf-p-t-40 lf-p-b-20 text-center details-title">
<view class="lf-p-t-35" style="background-color: #F6F6F6;">
<!-- <view class="lf-p-t-40 lf-p-b-20 text-center details-title">
<view class="lf-font-32 details-text flex justify-between align-center text-center" style="color: #222;position: relative;left: 270rpx;">
<view class="rhombus lf-m-l-30"></view>
<view>为你推荐</view>
<view class="rhombus lf-m-r-30"></view>
</view>
</view>
</view> -->
<lf-title-line title="为你推荐"></lf-title-line>
<lf-waterfall :list="list"></lf-waterfall>
</view>
<!-- 回到顶部 -->
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
</view>
</template>
<script>
import lfTitleLine from '@/components/lf-title-line/lf-title-line.vue';
export default {
components: {
lfTitleLine
},
data() {
return {
list: [
@ -155,6 +161,16 @@
},
]
}
},
methods: {
//
lookImg(img){
this.$u.throttle(() => {
uni.previewImage({
urls: [img]
})
}, 200);
},
}
}
</script>

BIN
static/center/collect-active.png

After

Width: 75  |  Height: 75  |  Size: 1.4 KiB

BIN
static/center/collect.png

After

Width: 75  |  Height: 75  |  Size: 2.4 KiB

BIN
static/center/home.png

After

Width: 75  |  Height: 75  |  Size: 2.2 KiB

BIN
static/center/loginout.png

After

Width: 75  |  Height: 75  |  Size: 2.3 KiB

BIN
static/center/order.png

After

Width: 75  |  Height: 75  |  Size: 1.4 KiB

BIN
static/center/problem.png

After

Width: 75  |  Height: 75  |  Size: 2.7 KiB

BIN
static/center/scan.png

After

Width: 75  |  Height: 75  |  Size: 1.0 KiB

BIN
static/center/service.png

After

Width: 75  |  Height: 75  |  Size: 2.3 KiB

BIN
static/center/share.png

After

Width: 75  |  Height: 75  |  Size: 1.4 KiB

BIN
static/center/shop-logo.png

After

Width: 90  |  Height: 90  |  Size: 2.9 KiB

BIN
static/center/suggestion.png

After

Width: 75  |  Height: 75  |  Size: 1.8 KiB

2
uview-ui/components/u-tabs/u-tabs.vue

@ -199,7 +199,7 @@
computed: {
// bar
tabBarStyle() {
let scrollBarLeft = this.scrollBarLeft - 7;
let scrollBarLeft = this.scrollBarLeft - 9;
let style = {
width: this.barWidth + 'rpx',
transform: `translate(${scrollBarLeft}px, -100%)`,

Loading…
Cancel
Save