From 4b36fd4a31342acddb0351c5b8b5c61852398b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=9A=E9=A3=8E=E6=8B=82=E6=9F=B3=E9=A2=9C?= <434857005@qq.com> Date: Tue, 16 May 2023 11:58:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96web=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/web.py | 7 ++-- js/version.txt | 2 +- templates/cms/mxpro/categoryContent.html | 5 +-- templates/cms/mxpro/homeContent.html | 2 +- templates/cms/mxpro/js/commonUI.js | 41 +++++++++++++++++++++--- 5 files changed, 47 insertions(+), 10 deletions(-) diff --git a/controllers/web.py b/controllers/web.py index f3288c9..8edef9d 100644 --- a/controllers/web.py +++ b/controllers/web.py @@ -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) diff --git a/js/version.txt b/js/version.txt index 7f2ee8b..8272677 100644 --- a/js/version.txt +++ b/js/version.txt @@ -1 +1 @@ -3.9.42beta2 \ No newline at end of file +3.9.42beta3 \ No newline at end of file diff --git a/templates/cms/mxpro/categoryContent.html b/templates/cms/mxpro/categoryContent.html index 81b5b5f..284b568 100644 --- a/templates/cms/mxpro/categoryContent.html +++ b/templates/cms/mxpro/categoryContent.html @@ -46,7 +46,7 @@
展开 - 已选择:最新-{{ctx.tname}} + 已选择:{{ctx.tname}} ,共检索到“{[sitems.total]}”条结果
@@ -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}}"; diff --git a/templates/cms/mxpro/homeContent.html b/templates/cms/mxpro/homeContent.html index 1072f39..4c49109 100644 --- a/templates/cms/mxpro/homeContent.html +++ b/templates/cms/mxpro/homeContent.html @@ -60,7 +60,7 @@
- {[item.no_use.type_name]} + {[item.no_use?item.no_use.type_name:'']} {[item.vod_remarks]}
diff --git a/templates/cms/mxpro/js/commonUI.js b/templates/cms/mxpro/js/commonUI.js index a724a34..0ae7079 100644 --- a/templates/cms/mxpro/js/commonUI.js +++ b/templates/cms/mxpro/js/commonUI.js @@ -248,11 +248,11 @@ const stuFilterComponent = { @@ -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:{