优化web筛选
This commit is contained in:
parent
c012416171
commit
4b36fd4a31
@ -6,7 +6,7 @@
|
||||
import functools
|
||||
import json
|
||||
import os
|
||||
from urllib.parse import urljoin, unquote
|
||||
from urllib.parse import urljoin, unquote,quote
|
||||
import requests
|
||||
from flask import Blueprint, abort, request, render_template, send_from_directory, render_template_string, jsonify, \
|
||||
make_response, redirect, \
|
||||
@ -62,6 +62,7 @@ def web_index(web_name, theme):
|
||||
tid = getParmas('tid')
|
||||
tname = getParmas('tname')
|
||||
url = getParmas('url')
|
||||
fl = getParmas('f')
|
||||
player = getParmas('player') or 'mui'
|
||||
ctx['vod_id'] = vod_id
|
||||
ctx['vod_name'] = vod_name
|
||||
@ -70,7 +71,9 @@ def web_index(web_name, theme):
|
||||
ctx['tid'] = tid
|
||||
ctx['tname'] = tname
|
||||
ctx['url'] = url
|
||||
print('tid:', tid)
|
||||
ctx['fl'] = quote(fl)
|
||||
print('tid:', tid,'fl:',fl)
|
||||
# print('f:', fl)
|
||||
|
||||
file_path = os.path.abspath(f'js/{web_name}.js')
|
||||
print(file_path)
|
||||
|
||||
@ -1 +1 @@
|
||||
3.9.42beta2
|
||||
3.9.42beta3
|
||||
@ -46,7 +46,7 @@
|
||||
<div class="head clearfix">
|
||||
<a href="javascript:;" class="open-screen pull-right">展开 <i class="iconfont icon-moreunfold"></i></a>
|
||||
<span class="text">
|
||||
已选择:最新-{{ctx.tname}}
|
||||
已选择:{{ctx.tname}}
|
||||
</span>
|
||||
<span class="all">,共检索到“{[sitems.total]}”条结果</span>
|
||||
</div>
|
||||
@ -106,7 +106,7 @@ const app = createApp({
|
||||
setup(props, context) {
|
||||
onMounted(()=> {
|
||||
console.log('---onMounted---');
|
||||
axios.get(`/vod?pwd=${pwd}&rule=${web_name}&t=${tid}&pg=${pg}&ac=videolist`).then((resp) => {
|
||||
axios.get(`/vod?pwd=${pwd}&rule=${web_name}&t=${tid}&pg=${pg}&ac=videolist&f=${fl}`).then((resp) => {
|
||||
console.log(resp.data);
|
||||
sitems.value = resp.data;
|
||||
// 存浏览器session里,然后其它页面好获取出来
|
||||
@ -141,6 +141,7 @@ const app = createApp({
|
||||
const pg = '{{ctx.pg}}';
|
||||
const vod_id = '{{ctx.vod_id}}';
|
||||
const vod_name = '{{ctx.vod_name}}';
|
||||
const fl = '{{ctx.fl}}';
|
||||
// console.log(web_name);
|
||||
|
||||
const ctx_str = "ctxObj={{ctx|safe}}";
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
<div class="stui-vodlist__box">
|
||||
<a class="stui-vodlist__thumb lazyload" :href="'{{ctx.path}}?vod_id='+item.vod_id+'&vod_name='+item.vod_name" :title="item.vod_name" :data-original="item.vod_pic">
|
||||
<span class="play hidden-xs"></span>
|
||||
<span class="pic-text1 text-right"><b>{[item.no_use.type_name]}</b></span>
|
||||
<span class="pic-text1 text-right"><b>{[item.no_use?item.no_use.type_name:'']}</b></span>
|
||||
<span class="pic-text text-right"><b>{[item.vod_remarks]}</b></span>
|
||||
</a>
|
||||
<div class="stui-vodlist__detail">
|
||||
|
||||
@ -248,11 +248,11 @@ const stuFilterComponent = {
|
||||
<!-- 筛选 -->
|
||||
<ul class="clearfix" v-for="filters in now_filters">
|
||||
<li>
|
||||
<span>按{[filters.name]}:</span>
|
||||
<span>按{[filters.name]}-{[filters.key]}:</span>
|
||||
</li>
|
||||
|
||||
<li v-for="obj in filters.value">
|
||||
<a :href="ctx.path+'?tid='+item.type_id+'&tname='+item.type_name+'&filter='+obj.v">{[obj.n]}</a>
|
||||
<li v-for="obj in filters.value" :class="{ active: tellActive(obj,filters) }">
|
||||
<a :href="ctx.path+'?tid='+item.type_id+'&tname='+item.type_name+'&filter='+obj.v" @click.prevent="openFilterUrl(item,obj,filters)">{[obj.n]}</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
@ -264,6 +264,7 @@ const stuFilterComponent = {
|
||||
// console.log(props);
|
||||
const items = props.items;
|
||||
const tid = props.tid;
|
||||
const ctx = props.ctx;
|
||||
const now_filters = computed(() => {
|
||||
// console.log('计算now_filters');
|
||||
// items.value.class.find(it=>it.type_id===tid);
|
||||
@ -271,8 +272,40 @@ const stuFilterComponent = {
|
||||
// console.log(now_filters);
|
||||
return now_filters
|
||||
});
|
||||
let p = new URLSearchParams(location.href.split('?')[1]);
|
||||
let dict = Object.fromEntries(p.entries());
|
||||
let f = dict.f || '{}';
|
||||
try {
|
||||
f = JSON.parse(f);
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
const methods = {
|
||||
openFilterUrl(item,obj,filters){
|
||||
// let url = ctx.path+'?tid='+item.type_id+'&tname='+item.type_name+'&filter='+obj.v;
|
||||
// let p = new URLSearchParams(location.href.split('?')[1]);
|
||||
// let dict = Object.fromEntries(p.entries());
|
||||
// let f = dict.f || '{}';
|
||||
try {
|
||||
// f = JSON.parse(f);
|
||||
f[filters.key] = obj.v;
|
||||
f = JSON.stringify(f);
|
||||
dict.f = f;
|
||||
let new_p = new URLSearchParams(dict);
|
||||
let url = ctx.path+'?'+new_p;
|
||||
// console.log(url);
|
||||
location.href = url;
|
||||
}catch (e) {
|
||||
console.log(`筛选发生错误:${e.message}`);
|
||||
}
|
||||
},
|
||||
tellActive(obj,filters){
|
||||
return f[filters.key] === obj.v;
|
||||
}
|
||||
}
|
||||
return {
|
||||
now_filters:now_filters
|
||||
...methods,
|
||||
now_filters
|
||||
}
|
||||
},
|
||||
props:{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user