Skip to content

Commit 05ce463

Browse files
committed
新的项目素材管理
1 parent 11cca00 commit 05ce463

28 files changed

+112
-128
lines changed

src/components/AppHeader.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@
6262
@click="notificationsCard?.fetchNotifications()"
6363
>
6464
<v-avatar
65-
:image="
66-
s3BucketUrl + '/user/' + localuser.user.value.avatar
67-
"
65+
:image="localuser.getUserAvatar()"
6866
></v-avatar>
6967
</v-btn>
7068
</template>
@@ -116,7 +114,7 @@
116114
<v-window-item value="profile">
117115
<v-card
118116
:append-avatar="
119-
s3BucketUrl + '/user/' + localuser.user.value.avatar
117+
localuser.getUserAvatar()
120118
"
121119
:subtitle="localuser.user.value.username"
122120
:title="localuser.user.value.display_name"

src/components/NotificationsCardContent.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
size="42"
3737
>
3838
<v-img
39-
:src="s3BucketUrl + '/user/' + notification.actor.avatar"
39+
:src=" localuser.getUserAvatar(notification.actor.avatar)"
4040
alt="用户头像"
4141
></v-img>
4242
</v-avatar>
@@ -163,7 +163,7 @@ import {
163163
} from "@/services/notificationService";
164164
import {getProjectInfo, getProjectListById} from "@/services/projectService";
165165
import {get} from "@/services/serverConfig";
166-
166+
import { localuser } from "@/services/localAccount";
167167
export default {
168168
name: "NotificationsCardContent",
169169
props: {
@@ -608,6 +608,7 @@ export default {
608608
s3BucketUrl,
609609
projectCache,
610610
projectListCache,
611+
localuser,
611612
};
612613
},
613614
};

src/components/SearchComponent.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
22
<div class="search-component">
3-
43
<v-form @submit.prevent="handleSearch">
54
<div class="d-flex align-center gap-2">
65
<v-text-field
@@ -104,7 +103,7 @@
104103
v-bind="props"
105104
>
106105
<v-img
107-
:src="s3BucketUrl + '/scratch_slt/' + item.id"
106+
:src="getS3staticurl(item.thumbnail)"
108107
class="align-end"
109108
cover
110109
error-src="../assets/43-lazyload.png"
@@ -194,8 +193,7 @@
194193
</template>
195194

196195
<script>
197-
import {get} from '@/services/serverConfig';
198-
import {getProjectInfo} from '@/services/projectService';
196+
import {getS3staticurl} from '@/services/projectService';
199197
import {
200198
loadSearchHistory,
201199
addToSearchHistory,
@@ -230,7 +228,7 @@ export default {
230228
totalHits: 0,
231229
totalPages: 0,
232230
urlMap: {},
233-
s3BucketUrl: '',
231+
getS3staticurl: getS3staticurl,
234232
hotSearches: ['Scratch', '游戏', '动画', '音乐', '艺术', '编程'],
235233
};
236234
},
@@ -255,7 +253,6 @@ export default {
255253
256254
async created() {
257255
this.searchHistory = loadSearchHistory();
258-
this.s3BucketUrl = await get('s3.staticurl');
259256
},
260257
261258
methods: {

src/components/account/AvatarEditor.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
width="150"
2424
>
2525
<v-img
26-
:src="previewImage || (s3BucketUrl + '/user/' + userData.avatar)"
26+
:src="previewImage || ( localuser.getUserAvatar())"
2727
class="bg-grey-lighten-3"
2828
cover
2929
height="150"
@@ -56,7 +56,7 @@
5656
<script>
5757
import Compressor from "compressorjs";
5858
import {uploadUserAvatar} from "@/services/accountService";
59-
59+
import { localuser } from "@/services/localAccount";
6060
export default {
6161
name: "AvatarEditor",
6262
props: {
@@ -73,7 +73,8 @@ export default {
7373
return {
7474
loading: false,
7575
avatarFile: null,
76-
previewImage: null
76+
previewImage: null,
77+
localuser,
7778
};
7879
},
7980
methods: {

src/components/account/UserCard.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<v-avatar class="ma-3" size="64">
55
<v-img
66
:alt="userData.display_name"
7-
:src="s3BucketUrl + '/user/' + userData.avatar"
7+
:src="localuser.getUserAvatar(userData.avatar)"
88
cover
99
></v-img>
1010
</v-avatar>
@@ -41,6 +41,7 @@
4141
</template>
4242

4343
<script>
44+
import { localuser } from "@/services/localAccount";
4445
export default {
4546
name: "UserCard",
4647
props: {
@@ -56,6 +57,11 @@ export default {
5657
type: String,
5758
required: true
5859
}
59-
}
60+
},
61+
data() {
62+
return {
63+
localuser,
64+
};
65+
},
6066
};
6167
</script>

src/components/comment/CommentContent.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {computed} from 'vue'
2727
import TimeAgo from '../TimeAgo.vue'
2828
import Markdown from '../Markdown.vue'
2929
import {UAParser} from 'ua-parser-js'
30-
30+
import { localuser } from "@/services/localAccount";
3131
const props = defineProps({
3232
comment: {
3333
type: Object,
@@ -41,7 +41,7 @@ const props = defineProps({
4141
4242
const avatarUrl = computed(() => {
4343
if (props.comment?.user?.avatar) {
44-
return props.s3BucketUrl + '/user/' + props.comment.user.avatar
44+
return localuser.getUserAvatar(props.comment.user.avatar)
4545
}
4646
return ''
4747
})

src/components/comment/CommentListItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<script setup>
1515
import {computed} from 'vue'
16-
16+
import { localuser } from "@/services/localAccount";
1717
const props = defineProps({
1818
comment: {
1919
type: Object,
@@ -27,7 +27,7 @@ const props = defineProps({
2727
2828
const avatarUrl = computed(() => {
2929
if (props.comment?.user?.avatar) {
30-
return props.s3BucketUrl + '/user/' + props.comment.user.avatar
30+
return localuser.getUserAvatar(props.comment.user.avatar)
3131
}
3232
return ''
3333
})

src/components/extensions/ExtensionCard.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</v-card>
2424
<!-- 作者信息区域 -->
2525
<v-card-item v-if="extension.author"
26-
:append-avatar="extension.author.avatar ? s3BucketUrl + '/user/' + extension.author.avatar : ''">
26+
:append-avatar="extension.author.avatar ? localuser.getUserAvatar(extension.author.avatar) : ''">
2727
<v-card-title>{{ extension.author.display_name || extension.author.username || "未知用户" }}</v-card-title>
2828
<v-card-subtitle>{{ extension.author.username || "" }}</v-card-subtitle>
2929
</v-card-item>
@@ -33,6 +33,7 @@
3333
</template>
3434

3535
<script>
36+
import { localuser } from "@/services/localAccount";
3637
export default {
3738
name: 'ExtensionCard',
3839
props: {
@@ -45,6 +46,11 @@ export default {
4546
required: true
4647
}
4748
},
49+
data() {
50+
return {
51+
localuser,
52+
};
53+
},
4854
computed: {
4955
extensionTags() {
5056
if (!this.extension.project?.tags) return [];

src/components/extensions/ExtensionEditDialog.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
<template v-slot:prepend>
194194
<v-avatar>
195195
<v-img
196-
:src="s3BucketUrl + '/user/' + selectedSampleProject.author?.avatar || ''"
196+
:src="localuser.getUserAvatar(selectedSampleProject.author?.avatar) || ''"
197197
></v-img>
198198
</v-avatar>
199199
</template>
@@ -270,7 +270,7 @@
270270
<script>
271271
import request from "@/axios/axios";
272272
import { localuser } from "@/services/localAccount";
273-
import { get } from "@/services/serverConfig";
273+
274274
import ProjectSelector from "../shared/ProjectSelector.vue";
275275
276276
export default {
@@ -294,8 +294,7 @@ export default {
294294
formValid: false,
295295
loading: false,
296296
loadingCommits: false,
297-
s3BucketUrl: '',
298-
297+
localuser,
299298
form: {
300299
branch: '',
301300
commit: '',
@@ -331,7 +330,7 @@ export default {
331330
}
332331
333332
if (this.form.image) {
334-
return this.s3BucketUrl + '/extension/' + this.form.image;
333+
return localuser.getUserAvatar(this.form.image);
335334
}
336335
337336
return null;
@@ -362,7 +361,6 @@ export default {
362361
}
363362
},
364363
async created() {
365-
this.s3BucketUrl = await get('s3.staticurl');
366364
await this.fetchMyProjects();
367365
},
368366
methods: {

0 commit comments

Comments
 (0)