Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit 7853ca3

Browse files
committed
1.12
1 parent d763f98 commit 7853ca3

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

cache.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ class ApiCache extends LightCache {
4747
// 类似于 Service Worker 缓存机制
4848
const cache = this.getCache(url);
4949
if (cache === undefined) {
50-
logger.info("Request GitHub API address: ", url);
50+
logger.info("Request GitHub API: ", url);
5151
const response = await this.syncAxios(url);
5252
this.setCache(url, response, this.expiration);
5353
return response;
5454
} else {
55-
logger.debug("Cached GitHub API address: ", url);
55+
logger.debug("Cached GitHub API: ", url);
5656
return cache;
5757
}
5858
}

views/index.ejs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</head>
2323
<body>
2424
<div id="app">
25-
<el-card class="card">
25+
<el-card>
2626
<el-form label-width="auto">
2727
<el-form-item label="Username"><el-input v-model="form.username"></el-input></el-form-item>
2828
<el-form-item label="Repo" v-if="isRepo"><el-input v-model="form.repo"></el-input></el-form-item>
@@ -31,6 +31,7 @@
3131
</el-form>
3232
<code>{{ link }}</code><img :src="link">
3333
</el-card>
34+
<el-card></el-card>
3435
</div>
3536
<script>
3637
const form = Vue.ref({
@@ -40,15 +41,21 @@
4041
})
4142
const link = Vue.ref("");
4243
const isRepo = Vue.computed(() => form.value.type !== "User");
44+
const throwWarning = msg => ElementPlus.ElMessage({grouping: true, message: msg, showClose: false, type: "warning"})
4345
Vue.createApp({
4446
data() {
4547
return {
4648
form: form,
4749
link: link,
4850
isRepo: isRepo,
49-
generate: () => link.value =
50-
location.origin +
51-
((!isRepo.value) ? `/user/${form.value.username}/` : `/repo/${form.value.username}/${form.value.repo}`)
51+
generate: () => {
52+
const username = form.value.username.trim(),
53+
repo = form.value.repo.trim();
54+
55+
if (! username) {throwWarning("username is empty."); return }
56+
if (isRepo.value && ! repo) {throwWarning("repo is empty."); return }
57+
link.value = location.origin + ((!isRepo.value) ? `/user/${username}/` : `/repo/${username}/${repo}`)
58+
}
5259
}
5360
}
5461
}).use(ElementPlus).mount('#app');

0 commit comments

Comments
 (0)