-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,203 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,6 @@ | |
"dom", | ||
"dom.iterable", | ||
"scripthost" | ||
] | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<template> | ||
<v-card> | ||
|
||
<v-card flat :to="'/projects/' + info.id"> | ||
|
||
<v-img v-if="info.type == 'scratch'" gradient="to bottom, rgba(0,0,0,.1), rgba(0,0,0,.5)" class="align-end" | ||
color="surface-variant" :src="'https://s4-1.wuyuan.1r.ink/scratch_slt/' + info.id" | ||
lazy-src="../assets/scratchdefault.png"> | ||
<template v-slot:placeholder> | ||
<div class="d-flex align-center justify-center fill-height"> | ||
<v-progress-circular color="grey-lighten-4" indeterminate></v-progress-circular> | ||
</div> | ||
</template> | ||
<v-card-title class="text-white"> | ||
{{ info.title }}</v-card-title> | ||
</v-img> | ||
|
||
</v-card> | ||
<v-card flat :to="'/projects/' + info.id"> | ||
|
||
<v-card-item v-if="info.type == 'python'"> | ||
|
||
<v-card-title class="text-white"> | ||
{{ info.title }} </v-card-title> | ||
<v-card-subtitle class="text-white"> | ||
{{ info.tags }} | ||
{{ info.description }} </v-card-subtitle> | ||
|
||
</v-card-item> <v-card-item v-if="info.type == 'text'"> | ||
|
||
<v-card-title class="text-white"> | ||
{{ info.title }} </v-card-title> | ||
<v-card-subtitle class="text-white"> | ||
{{ info.tags }} | ||
{{ info.description }} </v-card-subtitle> | ||
|
||
</v-card-item> | ||
</v-card> | ||
|
||
<v-card flat :to="'/user/' + info.authorid"> | ||
|
||
|
||
<v-card-item> | ||
<template v-slot:prepend> | ||
<v-avatar size="32"> | ||
<v-img :alt="user.display_name" :src="'https://s4-1.wuyuan.1r.ink/user/' + user.images"></v-img> | ||
</v-avatar> | ||
</template> | ||
<v-card-title class="text-white"> | ||
{{ user.display_name }} </v-card-title> | ||
<v-card-subtitle class="text-white"> | ||
{{ user.motto }} </v-card-subtitle> | ||
|
||
</v-card-item></v-card> | ||
|
||
<v-card-actions v-if="actions"> | ||
<div v-for="action in actions" :key="action.name"> | ||
<v-btn @click="action.function(info.id, info)">{{ action.name }}</v-btn> | ||
</div> | ||
</v-card-actions> | ||
</v-card> | ||
</template> | ||
<script> | ||
export default { | ||
data() { | ||
return { | ||
tags: [], | ||
} | ||
}, | ||
props: | ||
{ | ||
info: { | ||
type: Object, | ||
default: '' | ||
}, | ||
user: { | ||
type: Object, | ||
default: '{ "id": 1, "username": "yxhyh", "display_name": "已销号用户", "motto": "已销号用户", "images": "0ec4beb623e3bcdbe0f207c9804f0bc2" }' | ||
}, | ||
actions: { | ||
type: Array, | ||
required: false, | ||
} | ||
}, | ||
watch: { | ||
info: { | ||
immediate: true, | ||
handler(newVal) { | ||
if (newVal.tags) { | ||
this.tags = newVal.tags.split(',') | ||
} else { | ||
this.tags = [] | ||
} | ||
} | ||
} | ||
}, | ||
methods: { | ||
callFunction(action) { | ||
action(this.info.id, this.info); | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<template><v-progress-linear :active="ProjectsLoading" height="4" indeterminate></v-progress-linear> | ||
<div class="mb-2" v-if="showinfo == true || showinfo == 'true'"> | ||
<v-chip><v-icon icon="mdi-counter" start></v-icon>共{{ | ||
this.projectscount | ||
}}个作品 | ||
</v-chip> | ||
<v-chip><v-icon icon="mdi-clock" start></v-icon>本页加载用时{{ | ||
Math.abs(usetime / 1000) | ||
}}秒 | ||
</v-chip> | ||
</div> | ||
<ProjectsCards :projects="projects" :actions='actions'></ProjectsCards> | ||
|
||
<v-pagination v-model="curPage" :length="totalPage" rounded="circle" :v-model="curPage" | ||
@update:model-value="onPageChange(curPage)" @input="onPageChange(curPage)"></v-pagination> | ||
</template> | ||
|
||
<script> | ||
import request from "../../axios/axios"; | ||
import ProjectsCards from "./ProjectsCards.vue"; | ||
export default { | ||
components: { ProjectsCards }, | ||
props: { | ||
authorid: { | ||
type: String, | ||
default: "", | ||
}, | ||
title: { | ||
type: String, | ||
default: "", | ||
}, | ||
type: { | ||
type: String, | ||
default: "", | ||
}, | ||
description: { | ||
type: String, | ||
default: "", | ||
}, | ||
order: { | ||
type: String, | ||
default: "view_down", | ||
}, | ||
source: { | ||
type: String, | ||
default: "", | ||
}, | ||
state: { | ||
type: String, | ||
default: "", | ||
}, | ||
tag: { | ||
type: String, | ||
default: '', | ||
}, | ||
showinfo: { | ||
type: String, | ||
default: false, | ||
}, | ||
actions: { | ||
type: Array, | ||
required: false | ||
} | ||
}, | ||
data() { | ||
return { | ||
ProjectsLoading: false, | ||
projects: [], | ||
curPage: 1, | ||
totalPage: 1, | ||
limit: 8, | ||
typeitems: { all: "", scratch: "scratch", python: "python" }, | ||
usetime: 0, | ||
projectscount: 0, | ||
search: { | ||
title: "", | ||
type: "", | ||
description: "", | ||
source: "", | ||
order: { name: "观看量升序", type: "view_up" }, | ||
authorid: "", | ||
type: { name: "所有", type: "" }, | ||
typeitems: [ | ||
{ name: "所有", type: "" }, | ||
{ name: "Scratch", type: "scratch" }, | ||
{ name: "Python", type: "python" }, | ||
], | ||
orderitems: [ | ||
{ name: "观看量升序", type: "view_up" }, | ||
{ name: "观看量降序", type: "view_down" }, | ||
{ name: "时间升序", type: "time_up" }, | ||
{ name: "时间降序", type: "time_down" }, | ||
{ name: "序号升序", type: "id_up" }, | ||
{ name: "序号降序", type: "id_down" }, | ||
], | ||
state: '' | ||
}, | ||
}; | ||
}, | ||
async created() { | ||
await this.getprojects(); | ||
}, | ||
methods: { | ||
async getprojects() { | ||
this.onPageChange(1); | ||
}, | ||
async onPageChange(page) { | ||
this.usetime = Date.now(); | ||
this.ProjectsLoading = true | ||
this.projects = await request({ | ||
url: `/proxy/explore/projects? | ||
&search_source=${this.source | ||
}&search_description=${this.description}&search_orderby=${this.order | ||
}&search_state=${this.state}&search_tag=${this.tag}&curr=${page}&limit=${this.limit}`, | ||
method: "get", | ||
}); | ||
this.totalPage = Math.ceil( | ||
this.projects.totalCount[0].totalCount / this.limit | ||
); | ||
this.projectscount = this.projects.totalCount[0].totalCount; | ||
this.curPage = page; | ||
console.log(this.projects); | ||
console.log(this.totalPage); | ||
this.ProjectsLoading = false | ||
this.usetime = Date.now() - this.usetime; | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<v-row> | ||
<v-col cols=" 12" md="3" v-for="info in projects.data" :key="info"> | ||
<ProjectCard :info="info" :user="projects.user.find((u) => u.id === info.authorid)" :actions="actions"></ProjectCard> | ||
</v-col></v-row> | ||
</template> | ||
|
||
<script> | ||
import ProjectCard from "./ProjectCard.vue"; | ||
export default { | ||
components: { ProjectCard }, | ||
props: { | ||
projects: { | ||
type: Object, | ||
default: 'text', | ||
}, | ||
actions:{ | ||
type: Array, | ||
required: false, | ||
} | ||
}, | ||
}; | ||
</script> |
Oops, something went wrong.