Skip to content

Commit 61414ca

Browse files
authored
Merge branch 'development' into translations_src-assets-locales-ja-json--development_en
2 parents 7683e49 + e751665 commit 61414ca

33 files changed

+282821
-126
lines changed

nuxt-i18n.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const defaultLocale = 'ja'
22

33
const options = {
44
strategy: 'prefix_except_default',
5+
seo: false,
56
detectBrowserLanguage: false,
67
defaultLocale,
78
vueI18n: {

nuxt.config.js

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const environment = process.env.NODE_ENV || 'development'
55

66
export default {
77
telemetry: false,
8-
ssr: false,
8+
ssr: true,
99
srcDir: 'src',
1010
/*
1111
** Headers of the page
@@ -14,63 +14,16 @@ export default {
1414
htmlAttrs: {
1515
prefix: 'og: http://ogp.me/ns#',
1616
},
17-
title: 'おうちで時間割',
1817
meta: [
1918
{ charset: 'utf-8' },
2019
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
21-
{
22-
hid: 'keyword',
23-
name: 'keyword',
24-
content: 'CodeforJapan, おうちで時間割, デジタル, 学び, 今後の学習',
25-
},
2620
{
2721
hid: 'author',
2822
name: 'author',
2923
content: 'Code for Japan',
3024
},
31-
{
32-
hid: 'og:site_name',
33-
property: 'og:site_name',
34-
content: 'おうちで時間割',
35-
},
36-
{
37-
hid: 'og:url',
38-
property: 'og:url',
39-
content: `https://app.studyathome.jp/`,
40-
},
41-
{
42-
hid: 'og:title',
43-
property: 'og:title',
44-
content: 'おうちで時間割',
45-
},
46-
{
47-
hid: 'og:description',
48-
property: 'og:description',
49-
content:
50-
'子どもの学びにデジタルの活用を - 臨時休校期間と今後の学習に向けて 簡単に楽しく学べる環境を今だから、みんなでつくろう。',
51-
},
52-
{
53-
hid: 'apple-mobile-web-app-title',
54-
name: 'apple-mobile-web-app-title',
55-
content: 'おうちで時間割',
56-
},
57-
{
58-
hid: 'description',
59-
name: 'description',
60-
content:
61-
'子どもの学びにデジタルの活用を - 臨時休校期間と今後の学習に向けて 簡単に楽しく学べる環境を今だから、みんなでつくろう。',
62-
},
6325
{ hid: 'og:type', property: 'og:type', content: 'website' },
64-
{
65-
hid: 'og:image',
66-
property: 'og:image',
67-
content: 'https://app.studyathome.jp/ogp.png',
68-
},
69-
{
70-
hid: 'twitter:image',
71-
name: 'twitter:image',
72-
content: 'https://app.studyathome.jp/ogp.png',
73-
},
26+
{ name: 'twitter:card', content: 'summary_large_image' },
7427
],
7528
link: [
7629
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },

src/assets/locales/ja.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"title": "おうちで時間割",
3+
"description": "子どもの学びにデジタルの活用を - 臨時休校期間と今後の学習に向けて 簡単に楽しく学べる環境を今だから、みんなでつくろう。",
24
"common": {
35
"general": {
46
"buttons": {
@@ -77,7 +79,7 @@
7779
"date": "日付設定",
7880
"time": "時間設定",
7981
"subject_label_color": "ラベル色",
80-
"video_keyword": "オプション機能:{source}の動画検索",
82+
"video_keyword": "オプション機能:動画検索",
8183
"video_url": "参考動画URL",
8284
"video_thumbnail": "動画サムネイル・キャプション表示",
8385
"textbook_page": "教科書ページ",
@@ -90,7 +92,7 @@
9092
"required": "*マークのあるものは必須項目です",
9193
"search_videos": {
9294
"search": "検索",
93-
"search_result": "{source}の動画検索結果",
95+
"search_result": "動画検索結果",
9496
"add_to_video_urls": "参考動画URLに登録する"
9597
}
9698
},

src/assets/locales/zh_TW.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"title": "在家學習時間表",
3+
"description": "「在家學習時間表」是你的數位學習好夥伴!我們創造了線上學習環境,讓你在家也可以輕鬆的上線學習,不管是老師或學生,歡迎一起來發掘更多上課的樂趣!",
24
"common": {
35
"general": {
46
"buttons": {
@@ -56,7 +58,7 @@
5658
"agree": "我同意使用條款"
5759
},
5860
"buttons": {
59-
"agree": "前往註冊",
61+
"agree": "繼續註冊",
6062
"disagree": "不同意"
6163
}
6264
},

src/components/BaseInputField.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default Vue.extend({
142142
},
143143
computed: {
144144
prependIconColor(): string {
145-
const classIdPattern = /^[あ-]{6}$/
145+
const classIdPattern = /^[あ-んa-zㄅ-ㄩ]{6}$/
146146
if (this.type === 'classId') {
147147
if (!this.value || !classIdPattern.test(this.value)) return '#C01B61'
148148
}
@@ -162,7 +162,7 @@ export default Vue.extend({
162162
return '#BDBDBD'
163163
},
164164
textFieldColor(): string {
165-
const classIdPattern = /^[あ-]{6}$/
165+
const classIdPattern = /^[あ-んa-zㄅ-ㄩ]{6}$/
166166
if (this.type === 'classId') {
167167
if (!this.value || !classIdPattern.test(this.value)) return '#C01B61'
168168
}
@@ -179,7 +179,7 @@ export default Vue.extend({
179179
return '#0071C2'
180180
},
181181
prependIcon(): string {
182-
const classIdPattern = /^[あ-]{6}$/
182+
const classIdPattern = /^[あ-んa-zㄅ-ㄩ]{6}$/
183183
if (this.type === 'classId') {
184184
if (!this.value || !classIdPattern.test(this.value))
185185
return 'mdi-alert-circle'

src/components/EditLessonScreen.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import EditLessonScreenInner2 from '@/components/EditLessonScreenInner2.vue'
5959
import EditLessonScreenInner3 from '@/components/EditLessonScreenInner3.vue'
6060
import EditLessonScreenInner4 from '@/components/EditLessonScreenInner4.vue'
6161
import classData from '@/types/store/classData'
62+
import { removeEmpty } from '@/utils/remove'
6263
6364
type LessonDataType = {
6465
lessonId: string
@@ -234,7 +235,7 @@ export default Vue.extend({
234235
try {
235236
const lessonData: classData.Lesson = await this.buildLessonData()
236237
await vxm.classData.changeLesson({
237-
editData: lessonData,
238+
editData: removeEmpty(lessonData),
238239
id: this.lessonData.lessonId,
239240
})
240241
await this.$emit('collapse')

src/components/EditLessonScreenInner3.vue

Lines changed: 91 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,18 @@
99
<div class="VideoSearch">
1010
<editor-input-field-pickable
1111
v-model="videoSearchWord"
12-
:title="
13-
$t('components.editing_screen.labels.video_keyword', {
14-
source: 'NHK For School',
15-
})
16-
"
12+
selector="video"
13+
:title="$t('components.editing_screen.labels.video_keyword')"
1714
:placeholder="$t('components.editing_screen.placeholder.video_keyword')"
1815
icon-name="mdi-magnify"
1916
:button-text="$t('components.editing_screen.search_videos.search')"
2017
@clickButton="handleVideoSearchWord"
18+
@changeMovie="handleChangeMovie"
2119
/>
2220

2321
<div v-if="videoSearchResult.length > 0" class="SearchResult">
2422
<h3 class="SearchResultTitle">
25-
{{
26-
$t('components.editing_screen.search_videos.search_result', {
27-
source: 'NHK For School',
28-
})
29-
}}
23+
{{ $t('components.editing_screen.search_videos.search_result') }}
3024
</h3>
3125
<ul class="SearchResultList">
3226
<li v-for="(v, i) in displayLists" :key="i" class="SearchResultItem">
@@ -54,7 +48,13 @@
5448
v-if="v.videoUrl"
5549
class="SearchResultButton"
5650
color="#338dce"
57-
@click="registerVideoUrl(v.videoUrl)"
51+
@click="
52+
registerVideoUrl(
53+
v.videoUrl,
54+
v.videoTitle,
55+
v.videoThumbnailUrl
56+
)
57+
"
5858
>
5959
<v-icon color="white"> mdi-link </v-icon>
6060
{{
@@ -81,12 +81,16 @@
8181
<script lang="ts">
8282
import { Vue, Component, Prop, Emit, Watch } from 'vue-property-decorator'
8383
import EditorInputFieldPickable from '~/components/EditorInputFieldPickable.vue'
84+
import { MovieListItem, Movie } from '~/types/movies'
8485
85-
let movies: any[] = []
86+
let movies: Movie[] = []
8687
8788
export type formData = {
8889
videoUrl: string | null
8990
videoTitle: string
91+
videoSubTitle: string | null
92+
videoDescription: string | null
93+
videoPlayTime: string | null
9094
videoThumbnailUrl: string | null
9195
}
9296
@@ -99,6 +103,9 @@ export default class EditLessonScreenInner3 extends Vue {
99103
tempFormData = {
100104
videoUrl: this.form.videoUrl,
101105
videoTitle: this.form.videoTitle,
106+
videoSubTitle: this.form.videoSubTitle,
107+
videoDescription: this.form.videoDescription,
108+
videoPlayTime: this.form.videoPlayTime,
102109
videoThumbnailUrl:
103110
this.form.videoThumbnailUrl !== '' ? this.form.videoThumbnailUrl : null,
104111
}
@@ -109,24 +116,28 @@ export default class EditLessonScreenInner3 extends Vue {
109116
default: () => ({
110117
videoUrl: null,
111118
videoTitle: '',
119+
videoSubTitle: '',
120+
videoDescription: '',
121+
videoPlayTime: '',
112122
videoThumbnailUrl: '',
113123
}),
114124
})
115125
public value!: formData
116126
127+
videoSourceType: string = ''
117128
videoSearchWord: string = ''
118-
videoSearchResult: formData[] = []
129+
videoSearchResult: (formData | undefined)[] = []
119130
page: number = 1
120131
pageSize: number = 5
121132
length: number = 0
122-
displayLists: formData[] = []
133+
displayLists: (formData | undefined)[] = []
123134
124135
mounted() {
125-
fetch('/data/movies.json')
126-
.then((res) => res.json())
127-
.then((data) => {
128-
movies = data
129-
})
136+
// fetch('/data/movies.json')
137+
// .then((res) => res.json())
138+
// .then((data) => {
139+
// movies = data
140+
// })
130141
}
131142
132143
private get form(): formData {
@@ -147,6 +158,15 @@ export default class EditLessonScreenInner3 extends Vue {
147158
this.tempFormData = this.value
148159
}
149160
161+
private handleChangeMovie(selected: MovieListItem) {
162+
this.videoSourceType = selected.sourceType
163+
fetch(`/data/${selected.dataFile}`)
164+
.then((res) => res.json())
165+
.then((data) => {
166+
movies = data
167+
})
168+
}
169+
150170
private handleVideoSearchWord() {
151171
if (this.videoSearchWord) {
152172
this.page = 1
@@ -158,33 +178,16 @@ export default class EditLessonScreenInner3 extends Vue {
158178
return fullText.includes(this.videoSearchWord)
159179
})
160180
.map((v) => {
161-
const videoId = v['教材_ID']
162-
const videoType = parseInt(videoId.slice(5, 6))
163-
const nfsMovieUrl = 'https://www2.nhk.or.jp/school/movie/'
164-
const videoDirectory = videoId.slice(0, 8)
165-
let videoThumbnailUrl = `https://www.nhk.or.jp/das/image/${videoDirectory}/${videoId}_S_005.jpg`
166-
let videoUrl
167-
switch (videoType) {
168-
case 1:
169-
case 2:
170-
videoUrl = `${nfsMovieUrl}bangumi.cgi?das_id=${videoId}&p=box`
181+
let videoInfo
182+
switch (this.videoSourceType) {
183+
case 'NHK':
184+
videoInfo = this.mapNhk(v)
171185
break
172-
case 3:
173-
case 4:
174-
videoUrl = `${nfsMovieUrl}clip.cgi?das_id=${videoId}&p=box`
186+
case 'junyiacademy':
187+
videoInfo = this.mapJunyiacademy(v)
175188
break
176-
default:
177-
videoUrl = null
178-
videoThumbnailUrl = ''
179-
}
180-
return {
181-
videoUrl,
182-
videoTitle: v['教材_タイトル'],
183-
videoSubTitle: v['教材_サブタイトル'],
184-
videoDescription: v['教材_説明'],
185-
videoPlayTime: v['教材_再生時間'],
186-
videoThumbnailUrl,
187189
}
190+
return videoInfo
188191
})
189192
190193
this.length = Math.ceil(this.videoSearchResult.length / this.pageSize)
@@ -193,8 +196,10 @@ export default class EditLessonScreenInner3 extends Vue {
193196
}
194197
}
195198
196-
private registerVideoUrl(url: string) {
199+
private registerVideoUrl(url: string, title: string, thumbnailUrl: string) {
197200
this.tempFormData.videoUrl = url
201+
this.tempFormData.videoTitle = title
202+
this.tempFormData.videoThumbnailUrl = thumbnailUrl
198203
}
199204
200205
private pageChange(pageNumber: number) {
@@ -204,6 +209,48 @@ export default class EditLessonScreenInner3 extends Vue {
204209
)
205210
}
206211
212+
private mapNhk(v: Movie): formData {
213+
const videoId = v.inherentProperties.教材_ID
214+
const videoType = parseInt(videoId.slice(5, 6))
215+
const nfsMovieUrl = 'https://www2.nhk.or.jp/school/movie/'
216+
const videoDirectory = videoId.slice(0, 8)
217+
let videoThumbnailUrl = `https://www.nhk.or.jp/das/image/${videoDirectory}/${videoId}_S_005.jpg`
218+
let videoUrl
219+
switch (videoType) {
220+
case 1:
221+
case 2:
222+
videoUrl = `${nfsMovieUrl}bangumi.cgi?das_id=${videoId}&p=box`
223+
break
224+
case 3:
225+
case 4:
226+
videoUrl = `${nfsMovieUrl}clip.cgi?das_id=${videoId}&p=box`
227+
break
228+
default:
229+
videoUrl = null
230+
videoThumbnailUrl = ''
231+
}
232+
return {
233+
videoUrl,
234+
videoTitle: v.title,
235+
videoSubTitle: v.inherentProperties.教材_サブタイトル,
236+
videoDescription: v.description,
237+
videoPlayTime: v.inherentProperties.教材_再生時間,
238+
videoThumbnailUrl,
239+
}
240+
}
241+
242+
private mapJunyiacademy(v: Movie): formData {
243+
const videoId: string = v.inherentProperties.url.slice(-11)
244+
return {
245+
videoUrl: v.inherentProperties.url,
246+
videoTitle: v.title,
247+
videoSubTitle: '',
248+
videoDescription: v.description,
249+
videoPlayTime: '',
250+
videoThumbnailUrl: `https://img.youtube.com/vi/${videoId}/hqdefault.jpg`,
251+
}
252+
}
253+
207254
/* CORS 回避必須
208255
@Watch('form.videoUrl')
209256
onChangeVideoUrl() {

0 commit comments

Comments
 (0)