Browse Source

优化登录、新增搜索、商品列表

master
ltlzx 4 years ago
parent
commit
97833fcf7e
  1. 97
      pages/category/productList.vue
  2. 6
      pages/index/search.vue
  3. 8
      pages/login/index.vue

97
pages/category/productList.vue

@ -4,7 +4,8 @@
<block slot="left"> <block slot="left">
<view class="nav_left"> <view class="nav_left">
<image src="../../static/img/left.png" mode="" @click="back"></image> <image src="../../static/img/left.png" mode="" @click="back"></image>
<image src="../../static/img/seach1.png" mode=""></image> <image src="../../static/img/seach1.png" mode="" @click="goPage()"></image>
</view> </view>
</block> </block>
<block slot="right"> <block slot="right">
@ -16,13 +17,13 @@
</block> </block>
</uni-nav-bar> </uni-nav-bar>
<view class="pets_nav"> <view class="pets_nav">
<text>Synthesis</text> <text :class="query.order_type==0?'active_text':''" @click="selectNav(0)">Synthesis</text>
<view class="pets_nav_item"> <view class="pets_nav_item" @click="selectNav(1)">
<text>Sales</text> <text :class="query.order_type==3 ?'active_text' :query.order_type==4 ?'active_text':''">Sales</text>
<image src="/static/img/bottom1.png" mode="" class="pets_nav_arrow"></image> <image src="/static/img/bottom1.png" mode="" class="pets_nav_arrow"></image>
</view> </view>
<view class="pets_nav_item"> <view class="pets_nav_item" @click="selectNav(2)">
<text>Price</text> <text :class="query.order_type==1 ?'active_text':query.order_type==2 ?'active_text':''">Price</text>
<view class="pets_nav_item_right"> <view class="pets_nav_item_right">
<image src="../../static/img/top.png" mode="" class="pets_nav_arrow"></image> <image src="../../static/img/top.png" mode="" class="pets_nav_arrow"></image>
<image src="/static/img/bottom1.png" mode="" class="pets_nav_arrow"></image> <image src="/static/img/bottom1.png" mode="" class="pets_nav_arrow"></image>
@ -36,15 +37,15 @@
</view> </view>
<view class="body"> <view class="body">
<view class="product" v-show="pets_index==0"> <view class="product" v-show="pets_index==0">
<view class="product_item" v-for="(item,index) in 5" :key="index"> <view class="product_item" v-for="(item,index) in list" :key="index">
<view class="product_item_image"></view> <image class="product_item_image" :src="item.image"></image>
<view class="product_item_right"> <view class="product_item_right">
<view >Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY7164 Men's</view> <view >{{item.short_name}}</view>
<view class="item_right_lable"> <view class="item_right_lable">
<view class="right_lable_item">Hashtag buzzword</view> <view class="right_lable_item" v-if="item.tags!=''">{{item.tags}}</view>
</view> </view>
<view class="item_right_price"> <view class="item_right_price">
<text>US$314.00</text> <text>US${{item.shop_price}}</text>
<view class="right_price_operation"> <view class="right_price_operation">
<image src="/static/img/like.png" mode=""></image> <image src="/static/img/like.png" mode=""></image>
<image src="../../static/img/cart2.png" mode=""></image> <image src="../../static/img/cart2.png" mode=""></image>
@ -55,15 +56,15 @@
</view> </view>
<view class="product1" v-show="pets_index==1"> <view class="product1" v-show="pets_index==1">
<custom-waterfalls-flow :value="list"> <custom-waterfalls-flow ref="waterfallsFlowRef" :value="list" imageKey="goods_img">
<template v-slot:default="item"> <template v-slot:default="item">
<view class="product1_item"> <view class="product1_item">
<view>{{item.title}}</view> <view>{{item.short_name}}</view>
<view class="desc"> <view class="desc">
<text>{{item.desc}}</text> <text>US${{item.shop_price}}</text>
<image src="../../static/img/cart2.png" mode=""></image> <image src="../../static/img/cart2.png" mode=""></image>
</view> </view>
<view class="lable" v-if="item.lable!=''">{{item.lable}}</view> <view class="lable" v-if="item.tags!=''">{{item.tags}}</view>
</view> </view>
</template> </template>
</custom-waterfalls-flow> </custom-waterfalls-flow>
@ -81,39 +82,46 @@
pets_index:1, pets_index:1,
navWidth:"160rpx", navWidth:"160rpx",
query:{ query:{
_action:'getgoods' _action:'getgoods',
}, order_type:0
list: [
{
image: 'https://via.placeholder.com/200x200.png/ff0000',
title: 'Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY7164 Men',
desc: 'US$314.00',
lable:"Hashtag buzzword" ,
},
{
image: 'https://via.placeholder.com/200x200.png/ff0000',
title: 'Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY7164 Men',
desc: 'US$314.00',
lable:"" ,
},
{
image: 'https://via.placeholder.com/200x200.png/ff0000',
title: 'Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY7164 Men',
desc: 'US$314.00',
lable:"" ,
}, },
{ list:[]
image: 'https://via.placeholder.com/200x200.png/ff0000',
title: 'Adidas Yeezy Boost 350 V2 Dazzling Blue Black GY7164 Men',
desc: 'US$314.00',
lable:"" ,
},
]
} }
}, },
methods:{ methods:{
back(){ back(){
uni.navigateBack() uni.navigateBack()
},
goPage(){
uni.navigateTo({
url:'../index/search'
})
},
selectNav(type){
if(type==0){
this.query.order_type=0
}else if(type==1){
this.query.order_type=3
}else{
if(this.query.order_type!=1 &&this.query.order_type!=2){
this.query.order_type=1
}else if(this.query.order_type==1){
this.query.order_type=2
}else{
this.query.order_type=1
}
}
this.getList()
},
getList(){
defaultRequest(this.query).then(res=>{
console.info(res)
if(res.error==0){
this.list=res.data
this.$refs.waterfallsFlowRef.refresh();
}
})
} }
}, },
onLoad(e) { onLoad(e) {
@ -122,6 +130,7 @@
}else{ }else{
this.query.keyword=e.keyword this.query.keyword=e.keyword
} }
this.getList()
} }
} }
@ -158,6 +167,7 @@
// border-top: 1px solid #F5F6FA; // border-top: 1px solid #F5F6FA;
border-bottom: 1px solid #F5F6FA; border-bottom: 1px solid #F5F6FA;
position: fixed; position: fixed;
background-color: white;
top: 0; top: 0;
margin-top: 155rpx; margin-top: 155rpx;
/* #ifdef H5 */ /* #ifdef H5 */
@ -166,6 +176,9 @@
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
z-index: 99; z-index: 99;
.active_text{
color: #000000;
}
.pets_nav_item{ .pets_nav_item{
display: flex; display: flex;
align-items: center; align-items: center;

6
pages/index/search.vue

@ -41,6 +41,7 @@
</template> </template>
<script> <script>
import {defaultRequest} from '../../api/index.js'
export default { export default {
data() { data() {
return { return {
@ -49,7 +50,10 @@
}, },
methods:{ methods:{
search(){ search(){
if(this.searchValue=='')return
uni.navigateTo({
url:'../category/productList?keyword='+this.searchValue+'&type=1'
})
} }
} }
} }

8
pages/login/index.vue

@ -52,7 +52,7 @@
</template> </template>
<script> <script>
import {defaultRequest} from '../../api/index.js' import {defaultRequest1} from '../../api/index.js'
export default { export default {
data() { data() {
return { return {
@ -91,7 +91,7 @@
// //
configuration(){ configuration(){
let data={_action:'getpagedata',pagecode:'PAGE-LOGIN'} let data={_action:'getpagedata',pagecode:'PAGE-LOGIN'}
defaultRequest(data).then(res=>{ defaultRequest1(data).then(res=>{
console.info(res) console.info(res)
}) })
}, },
@ -102,7 +102,7 @@
this.loginErr=true this.loginErr=true
return return
} }
defaultRequest(this.loginDate).then(res=>{ defaultRequest1(this.loginDate).then(res=>{
console.info(res) console.info(res)
if(res.error==0){ if(res.error==0){
this.loginErr=false this.loginErr=false
@ -134,7 +134,7 @@
return return
} }
this.regDate.password2=this.regDate.password1 this.regDate.password2=this.regDate.password1
defaultRequest(this.regDate).then(res=>{ defaultRequest1(this.regDate).then(res=>{
console.info(res) console.info(res)
if(res.error==0){ if(res.error==0){
this.regErr=false this.regErr=false

Loading…
Cancel
Save