集成列表无限加载,美化搜索框

This commit is contained in:
Aicirou 2020-05-15 03:20:11 +08:00
parent 05bf9d6aaa
commit 6f34d69a6e
9 changed files with 71 additions and 21 deletions

5
package-lock.json generated
View File

@ -12498,6 +12498,11 @@
}
}
},
"vue-infinite-scroll": {
"version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/vue-infinite-scroll/download/vue-infinite-scroll-2.0.2.tgz",
"integrity": "sha1-yjepH+ku4K07dKz4aCwAkXFEtxE="
},
"vue-loader": {
"version": "15.9.1",
"resolved": "https://registry.npm.taobao.org/vue-loader/download/vue-loader-15.9.1.tgz?cache=0&sync_timestamp=1584584267698&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-loader%2Fdownload%2Fvue-loader-15.9.1.tgz",

View File

@ -26,6 +26,7 @@
"vue-axios": "^2.1.5",
"vue-clipboard2": "^0.3.1",
"vue-i18n": "^8.17.3",
"vue-infinite-scroll": "^2.0.2",
"vue-router": "^3.1.6",
"vue2-ace-editor": "0.0.15",
"vuex": "^3.4.0"

View File

@ -54,8 +54,8 @@ body {
td span {
vertical-align: middle;
}
td .g2-file-desc{
font-size:12px;
td .g2-file-desc {
font-size: 12px;
}
}
@ -87,6 +87,11 @@ body {
}
}
// 搜索框
.search-input,.search-input::-webkit-input-placeholder {
color: whitesmoke;
}
.golist {
min-height: 240px;
position: relative;

View File

@ -23,10 +23,12 @@
"copy": "Copy link",
"newTab": "Open a new tab",
"download": "Download"
}
},
"total": "Total",
"item": "item"
},
"search": {
"placeholder": "Search or jump to…"
"placeholder": "Search resources..."
},
"page": {
"video": {

View File

@ -23,7 +23,9 @@
"copy": "复制链接",
"newTab": "打开新的标签页",
"download": "下载"
}
},
"total": "共",
"item": "项"
},
"search": {
"placeholder": "搜索..."

View File

@ -23,7 +23,9 @@
"copy": "復制鏈接",
"newTab": "打開新的標簽頁",
"download": "下載"
}
},
"total": "共",
"item": "項"
},
"search": {
"placeholder": "搜索..."

View File

@ -11,12 +11,14 @@ import i18n from './i18n'
// store
import store from '@/store/index'
import VueClipboard from 'vue-clipboard2'
import infiniteScroll from 'vue-infinite-scroll'
import "@/assets/style/theme/register.scss"
Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.use(VueAxios,axios)
Vue.use(VueClipboard)
Vue.use(infiniteScroll)
new Vue({
router,

View File

@ -44,16 +44,18 @@
<!-- is-hidden-desktop -->
<div class="navbar-item">
<div class="field is-grouped">
<p class="control has-icons-left" style="width:100%;">
<p class="control has-icons-left is-dark" style="width:100%;">
<input
class="input is-rounded has-text-grey"
class="input is-rounded search-input"
@keyup.enter="query"
v-model="param"
type="search"
:placeholder="$t('search.placeholder')"
style="background-color: rgb(68, 66, 66);border-color: #272727;"
/>
<span class="icon is-small is-left">
<i class="fas fa-search"></i>
<span class="icon is-small is-left" style="padding:0 5px;">
<!-- <i class="fas fa-search"></i> -->
<img :src="eyes" />
</span>
</p>
</div>
@ -105,6 +107,7 @@ export default {
currgd: {},
gds: [],
isActive: false,
eyes: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFwAAAA0CAYAAAAHSF9vAAAAAXNSR0IArs4c6QAACN5JREFUeAHtXG9oHGUaf95J0tj2sskmze4SsylCWiqlBZEiHp6atnJ+8FCx1OOgFUy1eKfXuwM9wdMPeoJ/QM8/3NHaCrYgXmn9g35QbI3W4+QohxARSxuQJrHsbppssrHtpcnO6/Ob7KYzs+/M7M7O7KZc3y+ZeZ7n9zzP+8sz77zv7LwjKIAmpWwaTWfXyAZaKyStkDq1kpAzfDyli4bvm5c1DCZaWjIBhArFRWp6OjZzPr9ek/lrpODcpWgWGk3x8VmRp2+749ETQojZIIILv06YZG04M7WJSN8upLxbEi1388UJf0Mk95N21ds9ncvPuNnWQjc8dq6L9P/9hkhs576sc4vJJJ2TQrxHpO3vibUe5b7obvZuuooJPyPlsrnMxOPstF9K6nJzrtLNJyuPcAeeWRlr/5fKJkzZ6czETVwgTzLRm1E0lcYSglAs+xpj7c91CXG+YnwlgNPpydtI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yq8lf+S/Gj53A6y4uh+dfHavm0kKtC8jPjTd2d0YVZhypxN9noWLaPd60dRT+wXK/t00Ix0BOPbkI/VDkqCYfhlT0+Kro8ZZ57fBwJh2vsyrp4fvYIV8k6z1BVGhQq4uGeePvfq3S1AB9OT/yWT15HpS8IQzrg/L9Zsqxps9c3BUrGcHM+AGtLG/v4bvK1WR70MSeLfZoPBkk2coQ/+IX/oHO2+GN+wJMX2cC4Eg4DbPbknba8K0zsx3nQjScGP/C7GneGsSkWucIv/CNO0LnDH3gBP+VsijXsK0niyl57M1sh7rU3h7nyNYkafk3CTDzfiLSRzNRm3vi0jcfJ/4vvpfBK9kAy1nqkmntCIHdvJt/0RSDRydssIpf/F4FEjmfxY0F/EchctFeOa8DAT7a2wdC+qrYdAAAAAElFTkSuQmCC'
};
},
methods: {

View File

@ -2,7 +2,12 @@
<div>
<headmd :option="headmd" v-if="headmd.display"></headmd>
<div class="golist" v-loading="loading">
<table class="table is-hoverable">
<table
class="table is-hoverable"
v-infinite-scroll="pageLoad"
infinite-scroll-disabled="busy"
infinite-scroll-distance="10"
>
<thead>
<tr>
<th
@ -40,7 +45,9 @@
</figure>
</span>-->
{{ file.name }}
<span class="has-text-grey g2-file-desc">{{ file.description }}</span>
<span class="has-text-grey g2-file-desc">{{
file.description
}}</span>
</td>
<td class="is-hidden-mobile is-hidden-touch">
{{ file.modifiedTime }}
@ -77,12 +84,18 @@
</tbody>
</table>
<div
v-show="files.length == 0"
v-show="files.length === 0"
class="has-text-centered no-content"
></div>
<!-- <div v-show="loading" class="pageloader is-active">
<span class="title">{{ $t("list.loading") }}</span>
</div> -->
<center>
<div :class="!busy ? 'is-hidden' : ''">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr-only">Loading...</span>
</div>
<span v-if="page.page_token === null && files.length !== 0" class="tag">
{{ $t("list.total") }} {{ files.length }} {{ $t("list.item") }}
</span>
</center>
</div>
<hr />
<readmemd :option="readmemd" v-if="readmemd.display"></readmemd>
@ -106,13 +119,13 @@ export default {
},
data: function() {
return {
busy: false,
page: {
page_token: null,
page_index: 0,
},
files: [],
loading: true,
copyTooltip: "",
icon: {
"application/vnd.google-apps.folder": "icon-morenwenjianjia",
"video/mp4": "icon-mp",
@ -168,7 +181,7 @@ export default {
return this.files.map((item) => {
var p = path + checkoutPath(item.name, item);
let isFolder = item.mimeType === "application/vnd.google-apps.folder";
let size = isFolder ? this.$t("folder") : formatFileSize(item.size);
let size = isFolder ? '-' : formatFileSize(item.size);
return {
path: p,
...item,
@ -183,11 +196,20 @@ export default {
this.render();
},
methods: {
render() {
pageLoad() {
if (!this.page.page_token) return;
this.page.page_index++;
this.render("scroll");
},
render(scroll) {
if (scroll) {
this.busy = true;
} else {
this.loading = true;
}
this.headmd = { display: false, file: {}, path: "" };
this.readmemd = { display: false, file: {}, path: "" };
var path = this.$route.path;
this.loading = true;
var password = localStorage.getItem("password" + path);
let q = this.$route.query.q;
var p = {
@ -212,16 +234,22 @@ export default {
page_index: body.curPageIndex,
};
try {
if (scroll) {
this.files = this.files.concat(data.files);
} else {
this.files = data.files;
}
this.renderMd(data.files, path);
} catch (e) {
console.log(e);
}
}
this.loading = false;
this.busy = false;
})
.catch(() => {
this.loading = false;
this.busy = false;
this.$router.go(-1);
});
},