修改搜索页面显示
parent
d83fbfcd77
commit
f48baf1591
|
|
@ -983,7 +983,6 @@
|
||||||
success: res => {
|
success: res => {
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
console.log(data.data);
|
|
||||||
const new_data = data.data;
|
const new_data = data.data;
|
||||||
// 没有回复时的评论
|
// 没有回复时的评论
|
||||||
if (new_video_comments_id == 0) {
|
if (new_video_comments_id == 0) {
|
||||||
|
|
@ -996,9 +995,6 @@
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.active_comments.forEach(item => {
|
this.active_comments.forEach(item => {
|
||||||
console.log(item);
|
|
||||||
console.log(item.id == new_video_comments_id);
|
|
||||||
|
|
||||||
if (item.id == new_video_comments_id) {
|
if (item.id == new_video_comments_id) {
|
||||||
item.sub_comments.unshift(new_data);
|
item.sub_comments.unshift(new_data);
|
||||||
item.comments_count++;
|
item.comments_count++;
|
||||||
|
|
|
||||||
|
|
@ -15,34 +15,36 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 搜索历史记录 -->
|
<!-- 搜索历史记录 -->
|
||||||
<view class="search-history flex-col jc-c align-c">
|
<view v-if="show_search_history.length > 0" class="search-history flex-col jc-c align-c">
|
||||||
<view v-for="(history, index) in search_history" :key="index" class="wh-auto history-item flex-row align-c jc-sb">
|
<view v-for="(history, index) in show_search_history" :key="index" class="wh-auto history-item flex-row align-c jc-sb">
|
||||||
<view class="flex-row align-c search-history-title cp" :data-value="history.text" @tap.stop="perform_search">
|
<view class="flex-row align-c search-history-title cp" :data-value="history" @tap.stop="perform_search">
|
||||||
<iconfont name="icon-time" size="32rpx"></iconfont>
|
<iconfont name="icon-time" size="32rpx"></iconfont>
|
||||||
<text>{{ history.text }}</text>
|
<text>{{ history }}</text>
|
||||||
</view>
|
</view>
|
||||||
<iconfont name="icon-close-line" size="24rpx" :data-index="index" @tap="delete_history"></iconfont>
|
<iconfont name="icon-close-line" size="24rpx" :data-index="index" @tap="delete_history"></iconfont>
|
||||||
</view>
|
</view>
|
||||||
<!-- 查看更多 -->
|
<!-- 查看更多 -->
|
||||||
<template v-if="is_view_more">
|
<template v-if="search_history.length > (show_search_history.length + 4)">
|
||||||
<loadingComponent></loadingComponent>
|
<template v-if="is_view_more">
|
||||||
</template>
|
<loadingComponent></loadingComponent>
|
||||||
<template v-else>
|
</template>
|
||||||
<view class="more-history-btn cp" @tap="view_more_history">查看更多历史</view>
|
<template v-else>
|
||||||
|
<view class="more-history-btn cp" @tap="view_more_history">查看更多历史</view>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<!-- 热搜列表 -->
|
<!-- 热搜列表 -->
|
||||||
<view class="hot-search">
|
<view v-if="search_history_data.length > 0" class="hot-search">
|
||||||
<view class="hot-tabs">
|
<view class="hot-tabs">
|
||||||
<scroll-view scroll-x :show-scrollbar="false" class="tabs-scroll" style="white-space: nowrap;">
|
<scroll-view scroll-x :show-scrollbar="false" class="tabs-scroll" style="white-space: nowrap;">
|
||||||
<view class="tabs-scroll-content">
|
<view class="tabs-scroll-content">
|
||||||
<view v-for="(tab, index) in hot_tabs" :key="index" class="hot-tab-item cp" :class="(hot_current_tab === index) ? 'active' : ''" :data-index="index" @tap="switch_hot_tab">{{ tab }}</view>
|
<view v-for="(tab, index) in search_history_data" :key="index" class="hot-tab-item cp" :class="(hot_current_tab === index) ? 'active' : ''" :data-index="index" @tap="switch_hot_tab">{{ tab.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<view class="hot-list flex-col align-c gap-10">
|
<view class="hot-list flex-col align-c gap-10">
|
||||||
<view v-for="(item, index) in hot_list" :key="index" :class="'cp wh-auto flex-row align-c jc-sb hot-item' + (index < 3 ? ' hot-item-top' : '')" :data-value="item.title" @tap.stop="perform_search">
|
<view v-for="(item, index) in search_history_data[hot_current_tab].data" :key="index" :class="'cp wh-auto flex-row align-c jc-sb gap-10 hot-item' + (index < 3 ? ' hot-item-top' : '')" :data-value="item.title" @tap.stop="perform_search">
|
||||||
<view class="flex-row align-c gap-10">
|
<view class="flex-1 flex-row align-c gap-10">
|
||||||
<view class="hot-num flex-row align-c jc-c">
|
<view class="hot-num flex-row align-c jc-c">
|
||||||
<view :class="index < 3 ? `hexagon-top hexagon-top-${index + 1}` : 'hexagon-no-top'"><span>{{ index + 1 }}</span></view>
|
<view :class="index < 3 ? `hexagon-top hexagon-top-${index + 1}` : 'hexagon-no-top'"><span>{{ index + 1 }}</span></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -59,6 +61,7 @@
|
||||||
import searchComponent from '@/pages/plugins/video/components/search.vue';
|
import searchComponent from '@/pages/plugins/video/components/search.vue';
|
||||||
import loadingComponent from '@/pages/plugins/video/components/loading.vue';
|
import loadingComponent from '@/pages/plugins/video/components/loading.vue';
|
||||||
import { video_get_top_left_padding } from '@/common/js/common/common.js';
|
import { video_get_top_left_padding } from '@/common/js/common/common.js';
|
||||||
|
import { isEmpty } from '../../../../common/js/common/common';
|
||||||
const app = getApp();
|
const app = getApp();
|
||||||
var system = app.globalData.get_system_info(null, null, true);
|
var system = app.globalData.get_system_info(null, null, true);
|
||||||
// 状态栏高度
|
// 状态栏高度
|
||||||
|
|
@ -84,30 +87,16 @@ export default {
|
||||||
top_content_style: 'padding-top:' + bar_height + 'px;padding-bottom:10px;',
|
top_content_style: 'padding-top:' + bar_height + 'px;padding-bottom:10px;',
|
||||||
// #endif
|
// #endif
|
||||||
search_query: '',
|
search_query: '',
|
||||||
search_history: [
|
search_history: [],
|
||||||
{ text: '软件升级规则' },
|
show_search_history: [],
|
||||||
{ text: '进销存管理系统提升效率' },
|
search_history_data: [],
|
||||||
{ text: '任何人的错都是我的错' },
|
|
||||||
{ text: '心中无敌,方能无敌于天下' }
|
|
||||||
],
|
|
||||||
hot_tabs: ['今日热搜', '点赞热榜', '评论热榜', '分享热榜', '分享热榜', '分享热榜', '分享热榜'],
|
|
||||||
hot_current_tab: 0,
|
hot_current_tab: 0,
|
||||||
hot_list: [
|
|
||||||
{ title: '国家补贴至高补贴20%', hotness: '811.2万' },
|
|
||||||
{ title: '夏季高质量睡眠秘诀', hotness: '2100' },
|
|
||||||
{ title: '不要总认为自己比别人聪明', hotness: '311' },
|
|
||||||
{ title: '今天最好的表现是明天最低的要求', hotness: '311' },
|
|
||||||
{ title: '今天最好的表现是明天最低的要求', hotness: '311' },
|
|
||||||
{ title: '今天最好的表现是明天最低的要求', hotness: '311' },
|
|
||||||
{ title: '今天最好的表现是明天最低的要求', hotness: '311' },
|
|
||||||
{ title: '今天最好的表现是明天最低的要求', hotness: '311' },
|
|
||||||
{ title: '今天最好的表现是明天最低的要求', hotness: '311' }
|
|
||||||
],
|
|
||||||
is_view_more: false,
|
is_view_more: false,
|
||||||
header_padding_left: '',
|
header_padding_left: '',
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
onShow() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -134,20 +123,43 @@ export default {
|
||||||
header_padding_left: padding_left,
|
header_padding_left: padding_left,
|
||||||
menu_button_info: menu_button_info
|
menu_button_info: menu_button_info
|
||||||
});
|
});
|
||||||
|
if (this.search_history.length > 0) {
|
||||||
|
this.show_search_history = this.search_history.filter((item, index) => index < 5);
|
||||||
|
} else {
|
||||||
|
this.show_search_history = [];
|
||||||
|
}
|
||||||
|
this.init_data();
|
||||||
|
},
|
||||||
|
init_data() {
|
||||||
|
uni.request({
|
||||||
|
url: app.globalData.get_request_url("searchrecord", "index", "video"),
|
||||||
|
method: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
success: res => {
|
||||||
|
const data = res.data;
|
||||||
|
if (data.code == 0) {
|
||||||
|
const new_data = data.data;
|
||||||
|
this.setData({
|
||||||
|
search_history_data: new_data.search_history_data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 返回
|
// 返回
|
||||||
handle_back() {
|
handle_back() {
|
||||||
app.globalData.page_back_prev_event();
|
app.globalData.page_back_prev_event();
|
||||||
},
|
},
|
||||||
handle_search(e) {
|
handle_search(e) {
|
||||||
|
// 保存搜索历史记录
|
||||||
|
if (!isEmpty(e) && !this.search_history.includes(e)) {
|
||||||
|
this.search_history.push(e);
|
||||||
|
}
|
||||||
this.search_query = e;
|
this.search_query = e;
|
||||||
app.globalData.url_open(`/pages/plugins/video/search/search?search_query=${this.search_query}`, false);
|
app.globalData.url_open(`/pages/plugins/video/search/search?search_query=${this.search_query}`, false);
|
||||||
},
|
},
|
||||||
perform_search(e) {
|
perform_search(e) {
|
||||||
this.search_query = e.currentTarget.dataset.value;
|
this.search_query = e.currentTarget.dataset.value;
|
||||||
// uni.navigateTo({
|
|
||||||
// url: `/pages/plugins/video/search/search?search_query=${this.search_query}`
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
delete_history(e) {
|
delete_history(e) {
|
||||||
const index = e.currentTarget.dataset.index;
|
const index = e.currentTarget.dataset.index;
|
||||||
|
|
@ -158,7 +170,9 @@ export default {
|
||||||
this.is_view_more = true;
|
this.is_view_more = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.is_view_more = false;
|
this.is_view_more = false;
|
||||||
}, 3000);
|
// 每次显示5条数据
|
||||||
|
this.show_search_history = this.search_history.filter((item, index) => index < ((this.show_search_history.length - 1) + 5))
|
||||||
|
}, 500);
|
||||||
},
|
},
|
||||||
switch_hot_tab(e) {
|
switch_hot_tab(e) {
|
||||||
this.setData({
|
this.setData({
|
||||||
|
|
@ -304,8 +318,8 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.hot-item {
|
.hot-item {
|
||||||
height: 72rpx;
|
// height: 72rpx;
|
||||||
padding-left: 20rpx;
|
padding: 16rpx 0 16rpx 20rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: linear-gradient( 90deg, #F4F4F4 0%, #FFFFFF 100%);
|
background: linear-gradient( 90deg, #F4F4F4 0%, #FFFFFF 100%);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,68 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="wh-auto ht-auto pr video-container">
|
<view class="wh-auto ht-auto pr video-container">
|
||||||
<scroll-view scroll-y :show-scrollbar="false" class="ht" @scrolltolower="on_scroll_lower_event" @scrolltoupper="on_scroll_upper_event" lower-threshold="60" scroll-with-animation="true">
|
<scroll-view scroll-y :show-scrollbar="false" class="ht" @scrolltolower="on_scroll_lower_event" lower-threshold="60" scroll-with-animation="true">
|
||||||
<view class="wh-auto ht-auto pr">
|
<view class="wh-auto ht-auto pr">
|
||||||
<!-- 搜索框 -->
|
<template v-if="tabs.length > 0">
|
||||||
<view class="header-top">
|
<!-- 搜索框 -->
|
||||||
<view class="header-search" :style="top_content_style + menu_button_info">
|
<view class="header-top">
|
||||||
<view id="search-height" class="flex-row align-c">
|
<view class="header-search" :style="top_content_style + menu_button_info">
|
||||||
<!-- 支付宝小程序自带返回按钮,这里就不给返回按钮了,这里给留出一点空间就行 -->
|
<view id="search-height" class="flex-row align-c">
|
||||||
<!-- #ifndef MP-ALIPAY -->
|
<!-- 支付宝小程序自带返回按钮,这里就不给返回按钮了,这里给留出一点空间就行 -->
|
||||||
<view class="cp" @tap="handle_back">
|
<!-- #ifndef MP-ALIPAY -->
|
||||||
<iconfont name="icon-arrow-left " size="36rpx" color="#333" class="mr-10"></iconfont>
|
<view class="cp" @tap="handle_back">
|
||||||
</view>
|
<iconfont name="icon-arrow-left " size="36rpx" color="#333" class="mr-10"></iconfont>
|
||||||
<!-- #endif -->
|
</view>
|
||||||
<view class="wh-auto ht-auto" :style="header_padding_left">
|
<!-- #endif -->
|
||||||
<search-component :propSearchQuery="search_query" @search="handle_search" />
|
<view class="wh-auto ht-auto" :style="header_padding_left">
|
||||||
</view>
|
<search-component :propSearchQuery="search_query" @search="handle_search" />
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 导航栏 -->
|
|
||||||
<view class="nav-tabs flex-row align-s jc-sb gap-10">
|
|
||||||
<view class="tabs-scroll-content">
|
|
||||||
<view v-for="(tab, index) in tabs" :key="index" class="tab-item" :class="(currentTab === index) ? 'active' : ''" :data-index="index" @click="switch_tab">{{ tab }}</view>
|
|
||||||
</view>
|
|
||||||
<view class="nav-tabs-filter" @click="toggle_filter_popup">
|
|
||||||
<iconfont name="icon-filter" size="32rpx"></iconfont>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 推荐视频卡片区域 -->
|
|
||||||
<view class="recommend-videos">
|
|
||||||
<view class="video-grid">
|
|
||||||
<view v-for="(item, index) in recommend_videos" :key="index" class="video-card" :data-value="item" @click="navigate_to_detail">
|
|
||||||
<image class="video-thumbnail" :src="item.thumbnail_url" mode="widthFix"></image>
|
|
||||||
<view class="video-info flex-col jc-c">
|
|
||||||
<view class="video-title text-line-2">{{ item.title }}</view>
|
|
||||||
<view class="flex-row align-c jc-sb">
|
|
||||||
<view class="video-date">{{ item.date }}</view>
|
|
||||||
<view class="video-likes flex-row align-c gap-4">
|
|
||||||
<iconfont name="icon-givealike-o-fine" size="24rpx"></iconfont>
|
|
||||||
<text>{{ item.likes }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 导航栏 -->
|
||||||
|
<view class="nav-tabs flex-row align-s jc-sb gap-10">
|
||||||
|
<view class="tabs-scroll-content">
|
||||||
|
<view v-for="(tab, index) in category_list" :key="index" class="tab-item" :class="(currentTab === index) ? 'active' : ''" :data-index="index" @click="switch_tab">{{ tab.name }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="nav-tabs-filter" @click="toggle_filter_popup">
|
||||||
|
<iconfont name="icon-filter" size="32rpx"></iconfont>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 加载更多 -->
|
<!-- 推荐视频卡片区域 -->
|
||||||
<loadingComponent v-if="is_more_loading"></loadingComponent>
|
<view class="recommend-videos">
|
||||||
</view>
|
<template v-if="recommend_videos.length > 0">
|
||||||
|
<view class="video-grid">
|
||||||
|
<view v-for="(item, index) in recommend_videos" :key="index" class="video-card" :data-value="item" @click="navigate_to_detail">
|
||||||
|
<image class="video-thumbnail" :src="item.cover" mode="widthFix"></image>
|
||||||
|
<view class="video-info flex-col jc-c">
|
||||||
|
<view class="video-title text-line-2">{{ item.title }}</view>
|
||||||
|
<view class="flex-row align-c jc-sb">
|
||||||
|
<view class="video-date">{{ item.add_time_date }}</view>
|
||||||
|
<view class="video-likes flex-row align-c gap-4">
|
||||||
|
<iconfont name="icon-givealike-o-fine" size="24rpx"></iconfont>
|
||||||
|
<text>{{ item.access_count }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="page < page_total">
|
||||||
|
<!-- 加载更多 -->
|
||||||
|
<loadingComponent v-if="is_more_loading"></loadingComponent>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<!-- 结尾 -->
|
||||||
|
<component-bottom-line :propStatus="goods_bottom_line_status"></component-bottom-line>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<component-no-data :propStatus="data_tabs_loding_status" :propMsg="data_tabs_loding_msg"></component-no-data>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 选项卡更多弹窗 -->
|
<!-- 选项卡更多弹窗 -->
|
||||||
|
|
@ -79,6 +95,7 @@ import searchComponent from '@/pages/plugins/video/components/search.vue';
|
||||||
import componentPopup from '@/components/popup/popup';
|
import componentPopup from '@/components/popup/popup';
|
||||||
import loadingComponent from '@/pages/plugins/video/components/loading.vue';
|
import loadingComponent from '@/pages/plugins/video/components/loading.vue';
|
||||||
import componentNoData from '@/components/no-data/no-data';
|
import componentNoData from '@/components/no-data/no-data';
|
||||||
|
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||||
import { video_get_top_left_padding } from '@/common/js/common/common.js';
|
import { video_get_top_left_padding } from '@/common/js/common/common.js';
|
||||||
const app = getApp();
|
const app = getApp();
|
||||||
// 状态栏高度
|
// 状态栏高度
|
||||||
|
|
@ -91,7 +108,8 @@ export default {
|
||||||
searchComponent,
|
searchComponent,
|
||||||
componentPopup,
|
componentPopup,
|
||||||
loadingComponent,
|
loadingComponent,
|
||||||
componentNoData
|
componentNoData,
|
||||||
|
componentBottomLine
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -108,36 +126,7 @@ export default {
|
||||||
search_query: '',
|
search_query: '',
|
||||||
tabs: ['推荐', 'DIV装修', '商城管理', '多商户', '多门店', '客服','多门店', '客服'],
|
tabs: ['推荐', 'DIV装修', '商城管理', '多商户', '多门店', '客服','多门店', '客服'],
|
||||||
currentTab: 0,
|
currentTab: 0,
|
||||||
recommend_videos: [
|
recommend_videos: [],
|
||||||
{
|
|
||||||
thumbnail_url: 'http://shopxo.com/static/upload/images/plugins_homemiddleadv/2019/04/22/1555929400479636.jpg',
|
|
||||||
title: '进销存软件究竟要怎么选?',
|
|
||||||
date: '2025-06-12',
|
|
||||||
likes: 2189,
|
|
||||||
detailId: '1'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
thumbnail_url: 'http://shopxo.com/static/upload/images/plugins_expressforkdn/2019/03/11/1552286675575734.png',
|
|
||||||
title: '一分钟告诉你,进销存是什么,进销存对企业有什么用...',
|
|
||||||
date: '2025-06-12',
|
|
||||||
likes: 2189,
|
|
||||||
detailId: '2'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
thumbnail_url: 'http://shopxo.com/static/upload/images/goods_category/2023/08/12/1691819651259940.png',
|
|
||||||
title: '全自动Excel进销存管理系统',
|
|
||||||
date: '2025-06-12',
|
|
||||||
likes: 2189,
|
|
||||||
detailId: '3'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
thumbnail_url: 'http://shopxo.com/static/upload/images/common/2019/05/17/1558073623641199.jpg',
|
|
||||||
title: '管家婆进销存到底有多简单',
|
|
||||||
date: '2025-06-12',
|
|
||||||
likes: 2189,
|
|
||||||
detailId: '4'
|
|
||||||
},
|
|
||||||
],
|
|
||||||
isLoadingMore: false,
|
isLoadingMore: false,
|
||||||
params: null,
|
params: null,
|
||||||
filter_popup_status: false,
|
filter_popup_status: false,
|
||||||
|
|
@ -157,6 +146,18 @@ export default {
|
||||||
},
|
},
|
||||||
is_more_loading: false,
|
is_more_loading: false,
|
||||||
header_padding_left: '',
|
header_padding_left: '',
|
||||||
|
category_list: [],
|
||||||
|
search_order_by_list: [],
|
||||||
|
search_release_time_list: [],
|
||||||
|
search_duration_list: [],
|
||||||
|
page: 0,
|
||||||
|
page_total: 1,
|
||||||
|
search_cid: '',
|
||||||
|
goods_bottom_line_status: false,
|
||||||
|
data_tabs_loding_status: 1,
|
||||||
|
data_tabs_loding_msg: '',
|
||||||
|
data_list_loding_status: 1,
|
||||||
|
data_tabs_loding_msg: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(params) {
|
onLoad(params) {
|
||||||
|
|
@ -166,7 +167,7 @@ export default {
|
||||||
params: app.globalData.launch_params_handle(params),
|
params: app.globalData.launch_params_handle(params),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
created() {
|
onShow() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -209,28 +210,107 @@ export default {
|
||||||
})
|
})
|
||||||
.exec(); // 执行查询
|
.exec(); // 执行查询
|
||||||
}, 500);
|
}, 500);
|
||||||
|
// 初始化搜索页数据
|
||||||
|
this.init_data();
|
||||||
|
},
|
||||||
|
init_data () {
|
||||||
|
uni.request({
|
||||||
|
url: app.globalData.get_request_url("searchinit", "index", "video"),
|
||||||
|
method: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
success: res => {
|
||||||
|
const data = res.data;
|
||||||
|
if (data.code == 0) {
|
||||||
|
const new_data = data.data;
|
||||||
|
this.setData({
|
||||||
|
category_list: new_data.category_list,
|
||||||
|
search_order_by_list: new_data.search_order_by_list,
|
||||||
|
search_release_time_list: new_data.search_release_time_list,
|
||||||
|
search_duration_list: new_data.search_duration_list,
|
||||||
|
search_cid: new_data?.category_list[0]?.id || '',
|
||||||
|
data_tabs_loding_status: 0,
|
||||||
|
})
|
||||||
|
// 加载数据
|
||||||
|
this.load_recommend_videos();
|
||||||
|
} else {
|
||||||
|
this.setData({
|
||||||
|
data_tabs_loding_status: 2,
|
||||||
|
data_tabs_loding_msg: data.msg,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
this.setData({
|
||||||
|
data_tabs_loding_status: 2,
|
||||||
|
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handle_back() {
|
handle_back() {
|
||||||
app.globalData.page_back_prev_event();
|
app.globalData.page_back_prev_event();
|
||||||
},
|
},
|
||||||
handle_search(e) {
|
handle_search(e) {
|
||||||
this.search_query = e;
|
this.setData({
|
||||||
if (this.search_query.trim() == '') {
|
search_query: e,
|
||||||
app.globalData.url_open(`/pages/plugins/video/search/search-record`, false);
|
page: 0,
|
||||||
} else {
|
page_total: 1,
|
||||||
app.globalData.url_open(`/pages/plugins/video/search/search?search_query=${this.search_query}`, false);
|
})
|
||||||
}
|
// 更新数据信息
|
||||||
|
this.load_recommend_videos();
|
||||||
},
|
},
|
||||||
switch_tab(e) {
|
switch_tab(e) {
|
||||||
const index = e.currentTarget.dataset.index;
|
const index = e?.currentTarget?.dataset?.index || 0;
|
||||||
this.currentTab = index;
|
this.setData({
|
||||||
|
currentTab: index,
|
||||||
|
search_cid: this.category_list[index]?.id || '',
|
||||||
|
page: 0,
|
||||||
|
page_total: 1,
|
||||||
|
data_list_loding_status: 1,
|
||||||
|
recommend_videos: []
|
||||||
|
})
|
||||||
// 根据当前标签加载对应的数据
|
// 根据当前标签加载对应的数据
|
||||||
this.load_recommend_videos();
|
this.load_recommend_videos();
|
||||||
},
|
},
|
||||||
load_recommend_videos() {
|
load_recommend_videos() {
|
||||||
// 加载推荐视频数据的逻辑
|
// 加载推荐视频数据的逻辑
|
||||||
// 根据当前标签加载对应的数据
|
uni.request({
|
||||||
console.log('加载推荐视频数据');
|
url: app.globalData.get_request_url("searchdatalist", "index", "video"),
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
cid: this.search_cid,
|
||||||
|
bwd: this.search_query,
|
||||||
|
rt: '',
|
||||||
|
dn: '',
|
||||||
|
by: '',
|
||||||
|
page: this.page + 1,
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: res => {
|
||||||
|
const data = res.data;
|
||||||
|
if (data.code == 0) {
|
||||||
|
const new_data = data.data;
|
||||||
|
this.setData({
|
||||||
|
recommend_videos: new_data.data,
|
||||||
|
page: this.page + 1,
|
||||||
|
page_total: data.page_total,
|
||||||
|
goods_bottom_line_status: this.page + 1 >= data.page_total,
|
||||||
|
data_list_loding_status: 0
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.setData({
|
||||||
|
data_list_loding_status: 2,
|
||||||
|
data_list_loding_msg: data.msg,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
this.setData({
|
||||||
|
data_list_loding_status: 2,
|
||||||
|
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
navigate_to_detail(e) {
|
navigate_to_detail(e) {
|
||||||
const item = e.currentTarget.dataset.value;
|
const item = e.currentTarget.dataset.value;
|
||||||
|
|
@ -239,9 +319,6 @@ export default {
|
||||||
on_scroll_lower_event() {
|
on_scroll_lower_event() {
|
||||||
this.load_more();
|
this.load_more();
|
||||||
},
|
},
|
||||||
on_scroll_upper_event() {
|
|
||||||
this.load_more();
|
|
||||||
},
|
|
||||||
load_more() {
|
load_more() {
|
||||||
// 加载更多数据的逻辑
|
// 加载更多数据的逻辑
|
||||||
if (this.is_more_loading) {
|
if (this.is_more_loading) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue