From d2ff91b76187536155dc96c768e5da947a2ea69d Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 15 Nov 2023 18:34:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=89=80=E6=9C=89=E7=9A=84?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/app.js | 17 +- dist/assets/app.css | 1 + dist/components/header.js | 86 +++--- dist/index.html | 4 +- dist/lib/ui/layer/index.js | 2 +- dist/lib/ui/pager/index.js | 6 +- dist/store.js | 3 +- dist/views/about.js | 94 ++++++ dist/views/about.vue | 87 ------ dist/views/home.js | 191 +++++++++++++ dist/views/home.vue | 151 ---------- dist/views/login.js | 178 ++++++++++++ dist/views/login.vue | 169 ----------- dist/views/request.js | 565 +++++++++++++++++++------------------ dist/views/request.vue | 382 ------------------------- 15 files changed, 824 insertions(+), 1112 deletions(-) delete mode 100644 dist/views/about.vue delete mode 100644 dist/views/home.vue delete mode 100644 dist/views/login.vue delete mode 100644 dist/views/request.vue diff --git a/dist/app.js b/dist/app.js index 91d68de..67fd260 100644 --- a/dist/app.js +++ b/dist/app.js @@ -8,17 +8,12 @@ import { createApp } from 'wkitd' import { css, html } from 'wkit' import 'es.shim' -// import '//jscdn.ink/@bd/ui/latest/form/input.js' -// import '//jscdn.ink/@bd/ui/latest/form/button.js' -// import '//jscdn.ink/@bd/ui/latest/form/checkbox.js' -// import '//jscdn.ink/@bd/ui/latest/form/switch.js' -// import '//jscdn.ink/@bd/ui/latest/form/link.js' -// import '//jscdn.ink/@bd/ui/latest/layer/index.js' -// // import 'http://127.0.0.1:8090/dist/layer/index.js' -// import '//jscdn.ink/@bd/ui/latest/pager/index.js' -// import '//jscdn.ink/@bytedo/wcui/1.0.12/form/dropdown.js' - -// import App from './app.vue' +import '@ui/form/input.js' +import '@ui/form/button.js' +import '@ui/form/switch.js' +import '@ui/form/link.js' +import '@ui/layer/index.js' +import '@ui/pager/index.js' import router from './router.js' import store from './store.js' diff --git a/dist/assets/app.css b/dist/assets/app.css index 4db0a91..5600d38 100644 --- a/dist/assets/app.css +++ b/dist/assets/app.css @@ -9,6 +9,7 @@ background: var(--color-dark-1); } } + body { line-height: 1.5; font-size: 14px; diff --git a/dist/components/header.js b/dist/components/header.js index b58c94d..96cbc73 100644 --- a/dist/components/header.js +++ b/dist/components/header.js @@ -1,13 +1,13 @@ import { html, css, Component, classMap } from 'wkit' +import { watch } from 'wkitd' import fetch from '/lib/fetch.js' class Header extends Component { - static props = { - input: '' - } - static styles = css` + ::selection { + background: var(--color-plain-a); + } .common-header { flex-shrink: 0; display: flex; @@ -51,13 +51,10 @@ class Header extends Component { border-radius: 4px; transition: background 0.2s ease-in-out; - &:hover { + &:hover, + &.active { background: rgba(255, 255, 255, 0.3); } - - &.router-link-active { - text-decoration: underline; - } } } } @@ -78,6 +75,7 @@ class Header extends Component { height: 320px; .search { display: inline-block; + --wc-input-border-color: none; } } @@ -105,36 +103,59 @@ class Header extends Component { } ` - search() { - let id = this.input.trim() + #search(ev) { + let id = this.$store.searchInput + if (id) { - fetch('/package/search/' + encodeURIComponent(id)).then(r => { - let dict = { versions: [], id } - let last = null - for (let it of r.data) { - let tmp = it.split('/') - let v = tmp.shift() - let n = tmp.join('/') - if (last === v) { - dict[last].push(n) - } else { - last = v - dict.versions.push(last) - dict[last] = [n] + fetch('/package/search/' + encodeURIComponent(id)) + .then(r => { + let dict = { versions: [], id } + let last = null + for (let it of r.data) { + let tmp = it.split('/') + let v = tmp.shift() + let n = tmp.join('/') + if (last === v) { + dict[last].push(n) + } else { + last = v + dict.versions.push(last) + dict[last] = [n] + } } - } - this.$store.result = dict - }) + dict.version = last + this.$store.result = dict + }) + .catch(err => { + this.$store.result = { version: '', versions: [], id: '' } + }) } else { - this.$store.result = null + this.$store.result = { version: '', versions: [], id: '' } } } + #handleInput(ev) { + this.$store.searchInput = ev.target.value + } + + mounted() { + watch('$store.searchInput', val => { + this.#search() + }) + watch('$route', route => { + if (route.path === '/' && !route.query.name) { + this.$store.searchInput = '' + } + }) + } + render() { return html`