完成第一版

master
yutent 2023-02-12 22:35:30 +08:00
parent 62e53063b9
commit 24bb7e3aae
4 changed files with 25 additions and 26 deletions

View File

@ -7,8 +7,8 @@
<title>{{title}}</title> <title>{{title}}</title>
<meta name="keywords" content="{{keywords}}"> <meta name="keywords" content="{{keywords}}">
<meta name="description" content="{{description}}"> <meta name="description" content="{{description}}">
<link rel="stylesheet" href="//a.jscdn.ink/@bytedo/wcui/dist/css/reset-basic.css"> <link rel="stylesheet" href="//jscdn.ink/@bytedo/wcui/1.0.12/css/reset-basic.css">
<script async src="//esm.tool/es-module-shims.wasm.js"></script> <script async src="//jscdn.ink/es-module-shims/1.6.3/es-module-shims.wasm.js"></script>
<script type="importmap">{{importmap}}</script> <script type="importmap">{{importmap}}</script>
</head> </head>
<body> <body>

View File

@ -1,10 +1,10 @@
import { createApp } from 'vue' import { createApp } from 'vue'
import '//a.jscdn.ink/es.shim/dist/index.js' import '//jscdn.ink/es.shim/2.1.0/index.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/form/input.js' import '//jscdn.ink/@bytedo/wcui/1.0.12/form/input.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/form/button.js' import '//jscdn.ink/@bytedo/wcui/1.0.12/form/button.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/form/link.js' import '//jscdn.ink/@bytedo/wcui/1.0.12/form/link.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/layer/index.js' import '//jscdn.ink/@bytedo/wcui/1.0.12/layer/index.js'
import App from './app.vue' import App from './app.vue'

View File

@ -17,19 +17,19 @@
<wc-tr v-for="it of list" :key="it.id"> <wc-tr v-for="it of list" :key="it.id">
<wc-td align="center">{{ it.id }}</wc-td> <wc-td align="center">{{ it.id }}</wc-td>
<wc-td align="center">{{ it.author }}</wc-td> <wc-td align="center">{{ it.author }}</wc-td>
<wc-td>{{ it.description }}</wc-td> <wc-td align="center">{{ it.latest || '-' }}</wc-td>
<wc-td align="center">{{ it.sync_date }}</wc-td> <wc-td align="center">{{ it.latest ? it.sync_date : '-' }}</wc-td>
<wc-td align="center">{{ $store.stats[it.stat] }}</wc-td> <wc-td align="center">{{ $store.stats[it.stat] }}</wc-td>
<wc-td>{{ it.remark }}</wc-td> <wc-td>{{ it.remark || '-' }}</wc-td>
<wc-td align="center"> <wc-td align="center">
<wc-link <wc-link
:disabled="it.stat !== 2" :disabled="loading || it.stat !== 2"
@click="handlePackgae('sync', it.id)" @click="handlePackgae('sync', it.id)"
type="info" type="info"
>更新</wc-link >更新</wc-link
> >
<wc-link <wc-link
v-if="$store.user.admin" v-if="$store.user.admin && it.stat !== 2"
@click="handlePackgae('accept', it.id)" @click="handlePackgae('accept', it.id)"
type="info" type="info"
>通过</wc-link >通过</wc-link
@ -94,9 +94,9 @@
</template> </template>
<script> <script>
import '//a.jscdn.ink/@bytedo/wcui/dist/table/index.js' import '//jscdn.ink/@bytedo/wcui/1.0.12/table/index.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/form/switch.js' import '//jscdn.ink/@bytedo/wcui/1.0.12/form/switch.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/pager/index.js' import '//jscdn.ink/@bytedo/wcui/1.0.12/pager/index.js'
import fetch from '@/lib/fetch.js' import fetch from '@/lib/fetch.js'
export default { export default {
@ -107,7 +107,7 @@ export default {
thead: JSON.stringify([ thead: JSON.stringify([
'开源库', '开源库',
'作者', '作者',
'介绍', '最后同步版本',
'最后同步日期', '最后同步日期',
'收录状态', '收录状态',
'备注', '备注',
@ -206,13 +206,13 @@ export default {
: 'unknow' : 'unknow'
this.lib.author = author this.lib.author = author
this.lib.description = r.description this.lib.description = r.description || r.homepage
this.lib.latest = r['dist-tags'].latest this.lib.latest = r['dist-tags'].latest
this.disabled = false this.disabled = false
return { return {
author, author,
description: r.description, description: this.lib.description,
latest: r['dist-tags'].latest latest: r['dist-tags'].latest
} }
}) })
@ -270,7 +270,7 @@ export default {
}) })
}) })
} else if (act === 'accept') { } else if (act === 'accept') {
req = layer.prompt('请输入文件目录').then(dist => { req = layer.prompt('请输入文件目录', 'dist').then(dist => {
return fetch(`/package/${act}/${encodeURIComponent(id)}`, { return fetch(`/package/${act}/${encodeURIComponent(id)}`, {
method: 'PUT', method: 'PUT',
body: { dist } body: { dist }
@ -281,7 +281,7 @@ export default {
method: 'PUT' method: 'PUT'
}) })
} }
this.loading = true
req req
.then(r => { .then(r => {
layer.toast('操作成功', 'success') layer.toast('操作成功', 'success')
@ -290,6 +290,7 @@ export default {
.catch(r => { .catch(r => {
r && layer.toast(r.msg, 'error') r && layer.toast(r.msg, 'error')
}) })
.finally(_ => (this.loading = false))
} }
} }
} }

View File

@ -25,13 +25,11 @@ export default {
// 有用到其他的库, 可以手动添加, // 有用到其他的库, 可以手动添加,
// 也可以在页面中直接引入完整的路径, 而不必须在这里声明 // 也可以在页面中直接引入完整的路径, 而不必须在这里声明
imports: { imports: {
vue: '//a.jscdn.ink/vue/dist/vue.esm-browser.prod.js', vue: '//jscdn.ink/vue/3.2.47/vue.esm-browser.prod.js',
'vue-router': '//a.jscdn.ink/vue-router/dist/vue-router.esm-browser.js', 'vue-router': '//jscdn.ink/vue-router/4.1.6/vue-router.esm-browser.js',
// 这个库被vue-router依赖, 可以注释掉vue-router代码中的 @vue/devtools-api 的引入 // 这个库被vue-router依赖, 可以注释掉vue-router代码中的 @vue/devtools-api 的引入
// 以达到减少不必须的体积的效果 // 以达到减少不必须的体积的效果
'@vue/devtools-api': '@vue/devtools-api': '//jscdn.ink/@vue/devtools-api/6.5.0/esm/index.js',
'//a.jscdn.ink/@vue/devtools-api@6.4.4/lib/esm/index.js', fetch: '//jscdn.ink/@bytedo/fetch/2.1.1/next.js'
fetch: '//a.jscdn.ink/@bytedo/fetch/dist/next.js',
'node-fetch': '//a.jscdn.ink/@bytedo/fetch/dist/next.js'
} }
} }