更新
This commit is contained in:
parent
dc20a1c4b1
commit
5c9b02ed3b
10
App.vue
10
App.vue
@ -77,10 +77,10 @@
|
||||
visible: false
|
||||
})
|
||||
// #ifdef H5
|
||||
// uni.setTabBarItem({
|
||||
// index: 2,
|
||||
// visible: false
|
||||
// })
|
||||
uni.setTabBarItem({
|
||||
index: 2,
|
||||
visible: false
|
||||
})
|
||||
// #endif
|
||||
|
||||
this.globalData.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
|
||||
@ -401,7 +401,7 @@
|
||||
@import 'static/css/base.css';
|
||||
@import 'static/iconfont/iconfont.css';
|
||||
@import 'static/css/style.scss';
|
||||
|
||||
|
||||
.bg-color-red {
|
||||
background-color: #e93323 !important;
|
||||
}
|
||||
|
11
api/store.js
11
api/store.js
@ -100,7 +100,7 @@ export function getCategoryIndexList() {
|
||||
* 获取产品列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getProductslist(data) {
|
||||
export function getProductslist(data, enLoad=false) {
|
||||
if (data.brand_id && Array.isArray(data.brand_id)) {
|
||||
data = {
|
||||
...data
|
||||
@ -108,7 +108,8 @@ export function getProductslist(data) {
|
||||
data.brand_id = data.brand_id.toString()
|
||||
}
|
||||
return request.get('product/spu/lst', data, {
|
||||
noAuth: true
|
||||
noAuth: true,
|
||||
enLoad: enLoad
|
||||
});
|
||||
}
|
||||
/**
|
||||
@ -139,13 +140,15 @@ export function getBrandlist(data) {
|
||||
* 获取推荐产品
|
||||
*
|
||||
*/
|
||||
export function getProductHot(page, limit, sale_type) {
|
||||
export function getProductHot(page, limit, sale_type, enLoad=false) {
|
||||
console.log(enLoad);
|
||||
return request.get("product/spu/recommend", {
|
||||
page: page === undefined ? 1 : page,
|
||||
limit: limit === undefined ? 10 : limit,
|
||||
sale_type: sale_type || null
|
||||
}, {
|
||||
noAuth: true
|
||||
noAuth: true,
|
||||
enLoad: enLoad
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
@ -2,8 +2,8 @@
|
||||
"name" : "惠农生活",
|
||||
"appid" : "__UNI__3A527D1",
|
||||
"description" : "",
|
||||
"versionName" : "2.0.10",
|
||||
"versionCode" : 2010,
|
||||
"versionName" : "2.0.11",
|
||||
"versionCode" : 2011,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
@ -219,7 +219,7 @@
|
||||
class="search_content flex_a_c_j_sb">
|
||||
<view class="flex_a_c search_content_wrap">
|
||||
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
|
||||
<input type="text" placeholder="搜索您需要批发进货的产品名称" :value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;"
|
||||
<input type="text" placeholder="搜索商品名称" :value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;"
|
||||
disabled style="pointer-events: none;">
|
||||
</view>
|
||||
<!-- <button class="search_btn">搜索</button> -->
|
||||
|
@ -315,11 +315,11 @@
|
||||
<view class="wholeSale-nav">
|
||||
<!-- <u-icon class="icon" name="arrow-left" size="20" @click="navBack"></u-icon> -->
|
||||
<!-- 搜索 -->
|
||||
<view @click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}`)" hover-class="none"
|
||||
<view @click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}&shop=true`)" hover-class="none"
|
||||
class="search_content flex_a_c_j_sb">
|
||||
<view class="flex_a_c search_content_wrap">
|
||||
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
|
||||
<input type="text" placeholder="搜索您需要批发进货的产品名称" :value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;"
|
||||
<input type="text" placeholder="搜索店铺名称" :value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;"
|
||||
disabled style="pointer-events: none;">
|
||||
</view>
|
||||
<!-- <button class="search_btn">搜索</button> -->
|
||||
|
@ -219,7 +219,7 @@
|
||||
class="search_content flex_a_c_j_sb">
|
||||
<view class="flex_a_c search_content_wrap">
|
||||
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
|
||||
<input type="text" placeholder="搜索您需要批发进货的产品名称" :value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;"
|
||||
<input type="text" placeholder="搜索商品名称" :value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;"
|
||||
disabled style="pointer-events: none;">
|
||||
</view>
|
||||
<!-- <button class="search_btn">搜索</button> -->
|
||||
|
@ -4,7 +4,7 @@
|
||||
<view class='search acea-row row-between-wrapper'>
|
||||
<view class='input acea-row row-between-wrapper'>
|
||||
<text class='iconfont icon-sousuo2'></text>
|
||||
<input type='text' :value='searchValue' :focus="focus" placeholder='点击搜索商品、店铺名称' placeholder-class='placeholder'
|
||||
<input type='text' :value='searchValue' :focus="focus" :placeholder="isShop?'点击搜索店铺名称':'点击搜索商品名称'" placeholder-class='placeholder'
|
||||
@input="setValue"></input>
|
||||
</view>
|
||||
<view class='bnt' @tap='searchBut'>搜索</view>
|
||||
@ -172,11 +172,18 @@
|
||||
mainWidth: 960,
|
||||
isShow: true,
|
||||
back: false,
|
||||
isShop: false,
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.searchValue = options.searchVal || ''
|
||||
this.back = options.back;
|
||||
this.isShop = options.shop || false;
|
||||
if(options.shop=='true'){
|
||||
uni.setNavigationBarTitle({
|
||||
title: '搜索店铺'
|
||||
})
|
||||
}
|
||||
},
|
||||
onShow: function() {
|
||||
try {
|
||||
|
@ -1016,28 +1016,28 @@
|
||||
this.loadGoods(e);
|
||||
},
|
||||
loadGoods(e = 1) {
|
||||
if (e == 1) return this.get_host_product();
|
||||
if (e == 1) return this.get_host_product(true);
|
||||
if (e == 2) return this.get_host_home({
|
||||
mer_type: 1
|
||||
});
|
||||
}, true);
|
||||
if (e == 3) return this.get_host_home({
|
||||
mer_type: 2
|
||||
});
|
||||
}, true);
|
||||
if (e == 4) return this.get_host_home({
|
||||
mer_type: 3
|
||||
});
|
||||
}, true);
|
||||
},
|
||||
/**
|
||||
* 获取我的推荐
|
||||
*/
|
||||
get_host_product: function() {
|
||||
get_host_product: function(reload=false) {
|
||||
let that = this;
|
||||
let num = that.hotLimit;
|
||||
if (!that.hotScroll) return;
|
||||
if (that.hotLoading) return;
|
||||
that.hotLoading = true;
|
||||
that.hotTitle = '加载中';
|
||||
getProductHot(that.hotPage, that.hotLimit, 1).then(res => {
|
||||
getProductHot(that.hotPage, that.hotLimit, 1, true).then(res => {
|
||||
let list = res.data.list;
|
||||
let productList = that.$util.SplitArray(list, that.hostProduct);
|
||||
let hotScroll = list.length <= num && list.length != 0;
|
||||
@ -1051,7 +1051,7 @@
|
||||
/**
|
||||
* 获取里海云仓, 云市场, 名优特产
|
||||
*/
|
||||
get_host_home: function(query = {}) {
|
||||
get_host_home: function(query = {}, reload) {
|
||||
let that = this;
|
||||
let num = that.hotLimit;
|
||||
if (!that.hotScroll) return;
|
||||
@ -1063,7 +1063,7 @@
|
||||
query.sale_type = 1;
|
||||
getProductslist({
|
||||
...query
|
||||
}).then(res => {
|
||||
}, true).then(res => {
|
||||
let list = res.data.list;
|
||||
let productList = that.$util.SplitArray(list, that.hostProduct);
|
||||
let hotScroll = list.length <= num && list.length != 0;
|
||||
|
@ -482,7 +482,8 @@
|
||||
}
|
||||
if (this.isLoading == -1) return;
|
||||
this.isLoading = 1;
|
||||
getProductslist(this.where).then(res => {
|
||||
getProductslist(this.where, true).then(res => {
|
||||
if (reLoad) this.hostProduct = [];
|
||||
this.hostProduct = [...this.hostProduct, ...res.data.list];
|
||||
this.isLoading = 0;
|
||||
if (res.data.list.length < this.where.limit) this.isLoading = -1;
|
||||
|
@ -58,12 +58,16 @@ function atob(input) {
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
var HTTP_list = new Map();
|
||||
|
||||
/**
|
||||
* 发送请求
|
||||
*/
|
||||
function baseRequest(url, method, data, {
|
||||
noAuth = false,
|
||||
noVerify = false
|
||||
noVerify = false,
|
||||
enLoad = false //终止上一个接口相同类型正在请求的接口, 防止快速切换tab时页面抖动
|
||||
}) {
|
||||
let Url = HTTP_REQUEST_URL,
|
||||
header = HEADER;
|
||||
@ -76,11 +80,19 @@ function baseRequest(url, method, data, {
|
||||
});
|
||||
}
|
||||
}
|
||||
let URL = Url + '/api/' + url
|
||||
console.log(enLoad, HTTP_list);
|
||||
if(enLoad) {
|
||||
let http = HTTP_list.get(URL);
|
||||
if(http){
|
||||
http.abort();
|
||||
}
|
||||
}
|
||||
if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
|
||||
if(store.state.app.uuid)header['uuid'] = store.state.app.uuid
|
||||
if(store.state.app.uuid) header['uuid'] = store.state.app.uuid
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.request({
|
||||
url: Url + '/api/' + url,
|
||||
let http = uni.request({
|
||||
url: URL,
|
||||
method: method || 'GET',
|
||||
header: header,
|
||||
data: data || {},
|
||||
@ -110,8 +122,12 @@ function baseRequest(url, method, data, {
|
||||
},
|
||||
fail: (message) => {
|
||||
reject('请求失败');
|
||||
}
|
||||
},
|
||||
complete: () => {
|
||||
// if(enLoad) HTTP_list.delete(URL);
|
||||
}
|
||||
})
|
||||
if(enLoad) HTTP_list.set(URL, http);
|
||||
});
|
||||
}
|
||||
const request = {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user