一大波更新

master
yutent 2023-02-10 17:03:51 +08:00
parent dabb23967b
commit 1183064004
8 changed files with 85 additions and 38 deletions

View File

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

View File

@ -1 +1,10 @@
<svg viewBox="0 0 261.76 226.69" xmlns="http://www.w3.org/2000/svg"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/><path d="M36.21 192.639l160.921-74.805-81.778-5.063 119.519-67.69L49.06 126.138l88.8 2.712z" fill="rgb(252, 118, 97)"/></svg>
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" width="512" height="177">
<path fill-rule="evenodd"
d="M229.7 89q0-6.4 2-12t5.7-9.7q3.7-4.1 9-6.4 5.3-2.3 11.9-2.3 8.2 0 15.5 3l-2.9 10.9q-2.3-1-5.2-1.6-3-.7-6.3-.7-7.8 0-11.9 4.9-4.1 4.9-4.1 13.9 0 8.6 3.9 13.7 3.8 5 13 5 3.4 0 6.8-.7 3.3-.6 5.7-1.6l1.9 11q-2.2 1.1-6.7 2-4.5.9-9.2.9-7.5 0-12.9-2.3-5.5-2.2-9.1-6.3-3.6-4-5.4-9.6-1.7-5.6-1.7-12.1zm104.1 27.1q-4 1.2-10 2.2-6.1 1-12.7 1-6.8 0-12.3-2.1-5.4-2.1-9.2-6-3.8-4-5.9-9.5-2-5.6-2-12.6 0-6.8 1.7-12.4 1.7-5.6 5-9.6.9-1 1.8-1.9.9-.9 1.9-1.6 1-.8 2.1-1.5 1.1-.6 2.3-1.1 4.8-2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 2.6 1.8 2.6 4.7 0 3.1-2.4 4.4-2.4 1.3-7.7 1.3-5.3 0-9.5-1.2z"
fill="#fff" />
<path fill="none" stroke="#ced6e0" stroke-width="10" stroke-linecap="round"
d="M114.6 136.5L61.4 91.6q-.9-.8-1.4-1.9-.6-1.1-.6-2.3 0-1.2.5-2.3.5-1.1 1.4-1.9l53.3-47.6M400.8 40.7l53.4 47.6q.9.8 1.3 1.9.5 1.1.5 2.3 0 1.2-.5 2.3-.5 1.1-1.5 1.9l-53.2 45" />
</svg>

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -2,7 +2,7 @@
<div class="common-header" :class="{ 'search-show': $store.searchShow }">
<header class="navibar">
<div class="wrapper">
<a class="logo">Js CDN</a>
<a class="logo"><img src="/assets/logo.svg" /></a>
<nav class="navi">
<router-link to="/"> </router-link>
@ -56,6 +56,11 @@ export default {
.logo {
font-weight: bold;
font-size: 26px;
img {
display: block;
height: 36px;
}
}
.navi {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,14 +1,16 @@
import { createApp } from 'vue'
import '//a.jscdn.ink/es.shim/dist/index.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/form/input.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/form/button.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/form/link.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/layer/index.js'
import App from './app.vue'
import router from './router'
import store from './store'
import '//jscdn.ink/@bytedo/wcui/dist/form/input.js'
import '//jscdn.ink/@bytedo/wcui/dist/form/button.js'
import '//jscdn.ink/@bytedo/wcui/dist/form/link.js'
import '//jscdn.ink/@bytedo/wcui/dist/layer/index.js'
const app = createApp(App)
app.use(router).use(store).mount('.app')

View File

@ -5,7 +5,9 @@
<h3 class="name">{{ $store.user.name }}</h3>
<cite class="homepage">
<wc-icon is="home" />主页:
<a target="_blank" :href="$store.user.homepage">{{ $store.user.homepage }}</a>
<a target="_blank" :href="$store.user.homepage">{{
$store.user.homepage
}}</a>
</cite>
<wc-button class="logout" @click="logout"></wc-button>
</div>
@ -13,7 +15,13 @@
<section class="title">请使用以下方式登录</section>
<section class="third-part">
<a class="github" title="github" @click="jumpLogin()">
<svg class="ico" viewBox="0 0 16 16" width="32" height="32" fill="currentColor">
<svg
class="ico"
viewBox="0 0 16 16"
width="32"
height="32"
fill="currentColor"
>
<path
d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 01-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 010 8c0-4.42 3.58-8 8-8z"
/>
@ -45,13 +53,20 @@ export default {
}
})
.then(r => {
let lastPath = localStorage.getItem('login_callback_path')
layer.toast('登录成功', 'success')
this.$store.user = r.data.user
localStorage.setItem('user', JSON.stringify(r.data.user))
localStorage.setItem('token', r.data.token)
this.$router.replace('/login')
if (lastPath) {
localStorage.removeItem('login_callback_path')
this.$router.replace(lastPath)
} else {
this.$router.replace('/login')
}
})
.catch(r => {
console.log(r)
layer.toast(r.msg, 'error')
})
}

View File

@ -18,17 +18,29 @@
<wc-td align="center">{{ it.id }}</wc-td>
<wc-td align="center">{{ it.author }}</wc-td>
<wc-td>{{ it.description }}</wc-td>
<wc-td>{{ it.sync_date }}</wc-td>
<wc-td align="center">{{ it.sync_date }}</wc-td>
<wc-td align="center">{{ $store.stats[it.stat] }}</wc-td>
<wc-td>{{ it.remark }}</wc-td>
<wc-td v-if="$store.user.admin" align="center">
<wc-td align="center">
<wc-link @click="handlePackgae('sync', it.id)" type="info"
>更新</wc-link
>
<wc-link
v-if="$store.user.admin"
@click="handlePackgae('accept', it.id)"
type="info"
>通过</wc-link
>
<wc-link @click="handlePackgae('reject', it.id)" type="warning"
<wc-link
v-if="$store.user.admin"
@click="handlePackgae('reject', it.id)"
type="warning"
>拒绝</wc-link
>
<wc-link @click="handlePackgae('delete', it.id)" type="danger"
<wc-link
v-if="$store.user.admin"
@click="handlePackgae('delete', it.id)"
type="danger"
>删除</wc-link
>
</wc-td>
@ -79,9 +91,9 @@
</template>
<script>
import '//unpkg.com/@bytedo/wcui/dist/table/index.js'
import '//unpkg.com/@bytedo/wcui/dist/form/switch.js'
import '//unpkg.com/@bytedo/wcui/dist/pager/index.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/table/index.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/form/switch.js'
import '//a.jscdn.ink/@bytedo/wcui/dist/pager/index.js'
import fetch from '@/lib/fetch.js'
export default {
@ -95,7 +107,8 @@ export default {
'介绍',
'最后同步日期',
'收录状态',
'备注'
'备注',
'操作'
]),
page: 1,
total: 0,
@ -114,25 +127,15 @@ export default {
mounted() {
this.$store.searchShow = false
if (this.$store.user.admin) {
this.thead = JSON.stringify([
'开源库',
'作者',
'介绍',
'最后同步日期',
'收录状态',
'备注',
'操作'
])
}
this.fetchList()
},
methods: {
fetchList() {
fetch('/package/list').then(r => {
this.$list = r.data
this.list = r.data.filter(it =>
this.$list = r.data.map(
it => ((it.sync_date = new Date(it.sync_date).format('Y/m/d')), it)
)
this.list = this.$list.filter(it =>
this.onlyShowWaited ? it.stat === 1 : true
)
this.total = this.list.length
@ -158,7 +161,14 @@ export default {
},
openDialog() {
this.$refs.form.show()
if (this.$store.user.id) {
this.$refs.form.show()
} else {
layer.confirm('你还没有登录, 请先登录之后, 再申请').then(_ => {
localStorage.setItem('login_callback_path', this.$route.path)
this.$router.push('/login')
})
}
},
resetForm(force) {
@ -245,12 +255,16 @@ export default {
},
handlePackgae(act, id) {
if (act !== 'sync' && !this.$store.user.admin) {
return layer.alert('别闹, 老实等管理员通过~~')
}
fetch(`/package/${act}/${encodeURIComponent(id)}`)
.then(r => {
layer.toast('操作成功', 'success')
this.fetchList()
})
.catch(r => {
console.log(r)
layer.toast(r.msg, 'error')
})
}

View File

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