重构: 前端Vue3+Tailwind+Vite构建管线+设置组件拆分

This commit is contained in:
lxy committed 2026-05-27 02:42:25 +08:00
1 parent f3148bf72f
commit aee7997195
44 files changed
+4309 -1720

No files matched your search

+21 -755
View File
@@ -1,762 +1,28 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<style>
:root {
--bg: #0f0f1a;
--card-bg: rgba(255,255,255,0.04);
--card-border: rgba(255,255,255,0.06);
--card-divider: rgba(255,255,255,0.04);
--text: #e0e0e0;
--text-strong: #fff;
--text-weak: rgba(255,255,255,0.25);
--text-muted: rgba(255,255,255,0.5);
--input-bg: rgba(255,255,255,0.08);
--input-border: rgba(255,255,255,0.1);
--input-border-focus: #4f8cff;
--accent: #4f8cff;
--toggle-track: rgba(255,255,255,0.1);
--toggle-thumb: rgba(255,255,255,0.5);
--option-bg: #1a1a2e;
--footer-color: rgba(255,255,255,0.3);
}
.light {
--bg: #f5f5f5;
--card-bg: rgba(0,0,0,0.03);
--card-border: rgba(0,0,0,0.08);
--card-divider: rgba(0,0,0,0.05);
--text: #333;
--text-strong: #111;
--text-weak: rgba(0,0,0,0.35);
--text-muted: rgba(0,0,0,0.55);
--input-bg: rgba(0,0,0,0.04);
--input-border: rgba(0,0,0,0.12);
--input-border-focus: #2b6cb0;
--accent: #2b6cb0;
--toggle-track: rgba(0,0,0,0.12);
--toggle-thumb: rgba(0,0,0,0.45);
--option-bg: #fff;
--footer-color: rgba(0,0,0,0.35);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
background: var(--bg);
color: var(--text);
padding: 16px 18px;
user-select: none;
-webkit-font-smoothing: antialiased;
overflow-y: auto;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }
.light ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
.light ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.22); }
.header { margin-bottom: 14px; }
.header h1 { font-size: 16px; font-weight: 600; color: var(--text-strong); }
.header p { font-size: 11px; color: var(--text-weak); margin-top: 2px; }
.section { margin-bottom: 12px; }
.section-label {
font-size: 10px; font-weight: 600; color: var(--text-weak);
text-transform: uppercase; letter-spacing: 1.5px;
margin-bottom: 4px; padding-left: 2px;
}
.card {
background: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 8px;
}
.item {
display: flex; justify-content: space-between; align-items: center;
padding: 8px 14px;
}
.item + .item { border-top: 1px solid var(--card-divider); }
.item-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.item-desc { font-size: 10px; color: var(--text-weak); margin-top: 1px; }
.item-sub { padding-left: 32px; }
/* Toggle */
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { display: none; }
.switch .track {
position: absolute; inset: 0;
background: var(--toggle-track);
border-radius: 10px; cursor: pointer; transition: background 0.2s;
}
.switch .thumb {
position: absolute; width: 14px; height: 14px; top: 3px; left: 3px;
background: var(--toggle-thumb);
border-radius: 50%; transition: all 0.2s; pointer-events: none;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(16px); background: var(--text-strong); }
/* Select */
select {
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; color: var(--text); font-size: 11px; padding: 3px 6px;
font-family: inherit; cursor: pointer; outline: none;
min-width: 80px; max-width: 160px;
}
select:focus { border-color: var(--input-border-focus); }
select option { background: var(--option-bg); color: var(--text); }
/* Button */
.btn {
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; color: var(--text); font-size: 11px; padding: 4px 10px;
font-family: inherit; cursor: pointer; transition: background 0.15s; white-space: nowrap;
}
.btn:hover { background: var(--card-border); }
.btn:active { background: var(--input-bg); }
.btn.active { background: var(--accent); border-color: var(--accent); color: var(--text-strong); }
.btn-sm { padding: 3px 8px; font-size: 10px; }
.btn-group { display: flex; gap: 4px; }
.radio-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.bing-nav { display: flex; gap: 4px; align-items: center; }
.wp-type-section { display: none; }
.wp-type-section.visible { display: block; }
input[type="text"] {
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; color: var(--text); font-size: 11px; padding: 4px 8px;
font-family: inherit; outline: none; width: 140px;
}
input[type="text"]:focus { border-color: var(--input-border-focus); }
/* City Picker */
.city-picker {
position: relative;
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; padding: 4px 24px 4px 8px; cursor: pointer;
font-size: 11px; min-width: 140px; max-width: 180px;
}
.city-picker:focus, .city-picker.open { border-color: var(--input-border-focus); }
.city-picker-text { color: var(--text); }
.city-picker-arrow {
position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
color: var(--text-weak); font-size: 10px; pointer-events: none;
}
.city-panel {
display: none; position: absolute; right: -1px; bottom: calc(100% + 4px);
background: var(--option-bg); border: 1px solid var(--input-border);
border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
z-index: 1000; width: 260px; height: 200px; overflow: hidden;
}
.city-picker.open .city-panel { display: flex; }
.city-col {
flex: 1; overflow-y: auto; border-right: 1px solid var(--card-divider);
}
.city-col:last-child { border-right: none; }
.city-col div {
padding: 5px 10px; font-size: 11px; color: var(--text); cursor: pointer;
white-space: nowrap;
}
.city-col div:hover { background: var(--input-bg); }
.city-col div.active { color: var(--accent); font-weight: 600; }
/* Saved colors */
.color-swatch {
width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
border: 2px solid transparent; transition: border-color 0.15s; position: relative;
}
.color-swatch:hover { border-color: var(--accent); }
.color-swatch .del {
display: none; position: absolute; top: -6px; right: -6px;
width: 14px; height: 14px; border-radius: 50%;
background: #e53e3e; color: #fff; font-size: 9px; line-height: 14px;
text-align: center; cursor: pointer;
}
.color-swatch:hover .del { display: block; }
.footer {
text-align: center; font-size: 11px; color: var(--footer-color); margin-top: 12px;
padding: 6px 0; letter-spacing: 0.5px;
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();/**
* @vue/shared v3.5.34
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function Qs(e){const t=Object.create(null);for(const s of e.split(","))t[s]=1;return s=>s in t}const G={},dt=[],Re=()=>{},nr=()=>!1,ps=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),hs=e=>e.startsWith("onUpdate:"),ie=Object.assign,en=(e,t)=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)},fi=Object.prototype.hasOwnProperty,H=(e,t)=>fi.call(e,t),R=Array.isArray,pt=e=>Ht(e)==="[object Map]",gs=e=>Ht(e)==="[object Set]",Sn=e=>Ht(e)==="[object Date]",F=e=>typeof e=="function",X=e=>typeof e=="string",ke=e=>typeof e=="symbol",U=e=>e!==null&&typeof e=="object",rr=e=>(U(e)||F(e))&&F(e.then)&&F(e.catch),ir=Object.prototype.toString,Ht=e=>ir.call(e),ui=e=>Ht(e).slice(8,-1),or=e=>Ht(e)==="[object Object]",tn=e=>X(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,At=Qs(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ms=e=>{const t=Object.create(null);return(s=>t[s]||(t[s]=e(s)))},ai=/-\w/g,ye=ms(e=>e.replace(ai,t=>t.slice(1).toUpperCase())),di=/\B([A-Z])/g,ct=ms(e=>e.replace(di,"-$1").toLowerCase()),lr=ms(e=>e.charAt(0).toUpperCase()+e.slice(1)),Es=ms(e=>e?`on${lr(e)}`:""),Me=(e,t)=>!Object.is(e,t),es=(e,...t)=>{for(let s=0;s<e.length;s++)e[s](...t)},cr=(e,t,s,n=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:n,value:s})},vs=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let Cn;const bs=()=>Cn||(Cn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ft(e){if(R(e)){const t={};for(let s=0;s<e.length;s++){const n=e[s],r=X(n)?mi(n):Ft(n);if(r)for(const i in r)t[i]=r[i]}return t}else if(X(e)||U(e))return e}const pi=/;(?![^(]*\))/g,hi=/:([^]+)/,gi=/\/\*[^]*?\*\//g;function mi(e){const t={};return e.replace(gi,"").split(pi).forEach(s=>{if(s){const n=s.split(hi);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function ze(e){let t="";if(X(e))t=e;else if(R(e))for(let s=0;s<e.length;s++){const n=ze(e[s]);n&&(t+=n+" ")}else if(U(e))for(const s in e)e[s]&&(t+=s+" ");return t.trim()}const vi="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",bi=Qs(vi);function fr(e){return!!e||e===""}function xi(e,t){if(e.length!==t.length)return!1;let s=!0;for(let n=0;s&&n<e.length;n++)s=Kt(e[n],t[n]);return s}function Kt(e,t){if(e===t)return!0;let s=Sn(e),n=Sn(t);if(s||n)return s&&n?e.getTime()===t.getTime():!1;if(s=ke(e),n=ke(t),s||n)return e===t;if(s=R(e),n=R(t),s||n)return s&&n?xi(e,t):!1;if(s=U(e),n=U(t),s||n){if(!s||!n)return!1;const r=Object.keys(e).length,i=Object.keys(t).length;if(r!==i)return!1;for(const o in e){const l=e.hasOwnProperty(o),f=t.hasOwnProperty(o);if(l&&!f||!l&&f||!Kt(e[o],t[o]))return!1}}return String(e)===String(t)}function yi(e,t){return e.findIndex(s=>Kt(s,t))}const ur=e=>!!(e&&e.__v_isRef===!0),ue=e=>X(e)?e:e==null?"":R(e)||U(e)&&(e.toString===ir||!F(e.toString))?ur(e)?ue(e.value):JSON.stringify(e,ar,2):String(e),ar=(e,t)=>ur(t)?ar(e,t.value):pt(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((s,[n,r],i)=>(s[Is(n,i)+" =>"]=r,s),{})}:gs(t)?{[`Set(${t.size})`]:[...t.values()].map(s=>Is(s))}:ke(t)?Is(t):U(t)&&!R(t)&&!or(t)?String(t):t,Is=(e,t="")=>{var s;return ke(e)?`Symbol(${(s=e.description)!=null?s:t})`:e};/**
* @vue/reactivity v3.5.34
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let re;class _i{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&re&&(re.active?(this.parent=re,this.index=(re.scopes||(re.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].pause();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].resume();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].resume()}}run(t){if(this._active){const s=re;try{return re=this,t()}finally{re=s}}}on(){++this._on===1&&(this.prevScope=re,re=this)}off(){if(this._on>0&&--this._on===0){if(re===this)re=this.prevScope;else{let t=re;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s<n;s++)this.effects[s].stop();for(this.effects.length=0,s=0,n=this.cleanups.length;s<n;s++)this.cleanups[s]();if(this.cleanups.length=0,this.scopes){for(s=0,n=this.scopes.length;s<n;s++)this.scopes[s].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function wi(){return re}let Y;const $s=new WeakSet;class dr{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,re&&(re.active?re.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,$s.has(this)&&($s.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||hr(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Tn(this),gr(this);const t=Y,s=_e;Y=this,_e=!0;try{return this.fn()}finally{mr(this),Y=t,_e=s,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)rn(t);this.deps=this.depsTail=void 0,Tn(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?$s.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Vs(this)&&this.run()}get dirty(){return Vs(this)}}let pr=0,Et,It;function hr(e,t=!1){if(e.flags|=8,t){e.next=It,It=e;return}e.next=Et,Et=e}function sn(){pr++}function nn(){if(--pr>0)return;if(It){let t=It;for(It=void 0;t;){const s=t.next;t.next=void 0,t.flags&=-9,t=s}}let e;for(;Et;){let t=Et;for(Et=void 0;t;){const s=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(n){e||(e=n)}t=s}}if(e)throw e}function gr(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function mr(e){let t,s=e.depsTail,n=s;for(;n;){const r=n.prevDep;n.version===-1?(n===s&&(s=r),rn(n),Si(n)):t=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=r}e.deps=t,e.depsTail=s}function Vs(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(vr(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function vr(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Dt)||(e.globalVersion=Dt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Vs(e))))return;e.flags|=2;const t=e.dep,s=Y,n=_e;Y=e,_e=!0;try{gr(e);const r=e.fn(e._value);(t.version===0||Me(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Y=s,_e=n,mr(e),e.flags&=-3}}function rn(e,t=!1){const{dep:s,prevSub:n,nextSub:r}=e;if(n&&(n.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=n,e.nextSub=void 0),s.subs===e&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)rn(i,!0)}!t&&!--s.sc&&s.map&&s.map.delete(s.key)}function Si(e){const{prevDep:t,nextDep:s}=e;t&&(t.nextDep=s,e.prevDep=void 0),s&&(s.prevDep=t,e.nextDep=void 0)}let _e=!0;const br=[];function He(){br.push(_e),_e=!1}function Ke(){const e=br.pop();_e=e===void 0?!0:e}function Tn(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const s=Y;Y=void 0;try{t()}finally{Y=s}}}let Dt=0;class Ci{constructor(t,s){this.sub=t,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class on{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Y||!_e||Y===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==Y)s=this.activeLink=new Ci(Y,this),Y.deps?(s.prevDep=Y.depsTail,Y.depsTail.nextDep=s,Y.depsTail=s):Y.deps=Y.depsTail=s,xr(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=Y.depsTail,s.nextDep=void 0,Y.depsTail.nextDep=s,Y.depsTail=s,Y.deps===s&&(Y.deps=n)}return s}trigger(t){this.version++,Dt++,this.notify(t)}Line truncated
* @vue/runtime-core v3.5.34
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function Ut(e,t,s,n){try{return n?e(...n):e()}catch(r){ys(r,t,s)}}function Fe(e,t,s,n){if(F(e)){const r=Ut(e,t,s,n);return r&&rr(r)&&r.catch(i=>{ys(i,t,s)}),r}if(R(e)){const r=[];for(let i=0;i<e.length;i++)r.push(Fe(e[i],t,s,n));return r}}function ys(e,t,s,n=!0){const r=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||G;if(t){let l=t.parent;const f=t.proxy,p=`https://vuejs.org/error-reference/#runtime-${s}`;for(;l;){const u=l.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](e,f,p)===!1)return}l=l.parent}if(i){He(),Ut(i,null,10,[e,f,p]),Ke();return}}Yi(e,s,r,n,o)}function Yi(e,t,s,n=!0,r=!1){if(r)throw e;console.error(e)}const ae=[];let Ee=-1;const ht=[];let qe=null,at=0;const Or=Promise.resolve();let rs=null;function Ar(e){const t=rs||Or;return e?t.then(this?e.bind(this):e):t}function Zi(e){let t=Ee+1,s=ae.length;for(;t<s;){const n=t+s>>>1,r=ae[n],i=Vt(r);i<e||i===e&&r.flags&2?t=n+1:s=n}return t}function un(e){if(!(e.flags&1)){const t=Vt(e),s=ae[ae.length-1];!s||!(e.flags&2)&&t>=Vt(s)?ae.push(e):ae.splice(Zi(t),0,e),e.flags|=1,Er()}}function Er(){rs||(rs=Or.then($r))}function Xi(e){R(e)?ht.push(...e):qe&&e.id===-1?qe.splice(at+1,0,e):e.flags&1||(ht.push(e),e.flags|=1),Er()}function On(e,t,s=Ee+1){for(;s<ae.length;s++){const n=ae[s];if(n&&n.flags&2){if(e&&n.id!==e.uid)continue;ae.splice(s,1),s--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function Ir(e){if(ht.length){const t=[...new Set(ht)].sort((s,n)=>Vt(s)-Vt(n));if(ht.length=0,qe){qe.push(...t);return}for(qe=t,at=0;at<qe.length;at++){const s=qe[at];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}qe=null,at=0}}const Vt=e=>e.id==null?e.flags&2?-1:1/0:e.id;function $r(e){try{for(Ee=0;Ee<ae.length;Ee++){const t=ae[Ee];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Ut(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Ee<ae.length;Ee++){const t=ae[Ee];t&&(t.flags&=-2)}Ee=-1,ae.length=0,Ir(),rs=null,(ae.length||ht.length)&&$r()}}let me=null,Mr=null;function is(e){const t=me;return me=e,Mr=e&&e.type.__scopeId||null,t}function Qi(e,t=me,s){if(!t||e._n)return e;const n=(...r)=>{n._d&&Nn(-1);const i=is(t);let o;try{o=e(...r)}finally{is(i),n._d&&Nn(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function lt(e,t){if(me===null)return e;const s=Cs(me),n=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[i,o,l,f=G]=t[r];i&&(F(i)&&(i={mounted:i,updated:i}),i.deep&&Le(o),n.push({dir:i,instance:s,value:o,oldValue:void 0,arg:l,modifiers:f}))}return e}function et(e,t,s,n){const r=e.dirs,i=t&&t.dirs;for(let o=0;o<r.length;o++){const l=r[o];i&&(l.oldValue=i[o].value);let f=l.dir[n];f&&(He(),Fe(f,s,8,[e.el,l,e,t]),Ke())}}function eo(e,t){if(de){let s=de.provides;const n=de.parent&&de.parent.provides;n===s&&(s=de.provides=Object.create(n)),s[e]=t}}function ts(e,t,s=!1){const n=tl();if(n||mt){let r=mt?mt._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return s&&F(t)?t.call(n&&n.proxy):t}}const to=Symbol.for("v-scx"),so=()=>ts(to);function gt(e,t,s){return Rr(e,t,s)}function Rr(e,t,s=G){const{immediate:n,deep:r,flush:i,once:o}=s,l=ie({},s),f=t&&n||!t&&i!=="post";let p;if(Bt){if(i==="sync"){const O=so();p=O.__watcherHandles||(O.__watcherHandles=[])}else if(!f){const O=()=>{};return O.stop=Re,O.resume=Re,O.pause=Re,O}}const u=de;l.call=(O,L,k)=>Fe(O,u,L,k);let d=!1;i==="post"?l.scheduler=O=>{pe(O,u&&u.suspense)}:i!=="sync"&&(d=!0,l.scheduler=(O,L)=>{L?O():un(O)}),l.augmentJob=O=>{t&&(O.flags|=4),d&&(O.flags|=2,u&&(O.id=u.uid,O.i=u))};const y=zi(e,t,l);return Bt&&(p?p.push(y):f&&y()),y}function no(e,t,s){const n=this.proxy,r=X(e)?e.includes(".")?kr(n,e):()=>n[e]:e.bind(n,n);let i;F(t)?i=t:(i=t.handler,s=t);const o=Wt(this),l=Rr(r,i.bind(n),s);return o(),l}function kr(e,t){const s=t.split(".");return()=>{let n=e;for(let r=0;r<s.length&&n;r++)n=n[s[r]];return n}}const ro=Symbol("_vte"),io=e=>e.__isTeleport,oo=Symbol("_leaveCb");function an(e,t){e.shapeFlag&6&&e.component?(e.transition=t,an(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function ft(e,t){return F(e)?ie({name:e.name},t,{setup:e}):e}function Fr(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function An(e,t){let s;return!!((s=Object.getOwnPropertyDescriptor(e,t))&&!s.configurable)}const os=new WeakMap;function $t(e,t,s,n,r=!1){if(R(e)){e.forEach((k,$)=>$t(k,t&&(R(t)?t[$]:t),s,n,r));return}if(Mt(n)&&!r){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&$t(e,t,s,n.component.subTree);return}const i=n.shapeFlag&4?Cs(n.component):n.el,o=r?null:i,{i:l,r:f}=e,p=t&&t.r,u=l.refs===G?l.refs={}:l.refs,d=l.setupState,y=B(d),O=d===G?nr:k=>An(u,k)?!1:H(y,k),L=(k,$)=>!($&&An(u,$));if(p!=null&&p!==f){if(En(t),X(p))u[p]=null,O(p)&&(d[p]=null);else if(le(p)){const k=t;L(p,k.k)&&(p.value=null),k.k&&(u[k.k]=null)}}if(F(f))Ut(f,l,12,[o,u]);else{const k=X(f),$=le(f)Line truncated
* @vue/runtime-dom v3.5.34
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let zs;const Bn=typeof window<"u"&&window.trustedTypes;if(Bn)try{zs=Bn.createPolicy("vue",{createHTML:e=>e})}catch{}const oi=zs?e=>zs.createHTML(e):e=>e,cl="http://www.w3.org/2000/svg",fl="http://www.w3.org/1998/Math/MathML",je=typeof document<"u"?document:null,Hn=je&&je.createElement("template"),ul={insert:(e,t,s)=>{t.insertBefore(e,s||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,s,n)=>{const r=t==="svg"?je.createElementNS(cl,e):t==="mathml"?je.createElementNS(fl,e):s?je.createElement(e,{is:s}):je.createElement(e);return e==="select"&&n&&n.multiple!=null&&r.setAttribute("multiple",n.multiple),r},createText:e=>je.createTextNode(e),createComment:e=>je.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>je.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,s,n,r,i){const o=s?s.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),s),!(r===i||!(r=r.nextSibling)););else{Hn.innerHTML=oi(n==="svg"?`<svg>${e}</svg>`:n==="mathml"?`<math>${e}</math>`:e);const l=Hn.content;if(n==="svg"||n==="mathml"){const f=l.firstChild;for(;f.firstChild;)l.appendChild(f.firstChild);l.removeChild(f)}t.insertBefore(l,s)}return[o?o.nextSibling:t.firstChild,s?s.previousSibling:t.lastChild]}},al=Symbol("_vtc");function dl(e,t,s){const n=e[al];n&&(t=(t?[t,...n]:[...n]).join(" ")),t==null?e.removeAttribute("class"):s?e.setAttribute("class",t):e.className=t}const Kn=Symbol("_vod"),pl=Symbol("_vsh"),hl=Symbol(""),gl=/(?:^|;)\s*display\s*:/;function ml(e,t,s){const n=e.style,r=X(s);let i=!1;if(s&&!r){if(t)if(X(t))for(const o of t.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&Ot(n,l,"")}else for(const o in t)s[o]==null&&Ot(n,o,"");for(const o in s){o==="display"&&(i=!0);const l=s[o];l!=null?bl(e,o,!X(t)&&t?t[o]:void 0,l)||Ot(n,o,l):Ot(n,o,"")}}else if(r){if(t!==s){const o=n[hl];o&&(s+=";"+o),n.cssText=s,i=gl.test(s)}}else t&&e.removeAttribute("style");Kn in e&&(e[Kn]=i?n.display:"",e[pl]&&(n.display="none"))}const Un=/\s*!important$/;function Ot(e,t,s){if(R(s))s.forEach(n=>Ot(e,t,n));else if(s==null&&(s=""),t.startsWith("--"))e.setProperty(t,s);else{const n=vl(e,t);Un.test(s)?e.setProperty(ct(n),s.replace(Un,""),"important"):e[n]=s}}const Wn=["Webkit","Moz","ms"],js={};function vl(e,t){const s=js[t];if(s)return s;let n=ye(t);if(n!=="filter"&&n in e)return js[t]=n;n=lr(n);for(let r=0;r<Wn.length;r++){const i=Wn[r]+n;if(i in e)return js[t]=i}return t}function bl(e,t,s,n){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&X(n)&&s===n}const Jn="http://www.w3.org/1999/xlink";function Gn(e,t,s,n,r,i=bi(t)){n&&t.startsWith("xlink:")?s==null?e.removeAttributeNS(Jn,t.slice(6,t.length)):e.setAttributeNS(Jn,t,s):s==null||i&&!fr(s)?e.removeAttribute(t):e.setAttribute(t,i?"":ke(s)?String(s):s)}function qn(e,t,s,n,r){if(t==="innerHTML"||t==="textContent"){s!=null&&(e[t]=t==="innerHTML"?oi(s):s);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const l=i==="OPTION"?e.getAttribute("value")||"":e.value,f=s==null?e.type==="checkbox"?"on":"":String(s);(l!==f||!("_value"in e))&&(e.value=f),s==null&&e.removeAttribute(t),e._value=s;return}let o=!1;if(s===""||s==null){const l=typeof e[t];l==="boolean"?s=fr(s):s==null&&l==="string"?(s="",o=!0):l==="number"&&(s=0,o=!0)}try{e[t]=s}catch{}o&&e.removeAttribute(r||t)}function nt(e,t,s,n){e.addEventListener(t,s,n)}function xl(e,t,s,n){e.removeEventListener(t,s,n)}const zn=Symbol("_vei");function yl(e,t,s,n,r=null){const i=e[zn]||(e[zn]={}),o=i[t];if(n&&o)o.value=n;else{const[l,f]=_l(t);if(n){const p=i[t]=Cl(n,r);nt(e,l,p,f)}else o&&(xl(e,l,o,f),i[t]=void 0)}}const Yn=/(?:Once|Passive|Capture)$/;function _l(e){let t;if(Yn.test(e)){t={};let n;for(;n=e.match(Yn);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ct(e.slice(2)),t]}let Ns=0;const wl=Promise.resolve(),Sl=()=>Ns||(wl.then(()=>Ns=0),Ns=Date.now());function Cl(e,t){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Fe(Tl(n,s.value),t,5,[n])};return s.value=e,s.attached=Sl(),s}function Tl(e,t){if(R(t)){const s=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{s.call(e),e._stopped=!0},t.map(n=>r=>!r._stopped&&n&&n(r))}else return t}const Zn=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Pl=(e,t,s,n,r,i)=>{const o=r==="svg";t==="class"?dl(e,n,o):t==="style"?ml(e,s,n):ps(t)?hs(t)||yl(e,t,s,n,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Ol(e,t,n,o))?(qn(e,t,n),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Gn(e,t,n,o,i,t!=="value")):e._isVueCE&&(Al(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!X(n)))?qn(e,ye(t),n,i,t):(t==="true-value"?e._trueValue=n:t==="false-value"&&(e._falseValue=n),Gn(e,t,n,o))};function Ol(e,t,s,n){if(n)return!!(t==="innerHTLine truncated
<style rel="stylesheet" crossorigin>.switch[data-v-d838d577]{position:relative;width:36px;height:20px;flex-shrink:0}.switch input[data-v-d838d577]{display:none}.switch .track[data-v-d838d577]{position:absolute;inset:0;background:var(--toggle-track);border-radius:10px;cursor:pointer;transition:background .2s}.switch .thumb[data-v-d838d577]{position:absolute;width:14px;height:14px;top:3px;left:3px;background:var(--toggle-thumb);border-radius:50%;transition:all .2s;pointer-events:none}.switch input:checked+.track[data-v-d838d577]{background:var(--accent)}.switch input:checked+.track .thumb[data-v-d838d577]{transform:translate(16px);background:var(--text-strong)}.btn[data-v-c301f1ac]{background:var(--input-bg);border:1px solid var(--input-border);border-radius:6px;color:var(--text);font-size:11px;padding:4px 10px;font-family:inherit;cursor:pointer;transition:background .15s;white-space:nowrap}.btn[data-v-c301f1ac]:hover{background:var(--card-border)}.btn-sm[data-v-c301f1ac]{background:var(--input-bg);border:1px solid var(--input-border);border-radius:6px;color:var(--text);font-size:10px;padding:3px 8px;font-family:inherit;cursor:pointer;white-space:nowrap}.btn-sm[data-v-c301f1ac]:hover{background:var(--card-border)}.color-swatch[data-v-c301f1ac]{width:28px;height:28px;border-radius:6px;cursor:pointer;border:2px solid transparent;transition:border-color .15s;position:relative}.color-swatch[data-v-c301f1ac]:hover{border-color:var(--accent)}.color-swatch .del[data-v-c301f1ac]{display:none;position:absolute;top:-6px;right:-6px;width:14px;height:14px;border-radius:50%;background:#e53e3e;color:#fff;font-size:9px;line-height:14px;text-align:center;cursor:pointer}.color-swatch:hover .del[data-v-c301f1ac]{display:block}.btn[data-v-b7fb61bb]{background:var(--input-bg);border:1px solid var(--input-border);border-radius:6px;color:var(--text);font-size:11px;padding:4px 10px;font-family:inherit;cursor:pointer;transition:background .15s;white-space:nowrap}.btn[data-v-b7fb61bb]:hover{background:var(--card-border)}.btn-sm[data-v-b7fb61bb]{background:var(--input-bg);border:1px solid var(--input-border);border-radius:6px;color:var(--text);font-size:10px;padding:3px 8px;font-family:inherit;cursor:pointer;white-space:nowrap}.btn-sm[data-v-b7fb61bb]:hover{background:var(--card-border)}.city-picker[data-v-f6ff8e37]{position:relative;background:var(--input-bg);border:1px solid var(--input-border);border-radius:6px;padding:4px 24px 4px 8px;cursor:pointer;font-size:11px;min-width:140px;max-width:180px}.city-picker[data-v-f6ff8e37]:focus,.city-picker.open[data-v-f6ff8e37]{border-color:var(--input-border-focus)}.city-panel[data-v-f6ff8e37]{display:none;position:absolute;right:-1px;bottom:calc(100% + 4px);background:var(--option-bg);border:1px solid var(--input-border);border-radius:8px;box-shadow:0 8px 24px #00000040;z-index:1000;width:260px;height:200px;overflow:hidden}.city-picker.open .city-panel[data-v-f6ff8e37]{display:flex}.city-col[data-v-f6ff8e37]{flex:1;overflow-y:auto;border-right:1px solid var(--card-divider)}.city-col[data-v-f6ff8e37]:last-child{border-right:none}.city-col div[data-v-f6ff8e37]{padding:5px 10px;font-size:11px;color:var(--text);cursor:pointer;white-space:nowrap}.city-col div[data-v-f6ff8e37]:hover{background:var(--input-bg)}.city-col div.active[data-v-f6ff8e37]{color:var(--accent);font-weight:600}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-oLine truncated
</head>
<body>
<div class="header">
<h1>桌面设置</h1>
<p>壁纸 · 布局 · 信息显示</p>
</div>
<!-- 显示控制 -->
<div class="section">
<div class="section-label">显示控制</div>
<div class="card">
<div class="item">
<div><div class="item-label">开机启动</div><div class="item-desc">系统启动时自动运行</div></div>
<label class="switch"><input type="checkbox" id="autoStart"><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">显示壁纸</div></div>
<label class="switch"><input type="checkbox" id="wallpaper" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">时间日期</div></div>
<label class="switch"><input type="checkbox" id="time" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item item-sub">
<div><div class="item-label">显示秒</div></div>
<label class="switch"><input type="checkbox" id="showSeconds" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">天气信息</div></div>
<label class="switch"><input type="checkbox" id="weather" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">星座运势</div></div>
<label class="switch"><input type="checkbox" id="zodiacCard" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">知识卡片</div></div>
<label class="switch"><input type="checkbox" id="knowledgeCard" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">AI 资讯</div></div>
<label class="switch"><input type="checkbox" id="ainewsCard" checked><span class="track"><span class="thumb"></span></span></label>
</div>
</div>
</div>
<!-- 壁纸类型 -->
<div class="section">
<div class="section-label">壁纸类型</div>
<div class="card">
<div class="item">
<div class="item-label">类型选择</div>
<div class="radio-tabs" id="wpTypeTabs">
<button class="btn" data-type="theme">主题</button>
<button class="btn" data-type="image">本地图片</button>
<button class="btn" data-type="bing">Bing</button>
<button class="btn" data-type="color">纯色/渐变</button>
</div>
</div>
</div>
</div>
<!-- 主题选择 -->
<div class="section wp-type-section" id="sec-theme">
<div class="section-label">壁纸主题</div>
<div class="card">
<div class="item">
<div class="item-label">选择主题</div>
<select id="themeSelect"></select>
</div>
<div class="item" id="textInputRow" style="display:none">
<div class="item-label">自定义文字</div>
<input type="text" id="wallpaperText" placeholder="输入显示文字">
</div>
</div>
</div>
<!-- 本地图片 -->
<div class="section wp-type-section" id="sec-image">
<div class="section-label">本地图片</div>
<div class="card">
<div class="item">
<div class="item-desc" id="imagePathDisplay">未选择图片</div>
<button class="btn" id="btnPickImage">选择图片</button>
</div>
</div>
</div>
<!-- Bing -->
<div class="section wp-type-section" id="sec-bing">
<div class="section-label">Bing 每日壁纸</div>
<div class="card">
<div class="item">
<div style="display:flex;align-items:center;gap:8px;flex:1;min-width:0">
<img id="bingPreview" style="width:64px;height:40px;object-fit:cover;border-radius:4px;flex-shrink:0;display:none">
<div style="min-width:0;overflow:hidden">
<div class="item-label" id="bingCopyright" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Bing 每日壁纸</div>
<div class="item-desc" id="bingIdx"></div>
</div>
</div>
<div class="bing-nav" style="flex-shrink:0">
<button class="btn btn-sm" id="btnBingPrev">◀</button>
<button class="btn btn-sm" id="btnBingNext">▶</button>
<button class="btn btn-sm" id="btnBingFav">☆</button>
</div>
</div>
<div class="item">
<div><div class="item-label">定时切换</div><div class="item-desc">每小时自动切换壁纸</div></div>
<label class="switch"><input type="checkbox" id="bingAutoRefresh"><span class="track"><span class="thumb"></span></span></label>
</div>
</div>
<div id="bingFavSection" style="display:none;margin-top:6px">
<div class="section-label">收藏列表</div>
<div class="card" id="bingFavList"></div>
</div>
</div>
<!-- 纯色/渐变 -->
<div class="section wp-type-section" id="sec-color">
<div class="section-label">纯色 / 渐变</div>
<div class="card">
<div class="item">
<div class="item-label">选择颜色</div>
<div class="btn-group">
<button class="btn" id="btnSolidColor">纯色</button>
<button class="btn" id="btnGradientColor">渐变</button>
</div>
</div>
<div class="item" id="currentColorRow" style="display:none">
<div class="item-label">当前颜色</div>
<div style="display:flex;align-items:center;gap:6px">
<span id="currentColorPreview" style="display:inline-block;width:24px;height:16px;border-radius:3px;border:1px solid var(--input-border)"></span>
<button class="btn btn-sm" id="btnSaveColor">收藏</button>
</div>
</div>
</div>
<div id="savedColorsSection" style="display:none;margin-top:6px">
<div class="card" id="savedColorsGrid" style="padding:8px 12px;display:flex;flex-wrap:wrap;gap:6px">
</div>
</div>
</div>
<!-- 布局 -->
<div class="section">
<div class="section-label">布局</div>
<div class="card">
<div class="item">
<div class="item-label">信息布局</div>
<select id="layout">
<option value="single">合并卡片</option>
<option value="multi">独立卡片</option>
</select>
</div>
</div>
</div>
<!-- 相册 -->
<div class="section">
<div class="section-label">相册</div>
<div class="card">
<div class="item">
<div><div class="item-label">相册展示</div></div>
<label class="switch"><input type="checkbox" id="photoCard" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">电子相册模式</div><div class="item-desc">照片铺满整个壁纸</div></div>
<label class="switch"><input type="checkbox" id="photoFrameMode"><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div class="item-desc" id="photoDirDisplay">未选择目录</div>
<div class="btn-group">
<button class="btn" id="btnPickPhotoDir">选择目录</button>
<button class="btn btn-sm" id="btnClearPhotoDir" style="display:none">清除</button>
</div>
</div>
<div class="item">
<div class="item-label">切换间隔</div>
<select id="photoInterval">
<option value="5">5 秒</option>
<option value="10">10 秒</option>
<option value="15" selected>15 秒</option>
<option value="20">20 秒</option>
<option value="30">30 秒</option>
<option value="60">60 秒</option>
</select>
</div>
</div>
</div>
<!-- 星座 + 城市 -->
<div class="section">
<div class="section-label">个性化</div>
<div class="card">
<div class="item">
<div class="item-label">我的星座</div>
<select id="zodiacSelect">
<option>白羊座</option><option>金牛座</option><option>双子座</option>
<option>巨蟹座</option><option>狮子座</option><option>处女座</option>
<option>天秤座</option><option>天蝎座</option><option>射手座</option>
<option>摩羯座</option><option>水瓶座</option><option>双鱼座</option>
</select>
</div>
<div class="item">
<div><div class="item-label">知识关键字</div><div class="item-desc">AI 将根据关键字生成知识小卡片</div></div>
<input type="text" id="knowledgeKeyword" placeholder="如: 历史、科学、冷知识">
</div>
<div class="item">
<div><div class="item-label">知识提示词</div><div class="item-desc">补充风格或方向,系统会保证内容密度</div></div>
<input type="text" id="knowledgePrompt" placeholder="如: 偏实践、给出判断标准">
</div>
<div class="item" style="position:relative">
<div class="item-label">天气城市</div>
<div class="city-picker" id="cityPicker" tabindex="0">
<span class="city-picker-text" id="cityPickerText">未选择</span>
<span class="city-picker-arrow">▾</span>
<div class="city-panel" id="cityPanel">
<div class="city-col" id="provCol"></div>
<div class="city-col" id="cityCol"></div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">u-desktop v1.0</div>
<script>
var toggleKeys = ['autoStart', 'wallpaper', 'time', 'showSeconds', 'weather', 'zodiacCard', 'knowledgeCard', 'ainewsCard', 'photoCard', 'photoFrameMode'];
var initDone = false;
function sendToggle() {
if (!initDone) return;
var data = {};
toggleKeys.forEach(function(k) { data[k] = document.getElementById(k).checked; });
if (window.saveToggles) window.saveToggles(JSON.stringify(data));
}
toggleKeys.forEach(function(k) {
document.getElementById(k).addEventListener('change', sendToggle);
});
document.getElementById('layout').addEventListener('change', function() {
if (window.saveLayout) window.saveLayout(this.value);
});
document.getElementById('zodiacSelect').addEventListener('change', function() {
if (window.saveZodiac) window.saveZodiac(this.value);
});
var kwTimer = null;
document.getElementById('knowledgeKeyword').addEventListener('input', function() {
clearTimeout(kwTimer);
var val = this.value;
kwTimer = setTimeout(function() {
if (window.saveKnowledgeKeyword) window.saveKnowledgeKeyword(val);
}, 500);
});
var kpTimer = null;
document.getElementById('knowledgePrompt').addEventListener('input', function() {
clearTimeout(kpTimer);
var val = this.value;
kpTimer = setTimeout(function() {
if (window.saveKnowledgePrompt) window.saveKnowledgePrompt(val);
}, 500);
});
// City picker
var cityMap = {};
var selectedCityId = '';
var selectedCityName = '';
var picker = document.getElementById('cityPicker');
var pickerText = document.getElementById('cityPickerText');
var provCol = document.getElementById('provCol');
var cityCol = document.getElementById('cityCol');
var activeProv = '';
function renderProvinces(provinces) {
provCol.innerHTML = '';
provinces.forEach(function(p) {
var div = document.createElement('div');
div.textContent = p;
if (p === activeProv) div.className = 'active';
div.addEventListener('click', function(e) {
e.stopPropagation();
activeProv = p;
renderProvinces(provinces);
renderCities(p);
});
provCol.appendChild(div);
});
}
function renderCities(prov) {
cityCol.innerHTML = '';
var list = cityMap[prov] || [];
list.forEach(function(c) {
var div = document.createElement('div');
div.textContent = c.name;
if (c.id === selectedCityId) div.className = 'active';
div.addEventListener('click', function(e) {
e.stopPropagation();
selectedCityId = c.id;
selectedCityName = c.name;
pickerText.textContent = activeProv + ' · ' + c.name;
picker.classList.remove('open');
renderCities(prov);
if (window.saveCity) window.saveCity(c.id);
});
cityCol.appendChild(div);
});
}
picker.addEventListener('click', function(e) {
e.stopPropagation();
this.classList.toggle('open');
this.focus();
});
document.addEventListener('click', function(e) {
if (!picker.contains(e.target)) picker.classList.remove('open');
});
document.getElementById('themeSelect').addEventListener('change', function() {
if (window.saveWallpaperType) window.saveWallpaperType('theme', this.value);
document.getElementById('textInputRow').style.display = this.value === 'text' ? 'flex' : 'none';
});
document.getElementById('btnPickPhotoDir').addEventListener('click', function() {
if (!window.pickPhotoDir) return;
window.pickPhotoDir().then(function(dir) {
if (dir) {
document.getElementById('photoDirDisplay').textContent = dir;
document.getElementById('btnClearPhotoDir').style.display = '';
}
});
});
document.getElementById('btnClearPhotoDir').addEventListener('click', function() {
if (!window.clearPhotoDir) return;
window.clearPhotoDir().then(function() {
document.getElementById('photoDirDisplay').textContent = '未选择目录';
document.getElementById('btnClearPhotoDir').style.display = 'none';
});
});
document.getElementById('photoInterval').addEventListener('change', function() {
if (window.savePhotoInterval) window.savePhotoInterval(parseInt(this.value));
});
var textTimer = null;
document.getElementById('wallpaperText').addEventListener('input', function() {
clearTimeout(textTimer);
var val = this.value;
textTimer = setTimeout(function() {
if (window.saveWallpaperText) window.saveWallpaperText(val);
}, 500);
});
var wpTypeTabs = document.querySelectorAll('#wpTypeTabs .btn');
var currentWpType = '';
function setWpType(type) {
wpTypeTabs.forEach(function(b) { b.classList.toggle('active', b.dataset.type === type); });
document.querySelectorAll('.wp-type-section').forEach(function(s) { s.classList.remove('visible'); });
var sec = document.getElementById('sec-' + type);
if (sec) sec.classList.add('visible');
if (initDone && type === 'bing' && currentWpType !== 'bing') {
if (window.enableBing) window.enableBing();
}
currentWpType = type;
}
wpTypeTabs.forEach(function(b) {
b.addEventListener('click', function() { setWpType(b.dataset.type); });
});
document.getElementById('btnPickImage').addEventListener('click', function() {
if (!window.pickLocalImage) return;
window.pickLocalImage().then(function(path) {
if (path) document.getElementById('imagePathDisplay').textContent = path;
});
});
function updateBingUI(stateJson) {
if (!stateJson) return;
var s = JSON.parse(stateJson);
document.getElementById('btnBingFav').textContent = s.label;
document.getElementById('bingCopyright').textContent = s.copyright || 'Bing 每日壁纸';
document.getElementById('bingIdx').textContent = (s.total > 0) ? ((s.idx + 1) + ' / ' + s.total) : '';
// load preview thumbnail
if (s.filename && window.bingThumbDataURI) {
var preview = document.getElementById('bingPreview');
window.bingThumbDataURI(s.filename).then(function(uri) {
if (uri) { preview.src = uri; preview.style.display = 'block'; }
});
}
}
function loadBingFavorites() {
if (!window.getBingFavorites) return;
window.getBingFavorites().then(function(json) {
var favs = JSON.parse(json);
var sec = document.getElementById('bingFavSection');
var list = document.getElementById('bingFavList');
list.innerHTML = '';
if (!favs || favs.length === 0) { sec.style.display = 'none'; return; }
sec.style.display = 'block';
list.style.cssText = 'padding:8px 12px;display:flex;flex-wrap:wrap;gap:6px';
favs.forEach(function(f) {
var img = document.createElement('img');
img.style.cssText = 'width:64px;height:40px;object-fit:cover;border-radius:4px;cursor:pointer;border:2px solid transparent;transition:border-color 0.15s';
img.title = f.copyright + ' (' + f.date + ')';
img.addEventListener('click', function() {
if (window.bingSetByIdx) window.bingSetByIdx(f.idx).then(function(s) { updateBingUI(s); });
});
img.addEventListener('mouseenter', function() { this.style.borderColor = 'var(--accent)'; });
img.addEventListener('mouseleave', function() { this.style.borderColor = 'transparent'; });
list.appendChild(img);
if (window.bingThumbDataURI) {
window.bingThumbDataURI(f.filename).then(function(uri) {
if (uri) img.src = uri;
});
}
});
});
}
document.getElementById('btnBingPrev').addEventListener('click', function() {
if (window.bingPrev) window.bingPrev().then(function(s) { updateBingUI(s); });
});
document.getElementById('btnBingNext').addEventListener('click', function() {
if (window.bingNext) window.bingNext().then(function(s) { updateBingUI(s); });
});
document.getElementById('btnBingFav').addEventListener('click', function() {
if (window.bingToggleFavorite) {
window.bingToggleFavorite().then(function(s) { updateBingUI(s); loadBingFavorites(); });
}
});
document.getElementById('bingAutoRefresh').addEventListener('change', function() {
if (window.saveBingAutoRefresh) window.saveBingAutoRefresh(this.checked);
});
document.getElementById('btnSolidColor').addEventListener('click', function() {
if (window.pickSolidColor) {
window.pickSolidColor().then(function(c) {
if (c) { currentColor1 = c; currentColor2 = ''; currentGradient = false; updateColorPreview(); }
});
}
});
document.getElementById('btnGradientColor').addEventListener('click', function() {
if (window.pickGradientColor) {
window.pickGradientColor().then(function(res) {
if (res) {
var parts = res.split(',');
currentColor1 = parts[0]; currentColor2 = parts[1] || ''; currentGradient = true;
updateColorPreview();
}
});
}
});
// Color favorites
var currentColor1 = '', currentColor2 = '', currentGradient = false;
var savedColors = [];
function updateColorPreview() {
var row = document.getElementById('currentColorRow');
var preview = document.getElementById('currentColorPreview');
if (!currentColor1) { row.style.display = 'none'; return; }
row.style.display = 'flex';
if (currentGradient && currentColor2) {
preview.style.background = 'linear-gradient(135deg,' + currentColor1 + ',' + currentColor2 + ')';
} else {
preview.style.background = currentColor1;
}
}
function renderSavedColors() {
var sec = document.getElementById('savedColorsSection');
var grid = document.getElementById('savedColorsGrid');
grid.innerHTML = '';
if (!savedColors || savedColors.length === 0) { sec.style.display = 'none'; return; }
sec.style.display = 'block';
savedColors.forEach(function(sc, idx) {
var swatch = document.createElement('div');
swatch.className = 'color-swatch';
if (sc.gradient && sc.color2) {
swatch.style.background = 'linear-gradient(135deg,' + sc.color1 + ',' + sc.color2 + ')';
} else {
swatch.style.background = sc.color1;
}
var del = document.createElement('span');
del.className = 'del'; del.textContent = 'x';
del.addEventListener('click', function(e) {
e.stopPropagation();
if (window.removeSavedColor) window.removeSavedColor(idx).then(function() {
savedColors.splice(idx, 1);
renderSavedColors();
});
});
swatch.appendChild(del);
swatch.addEventListener('click', function() {
if (window.applySavedColor) window.applySavedColor(idx);
currentColor1 = sc.color1; currentColor2 = sc.color2; currentGradient = sc.gradient;
updateColorPreview();
});
grid.appendChild(swatch);
});
}
document.getElementById('btnSaveColor').addEventListener('click', function() {
if (!currentColor1) return;
if (window.addSavedColor) window.addSavedColor(currentColor1, currentColor2, currentGradient).then(function() {
savedColors.push({color1: currentColor1, color2: currentColor2, gradient: currentGradient});
renderSavedColors();
});
});
if (window.loadAllSettings) {
window.loadAllSettings().then(function(raw) {
var s = JSON.parse(raw);
// Apply system theme
if (s.lightTheme) {
document.documentElement.className = 'light';
}
// Province-city cascade
cityMap = s.citiesByProv || {};
selectedCityId = s.city || '';
activeProv = '';
if (s.provinces && s.provinces.length) {
for (var p in cityMap) {
for (var ci = 0; ci < cityMap[p].length; ci++) {
if (cityMap[p][ci].id === selectedCityId) { activeProv = p; selectedCityName = cityMap[p][ci].name; break; }
}
if (activeProv) break;
}
renderProvinces(s.provinces);
if (activeProv) renderCities(activeProv);
if (activeProv && selectedCityName) {
pickerText.textContent = activeProv + ' · ' + selectedCityName;
}
}
if (s.themes && s.themes.length) {
var themeSel = document.getElementById('themeSelect');
s.themes.forEach(function(t) {
var opt = document.createElement('option');
opt.value = t.value;
opt.textContent = t.label;
themeSel.appendChild(opt);
});
}
toggleKeys.forEach(function(k) {
if (s[k] !== undefined) document.getElementById(k).checked = s[k];
});
if (s.layout) document.getElementById('layout').value = s.layout;
if (s.zodiac) document.getElementById('zodiacSelect').value = s.zodiac;
if (s.theme) document.getElementById('themeSelect').value = s.theme;
if (s.wallpaperText) document.getElementById('wallpaperText').value = s.wallpaperText;
if (s.imagePath) document.getElementById('imagePathDisplay').textContent = s.imagePath;
if (s.knowledgeKeyword) document.getElementById('knowledgeKeyword').value = s.knowledgeKeyword;
if (s.knowledgePrompt) document.getElementById('knowledgePrompt').value = s.knowledgePrompt;
if (s.theme === 'text') document.getElementById('textInputRow').style.display = 'flex';
// Photo state
if (s.photoDir) {
document.getElementById('photoDirDisplay').textContent = s.photoDir;
document.getElementById('btnClearPhotoDir').style.display = '';
}
if (s.photoInterval) document.getElementById('photoInterval').value = s.photoInterval;
// Color state
if (s.color1) { currentColor1 = s.color1; currentColor2 = s.color2 || ''; currentGradient = s.colorGradient || false; }
if (s.wallpaperType === 'color') updateColorPreview();
savedColors = s.savedColors || [];
renderSavedColors();
setWpType(s.wallpaperType || 'theme');
// Bing state
if (s.wallpaperType === 'bing' && window.getBingInfo) {
window.getBingInfo().then(function(si) { updateBingUI(si); });
}
if (s.wallpaperType === 'bing') loadBingFavorites();
if (s.bingAutoRefresh !== undefined) document.getElementById('bingAutoRefresh').checked = s.bingAutoRefresh;
// resize window to fit content
setTimeout(function() {
var el = document.documentElement;
var cw = el.scrollWidth;
var ch = el.scrollHeight + 8;
if (window.resizeToFit) window.resizeToFit(cw, ch);
}, 100);
initDone = true;
});
}
</script>
<div id="app"></div>
</body>
</html>