Skip to content

Commit 26d63c1

Browse files
authored
Merge pull request #1 from kaizumaki/feature/pr-630
[FYI]typescriptエラーを修正する
2 parents c76150a + cfed775 commit 26d63c1

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

src/assets/locales/ja.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"date": "日付設定",
7878
"time": "時間設定",
7979
"subject_label_color": "ラベル色",
80-
"video_keyword": "オプション機能:{source}動画検索",
80+
"video_keyword": "オプション機能:動画検索",
8181
"video_url": "参考動画URL",
8282
"video_thumbnail": "動画サムネイル・キャプション表示",
8383
"textbook_page": "教科書ページ",
@@ -90,7 +90,7 @@
9090
"required": "*マークのあるものは必須項目です",
9191
"search_videos": {
9292
"search": "検索",
93-
"search_result": "{source}動画検索結果",
93+
"search_result": "動画検索結果",
9494
"add_to_video_urls": "参考動画URLに登録する"
9595
}
9696
},

src/components/EditLessonScreenInner3.vue

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
<editor-input-field-pickable
1111
v-model="videoSearchWord"
1212
selector="video"
13-
:title="
14-
$t('components.editing_screen.labels.video_keyword', {
15-
source: '',
16-
})
17-
"
13+
:title="$t('components.editing_screen.labels.video_keyword')"
1814
:placeholder="$t('components.editing_screen.placeholder.video_keyword')"
1915
icon-name="mdi-magnify"
2016
:button-text="$t('components.editing_screen.search_videos.search')"
@@ -24,11 +20,7 @@
2420

2521
<div v-if="videoSearchResult.length > 0" class="SearchResult">
2622
<h3 class="SearchResultTitle">
27-
{{
28-
$t('components.editing_screen.search_videos.search_result', {
29-
source: '',
30-
})
31-
}}
23+
{{ $t('components.editing_screen.search_videos.search_result') }}
3224
</h3>
3325
<ul class="SearchResultList">
3426
<li v-for="(v, i) in displayLists" :key="i" class="SearchResultItem">
@@ -83,12 +75,16 @@
8375
<script lang="ts">
8476
import { Vue, Component, Prop, Emit, Watch } from 'vue-property-decorator'
8577
import EditorInputFieldPickable from '~/components/EditorInputFieldPickable.vue'
78+
import { MovieListItem, Movie } from '~/types/movies'
8679
87-
let movies: any[] = []
80+
let movies: Movie[] = []
8881
8982
export type formData = {
9083
videoUrl: string | null
9184
videoTitle: string
85+
videoSubTitle: string | null
86+
videoDescription: string | null
87+
videoPlayTime: string | null
9288
videoThumbnailUrl: string | null
9389
}
9490
@@ -101,6 +97,9 @@ export default class EditLessonScreenInner3 extends Vue {
10197
tempFormData = {
10298
videoUrl: this.form.videoUrl,
10399
videoTitle: this.form.videoTitle,
100+
videoSubTitle: this.form.videoSubTitle,
101+
videoDescription: this.form.videoDescription,
102+
videoPlayTime: this.form.videoPlayTime,
104103
videoThumbnailUrl:
105104
this.form.videoThumbnailUrl !== '' ? this.form.videoThumbnailUrl : null,
106105
}
@@ -111,18 +110,21 @@ export default class EditLessonScreenInner3 extends Vue {
111110
default: () => ({
112111
videoUrl: null,
113112
videoTitle: '',
113+
videoSubTitle: '',
114+
videoDescription: '',
115+
videoPlayTime: '',
114116
videoThumbnailUrl: '',
115117
}),
116118
})
117119
public value!: formData
118120
119121
videoSourceType: string = ''
120122
videoSearchWord: string = ''
121-
videoSearchResult: formData[] = []
123+
videoSearchResult: (formData | undefined)[] = []
122124
page: number = 1
123125
pageSize: number = 5
124126
length: number = 0
125-
displayLists: formData[] = []
127+
displayLists: (formData | undefined)[] = []
126128
127129
mounted() {
128130
// fetch('/data/movies.json')
@@ -150,7 +152,7 @@ export default class EditLessonScreenInner3 extends Vue {
150152
this.tempFormData = this.value
151153
}
152154
153-
private handleChangeMovie(selected) {
155+
private handleChangeMovie(selected: MovieListItem) {
154156
this.videoSourceType = selected.sourceType
155157
fetch(`/data/${selected.dataFile}`)
156158
.then((res) => res.json())
@@ -199,7 +201,7 @@ export default class EditLessonScreenInner3 extends Vue {
199201
)
200202
}
201203
202-
private mapNhk(v) {
204+
private mapNhk(v: Movie): formData {
203205
const videoId = v.inherentProperties.教材_ID
204206
const videoType = parseInt(videoId.slice(5, 6))
205207
const nfsMovieUrl = 'https://www2.nhk.or.jp/school/movie/'
@@ -229,7 +231,7 @@ export default class EditLessonScreenInner3 extends Vue {
229231
}
230232
}
231233
232-
private mapJunyiacademy(v) {
234+
private mapJunyiacademy(v: Movie): formData {
233235
return {
234236
videoUrl: v.inherentProperties.url,
235237
videoTitle: v.title,

src/types/movies.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export interface MovieListItem {
2+
sourceType: string
3+
name: string
4+
dataFile: string
5+
}
6+
7+
export interface Movie {
8+
[key: string]: string | null | any | undefined
9+
title: string
10+
description: string | null
11+
keywords: string | null
12+
source: string
13+
inherentProperties: any | undefined
14+
}

0 commit comments

Comments
 (0)