3.13(优化

This commit is contained in:
Hong
2024-03-13 19:53:53 +08:00
parent 385ec69898
commit efe5bbad16
10 changed files with 489 additions and 58 deletions

View File

@@ -7,6 +7,35 @@ export function getDetailAPI(noteId) {
method: 'get'
})
}
//热门搜索记录
export function getHistoryListAll(noteId) {
return request({
url: `/api/front/hot/history/list/all`,
method: 'get'
})
}
//添加搜索历史 /api/front/personal/search/history/search/{searchKey}
export function getHistoryListSearch(searchKey) {
return request({
url: `/api/front/personal/search/history/search/${searchKey}`,
method: 'get'
})
}
//搜索历史 /api/front/personal/search/history/list/page
export function getHistoryListPage(searchKey) {
return request({
url: `/api/front/personal/search/history/list/page`,
method: 'get'
})
}
//删除历史记 /api/front/personal/search/history/del
export function getHistoryListDel(data) {
return request({
url: `/api/front/personal/search/history/del`,
method: 'post',
data
})
}
//分享社区笔记 api/front/community/note/share/{noteId}
export function getNoteShare(noteId) {
return request({

View File

@@ -13,15 +13,17 @@ export const carShopUserMenuList = [{
}, {
text: '我的收藏',
path: '/pages/carShop/mine/my_favorite/my_favorite'
}, {
text: '我的足迹',
path: '/pages/carShop/community/community'
}, {
},
// {
// text: '我的足迹',
// path: '/pages/carShop/community/community'
// },
{
text: '我的钱包',
path: '/pages/carShop/mine/wallet/wallet'
}, {
text: '我的推广',
path: '/pages/carShop/community/community'
path: '/pages/driver/welfare/invite/invite'
}, {
text: '联系客服',
path: '/pages/carShop/community/community'

View File

@@ -2,8 +2,8 @@
"name" : "滴友之家test",
"appid" : "__UNI__F2BE74F",
"description" : "",
"versionName" : "1.0.6",
"versionCode" : 106,
"versionName" : "1.0.7",
"versionCode" : 107,
"transformPx" : false,
"app-plus" : {
"usingComponents" : true,

View File

@@ -1384,6 +1384,14 @@
"navigationBarTitleText" : "我的评价",//租车订单
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/search/search",
"style" :
{
"navigationBarTitleText" : "搜索",
"enablePullDownRefresh" : false
}
}
],
"tabBar": {

View File

@@ -1,6 +1,6 @@
<template>
<view class="content">
<z-paging ref="paging" v-model="dataList" @query="queryList"
<z-paging ref="paging" v-model="dataList" @query="queryList" @scroll="scrollFn"
:hide-empty-view="userInfo.concernedNum==0 && actTabType == 5">
<view slot="top">
<view class="navbar-box fixed-top bg-white">
@@ -13,7 +13,7 @@
{{unreadNum}}
</view>
</view>
<view class="search-box ">
<view class="search-box" @click="$tab.navigateTo('/pages/search/search')">
<view class="search-box-c flex align-center">
<image class="search-box-image" src="@/static/images/app/icon/search.png" mode="">
</image>
@@ -35,7 +35,7 @@
<view class="">
<view :style="`height: ${$u.sys().statusBarHeight}px;`" />
</view>
<view style="height: 200rpx;" />
<view v-if="showElement" style="height: 200rpx;" />
</view>
<view class="swiper-box" v-if="actTabType != 5">
<u-swiper keyName="image" :list="brannerList" height="560rpx" @change="brannerChange"
@@ -249,7 +249,7 @@
//未关注列表
noAttentionList: [],
showElement: true, // 初始化为显示状态
prevScrollTop: 0, // 记录上一次滚动的位置
prevScrollTop: 80, // 记录上一次滚动的位置
current: 0,
userInfo: uni.getStorageSync('userInfo'),
config: getApp().globalData.config,
@@ -269,20 +269,6 @@
unreadNum: 0
}
},
onPageScroll(e) {
// 获取当前滚动的位置
const scrollTop = e.scrollTop;
// 判断滚动方向
if (scrollTop > this.prevScrollTop) {
// 向下滚动,隐藏元素
this.showElement = false;
} else {
// 向上滚动,显示元素
this.showElement = true;
}
// 更新上一次滚动的位置
this.prevScrollTop = scrollTop;
},
onShow() {
this.init()
this.userInfo = uni.getStorageSync('userInfo')
@@ -295,6 +281,18 @@
}
},
methods: {
//监听滚动
scrollFn(e) {
const scrollTop = e.target.scrollTop;
// 判断滚动方向
if (scrollTop > this.prevScrollTop) {
// 向下滚动,隐藏元素
this.showElement = false;
} else {
// 向上滚动,显示元素
this.showElement = true;
}
},
//发布
issueFn() {
uni.showActionSheet({
@@ -539,14 +537,13 @@
.navbar-box {
width: calc(750rpx);
.navbar-top {
padding: 0 24rpx;
// #ifdef MP-WEIXIN
width: 550rpx;
// #endif
// #ifdef APP
width: 702rpx;
width: 750rpx;
// #endif
height: 88rpx;
@@ -606,11 +603,10 @@
}
.tab-box {
padding: 0 32rpx;
padding:0 0 24rpx 0rpx;
width: calc(750rpx - 64rpx);
margin-left: 32rpx;
.tab-item {
font-size: 34rpx;
line-height: 110rpx;
color: #666;

View File

@@ -910,7 +910,9 @@
if (this.replyAddData.content !== '') {
replyAddAPI(this.replyAddData).then(res => {
this.replyAddData.content = ''
this.$refs.paging.reload()
res.data.replyList=[]
this.replyListAll.push(res.data)
this.getDetail(this.noteId)
})
} else {
this.$toast('不能为空')

View File

@@ -1,6 +1,6 @@
<template>
<view class="content">
<z-paging ref="paging" v-model="dataList" @query="queryList"
<z-paging ref="paging" v-model="dataList" @query="queryList" @scroll="scrollFn"
:hide-empty-view="userInfo.concernedNum==0 && actTabType == 5">
<view slot="top">
<view class="navbar-box fixed-top bg-white">
@@ -13,7 +13,7 @@
{{unreadNum}}
</view>
</view>
<view class="search-box ">
<view class="search-box " @click="$tab.navigateTo('/pages/search/search')">
<view class="search-box-c flex align-center">
<image class="search-box-image" src="@/static/images/app/icon/search.png" mode="">
</image>
@@ -35,7 +35,7 @@
<view class="">
<view :style="`height: ${$u.sys().statusBarHeight}px;`" />
</view>
<view style="height: 200rpx;" />
<view v-if="showElement" style="height: 200rpx;" />
</view>
<view class="swiper-box" v-if="actTabType != 5">
<u-swiper keyName="image" :list="brannerList" height="560rpx" @change="brannerChange"
@@ -248,7 +248,7 @@
//未关注列表
noAttentionList: [],
showElement: true, // 初始化为显示状态
prevScrollTop: 0, // 记录上一次滚动的位置
prevScrollTop: 80, // 记录上一次滚动的位置
current: 0,
userInfo: {},
config: getApp().globalData.config,
@@ -273,20 +273,6 @@
maskingShow: false,
}
},
// onPageScroll(e) {
// // 获取当前滚动的位置
// const scrollTop = e.scrollTop;
// // 判断滚动方向
// if (scrollTop > this.prevScrollTop) {
// // 向下滚动,隐藏元素
// this.showElement = false;
// } else {
// // 向上滚动,显示元素
// this.showElement = true;
// }
// // 更新上一次滚动的位置
// this.prevScrollTop = scrollTop;
// },
onShow() {
this.init()
this.userInfo = uni.getStorageSync('userInfo')
@@ -304,6 +290,21 @@
});
},
methods: {
//监听滚动
scrollFn(e) {
// console.log('number', e);
const scrollTop = e.target.scrollTop;
// console.log("number", scrollTop, this.prevScrollTop);
// 判断滚动方向
if (scrollTop > this.prevScrollTop) {
// console.log("number", scrollTop, this.prevScrollTop);
// 向下滚动,隐藏元素
this.showElement = false;
} else {
// 向上滚动,显示元素
this.showElement = true;
}
},
//视频监听播放
handleVideoClick(index) {
this.dataList.forEach((item, i) => {
@@ -358,7 +359,6 @@
this.noAttentionList[index].isConcerned = !this.noAttentionList[index].isConcerned
concernedAuthor(item.id).then(res => {
this.$refs.paging.refresh();
console.log(this.dataList.length, this.actTabType == 5);
})
},
//删除
@@ -396,11 +396,10 @@
url: `/pages/driver/index/consult_detail?id=${item.id}`
})
} else {
uni.navigateTo({
uni.navigateTo({
url: `/pages/driver/index/detail?id=${item.id}`
})
}
},
//查看
examineFn(urlList, index) {
@@ -554,14 +553,13 @@
.navbar-box {
width: calc(750rpx);
.navbar-top {
padding: 0 24rpx;
// #ifdef MP-WEIXIN
width: 550rpx;
// #endif
// #ifdef APP
width: 702rpx;
width: 750rpx;
// #endif
height: 88rpx;
@@ -624,11 +622,10 @@
}
.tab-box {
padding: 0 32rpx;
padding:0 0 24rpx 0rpx;
width: calc(750rpx - 64rpx);
margin-left: 32rpx;
.tab-item {
font-size: 34rpx;
line-height: 110rpx;
color: #666;

View File

@@ -177,7 +177,7 @@
projectList: this.materialRequisition
}
receiveUpdate(obj).then(res => {
uni.navigateTo({
uni.redirectTo({
url: '/pages/repair/accessory/sub_warehowse/particulars'
})
})

View File

@@ -770,6 +770,19 @@
} else if (e == 2) {
this.dataItem = e
this.auditShow = true
} else if (e == 3) {
// 预约接待-到店
this.$refs.prompt.tipContent = {
title: '确认到店',
content: `是否确认车牌号为【${this.detail.carNo}】的用户已到店?`,
confirmText: '确认',
cancelText: '取消',
}
this.dataItem = e
this.$refs.prompt.show = true
}else if (e == 4) {
// 维修接待-开单
this.$tab.navigateTo(`./reservation/createOrder?id=${this.detail.id}`)
} else if (e == 5) {
this.dataItem = e
this.$refs.repairCompleted.show = true

384
pages/search/search.vue Normal file
View File

@@ -0,0 +1,384 @@
<template>
<z-paging ref="paging" v-model="dataList" @query="queryList" :auto="false">
<view slot="top" class="search">
<u-search :showAction="true" placeholder="亲输入搜索内容" v-model="searchWord" actionText="搜索" :animation="true"
@custom="customFn"></u-search>
</view>
<view class="search" v-if="!dataList.length">
<view class="search-title f-36 c222">热门搜索</view>
<view class="search-label f-24 c111 flex align-center flex-wrap">
<view class="search-label-list" v-for="(item,index) in labelList" :key="index" @click="searchFn(item.searchTerm)">
{{item.searchTerm}}
</view>
</view>
<view class="search-title f-36 c222 flex justify-between align-center">
<view>近期搜索</view>
<image @click="delSearchFn(false)" src="@/static/images/icon/del.png" mode=""></image>
</view>
<view class="search-history">
<view class="search-history-list f-28 c111 flex justify-between align-center"
v-for="(item,index) in historyList" :key="index" @click="searchFn(item.searchQuery)">
<view>{{item.searchQuery}}</view>
<image @click.stop="delSearchFn(item.id)" src="@/static/images/icon/x_2.png" mode=""></image>
</view>
</view>
</view>
<view class="list-box">
<view v-for="(item,index) in dataList" :key="index">
<view class="user-item border-bottom border-eee">
<view class="user-info flex align-center justify-between">
<view class="left flex align-center" @click.stop="linkPersonalCenter(item.authorId)">
<image :src="item.authorAvatar" mode=""></image>
<view class="">
<view class="f-28 c666">
{{item.authorName}}
</view>
<view class="f-24 c666">
IP {{item.city || "未知"}} {{item.diffDays}}天前
</view>
</view>
</view>
<view class="image-box" @click.stop="reportFn(item)">
<image src="@/static/images/app/icon/more.png" mode=""></image>
</view>
</view>
<view class="content-title line-two" @click="toDetailPages(item,index)">
{{item.content?item.content:'分享图片'}}
</view>
<!-- <video :id="'refVideo'+item.id" v-if="item.video" :src="item.video" initial-time="1s"
:poster="item.cover" class="video-box" @play="handleVideoClick(index)"
@pause="currentVideoIndex = -1">
</video> -->
<view class="video-box" v-if="item.video" @click="toDetailPages(item,index)">
<image class="video-box-bo" src="@/static/images/app/mine/bo_fang.png" mode=""></image>
<image class="video-box-bg" :src="item.cover" mode=""></image>
</view>
<view v-if="item.image" class="image-list-box ">
<view v-if="item.image.length==1">
<view v-for="(itemImage,imageIndex) in item.image" :key="imageIndex">
<image class="image-one" :src="itemImage" mode="cover"
@click.stop="examineFn(item.image,imageIndex)"></image>
</view>
</view>
<view v-if="item.image.length==2" style="width: 100%;" class="flex justify-between">
<view v-for="(itemImage,imageIndex) in item.image" :key="imageIndex">
<image class="image-two" :src="itemImage" mode="cover"
@click.stop="examineFn(item.image,imageIndex)"></image>
</view>
</view>
<view v-if="item.image.length==4" style="width: 100%;" class="flex justify-between flex-wrap">
<view v-for="(itemImage,imageIndex) in item.image" :key="imageIndex">
<image class="image-two" :src="itemImage" mode="cover"
@click.stop="examineFn(item.image,imageIndex)"></image>
</view>
</view>
<view v-if="item.image.length>2&&item.image.length!=4" class="flex-wrap flex justify-between">
<view v-for="(itemImage,imageIndex) in item.image" :key="imageIndex">
<image class="image-three" :src="itemImage" mode="cover"
@click.stop="examineFn(item.image,imageIndex)"></image>
</view>
<view v-for="(a,b) in (item.image.length%3-1)<0?0:(item.image.length%3-1)">
<view class="image-three"></view>
</view>
</view>
</view>
<view class="faceback-box flex align-center justify-between">
<view class="" @click.stop="delCommFn(item, index)">
<!-- <text class="red" v-if="userInfo.id == item.authorId">删除</text> -->
</view>
<view class="flex align-center justify-end">
<view class="faceback-box-item flex align-center" @click.stop="shareFn(item)">
<image src="@/static/images/app/mine/share.png"></image>
{{item.shareNum}}
</view>
<view class="faceback-box-item flex align-center" @click="toDetailPages(item,index)">
<image src="@/static/images/app/mine/information.png"></image>
{{item.replyNum}}
</view>
<view class="faceback-box-item flex align-center" @click="Like(item)">
<image v-if="!item.userIsLike" src="@/static/images/app/mine/like.png">
</image>
<image v-if="item.userIsLike" src="@/static/images/app/icon/like.png"></image>
{{item.likeNum}}
</view>
</view>
</view>
</view>
</view>
</view>
</z-paging>
</template>
<script>
import {
getPlazaList,
getHistoryListAll,
getHistoryListSearch,
getHistoryListDel,
getHistoryListPage
} from "@/api/discover/discover.js"
export default {
data() {
return {
//搜索框
searchWord: '',
labelList: [{
name: '新能源'
},
{
name: 'BYD'
},
{
name: '轮胎常年不修会有什么隐患?应该如何避免?'
}
],
historyList: [{
name: '轮胎保质期',
id:1
},
{
name: '左转灯不亮',
id:2
},
{
name: '轮胎常年不修会有什么隐患?应该如何避免?',
id:3
}
],
dataList: []
}
},
onLoad() {
//获取热门搜索
getHistoryListAll().then(res => {
console.log(res);
this.labelList=res.data
})
//搜索历史记录
this.getHistoryListPageFn()
},
methods: {
//删除
delSearchFn(id) {
let ids = []
if (id) {
ids = [id]
} else {
this.historyList.forEach(item => {
ids.push(item.id)
})
}
getHistoryListDel({
ids: ids
}).then(res => {
this.getHistoryListPageFn()
console.log('删除成功', res.data);
})
},
//搜索历史
getHistoryListPageFn() {
getHistoryListPage().then(res => {
console.log(res);
this.historyList=res.data
})
},
//点击热门,近期
searchFn(item) {
this.searchWord = item
this.$refs.paging.reload()
},
//搜索
customFn() {
if (this.searchWord) {
getHistoryListSearch(this.searchWord).then(res => {
console.log('添加成功');
})
}
this.$refs.paging.reload()
},
toDetailPages(item, index) {
uni.navigateTo({
url: `/pages/driver/index/detail?id=${item.id}`
})
},
//查看
examineFn(urlList, index) {
uni.previewImage({
urls: urlList,
current: index,
loop: true
})
},
//列表
queryList(page, limit) {
getPlazaList({
searchWord: this.searchWord,
categoryId: 1,
page,
limit
}).then(res => {
console.log(res.data.list);
res.data.list.forEach(item => {
if (item.image != '') {
item.image = item.image.split(",")
} else {
item.image = []
}
const date1 = new Date();
const date2 = new Date(item.createTime);
// 计算相差的毫秒数
const diffTime = Math.abs(date2 - date1);
// 将毫秒数转换为天数
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
item.diffDays = diffDays
})
this.$refs.paging.complete(res.data.list);
}).catch(err => {
this.$refs.paging.complete(false)
})
},
}
}
</script>
<style lang="scss">
.search {
padding: 0 32rpx;
}
.search-title {
margin: 48rpx 0 24rpx 0;
image {
width: 40rpx;
height: 40rpx;
}
}
.search-history {
.search-history-list {
margin-bottom: 24rpx;
image {
width: 36rpx;
height: 36rpx;
}
}
}
.search-label {
.search-label-list {
padding: 10rpx 20rpx;
border-radius: 30rpx;
background: #F3F3F3;
margin-right: 32rpx;
margin-bottom: 24rpx;
}
}
.list-box {
padding: 0 32rpx;
.user-item {
padding-top: 48rpx;
.user-info {
.left {
image {
margin-right: 16rpx;
width: 80rpx;
height: 80rpx;
border-radius: 50%;
}
}
.image-box {
image {
width: 32rpx;
height: 32rpx;
}
}
}
.content-title {
margin-top: 16rpx;
max-height: 86rpx;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #111111;
line-height: 43rpx;
}
.video-box {
width: 686rpx;
height: 686rpx;
border-radius: 8rpx;
margin-top: 24rpx;
position: relative;
.video-box-bg {
width: 686rpx;
height: 686rpx;
position: absolute;
top: 0;
left: 0;
}
.video-box-bo {
position: absolute;
top: calc(50% - 60rpx);
left: calc(50% - 60rpx);
width: 120rpx;
height: 120rpx;
border-radius: 50%;
z-index: 999;
}
}
.image-list-box {
width: 100%;
margin-top: 24rpx;
.image-one {
width: 686rpx;
height: 686rpx;
border-radius: 8rpx;
}
.image-two {
width: 330rpx;
height: 330rpx;
box-shadow: 0rpx 0rpx 4rpx 0rpx rgba(0, 0, 0, 0.09);
border-radius: 8rpx;
}
.image-three {
width: 218rpx;
height: 218rpx;
box-shadow: 0rpx 0rpx 4rpx 0rpx rgba(0, 0, 0, 0.09);
border-radius: 8rpx;
}
}
.faceback-box {
padding: 34rpx 0;
.faceback-box-item {
margin-left: 48rpx;
}
image {
margin: 0 16rpx;
width: 36rpx;
height: 36rpx;
}
}
}
}
</style>