Created
April 14, 2018 00:58
-
-
Save chengdh/28f13cd4067a1fcd2ec52685f66a7c29 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/vecosum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<script src="https://code.jquery.com/jquery-2.2.4.js"></script> | |
<script src="https://npmcdn.com/parse/dist/parse.js"></script> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var Parse = require('parse'); | |
function connect_parse() { | |
Parse.initialize("videoapp-2018"); | |
Parse.serverURL = "http://10.0.210.199:1337/parse"; | |
} | |
//课程 | |
function create_lesson() { | |
connect_parse(); | |
const Lesson = Parse.Object.extend("Lesson"); | |
let lesson = new Lesson(); | |
let val = { | |
title: "测试课程-标题", | |
subtitle: "测试课程-标题", | |
introduce: "测试课程-标题", | |
img: "", | |
use_scrip: true, | |
watch_permis: 1, | |
price: 188, | |
under_frame: false, | |
sorted: 1, | |
total_credit: 10, | |
reserve_person: 0, | |
buy_person: 0, | |
create_date: "2018-03-11", | |
live_interact: false, | |
play_num: 100, | |
total_time: 4000, | |
end_date: "2018-21-31", | |
comm_person: 100 | |
}; | |
lesson.set(val); | |
lesson.save(null, { | |
success: function(lesson) { | |
// Execute any logic that should take place after the object is saved. | |
console.alert("课程创建成功 objectId: " + lesson.id); | |
create_video(lesson); | |
}, | |
error: function(lesson, error) { | |
// Execute any logic that should take place if the save fails. | |
// error is a Parse.Error with an error code and message. | |
alert("课程创建失败, with error code: " + error.message); | |
} | |
}); | |
} | |
create_lesson(); | |
//视频 | |
function create_video(a_lesson) { | |
const Video = Parse.Object.extend("Video"); | |
video = new Video(); | |
let val = { | |
title: "点播视频1-主标题", | |
subtitle: "点播视频1-副标题", | |
introduce: "点播视频1-介绍", | |
price: 100, | |
src: "http://a.com/a.avi", | |
cover_src: "http://a.com/a.png", | |
sorted: 1 | |
}; | |
video.set(val); | |
video.save(null, { | |
success: function(video) { | |
// Execute any logic that should take place after the object is saved. | |
console.alert("视频创建 objectId: " + directory.id); | |
create_directory(a_lesson,video); | |
}, | |
error: function(video, error) { | |
// Execute any logic that should take place if the save fails. | |
// error is a Parse.Error with an error code and message. | |
alert("视频创建失败, with error code: " + error.message); | |
} | |
}); | |
} | |
//目录 | |
function create_directory(a_lesson,a_video) { | |
const Directory = Parse.Object.extend("Directory"); | |
directory = new Directory(); | |
let val = { | |
lesson: a_lesson, | |
title: "目录标题1", | |
teacher: "教师", | |
credit: 10, | |
video: a_video, | |
price: 10, | |
sequence: 1, | |
play_num: 11, | |
time_len: 2000, | |
watch_permis: 1, | |
start_date: "", | |
end_date: "", | |
interact: false | |
}; | |
directory.set(val); | |
directory.save(null, { | |
success: function(directory) { | |
// Execute any logic that should take place after the object is saved. | |
console.alert("目录创建 objectId: " + directory.id); | |
}, | |
error: function(directory, error) { | |
// Execute any logic that should take place if the save fails. | |
// error is a Parse.Error with an error code and message. | |
alert("目录创建失败, with error code: " + error.message); | |
} | |
}); | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var Parse = require('parse'); | |
function connect_parse() { | |
Parse.initialize("videoapp-2018"); | |
Parse.serverURL = "http://10.0.210.199:1337/parse"; | |
} | |
//课程 | |
function create_lesson() { | |
connect_parse(); | |
const Lesson = Parse.Object.extend("Lesson"); | |
let lesson = new Lesson(); | |
let val = { | |
title: "测试课程-标题", | |
subtitle: "测试课程-标题", | |
introduce: "测试课程-标题", | |
img: "", | |
use_scrip: true, | |
watch_permis: 1, | |
price: 188, | |
under_frame: false, | |
sorted: 1, | |
total_credit: 10, | |
reserve_person: 0, | |
buy_person: 0, | |
create_date: "2018-03-11", | |
live_interact: false, | |
play_num: 100, | |
total_time: 4000, | |
end_date: "2018-21-31", | |
comm_person: 100 | |
}; | |
lesson.set(val); | |
lesson.save(null, { | |
success: function(lesson) { | |
// Execute any logic that should take place after the object is saved. | |
console.alert("课程创建成功 objectId: " + lesson.id); | |
create_video(lesson); | |
}, | |
error: function(lesson, error) { | |
// Execute any logic that should take place if the save fails. | |
// error is a Parse.Error with an error code and message. | |
alert("课程创建失败, with error code: " + error.message); | |
} | |
}); | |
} | |
create_lesson(); | |
//视频 | |
function create_video(a_lesson) { | |
const Video = Parse.Object.extend("Video"); | |
video = new Video(); | |
let val = { | |
title: "点播视频1-主标题", | |
subtitle: "点播视频1-副标题", | |
introduce: "点播视频1-介绍", | |
price: 100, | |
src: "http://a.com/a.avi", | |
cover_src: "http://a.com/a.png", | |
sorted: 1 | |
}; | |
video.set(val); | |
video.save(null, { | |
success: function(video) { | |
// Execute any logic that should take place after the object is saved. | |
console.alert("视频创建 objectId: " + directory.id); | |
create_directory(a_lesson,video); | |
}, | |
error: function(video, error) { | |
// Execute any logic that should take place if the save fails. | |
// error is a Parse.Error with an error code and message. | |
alert("视频创建失败, with error code: " + error.message); | |
} | |
}); | |
} | |
//目录 | |
function create_directory(a_lesson,a_video) { | |
const Directory = Parse.Object.extend("Directory"); | |
directory = new Directory(); | |
let val = { | |
lesson: a_lesson, | |
title: "目录标题1", | |
teacher: "教师", | |
credit: 10, | |
video: a_video, | |
price: 10, | |
sequence: 1, | |
play_num: 11, | |
time_len: 2000, | |
watch_permis: 1, | |
start_date: "", | |
end_date: "", | |
interact: false | |
}; | |
directory.set(val); | |
directory.save(null, { | |
success: function(directory) { | |
// Execute any logic that should take place after the object is saved. | |
console.alert("目录创建 objectId: " + directory.id); | |
}, | |
error: function(directory, error) { | |
// Execute any logic that should take place if the save fails. | |
// error is a Parse.Error with an error code and message. | |
alert("目录创建失败, with error code: " + error.message); | |
} | |
}); | |
}</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Parse = require('parse'); | |
function connect_parse() { | |
Parse.initialize("videoapp-2018"); | |
Parse.serverURL = "http://10.0.210.199:1337/parse"; | |
} | |
//课程 | |
function create_lesson() { | |
connect_parse(); | |
const Lesson = Parse.Object.extend("Lesson"); | |
let lesson = new Lesson(); | |
let val = { | |
title: "测试课程-标题", | |
subtitle: "测试课程-标题", | |
introduce: "测试课程-标题", | |
img: "", | |
use_scrip: true, | |
watch_permis: 1, | |
price: 188, | |
under_frame: false, | |
sorted: 1, | |
total_credit: 10, | |
reserve_person: 0, | |
buy_person: 0, | |
create_date: "2018-03-11", | |
live_interact: false, | |
play_num: 100, | |
total_time: 4000, | |
end_date: "2018-21-31", | |
comm_person: 100 | |
}; | |
lesson.set(val); | |
lesson.save(null, { | |
success: function(lesson) { | |
// Execute any logic that should take place after the object is saved. | |
console.alert("课程创建成功 objectId: " + lesson.id); | |
create_video(lesson); | |
}, | |
error: function(lesson, error) { | |
// Execute any logic that should take place if the save fails. | |
// error is a Parse.Error with an error code and message. | |
alert("课程创建失败, with error code: " + error.message); | |
} | |
}); | |
} | |
create_lesson(); | |
//视频 | |
function create_video(a_lesson) { | |
const Video = Parse.Object.extend("Video"); | |
video = new Video(); | |
let val = { | |
title: "点播视频1-主标题", | |
subtitle: "点播视频1-副标题", | |
introduce: "点播视频1-介绍", | |
price: 100, | |
src: "http://a.com/a.avi", | |
cover_src: "http://a.com/a.png", | |
sorted: 1 | |
}; | |
video.set(val); | |
video.save(null, { | |
success: function(video) { | |
// Execute any logic that should take place after the object is saved. | |
console.alert("视频创建 objectId: " + directory.id); | |
create_directory(a_lesson,video); | |
}, | |
error: function(video, error) { | |
// Execute any logic that should take place if the save fails. | |
// error is a Parse.Error with an error code and message. | |
alert("视频创建失败, with error code: " + error.message); | |
} | |
}); | |
} | |
//目录 | |
function create_directory(a_lesson,a_video) { | |
const Directory = Parse.Object.extend("Directory"); | |
directory = new Directory(); | |
let val = { | |
lesson: a_lesson, | |
title: "目录标题1", | |
teacher: "教师", | |
credit: 10, | |
video: a_video, | |
price: 10, | |
sequence: 1, | |
play_num: 11, | |
time_len: 2000, | |
watch_permis: 1, | |
start_date: "", | |
end_date: "", | |
interact: false | |
}; | |
directory.set(val); | |
directory.save(null, { | |
success: function(directory) { | |
// Execute any logic that should take place after the object is saved. | |
console.alert("目录创建 objectId: " + directory.id); | |
}, | |
error: function(directory, error) { | |
// Execute any logic that should take place if the save fails. | |
// error is a Parse.Error with an error code and message. | |
alert("目录创建失败, with error code: " + error.message); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment