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

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": { "vue-loader": {
"version": "15.9.1", "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", "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-axios": "^2.1.5",
"vue-clipboard2": "^0.3.1", "vue-clipboard2": "^0.3.1",
"vue-i18n": "^8.17.3", "vue-i18n": "^8.17.3",
"vue-infinite-scroll": "^2.0.2",
"vue-router": "^3.1.6", "vue-router": "^3.1.6",
"vue2-ace-editor": "0.0.15", "vue2-ace-editor": "0.0.15",
"vuex": "^3.4.0" "vuex": "^3.4.0"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,16 +44,18 @@
<!-- is-hidden-desktop --> <!-- is-hidden-desktop -->
<div class="navbar-item"> <div class="navbar-item">
<div class="field is-grouped"> <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 <input
class="input is-rounded has-text-grey" class="input is-rounded search-input"
@keyup.enter="query" @keyup.enter="query"
v-model="param" v-model="param"
type="search" type="search"
:placeholder="$t('search.placeholder')" :placeholder="$t('search.placeholder')"
style="background-color: rgb(68, 66, 66);border-color: #272727;"
/> />
<span class="icon is-small is-left"> <span class="icon is-small is-left" style="padding:0 5px;">
<i class="fas fa-search"></i> <!-- <i class="fas fa-search"></i> -->
<img :src="eyes" />
</span> </span>
</p> </p>
</div> </div>
@ -105,6 +107,7 @@ export default {
currgd: {}, currgd: {},
gds: [], gds: [],
isActive: false, isActive: false,
eyes: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFwAAAA0CAYAAAAHSF9vAAAAAXNSR0IArs4c6QAACN5JREFUeAHtXG9oHGUaf95J0tj2sskmze4SsylCWiqlBZEiHp6atnJ+8FCx1OOgFUy1eKfXuwM9wdMPeoJ/QM8/3NHaCrYgXmn9g35QbI3W4+QohxARSxuQJrHsbppssrHtpcnO6/Ob7KYzs+/M7M7O7KZc3y+ZeZ7n9zzP+8sz77zv7LwjKIAmpWwaTWfXyAZaKyStkDq1kpAzfDyli4bvm5c1DCZaWjIBhArFRWp6OjZzPr9ek/lrpODcpWgWGk3x8VmRp2+749ETQojZIIILv06YZG04M7WJSN8upLxbEi1388UJf0Mk95N21ds9ncvPuNnWQjc8dq6L9P/9hkhs576sc4vJJJ2TQrxHpO3vibUe5b7obvZuuooJPyPlsrnMxOPstF9K6nJzrtLNJyuPcAeeWRlr/5fKJkzZ6czETVwgTzLRm1E0lcYSglAs+xpj7c91CXG+YnwlgNPpydtI6ru5Uq+pBKeyZeL5oqDdyxujf+7oEDmVTZCy8XEZOTeXfZ597mSiKy600lzE9yS0nSvjbZ+W6pwlZQXOZrNtuYvyVZJym7MrfxpUjKaJnd2d7R/58+CNGh2buEPX5W4/V6SndyEORJaI30ej0UlPWzbwJHw0l+vIX5j7lMm+rhyHfmwwzPBlvjOZ6NjrB++GGUmN7+Dhi8mufPhw82vRCfF1w9LG27ojkXGLXHHiOobh7q2fn/s8TLKRE8hgUvYMZyZ+p8jRtwj+4DdUsuc7cJ1+YW4AfHkl61jhmcyPiQv6zAA7WOPlJFi99seViejfqvV5OpX9A8+gXq7WT4X4E0u15r5Y7GcpJ5yywnFTuaBffJtBNSabxzghXxo9O7nRKeFy5MDDTzm2AdusAW/gz8mvkvC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rYdAAAAAElFTkSuQmCC'
}; };
}, },
methods: { methods: {

View File

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