Skip to content

Commit d66e9ac

Browse files
Merge branch 'development' into translations_src-assets-locales-ja-json--development_en
2 parents 995070b + 204dde4 commit d66e9ac

File tree

4 files changed

+122733
-21
lines changed

4 files changed

+122733
-21
lines changed

src/assets/locales/ja.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"title": "タイトル",
2525
"subject_name": "教科名",
2626
"textbook": "教科書",
27-
"goal": "学習の目的",
28-
"description": "詳細",
27+
"goal": "ねらい",
28+
"description": "内容(ないよう)",
2929
"videos": "参考動画",
3030
"materials": "副教材"
3131
},
@@ -69,13 +69,17 @@
6969
"date": "日付設定",
7070
"time": "時間設定",
7171
"subject_label_color": "ラベル色",
72-
"description": "詳細説明",
72+
"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/components/EditLessonScreenInner1.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,6 @@
141141
@clickButton="endTimePickerOpen = true"
142142
/>
143143
</div>
144-
<editor-input-field-pickable
145-
v-model="tempFormData.title"
146-
:title="`${$t('common.lesson_data.labels.title')} *`"
147-
:label="$t('common.lesson_data.labels.title')"
148-
placeholder="例)理科"
149-
/>
150144
<div class="EditingScreen-Flex">
151145
<editor-input-field-pickable
152146
v-model="tempFormData.subjectName"
@@ -164,6 +158,12 @@
164158
@clickPickerButton="colorPickerOpen = true"
165159
/>
166160
</div>
161+
<editor-input-field-pickable
162+
v-model="tempFormData.title"
163+
:title="`${$t('common.lesson_data.labels.title')} *`"
164+
:label="$t('common.lesson_data.labels.title')"
165+
placeholder="例)理科"
166+
/>
167167
</div>
168168
</template>
169169

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

0 commit comments

Comments
 (0)