初始化黄果短剧 H5 客户端

对接后端 hgmjapi.mfcg.me:
- 接口解密 key 更新为 resKey360
- 登录 sysType 使用原生 getDevType(后端已放开 pc/android)
- 修正榜单接口路径 /vid/rangking → /vid/ranking,方法改为 GET

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
谢宇宁
2026-10-08 19:41:43 +07:00
co-authored by Claude Opus 4.8
commit c957b45bad
633 changed files with 51497 additions and 0 deletions
+396
View File
@@ -0,0 +1,396 @@
<template>
<div class="search-page">
<div class="search-box">
<div class="movie-tag-list">
<div class="all">{{ state.sortText }} <img class="arrow" src="@/assets/images/pc/down_arrow.png" alt=""></div>
<div class="meun-wrap">
<div class="meun-list">
<div @click="changeSort(item, index)" :class="{ active: state.activeIndex === index }"
v-for="(item, index) in state.sortList" :key="index">{{ item }}</div>
</div>
</div>
</div>
<div class="search" @click.stop>
<input type="text" @focus.stop="state.showHistoryList = true" @keydown.enter="search" v-model="state.searchValue" placeholder="輸入番號,女優或視頻名">
<div class="history-list" v-show="state.showHistoryList">
<div class="history-box">
<div class="title">
<span>搜索历史</span>
<img class="arrow" @click="clearnAll" src="@/assets/images/pc/clearn.png" alt="">
</div>
<div class="history">
<div class="item" v-for="(item, index) in state.historyData" :key="index" @click="selectTag(item)">
{{ item }}
<img @click.stop="clearnTag(index)" src="@/assets/images/pc/close1.png" alt="">
</div>
</div>
</div>
<div class="hot-search-tag-box">
<div class="title">
热门搜索
</div>
<div class="hot-item" v-for="(item, index) in state.hotTagList.slice(0,6)" :key="index" @click="selectTag(item.name)">
<span :class="['index', index < 3 ? 'top3' : '']">{{ index + 1 }}</span>
<span>{{ item.name }}</span>
</div>
</div>
</div>
</div>
<div class="search-btn" @click="search">搜索一下</div>
</div>
<div class="tag-lst">
<span v-for="(item, index) in state.hotTagList.slice(0,10)" :key="index" @click="selectTag(item.name)">{{ item.name }}</span>
</div>
<!-- 搜索结果 -->
<div class="results-wrap">
<div class="title">搜索结果</div>
<div class="result">全部视频 <span>({{ state.total }})</span></div>
<div class="card-list">
<movieCard :itemData="item" v-for="(item, index) in state.searchResults" :key="index" />
</div>
</div>
<div class="flex-center-center" v-if="state.total > 0">
<Pagination :pageSize="pageSize" :total="state.total" @changePage="changePage" />
</div>
</div>
</template>
<script setup lang="ts">
import insertAdv from '@/utils/insertAdv'
import { onMounted, reactive, ref, watch } from 'vue'
import CommunityApi from '@/service/community';
import { useRouter, useRoute } from 'vue-router';
const route = useRoute()
const router = useRouter()
const pageSize = 24
const state = reactive({
searchValue: '',
activeIndex: 0,
sortText: '全部視頻',
sortList: ['最新上架', '最多观看', '最多收藏'],
hotTagList: [],
pageNumber: 1,
total: 0,
showHistoryList: false,
historyData: [],
searchResults: [],
history
})
// 获热搜列表
const getHotTag = async () => {
const res: any = await CommunityApi.getHotRecommend({
pageNumber: 1,
pageSize: 10
})
state.hotTagList = res.list
}
getHotTag()
const changeSort = (item: string, index: number) => {
state.activeIndex = index
state.sortText = item
search()
}
// 搜索
const search = async () => {
AddSearchHistory()
const res: any = await CommunityApi.searchPost({
SortV: state.activeIndex,
keyWords: [state.searchValue],
pageNumber: state.pageNumber,
pageSize,
realm: 'video'
})
const updatedArray = insertAdv({
insertNum: 6,
pageSize,
pageNumber: state.pageNumber,
originArray: res.list || [],
advNum: 5
})
state.searchResults = updatedArray
state.total = res.total || 0
getSearchHistoryData()
}
// 分页
const changePage = (page: number) => {
state.pageNumber = page
router.push({
pāth: route.path,
query: {
...route.query,
page
}
})
search()
}
onMounted(() => {
const value = route.query.id
if (value) {
state.pageNumber = Number(route.query.page || 1)
state.searchValue = value as string
search()
}
})
watch(() => route.query.id, (value) => {
if (value) {
state.pageNumber = Number(route.query.page || 1)
state.searchValue = value as string
search()
}
})
const selectTag = (item: string) => {
state.searchValue = item
state.showHistoryList = false
search()
}
const clearnTag = (index: number) => {
state.historyData.splice(index, 1)
localStorage.setItem('SEARCH_HISTORY', state.historyData.join(','))
}
const clearnAll = () => {
state.historyData = []
localStorage.removeItem('SEARCH_HISTORY')
}
// 添加历史记录
const AddSearchHistory = () => {
// 搜索记录加数据
if (state.historyData.length > 0) {
// 去重
const arr = [...new Set(state.historyData)]
const narr = arr.slice(0,3)
narr.unshift(state.searchValue)
localStorage.setItem('SEARCH_HISTORY', narr.join(','))
} else {
localStorage.setItem('SEARCH_HISTORY', state.searchValue)
}
}
watch(() => state.showHistoryList, (value) => {
if (value) {
getSearchHistoryData()
}
})
// 获取历史记录
const getSearchHistoryData = () => {
const data = localStorage.getItem('SEARCH_HISTORY')
if (data) {
const arr = data.split(',')
state.historyData = [...new Set(arr)];
}
}
document.addEventListener('click', () => {
state.showHistoryList = false
});
</script>
<style lang="scss" scoped>
@media (min-width: 768px) {
.search-page {
width: 1516px;
color: #fff;
padding-top: 120px;
margin: auto;
.search-box {
@include flexCenter;
margin: auto;
}
.movie-tag-list {
height: 60px;
padding: 0px 25px;
border-radius: 10px;
border: 1px solid #212121;
background: #151515;
@include flexCenter;
cursor: pointer;
.all {
color: #A0A6B4;
font-size: 18px;
img {
width: 10px;
height: 10px;
margin-left: 5px;
}
}
.meun-wrap {
width: 100%;
height: 143px;
position: absolute;
top: 45px;
left: 0;
height: 0;
overflow: hidden;
transition: height 0.2s;
}
.meun-list {
margin-top: 10px;
width: 100%;
height: 105px;
z-index: 1;
color: #fff;
color: #A0A6B4;
font-size: 14px;
font-weight: 400;
line-height: 28px;
border-radius: 8px;
border: 1px solid #212121;
background: #151515;
text-align: center;
padding-top: 10px;
}
.active {
color: #FFF;
}
}
.movie-tag-list:hover {
.meun-wrap {
height: 143px;
transition: height 0.1s;
}
}
.search {
max-width: 700px;
display: flex;
height: 60px;
padding: 16px 21px;
flex-direction: column;
align-items: flex-start;
flex: 1 0 0;
border-radius: 10px;
border: 1px solid #FFC400;
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
margin: 0 20px;
position: relative;
input {
all: unset;
width: 100%;
font-size: 20px;
color: #FFF;
}
.history-list {
width: 100%;
height: 486px;
padding: 17px;
border-radius: 4px;
border: 1px solid rgba(255, 255, 255, 0.12);
background: #1A1C22;
position: absolute;
top: 70px;
left: 0;
z-index: 1;
.title {
@include flexBetween;
color: #999;
font-size: 12px;
font-weight: 400;
height: 32px;
img {
width: 16px;
height: 16px;
cursor: pointer;
}
}
.history {
.item {
@include flexBetween;
color: #BCBDBE;
font-size: 14px;
font-weight: 400;
height: 16px;
margin-top: 24px;
img {
width: 16px;
height: 16px;
cursor: pointer;
}
}
}
.hot-search-tag-box {
color: #BCBDBE;
font-size: 14px;
padding-top: 30px;
.hot-item {
margin-top: 24px;
.index {
color: #CCC;
margin-right: 8px;
}
.top3 {
color: #FFCD3F;
font-weight: 600;
}
}
}
}
}
.search-btn {
height: 60px;
width: 112px;
@include flexCenter;
color: #482F28;
font-weight: 600;
font-size: 18px;
border-radius: 10px;
background: #FFC400;
box-shadow: 0px -3px 8px 0px rgba(249, 255, 139, 0.60) inset, 0px 0px 8px 0px rgba(255, 196, 0, 0.50);
cursor: pointer;
}
.tag-lst {
@include flexCenter;
padding-top: 20px;
column-gap: 20px;
span {
font-size: 20px;
color: #E5E7EB;
font-weight: 400;
cursor: pointer;
}
span:hover {
text-decoration: underline;
}
}
.results-wrap {
width: 1516px;
margin: 70px auto;
.title {
color: #FFF;
font-size: 36px;
font-weight: 600;
line-height: 48px;
}
.result {
color: #FFF;
font-size: 16px;
line-height: 20px;
margin-top: 12px;
span {
color: #A0A6B4;
font-size: 14px;
}
}
.card-list {
padding-top: 34px;
display: flex;
flex-wrap: wrap;
column-gap: 24px;
row-gap: 36px;
}
}
}
}
</style>