Skip to content

Commit

Permalink
Merge pull request #15 from longxiaokong/master
Browse files Browse the repository at this point in the history
added reward and invitation code
  • Loading branch information
Clarivy authored May 23, 2024
2 parents 1928864 + 236cc88 commit 85e8819
Show file tree
Hide file tree
Showing 16 changed files with 513 additions and 174 deletions.
13 changes: 11 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
<v-app>
<Header :snackbar.sync="snackbar" />
<v-main>
<InsiderBanner />
<div>
<InsiderBanner />
</div>
<div>
<ActivityBanner :Enable=true>
评论拿赏金功能上线啦!详情请看<a href="https://www.baidu.com/link?url=VZ8B58kyM3gTA1w7QLtmappBY36c06lFXGEjzaYUBNG&wd=&eqid=d5f4c163008c878200000005660fff04">这里</a>!
</ActivityBanner>
</div>

<router-view :key="$route.path" />
<v-snackbar
v-model="snackbar.show"
Expand All @@ -25,14 +33,15 @@
<script>
import Header from '@/components/global/Header';
import InsiderBanner from '@/components/global/InsiderBanner';
import ActivityBanner from '@/components/global/ActivityBanner';
import useSnackbar from '@/composables/global/useSnackbar';
import { getPreset } from '@/composables/global/useCookie';
import { provide, reactive } from 'vue';
import { mdiClose } from '@mdi/js';
export default {
name: 'App',
components: { Header, InsiderBanner },
components: { Header, InsiderBanner, ActivityBanner },
setup() {
const { snackbar } = useSnackbar();
const global = reactive({
Expand Down
6 changes: 0 additions & 6 deletions src/components/courses/CourseCommentCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@
</v-list>
</v-menu>
</div>
<div class="mr-sm-1">
<v-icon size="15" style="">
{{ footerNote.statics.icons.mdiClockOutline }}
</v-icon>
<span class="text-caption"> {{ footerNote.semester }} </span>
</div>
</div>
</template>
</CommentCardContent>
Expand Down
32 changes: 32 additions & 0 deletions src/components/global/ActivityBanner.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<div class="d-flex justify-center activity-banner" :style="{
'background-color': $vuetify.theme.dark ? '#2a4165' : '#e8f0fe',
}" v-if=Enable>
<div class="d-flex justify-center flex-column">
<div class="text-body-1 primary--text">
<slot/>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'ActivityBanner',
props: {
Enable: Boolean
},
setup() {
},
}
</script>
<style scoped>
.activity-banner {
height: 48px;
position: absolute;
width: 100%;
/* opacity: 0.9; */
}
</style>
10 changes: 10 additions & 0 deletions src/components/global/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@
>
最近评价
</SliderButton>
<SliderButton
plain
tile
height="100%"
:hover-only="isCurrentPath('^\/ranking')"
to="/ranking"
class="px-1"
>
赏金排名
</SliderButton>
<SliderButton
plain
tile
Expand Down
80 changes: 57 additions & 23 deletions src/components/users/comment/CommentCardContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@
#default="{ overflow }"
>
<slot name="contentNote" :localComment="comment">
<v-row>
<v-col
class="pa-0 pl-3 pb-2 pt-sm-3 pt-2"
<div
class="pa-0 pb-2 pt-sm-3 pt-2 d-flex align-center"
:style="{ 'max-width': overflow ? '60vw' : '90%' }"
cols="12"
>
<v-icon size="16">
{{ statics.icons.mdiSchoolOutline }}
Expand All @@ -56,8 +54,35 @@
>
{{ teacher.name }}
</span>
</v-col>
</v-row>
<v-icon size="16">
{{ statics.icons.mdiClockOutline }}
</v-icon>
<span class="text-caption">
{{ semester }}
</span>
<span v-if="(comment.reward >= 0) && !(global.userProfile.is_admin || global.userProfile.is_community_admin)">
<v-icon size="16">
{{ statics.icons.mdiGold }}
</v-icon>
<span class="text-caption">
{{ comment.reward / 100 }}元
</span>
</span>
<div v-else class="d-flex align-center">
<v-icon size="16">
{{ statics.icons.mdiGold }}
</v-icon>
<v-text-field
:class="'pl-1 text-caption'"
v-model="localReward"
:rules=[formRules.reward]
suffix=""
style="max-width: 80px"
@keyup.enter="onEnterPressed"
>
</v-text-field>
</div>
</div>
</slot>
</TextContainer>
</slot>
Expand All @@ -73,19 +98,14 @@
sm="8"
>
<v-container>
<v-row>
<v-row class="pl-3">
<v-col
v-for="index in judgeItems.length"
:key="index"
cols="6"
sm="3"
:class="[
'py-0',
!(index % 2)
? 'px-lg-3 px-md-0 px-sm-1 px-0'
: 'pl-2 pr-lg-3 pr-md-0 pr-sm-1 pr-0',
index === 1 ? 'pl-sm-3' : '',
index === 3 ? 'pl-lg-3 pl-md-0 pl-sm-1' : '',
'px-0','py-0'
]"
>
<div>
Expand Down Expand Up @@ -131,14 +151,6 @@
赞同 {{ comment.like - comment.dislike }}
</span>
</div>
<div>
<v-icon size="16">
{{ statics.icons.mdiClockOutline }}
</v-icon>
<span class="text-caption">
{{ semester }}
</span>
</div>
</div>
</slot>
</v-col>
Expand All @@ -154,6 +166,9 @@
import useCommentCardContent from '@/composables/users/comment/useCommentCardContent';
import TextContainer from '@/components/users/comment/TextContainer';
import CommentCover from '@/components/users/comment/CommentCover';
import useForms from '@/composables/users/forms/useForms';
import useModifyReward from '@/composables/reward/useModifyReward';
import { inject, ref } from "vue";
import {
judgeItems,
gradingInfo,
Expand All @@ -167,8 +182,11 @@ import {
// and use vanilla div, and rewrite the reactive paddings
export default {
setup() {
const { statics } = useCommentCardContent();
return { statics, judgeItems, gradingInfo };
const showSnackbar = inject("showSnackbar")
const { statics, global } = useCommentCardContent();
const { formRules } = useForms();
const { formStatus, doModifyReward, onEnterUp } = useModifyReward();
return { statics, judgeItems, gradingInfo, global, formRules, formStatus, onEnterUp, doModifyReward, showSnackbar };
},
components: { TextContainer, CommentCover },
props: {
Expand All @@ -185,6 +203,22 @@ export default {
return `${year}${termItems[new Number(season) - 1].name}`;
},
},
data(){
let localReward = this.comment.reward / 100;
return {
localReward
}
},
methods: {
onEnterPressed() {
if (this.formRules.reward(this.localReward) === true){
this.formStatus.reward = this.localReward;
this.formStatus.id = this.comment.id;
this.doModifyReward();
}
else this.showSnackbar("error", "赏金格式错误");
},
},
};
</script>

Expand Down
4 changes: 2 additions & 2 deletions src/components/users/comment/TextContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
>
</v-sheet>
<div
:class="['d-flex', 'justify-space-between', 'mt-n8']"
:class="['d-flex', 'justify-space-between', 'mt-n8', 'align-center']"
v-if="!status.showAll && !noExpand"
>
<slot :overflow="status.isOverflow">
Expand All @@ -63,7 +63,7 @@
</v-chip>
</div>
<div
:class="['d-flex', 'justify-space-between', dense ? 'pr-sm-1' : '']"
:class="['d-flex', 'justify-space-between', dense ? 'pr-sm-1' : '', 'align-center']"
v-if="status.showAll && !noExpand"
>
<slot :overflow="status.isOverflow">
Expand Down
Loading

0 comments on commit 85e8819

Please sign in to comment.