Merge branches 'PCqiandao' and 'dev_chen' of https://bdgit.educoder.net/Hjqreturn/educoder into PCqiandao
commit
d7f79405d7
@ -0,0 +1,6 @@
|
|||||||
|
json.category_id category.id
|
||||||
|
json.category_name category.name
|
||||||
|
json.position category.position
|
||||||
|
json.category_count category_task_count(@course, category, @user)
|
||||||
|
json.category_type category.category_type_str
|
||||||
|
json.second_category_url category_url(category, @course)
|
@ -0,0 +1,16 @@
|
|||||||
|
class AddAttendanceToCourseModule < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
Course.all.each do |course|
|
||||||
|
unless course.course_modules.exists?(module_type: "attendance")
|
||||||
|
atta_position = course.course_modules.find_by(module_type: 'course_group')&.position.to_i
|
||||||
|
attendance_position = atta_position != 0 ? (atta_position + 1) : 14
|
||||||
|
course.course_modules.where("position >= #{attendance_position}").update_all("position = position + 1")
|
||||||
|
if course.is_end
|
||||||
|
course.course_modules << CourseModule.new(module_type: "attendance", hidden: 1, module_name: "签到", position: attendance_position)
|
||||||
|
else
|
||||||
|
course.course_modules << CourseModule.new(module_type: "attendance", hidden: 0, module_name: "签到", position: attendance_position)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
class AddParentIdToSecondCategory < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :course_second_categories, :parent_id, :integer, default: 0
|
||||||
|
|
||||||
|
add_index :course_second_categories, :parent_id
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 9.8 KiB |
@ -1,37 +0,0 @@
|
|||||||
import React, { useEffect, useRef } from 'react'
|
|
||||||
|
|
||||||
export default ({ url }) => {
|
|
||||||
const ref = useRef()
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let player = null
|
|
||||||
if (window.flvjs.isSupported) {
|
|
||||||
player = window.flvjs.createPlayer({
|
|
||||||
type: 'flv',
|
|
||||||
volume: 0.8,
|
|
||||||
cors: true,
|
|
||||||
url,
|
|
||||||
muted: false
|
|
||||||
})
|
|
||||||
|
|
||||||
if (ref.current) {
|
|
||||||
player.attachMediaElement(ref.current)
|
|
||||||
player.load()
|
|
||||||
player.play()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return () => {
|
|
||||||
if (player) {
|
|
||||||
player.unload()
|
|
||||||
player.pause()
|
|
||||||
player.destroy()
|
|
||||||
player = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}, [url, ref.current])
|
|
||||||
|
|
||||||
return (
|
|
||||||
<video ref={ref} controls autoPlay={true} muted={false} className="flv-player"></video>
|
|
||||||
)
|
|
||||||
}
|
|
@ -0,0 +1,11 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
export async function logWatchHistory(params) {
|
||||||
|
try {
|
||||||
|
const response = await axios.post('/watch_video_histories.json', params)
|
||||||
|
return response.data.log_id
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
Loading…
Reference in new issue