Skip to content

Commit e0ac03d

Browse files
authored
Merge branch 'development' into aws-migration
2 parents 97a191c + 5b45bd3 commit e0ac03d

File tree

5 files changed

+122726
-12
lines changed

5 files changed

+122726
-12
lines changed

src/assets/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
}
132132
},
133133
"user_classlist": {
134+
"title": "Course List",
134135
"add_class": "Register Course",
135136
"login_to_class": "Login With Selected Course",
136137
"no_classes": "There Are No Editable Courses. Please Register Your Course."

src/assets/locales/ja.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,16 @@
7070
"time": "時間設定",
7171
"subject_label_color": "ラベル色",
7272
"description": "詳細説明",
73+
"video_keyword": "(オプション機能)動画検索",
7374
"video_url": "参考動画URL",
7475
"video_thumbnail": "動画サムネイル・キャプション表示",
7576
"textbook_page": "教科書ページ",
7677
"material_title": "副教材タイトル",
7778
"material_url": "副教材URL"
7879
},
80+
"placeholders": {
81+
"video_keyword": "例) 理科"
82+
},
7983
"required": "*マークのあるものは必須項目です"
8084
},
8185
"editing_visibility_dialog": {

src/assets/locales/zh_TW.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
}
132132
},
133133
"user_classlist": {
134+
"title": "課程一覽",
134135
"add_class": "登錄課程",
135136
"login_to_class": "選擇課程進行登入",
136137
"no_classes": "無可以編輯的課程。請先進行課程登錄。"

src/components/EditLessonScreenInner3.vue

Lines changed: 141 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,71 @@
66
label="video"
77
placeholder="https://"
88
/>
9-
<video-thumbnail
10-
v-if="tempFormData.videoTitle && tempFormData.videoThumbnailUrl"
11-
:caption="tempFormData.videoTitle"
12-
:title="$t('components.editing_screen.labels.video_thumbnail')"
13-
:thumbnail-url="tempFormData.videoThumbnailUrl"
9+
10+
<editor-input-field-pickable
11+
v-model="videoSearchWord"
12+
:title="$t('components.editing_screen.labels.video_keyword')"
13+
:placeholders="$t('components.editing_screen.placeholder.video_keyword')"
1414
/>
15+
16+
<button class="Button" @click="handleVideoSearchWord">検索する</button>
17+
18+
<div v-if="videoSearchResult.length > 0" class="SearchResult">
19+
<h3>NHK For Schoolの動画検索結果</h3>
20+
<ul>
21+
<li v-for="(v, i) in displayLists" :key="i" class="SearchResultItem">
22+
<component
23+
:is="v.videoUrl ? 'a' : 'span'"
24+
:href="v.videoUrl"
25+
:target="v.videoUrl ? '_blank' : null"
26+
class="SearchResultLink"
27+
>
28+
{{ v.videoTitle }}&emsp;{{ v.videoSubTitle }}
29+
</component>
30+
<p class="SearchResultDescription">{{ v.videoDescription }}</p>
31+
<span>{{ v.videoPlayTime }}</span>
32+
<br v-if="v.videoThumbnailUrl" />
33+
<img
34+
v-if="v.videoThumbnailUrl"
35+
:src="v.videoThumbnailUrl"
36+
:alt="v.videoTitle"
37+
width="240"
38+
/>
39+
<br v-if="v.videoUrl" />
40+
<button
41+
v-if="v.videoUrl"
42+
class="Button"
43+
@click="registerVideoUrl(v.videoUrl)"
44+
>
45+
参考動画URLに登録する
46+
</button>
47+
</li>
48+
</ul>
49+
<v-pagination
50+
v-model="page"
51+
:length="length"
52+
:total-visible="5"
53+
@input="pageChange"
54+
/>
55+
</div>
1556
</div>
1657
</template>
1758

1859
<script lang="ts">
1960
import { Vue, Component, Prop, Emit, Watch } from 'vue-property-decorator'
20-
import VideoThumbnail from '@/components/VideoThumbnail.vue'
2161
import EditorInputFieldPickable from '~/components/EditorInputFieldPickable.vue'
2262
63+
let movies: any[] = []
64+
2365
export type formData = {
24-
videoUrl: string
66+
videoUrl: string | null
2567
videoTitle: string
2668
videoThumbnailUrl: string | null
2769
}
70+
2871
@Component({
2972
components: {
3073
EditorInputFieldPickable,
31-
VideoThumbnail,
3274
},
3375
})
3476
export default class EditLessonScreenInner3 extends Vue {
@@ -43,13 +85,28 @@ export default class EditLessonScreenInner3 extends Vue {
4385
type: Object as () => formData,
4486
required: true,
4587
default: () => ({
46-
videoUrl: '',
88+
videoUrl: null,
4789
videoTitle: '',
4890
videoThumbnailUrl: '',
4991
}),
5092
})
5193
public value!: formData
5294
95+
videoSearchWord: string = ''
96+
videoSearchResult: formData[] = []
97+
page: number = 1
98+
pageSize: number = 5
99+
length: number = 0
100+
displayLists: formData[] = []
101+
102+
mounted() {
103+
fetch('/data/movies.json')
104+
.then((res) => res.json())
105+
.then((data) => {
106+
movies = data
107+
})
108+
}
109+
53110
private get form(): formData {
54111
return this.value
55112
}
@@ -59,9 +116,61 @@ export default class EditLessonScreenInner3 extends Vue {
59116
this.input(this.tempFormData)
60117
}
61118
62-
@Watch('value', { deep: true })
63-
onChangeValueFormData() {
64-
this.tempFormData = this.value
119+
private handleVideoSearchWord() {
120+
if (this.videoSearchWord) {
121+
this.page = 1
122+
this.videoSearchResult = movies
123+
.filter((v) => {
124+
const fullText = Object.keys(v)
125+
.map((k) => v[k])
126+
.join()
127+
return fullText.includes(this.videoSearchWord)
128+
})
129+
.map((v) => {
130+
const videoId = v['教材_ID']
131+
const videoType = parseInt(videoId.slice(5, 6))
132+
const nfsMovieUrl = 'https://www2.nhk.or.jp/school/movie/'
133+
const videoDirectory = videoId.slice(0, 8)
134+
let videoThumbnailUrl = `https://www.nhk.or.jp/das/image/${videoDirectory}/${videoId}_S_005.jpg`
135+
let videoUrl
136+
switch (videoType) {
137+
case 1:
138+
case 2:
139+
videoUrl = `${nfsMovieUrl}bangumi.cgi?das_id=${videoId}&p=box`
140+
break
141+
case 3:
142+
case 4:
143+
videoUrl = `${nfsMovieUrl}clip.cgi?das_id=${videoId}&p=box`
144+
break
145+
default:
146+
videoUrl = null
147+
videoThumbnailUrl = ''
148+
}
149+
return {
150+
videoUrl,
151+
videoTitle: v['教材_タイトル'],
152+
videoSubTitle: v['教材_サブタイトル'],
153+
videoDescription: v['教材_説明'],
154+
videoPlayTime: v['教材_再生時間'],
155+
videoThumbnailUrl,
156+
}
157+
})
158+
159+
this.length = Math.ceil(this.videoSearchResult.length / this.pageSize)
160+
161+
this.displayLists = this.videoSearchResult.slice(0, this.pageSize)
162+
}
163+
}
164+
165+
private registerVideoUrl(url: string) {
166+
this.tempFormData.videoUrl = url
167+
}
168+
169+
private pageChange(pageNumber: number) {
170+
this.displayLists = this.videoSearchResult.slice(
171+
this.pageSize * (pageNumber - 1),
172+
this.pageSize * pageNumber
173+
)
65174
}
66175
67176
/* CORS 回避必須
@@ -92,3 +201,23 @@ export default class EditLessonScreenInner3 extends Vue {
92201
}
93202
}
94203
</script>
204+
205+
<style lang="scss" scoped>
206+
.Button {
207+
color: $color-white;
208+
margin-bottom: 20px;
209+
}
210+
.SearchResult {
211+
color: $color-white;
212+
margin-bottom: 20px;
213+
}
214+
.SearchResultItem {
215+
margin-bottom: 12px;
216+
}
217+
.SearchResultLink {
218+
color: $color-white;
219+
}
220+
.SearchResultDescription {
221+
margin: 0;
222+
}
223+
</style>

0 commit comments

Comments
 (0)