提交修改
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<uni-nav-bar leftText=" " :fixed="true" :border="false" @clickLeft="leftClick" color="#000" backgroundColor="#fff" :statusBar="true" title="样机分类"></uni-nav-bar>
|
||||
|
||||
<!--搜索 -->
|
||||
<view class="search">
|
||||
<uni-search-bar @confirm="search" v-model="searchValue" cancelButton="none" @blur="search"></uni-search-bar>
|
||||
</view>
|
||||
<!-- 顶部 tabs -->
|
||||
<view class="tabs">
|
||||
<view :class="['tab', currentTab==='latest'?'on':'']" @click="switchTab('latest')">最新发布</view>
|
||||
@@ -97,6 +100,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchValue:'',
|
||||
showlogin: false,
|
||||
tabs: [
|
||||
{ key: 'latest', label: '最新发布' },
|
||||
@@ -229,9 +233,9 @@ export default {
|
||||
// 分类切换事件
|
||||
onCategoryChange(categoryId) {
|
||||
// 如果点击的是当前分类且已有数据,不重复加载
|
||||
if (this.currentCategoryId === categoryId && this.slist.length > 0) {
|
||||
return;
|
||||
}
|
||||
// if (this.currentCategoryId === categoryId && this.slist.length > 0) {
|
||||
// return;
|
||||
// }
|
||||
// 切换分类时,重置所有状态
|
||||
this.currentCategoryId = categoryId;
|
||||
this.page = 1;
|
||||
@@ -242,6 +246,10 @@ export default {
|
||||
this.slist = []; // 先清空数据
|
||||
this.loadCategoryData(categoryId, false);
|
||||
},
|
||||
search(res){
|
||||
console.log(res.value)
|
||||
this.loadCategoryData('', false);
|
||||
},
|
||||
|
||||
// 根据分类id加载分类下的内容
|
||||
loadCategoryData(categoryId, isLoadMore = false) {
|
||||
@@ -272,7 +280,8 @@ export default {
|
||||
current:this.page,
|
||||
size:10,
|
||||
status:1,
|
||||
category_id:categoryId
|
||||
category_id:categoryId,
|
||||
keyword:this.searchValue
|
||||
};
|
||||
// 添加排序参数(如果后端支持)
|
||||
if(this.currentTab=='near'){
|
||||
@@ -334,6 +343,32 @@ export default {
|
||||
},
|
||||
// tab 切换
|
||||
switchTab(key) {
|
||||
if((this.longitude==''||this.latitude=='')&&key=='near'){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请先授权地理位!',
|
||||
content: '请在设置中开启模糊定位权限',
|
||||
confirmText: '去设置',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
wx.openSetting({
|
||||
success: (setRes) => {
|
||||
if (setRes.authSetting['scope.userFuzzyLocation']) {
|
||||
that.getFuzzy().then(res => {
|
||||
that.latitude = res.latitude
|
||||
that.longitude = res.longitude
|
||||
console.log(res);
|
||||
}).catch(err => console.error(err));
|
||||
} else {
|
||||
reject(new Error('未开启模糊定位权限'));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
return false
|
||||
}
|
||||
if (this.currentTab === key) return
|
||||
this.currentTab = key
|
||||
this.onRefresh()
|
||||
@@ -477,6 +512,9 @@ page,
|
||||
height: 100%;
|
||||
/* background: #f7f7f7; */
|
||||
}
|
||||
.search{
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
height: 80rpx;
|
||||
@@ -520,17 +558,18 @@ page,
|
||||
}
|
||||
|
||||
.content-con {
|
||||
height: calc(100% - 80rpx);
|
||||
height: calc(100% - 260rpx);
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.left-aside {
|
||||
width: 200rpx;
|
||||
width: 22%;
|
||||
background: #3BC6BD;
|
||||
color: #000;
|
||||
}
|
||||
.f-item {
|
||||
height: 96rpx;
|
||||
width: 100%;
|
||||
/* padding-left: 28rpx; */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -554,7 +593,8 @@ page,
|
||||
color: #000;
|
||||
}
|
||||
.right-aside {
|
||||
flex: 1;
|
||||
/* flex: 1; */
|
||||
width: 78%;
|
||||
/* background: #fff; */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user