提交 949f420c authored 作者: lihuihui's avatar lihuihui

Merge branch 'master' into survey

# Conflicts: # learnOnline/utils/util.js
...@@ -3,3 +3,4 @@ ...@@ -3,3 +3,4 @@
config.js config.js
node_modules node_modules
npm-debug.log npm-debug.log
.idea/
...@@ -7,7 +7,7 @@ const util = require('../utils/util.js') ...@@ -7,7 +7,7 @@ const util = require('../utils/util.js')
// 测试 用 cur_course_id:6438232736871219200 cur_video_id:6290435412296990720 // 测试 用 cur_course_id:6438232736871219200 cur_video_id:6290435412296990720
const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) => { const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/courses/' + cur_semester_id + '/' + cur_course_id, url: util.config.URL_PATH1 + '/v2/education/courses/' + cur_semester_id + '/' + cur_course_id,
callback: function (res) { callback: function (res) {
let i = 0, j = 0, nextVideo = {}, prevVideo = {}; let i = 0, j = 0, nextVideo = {}, prevVideo = {};
/* 计算上一章 和 下一章 */ /* 计算上一章 和 下一章 */
...@@ -20,13 +20,15 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -20,13 +20,15 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
prevVideo = { prevVideo = {
id: _.children[j-1].resource_id, id: _.children[j-1].resource_id,
time: _.children[j-1].video && util.durationToTimeString(_.children[j-1].video.video_length) || '', time: _.children[j-1].video && util.durationToTimeString(_.children[j-1].video.video_length) || '',
videoType: _.children[j-1].video && _.children[j-1].video.video_provider || '',
name: _.children[j-1].name name: _.children[j-1].name
} }
} else if (i-1>=0) { } else if (i-1>=0) {
let _temp = res.data.chapters[i - 1] let _temp = res.data.chapters[i - 1];
prevVideo = { prevVideo = {
id: _temp.children[_temp.children.length-1].resource_id, id: _temp.children[_temp.children.length-1].resource_id,
time: _temp.children[_temp.children.length-1].video && util.durationToTimeString(_temp.children[_temp.children.length-1].video.video_length) || '', time: _temp.children[_temp.children.length-1].video && util.durationToTimeString(_temp.children[_temp.children.length-1].video.video_length) || '',
videoType: _temp.children[_temp.children.length-1].video && _temp.children[_temp.children.length-1].video.video_provider || '',
name: _temp.children[_temp.children.length-1].name name: _temp.children[_temp.children.length-1].name
} }
} }
...@@ -34,6 +36,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -34,6 +36,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
nextVideo = { nextVideo = {
id: _.children[j + 1].resource_id, id: _.children[j + 1].resource_id,
time: _.children[j + 1].video && util.durationToTimeString(_.children[j + 1].video.video_length) || '', time: _.children[j + 1].video && util.durationToTimeString(_.children[j + 1].video.video_length) || '',
videoType: _.children[j + 1].video && _.children[j + 1].video.video_provider || '',
name: _.children[j + 1].name name: _.children[j + 1].name
} }
} else if (i + 1 < res.data.chapters.length) { } else if (i + 1 < res.data.chapters.length) {
...@@ -41,6 +44,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -41,6 +44,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
nextVideo = { nextVideo = {
id: _temp.children[0].resource_id, id: _temp.children[0].resource_id,
time: _temp.children[0].video && util.durationToTimeString(_temp.children[0].video.video_length) || '', time: _temp.children[0].video && util.durationToTimeString(_temp.children[0].video.video_length) || '',
videoType: _temp.children[0].video && _temp.children[0].video.video_provider || '',
name: _temp.children[0].name name: _temp.children[0].name
} }
} }
...@@ -64,6 +68,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -64,6 +68,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
return { return {
id: __.resource_id, id: __.resource_id,
time: __.video && util.durationToTimeString(__.video.video_length) || '', time: __.video && util.durationToTimeString(__.video.video_length) || '',
videoType:__.video && __.video.video_provider,
name: __.name, name: __.name,
homework: _homework homework: _homework
} }
...@@ -72,15 +77,23 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -72,15 +77,23 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
}), }),
nextVideo: nextVideo, nextVideo: nextVideo,
prevVideo: prevVideo prevVideo: prevVideo
} };
callback(json) callback(json)
} }
}) })
} }
/* 获取对应某个章节的详细信息 */ /* 获取对应某个章节的详细信息 */
const getCurrentChapterDetail = (vid, callback) => { const getCurrentChapterDetail = (vid, videoType,callback) => {
// CC视频请求数据接口
let _url = null;
if(videoType == 3){
_url = util.config.URL_PATH1 + '/v2/education/aliyun-video-streaming'
}else{
_url = util.config.URL_PATH1 + '/v2/education/video-streaming'
}
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/video-streaming', url: _url,
method: 'POST', method: 'POST',
data: { data: {
vid: vid vid: vid
...@@ -88,11 +101,11 @@ const getCurrentChapterDetail = (vid, callback) => { ...@@ -88,11 +101,11 @@ const getCurrentChapterDetail = (vid, callback) => {
callback: function (res) { callback: function (res) {
let json = { let json = {
video: { video: {
src: res.data.video[0].playurl, src: videoType == 3 ? res.data.video &&res.data.video.LD : res.data.video[0] && res.data.video[0].playurl,
spareSrc: 'http://pd4t7ae3m.bkt.clouddn.com/test.mp4' // 正式环境时,需要将 contentVideo 中 spareSrc 改成 src spareSrc: '' // 正式环境时,需要将 contentVideo 中 spareSrc 改成 src
}, },
audio: { audio: {
src: res.data.audio[0].url, src: videoType == 3 ? res.data.video &&res.data.video.SQ : res.data.audio[0].url,
poster: res.data.ppts && res.data.ppts[0] && res.data.ppts[0].ppt_url || '' poster: res.data.ppts && res.data.ppts[0] && res.data.ppts[0].ppt_url || ''
}, },
image: { image: {
...@@ -110,7 +123,7 @@ const getCurrentChapterDetail = (vid, callback) => { ...@@ -110,7 +123,7 @@ const getCurrentChapterDetail = (vid, callback) => {
// 测试 用 device_id : jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8 // 测试 用 device_id : jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8
const getProgress = (vid, did, sid, callback) => { const getProgress = (vid, did, sid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/video/' + sid + '/' + vid + '/device', url: util.config.URL_PATH1 + '/v2/education/video/' + sid + '/' + vid + '/device',
data: { data: {
device_id: did device_id: did
}, },
...@@ -121,9 +134,13 @@ const getProgress = (vid, did, sid, callback) => { ...@@ -121,9 +134,13 @@ const getProgress = (vid, did, sid, callback) => {
} }
/* 提交进度信息 */ /* 提交进度信息 */
const updateProgress = (obj) => { const updateProgress = (obj) => {
let uid = wx.getStorageSync('uid');
let sid = wx.getStorageSync('sid');
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/analytics/upload-video', url: util.config.URL_PATH1 + '/v2/analytics/upload-video',
data: { data: {
uid: uid || '',
sid: sid || '',
d: obj.did, d: obj.did,
i: obj.did, i: obj.did,
c: obj.cid, c: obj.cid,
......
...@@ -6,7 +6,7 @@ const util = require('../utils/util.js') ...@@ -6,7 +6,7 @@ const util = require('../utils/util.js')
/* 获取学期分类信息 */ /* 获取学期分类信息 */
const getlearnFindList = (callback) => { const getlearnFindList = (callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/semesters', url: util.config.URL_PATH1 + '/v2/education/semesters',
callback: function (res) { callback: function (res) {
let json = [{ val: '-1', name: '全部' }] let json = [{ val: '-1', name: '全部' }]
for (let i = 0; i < res.data.length; i++) { for (let i = 0; i < res.data.length; i++) {
...@@ -23,14 +23,14 @@ const getlearnFindList = (callback) => { ...@@ -23,14 +23,14 @@ const getlearnFindList = (callback) => {
/* 获取所有课程列表 - 选课广场 和 我的课程 共用同一个,通过 isMy判断 */ /* 获取所有课程列表 - 选课广场 和 我的课程 共用同一个,通过 isMy判断 */
const getCourseList = (isMy, param, callback) => { const getCourseList = (isMy, param, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/courses' + (isMy ? '/my' : '' ), url: util.config.URL_PATH1 + '/v2/education/courses' + (isMy ? '/my' : '' ),
data: param, // json格式 data: param, // json格式
callback: function (res) { callback: function (res) {
let json = []; let json = [];
for(let i = 0; i < res.data.length; i++) { for(let i = 0; i < res.data.length; i++) {
let cur = res.data[i], _cur = res.data[i].curriculum let cur = res.data[i], _cur = res.data[i].curriculum
/* 课程类型 */ /* 课程类型 curriculum_elective_type 类型 改为 course_type 吴锚要求 */
let _type = _cur.curriculum_elective_type, str1 = _type == 1 ? '必修课' : (_type == 2 ? '选修课' : (_type == 3 ? '重修课' : '')) let _type = cur.course_type, str1 = _type == 1 ? '必修课' : (_type == 2 ? '选修课' : (_type == 3 ? '重修课' : ''))
json.push({ json.push({
id: cur.course_id, id: cur.course_id,
...@@ -41,7 +41,7 @@ const getCourseList = (isMy, param, callback) => { ...@@ -41,7 +41,7 @@ const getCourseList = (isMy, param, callback) => {
status: _cur.is_enabled ? '已发布' : '未发布', status: _cur.is_enabled ? '已发布' : '未发布',
time: cur.begin_date.split(' ')[0] + ' 至 ' + cur.end_date.split(' ')[0], time: cur.begin_date.split(' ')[0] + ' 至 ' + cur.end_date.split(' ')[0],
myStatus: cur.selected != 0 ? (cur.score ? ('总成绩:' + cur.score) : '已选修') : '未选修', myStatus: cur.selected != 0 ? (cur.score ? ('总成绩:' + cur.score) : '已选修') : '未选修',
progress: cur.course_progress + '%' progress: cur.video_progress + '%'
}) })
} }
callback(json) callback(json)
...@@ -51,11 +51,11 @@ const getCourseList = (isMy, param, callback) => { ...@@ -51,11 +51,11 @@ const getCourseList = (isMy, param, callback) => {
/* 获取某个课程详细信息 - 课程考核 和 课程讨论单独获取 */ /* 获取某个课程详细信息 - 课程考核 和 课程讨论单独获取 */
const getCourseDetail = (id, sid, callback) => { const getCourseDetail = (id, sid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/courses/' + sid + '/' + id, url: util.config.URL_PATH1 + '/v2/education/courses/' + sid + '/' + id,
callback: function (res) { callback: function (res) {
let cur = res.data, _cur = cur.curriculum let cur = res.data, _cur = cur.curriculum
/* 课程类型 */ /* 课程类型 curriculum_elective_type 类型 改为 course_type 吴锚要求 */
let _type = _cur.curriculum_elective_type, str1 = _type == 1 ? '必修课' : (_type == 2 ? '选修课' : (_type == 3 ? '重修课' : '')) let _type = cur.course_type, str1 = _type == 1 ? '必修课' : (_type == 2 ? '选修课' : (_type == 3 ? '重修课' : ''))
let json = { let json = {
headerInfo: { headerInfo: {
isStart: !!cur.selected, // 是否为开始学习按钮 或者 选课按钮 isStart: !!cur.selected, // 是否为开始学习按钮 或者 选课按钮
...@@ -66,7 +66,7 @@ const getCourseDetail = (id, sid, callback) => { ...@@ -66,7 +66,7 @@ const getCourseDetail = (id, sid, callback) => {
arrTab: [((_cur && _cur.curriculum_credit || 0) + '学分'), str1, cur.semester_name], arrTab: [((_cur && _cur.curriculum_credit || 0) + '学分'), str1, cur.semester_name],
status: _cur.is_enabled ? '已发布' : '未发布', status: _cur.is_enabled ? '已发布' : '未发布',
time: cur.begin_date.split(' ')[0] + ' 至 ' + cur.end_date.split(' ')[0], time: cur.begin_date.split(' ')[0] + ' 至 ' + cur.end_date.split(' ')[0],
progress: cur.course_progress + '%' progress: cur.video_progress + '%'
}, },
tabs0Content: {}, tabs0Content: {},
tabs1ChapterList: {} tabs1ChapterList: {}
...@@ -89,6 +89,7 @@ const getCourseDetail = (id, sid, callback) => { ...@@ -89,6 +89,7 @@ const getCourseDetail = (id, sid, callback) => {
/* 课程内容 */ /* 课程内容 */
json.tabs1ChapterList = { json.tabs1ChapterList = {
currentChapterId: cur.latest_play || '', currentChapterId: cur.latest_play || '',
videoType: cur.latest_play_type || '',
course: cur.chapters.map(function (_, i) { course: cur.chapters.map(function (_, i) {
return { return {
title: _.name, title: _.name,
...@@ -106,6 +107,7 @@ const getCourseDetail = (id, sid, callback) => { ...@@ -106,6 +107,7 @@ const getCourseDetail = (id, sid, callback) => {
sid: cur.semester_id, sid: cur.semester_id,
vid: __.resource_id, vid: __.resource_id,
time: __.video && util.durationToTimeString(__.video.video_length) || '', time: __.video && util.durationToTimeString(__.video.video_length) || '',
videoType:__.video && __.video.video_provider,
name: __.name, name: __.name,
homework: _homework homework: _homework
} }
...@@ -132,7 +134,7 @@ const getCourseDetail = (id, sid, callback) => { ...@@ -132,7 +134,7 @@ const getCourseDetail = (id, sid, callback) => {
/* 获取课程考核信息 */ /* 获取课程考核信息 */
const getCourseAssess = (cid, sid, callback) => { const getCourseAssess = (cid, sid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/analytics/courses/' + sid + '/' + cid + '/evaluation', url: util.config.URL_PATH1 + '/v2/analytics/courses/' + sid + '/' + cid + '/evaluation',
callback: function (res) { callback: function (res) {
let cur = res.data let cur = res.data
let video = []; let video = [];
...@@ -160,6 +162,7 @@ const getCourseAssess = (cid, sid, callback) => { ...@@ -160,6 +162,7 @@ const getCourseAssess = (cid, sid, callback) => {
let __ = _.sections[j] let __ = _.sections[j]
tempArr.push({ tempArr.push({
name: __.title, name: __.title,
created_time: __.created_time || '暂未提交',
score: __.score || '0' score: __.score || '0'
}) })
} }
...@@ -175,6 +178,7 @@ const getCourseAssess = (cid, sid, callback) => { ...@@ -175,6 +178,7 @@ const getCourseAssess = (cid, sid, callback) => {
video: video, video: video,
homewrok: homewrok, homewrok: homewrok,
essay: { essay: {
created_time: cur.essay_evaluation.created_time || '',
status: cur.essay_evaluation.status || '暂无', status: cur.essay_evaluation.status || '暂无',
score: cur.essay_evaluation.score || '暂无' score: cur.essay_evaluation.score || '暂无'
} }
...@@ -184,9 +188,9 @@ const getCourseAssess = (cid, sid, callback) => { ...@@ -184,9 +188,9 @@ const getCourseAssess = (cid, sid, callback) => {
}) })
} }
/* 获取试题信息 */ /* 获取试题信息 */
const getExamDetail = (eid, sid, callback) => { const getExamDetail = (eid, sid, courseid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/homeworks/' + sid + '/' + eid, url: util.config.URL_PATH1 + '/v2/education/homeworks/' + sid + '/' + courseid + '/' + eid,
callback: function (res) { callback: function (res) {
callback(res) callback(res)
} }
...@@ -195,7 +199,7 @@ const getExamDetail = (eid, sid, callback) => { ...@@ -195,7 +199,7 @@ const getExamDetail = (eid, sid, callback) => {
/* 提交考试信息 */ /* 提交考试信息 */
const submitExamDetail = (param, callback) => { const submitExamDetail = (param, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/homeworks', url: util.config.URL_PATH1 + '/v2/education/homeworks',
method: 'POST', method: 'POST',
data: param, data: param,
callback: function (res) { callback: function (res) {
...@@ -206,7 +210,7 @@ const submitExamDetail = (param, callback) => { ...@@ -206,7 +210,7 @@ const submitExamDetail = (param, callback) => {
/* 选课 */ /* 选课 */
const selectCourse = (cid, sid, callback) => { const selectCourse = (cid, sid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/courses/major', url: util.config.URL_PATH1 + '/v2/education/courses/major',
data: { course_id: cid, semester_id: sid }, data: { course_id: cid, semester_id: sid },
method: 'POST', method: 'POST',
callback: function (res) { callback: function (res) {
...@@ -217,7 +221,7 @@ const selectCourse = (cid, sid, callback) => { ...@@ -217,7 +221,7 @@ const selectCourse = (cid, sid, callback) => {
/* 退课 */ /* 退课 */
const outSelectCourse = (cid, sid, callback) => { const outSelectCourse = (cid, sid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/courses/drop', url: util.config.URL_PATH1 + '/v2/education/courses/drop',
data: { course_id: cid, semester_id: sid }, data: { course_id: cid, semester_id: sid },
method: 'POST', method: 'POST',
callback: function (res) { callback: function (res) {
......
...@@ -10,7 +10,7 @@ const util = require('../utils/util.js') ...@@ -10,7 +10,7 @@ const util = require('../utils/util.js')
*/ */
const getDiscussList = (path, dataJson, callback) => { const getDiscussList = (path, dataJson, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/questions' + path, url: util.config.URL_PATH1 + '/v2/qa/questions' + path,
data: dataJson, data: dataJson,
callback: function (res) { callback: function (res) {
let _data = res.data let _data = res.data
...@@ -44,7 +44,7 @@ const getDiscussList = (path, dataJson, callback) => { ...@@ -44,7 +44,7 @@ const getDiscussList = (path, dataJson, callback) => {
*/ */
const getCourseDiscussList = (cid, sid, dataJson, callback) => { const getCourseDiscussList = (cid, sid, dataJson, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/questions/course/' + sid + '/' + cid, url: util.config.URL_PATH1 + '/v2/qa/questions/course/' + sid + '/' + cid,
data: dataJson, data: dataJson,
callback: function (res) { callback: function (res) {
let _data = res.data let _data = res.data
...@@ -73,7 +73,7 @@ const getCourseDiscussList = (cid, sid, dataJson, callback) => { ...@@ -73,7 +73,7 @@ const getCourseDiscussList = (cid, sid, dataJson, callback) => {
/* 获取问题详情 */ /* 获取问题详情 */
const getDiscussDetail = (qid, callback) => { const getDiscussDetail = (qid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/questions/' + qid, url: util.config.URL_PATH1 + '/v2/qa/questions/' + qid,
callback: function (res) { callback: function (res) {
let _data = res.data let _data = res.data
let json = { let json = {
...@@ -145,7 +145,7 @@ const getDiscussDetail = (qid, callback) => { ...@@ -145,7 +145,7 @@ const getDiscussDetail = (qid, callback) => {
/* 删除提问 */ /* 删除提问 */
const deleteDiscuss = (qid, callback) => { const deleteDiscuss = (qid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/questions/' + qid, url: util.config.URL_PATH1 + '/v2/qa/questions/' + qid,
method: 'DELETE', method: 'DELETE',
callback: function (res) { callback: function (res) {
let _data = res.data let _data = res.data
...@@ -158,7 +158,7 @@ const deleteDiscuss = (qid, callback) => { ...@@ -158,7 +158,7 @@ const deleteDiscuss = (qid, callback) => {
/* 提出问题 */ /* 提出问题 */
const publishQues = (param, callback) => { const publishQues = (param, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/questions', url: util.config.URL_PATH1 + '/v2/qa/questions',
method: 'POST', method: 'POST',
data: param, data: param,
callback: function (res) { callback: function (res) {
...@@ -170,7 +170,7 @@ const publishQues = (param, callback) => { ...@@ -170,7 +170,7 @@ const publishQues = (param, callback) => {
/* 回答问题 */ /* 回答问题 */
const answerQues = (param, callback) => { const answerQues = (param, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/answers', url: util.config.URL_PATH1 + '/v2/qa/answers',
method: 'POST', method: 'POST',
data: param, data: param,
callback: function (res) { callback: function (res) {
...@@ -184,7 +184,7 @@ const answerQues = (param, callback) => { ...@@ -184,7 +184,7 @@ const answerQues = (param, callback) => {
/* 删除回答 */ /* 删除回答 */
const deleteAnswer = (aid, callback) => { const deleteAnswer = (aid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/answers/' + aid, url: util.config.URL_PATH1 + '/v2/qa/answers/' + aid,
method: 'DELETE', method: 'DELETE',
callback: function (res) { callback: function (res) {
let _data = res.data let _data = res.data
...@@ -197,7 +197,7 @@ const deleteAnswer = (aid, callback) => { ...@@ -197,7 +197,7 @@ const deleteAnswer = (aid, callback) => {
/* 回复评论 */ /* 回复评论 */
const callbackComment = (param, callback) => { const callbackComment = (param, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/comments', url: util.config.URL_PATH1 + '/v2/qa/comments',
method: 'POST', method: 'POST',
data: param, data: param,
callback: function (res) { callback: function (res) {
...@@ -211,7 +211,7 @@ const callbackComment = (param, callback) => { ...@@ -211,7 +211,7 @@ const callbackComment = (param, callback) => {
/* 删除评论 */ /* 删除评论 */
const deleteComment = (cid, callback) => { const deleteComment = (cid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/comments/' + cid, url: util.config.URL_PATH1 + '/v2/qa/comments/' + cid,
method: 'DELETE', method: 'DELETE',
callback: function (res) { callback: function (res) {
let _data = res.data let _data = res.data
...@@ -224,7 +224,7 @@ const deleteComment = (cid, callback) => { ...@@ -224,7 +224,7 @@ const deleteComment = (cid, callback) => {
/* 点赞 */ /* 点赞 */
const like = (param, callback) => { const like = (param, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/tags', url: util.config.URL_PATH1 + '/v2/qa/tags',
method: 'POST', method: 'POST',
data: param, data: param,
callback: function (res) { callback: function (res) {
...@@ -238,7 +238,7 @@ const like = (param, callback) => { ...@@ -238,7 +238,7 @@ const like = (param, callback) => {
/* 取消点赞 */ /* 取消点赞 */
const unlike = (tagid, callback) => { const unlike = (tagid, callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/qa/tags/' + tagid, url: util.config.URL_PATH1 + '/v2/qa/tags/' + tagid,
method: 'DELETE', method: 'DELETE',
callback: function (res) { callback: function (res) {
let _data = res.data let _data = res.data
......
...@@ -6,13 +6,13 @@ const util = require('../utils/util.js') ...@@ -6,13 +6,13 @@ const util = require('../utils/util.js')
/* 获取我的消息信息 */ /* 获取我的消息信息 */
const getMyMsg = (callback) => { const getMyMsg = (callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/message/my', url: util.config.URL_PATH1 + '/v2/education/message/my',
callback: function (res) { callback: function (res) {
let json = res.data.map(function (_, i) { let json = res.data.map(function (_, i) {
return { return {
isRead: false, isRead: false,
id: _.id, id: _.id,
text: _.message, text: _.message_body,
time: _.created_time, time: _.created_time,
isShow: false // 该字段用来做 每条信息的打开、关闭 isShow: false // 该字段用来做 每条信息的打开、关闭
} }
......
...@@ -6,7 +6,7 @@ const util = require('../utils/util.js') ...@@ -6,7 +6,7 @@ const util = require('../utils/util.js')
/* 获取我的学分信息 */ /* 获取我的学分信息 */
const getMyScore = (callback) => { const getMyScore = (callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH + '/v2/education/credits', url: util.config.URL_PATH1 + '/v2/education/credits',
callback: function (res) { callback: function (res) {
let _data = res.data let _data = res.data
let json = { let json = {
...@@ -18,7 +18,8 @@ const getMyScore = (callback) => { ...@@ -18,7 +18,8 @@ const getMyScore = (callback) => {
myMustStr: _data.required_credits && ((_data.my_required_credits * 1.0 / _data.required_credits * 100).toFixed(1) + '%') || '0%', myMustStr: _data.required_credits && ((_data.my_required_credits * 1.0 / _data.required_credits * 100).toFixed(1) + '%') || '0%',
unmust: _data.optional_credits, unmust: _data.optional_credits,
myUnmust: _data.my_optional_credits, myUnmust: _data.my_optional_credits,
myUnmustStr: _data.optional_credits && ((_data.my_optional_credits * 1.0 / _data.optional_credits * 100).toFixed(1) + '%') || '0%' myUnmustStr: _data.optional_credits && ((_data.my_optional_credits * 1.0 / _data.optional_credits * 100).toFixed(1) + '%') || '0%',
lists: _data.lists
} }
callback(json) callback(json)
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
"navigationBarTitleText": "紫荆金融课堂" "navigationBarTitleText": "紫荆金融课堂"
}, },
"tabBar": { "tabBar": {
"borderStyle": "#dcdcdc", "borderStyle": "white",
"color": "#313131", "color": "#313131",
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"selectedColor": "#b49441", "selectedColor": "#b49441",
...@@ -48,5 +48,6 @@ ...@@ -48,5 +48,6 @@
"selectedIconPath": "/pages/learnSystem/icons/my-on.png" "selectedIconPath": "/pages/learnSystem/icons/my-on.png"
} }
] ]
} },
"sitemapLocation": "sitemap.json"
} }
\ No newline at end of file
#### 3.0.8.2019.07.25
1、增加阿里视频源
#### 3.0.8.2019.07.22
1、修复安卓手机数据上报问题
#### 3.0.7.2019.07.17
1、用户手机号没有绑定微信,后端返回401,弹出提示框
#### 3.0.6.2019.07.16
1、upload-video 接口在 data 中增加vid传递
#### 3.0.6.2019.07.15
1、show页面,没有vid 自动返回上一页
*******
#### 3.0.5.2019.07.15
1、upload-video 接口在 data 中增加uid传递
*******
#### 3.0.5.2019.07.12
1、传输接口的时候,增加程序的版本号
*******
\ No newline at end of file
const util = require('../../../utils/util.js') const util = require('../../../utils/util.js')
const md5 = require('../../../utils/md5.js')
/* 手机 验证码 相关内容 */ /* 手机 验证码 相关内容 */
const BindAccount = { const BindAccount = {
...@@ -12,23 +13,56 @@ const BindAccount = { ...@@ -12,23 +13,56 @@ const BindAccount = {
/* 点击确定 */ /* 点击确定 */
accountConfirm: function (e) { accountConfirm: function (e) {
const _that = this, _bind = _that.data.bindaccount const _that = this, _bind = _that.data.bindaccount;
/* 调用接口 - 使用账号登录 */ /* 调用接口 - 使用账号登录 */
wx.request({ wx.request({
url: util.config.URL_PATH + '/user/account-login', url: util.config.URL_PATH2 + '/user_center/login',
data: { username: _bind.account, password: _bind.pwd }, method: 'POST', header: { skey: wx.getStorageSync('userSession').sessionKey, tenant: util.config.tenant }, data: {
login_name: _bind.account,
password: md5('uokoaduw' + _bind.pwd.split('').reverse().join('') + 'auhgniq'),
service: 'applet.ezijing.com' }, method: 'POST', header: {
'tenant': util.config.tenant,
'content-type': 'application/x-www-form-urlencoded',
'version':util.config.version,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N'
},
success: function (res) { success: function (res) {
if (res.statusCode && res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return; } if (res.statusCode && res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return; }
wx.hideToast() wx.hideToast();
wx.setStorageSync('userSession', { sessionKey: res.data.ticket });
let _token = wx.getStorageSync('userSession').sessionKey
if (!_token) {
wx.reLaunch({ url: '/pages/index/index' })
return ;
}
/* 获取用户信息 */ /* 获取用户信息 */
wx.request({ wx.request({
url: util.config.URL_PATH + '/user/getinfo', url: util.config.URL_PATH1 + '/user/check-access',
data: {}, method: 'GET', header: { data: {}, method: 'GET', header: {
skey: wx.getStorageSync('userSession').sessionKey, token: _token,
tenant: util.config.tenant tenant: util.config.tenant,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N',
'version':util.config.version,
unionid: wx.getStorageSync('union_id')
}, },
success: res => { success: res => {
if (res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return; } if (res.statusCode != 200 && res.statusCode != 401) { wx.showToast({ title: res.data.message, icon: 'none' }); return; }
if (res.statusCode && res.statusCode == 401) {
// 401特殊处理,这种情况,理解为手机号绑定错误
wx.hideToast();
wx.showModal({
title: '提示',
content: res.data.message,
showCancel:false,
complete (res) {
_that.setData({
'bindaccount.pwd': '',
});
}
})
return ;
}
let _userInfo = { let _userInfo = {
avatarUrl: res.data.avatar || _that.tempUserInfo.avatarUrl || '无', avatarUrl: res.data.avatar || _that.tempUserInfo.avatarUrl || '无',
nickName: res.data.nickname || _that.tempUserInfo.nickName || '无' nickName: res.data.nickname || _that.tempUserInfo.nickName || '无'
......
...@@ -25,8 +25,12 @@ const BindPhone = { ...@@ -25,8 +25,12 @@ const BindPhone = {
if (!_bind.phone || !/^1[3-9][0-9]{9}$/.test(_bind.phone)) { wx.showToast({ title: '请填入正确手机号', icon: 'none', duration: 1500 }); return; } if (!_bind.phone || !/^1[3-9][0-9]{9}$/.test(_bind.phone)) { wx.showToast({ title: '请填入正确手机号', icon: 'none', duration: 1500 }); return; }
wx.showToast({ title: '验证码请求中', icon: 'none' }) wx.showToast({ title: '验证码请求中', icon: 'none' })
wx.request({ wx.request({
url: util.config.URL_PATH + '/user/get-code', url: util.config.URL_PATH2 + '/user_center/send_login_code',
data: { mobile: _bind.phone }, method: 'POST', header: { tenant: util.config.tenant }, data: { mobile: _bind.phone, service: 'applet.ezijing.com' }, method: 'POST', header: {
'tenant': util.config.tenant,
'content-type': 'application/x-www-form-urlencoded',
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N'
},
success: function (res) { success: function (res) {
if (res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return ; } if (res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return ; }
wx.hideToast() wx.hideToast()
...@@ -42,27 +46,57 @@ const BindPhone = { ...@@ -42,27 +46,57 @@ const BindPhone = {
}, },
/* 点击确定 */ /* 点击确定 */
codeConfirm: function (e) { codeConfirm: function (e) {
const _that = this, _bind = _that.data.bindphone const _that = this, _bind = _that.data.bindphone;
if (!_bind.phone || !/^1[3-9][0-9]{9}$/.test(_bind.phone)) { wx.showToast({ title: '请填入正确手机号', icon: 'none' }); return ; } if (!_bind.phone || !/^1[3-9][0-9]{9}$/.test(_bind.phone)) { wx.showToast({ title: '请填入正确手机号', icon: 'none' }); return ; }
if (!_bind.code || !/^\d{4}$/.test(_bind.code)) { wx.showToast({ title: '请填入正确验证码', icon: 'none' }); return ; } if (!_bind.code || !/^\d{4}$/.test(_bind.code)) { wx.showToast({ title: '请填入正确验证码', icon: 'none' }); return ; }
wx.showToast({ title: '验证中', icon: 'none' }) wx.showToast({ title: '验证中', icon: 'none' })
/* 调用接口 - 使用验证码登录 */ /* 调用接口 - 使用验证码登录 */
wx.request({ wx.request({
url: util.config.URL_PATH + '/user/code-login', url: util.config.URL_PATH2 + '/user_center/code_login',
data: { mobile: _bind.phone, code: _bind.code }, method: 'POST', header: { skey: wx.getStorageSync('userSession').sessionKey, tenant: util.config.tenant }, data: { mobile: _bind.phone, code: _bind.code, service: 'applet.ezijing.com' }, method: 'POST', header: {
'tenant': util.config.tenant,
'content-type': 'application/x-www-form-urlencoded',
'version':util.config.version,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N'
},
success: function (res) { success: function (res) {
if (res.statusCode && res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return ; } if (res.statusCode && res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return ; }
wx.hideToast() wx.hideToast();
clearInterval(_that.timer); clearInterval(_that.timer);
wx.setStorageSync('userSession', { sessionKey: res.data.ticket });
let _token = wx.getStorageSync('userSession').sessionKey
if (!_token) {
wx.reLaunch({ url: '/pages/index/index' })
return ;
}
/* 获取用户信息 */ /* 获取用户信息 */
wx.request({ wx.request({
url: util.config.URL_PATH + '/user/getinfo', url: util.config.URL_PATH1 + '/user/check-access',
data: {}, method: 'GET', header: { data: {}, method: 'GET', header: {
skey: wx.getStorageSync('userSession').sessionKey, token: _token,
tenant: util.config.tenant 'tenant': util.config.tenant,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N',
'version':util.config.version,
unionid: wx.getStorageSync('union_id')
}, },
success: res => { success: res => {
if (res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return; } if (res.statusCode != 200 && res.statusCode != 401) { wx.showToast({ title: res.data.message, icon: 'none' }); return; }
if (res.statusCode && res.statusCode == 401) {
// 401特殊处理,这种情况,理解为手机号绑定错误
wx.hideToast();
wx.showModal({
title: '提示',
content: res.data.message,
showCancel:false,
complete (res) {
_that.setData({
'bindphone.code': '',
});
}
})
return ;
}
let _userInfo = { let _userInfo = {
avatarUrl: res.data.avatar || _that.tempUserInfo.avatarUrl || '无', avatarUrl: res.data.avatar || _that.tempUserInfo.avatarUrl || '无',
nickName: res.data.nickname || _that.tempUserInfo.nickName || '无' nickName: res.data.nickname || _that.tempUserInfo.nickName || '无'
......
...@@ -4,6 +4,7 @@ const app = getApp() ...@@ -4,6 +4,7 @@ const app = getApp()
const util = require('../../utils/util.js') const util = require('../../utils/util.js')
const BindPhone = require('./bindPhone/bindPhone.js') const BindPhone = require('./bindPhone/bindPhone.js')
const BindAccount = require('./bindAccount/bindAccount.js') const BindAccount = require('./bindAccount/bindAccount.js')
const md5 = require('../../utils/md5.js')
Page({ Page({
data: { data: {
...@@ -40,8 +41,8 @@ Page({ ...@@ -40,8 +41,8 @@ Page({
onReady: function () { onReady: function () {
/* 判别 是否显示 账号登录 */ /* 判别 是否显示 账号登录 */
wx.request({ wx.request({
url: util.config.URL_PATH + '/switch/lock', url: util.config.URL_PATH1 + '/switch/lock',
data: {}, method: 'GET', header: { tenant: util.config.tenant }, success: res => { data: {}, method: 'GET', header: { tenant: util.config.tenant, apikey: 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N' }, success: res => {
this.setData({ 'isUseAccountLogin': res.data.switch }) this.setData({ 'isUseAccountLogin': res.data.switch })
wx.setStorageSync('isUseAccountLogin', res.data.switch) wx.setStorageSync('isUseAccountLogin', res.data.switch)
} }
...@@ -57,10 +58,10 @@ Page({ ...@@ -57,10 +58,10 @@ Page({
/* 判别是否登录或者登录过期 */ /* 判别是否登录或者登录过期 */
util.LoginAgainAndJumpPage((loginRes, res) => { util.LoginAgainAndJumpPage((loginRes, res) => {
if (loginRes) { if (loginRes) {
/* 只要调用登录接口,就返回sessionKey, 如果没有绑定 直接 */ /* 只要调用登录接口,就返回sessionKey, 如果没有绑定 直接 全部 不再使用skey 改为 token */
wx.setStorageSync('userSession', { sessionKey: loginRes.data.session_key }) wx.setStorageSync('userSession', { sessionKey: loginRes.data.ticket })
wx.setStorageSync('userInfo', {}) wx.setStorageSync('userInfo', {})
if (loginRes.data && loginRes.data.error_code == 40030) { if (loginRes.data && loginRes.data.code == 80120) {
/* 判别 是否绑定过 紫荆账号 */ /* 判别 是否绑定过 紫荆账号 */
this.popupShow(res); wx.hideLoading(); return; this.popupShow(res); wx.hideLoading(); return;
} else if (loginRes.data && loginRes.data.status && loginRes.data.status != 200) { } else if (loginRes.data && loginRes.data.status && loginRes.data.status != 200) {
...@@ -84,16 +85,70 @@ Page({ ...@@ -84,16 +85,70 @@ Page({
}) })
}, },
guestLogin: function () { guestLogin: function () {
wx.showModal({ this.accountConfirms();
title: '提示', content: '本账户只适用于“体验学习”,正式学习请点击“登录”按钮', // return;
success: (res) => { // wx.showModal({
if (res.confirm) { // title: '提示', content: '本账户只适用于“体验学习”,正式学习请点击“登录”按钮',
wx.setStorageSync('userInfo', { "avatarUrl": "https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJv5HunMDDhpdaTz7aVXniaeOUxyQxwa9clFnJCm7Y8eP8gbUkF7I9NHSXSDJ1KssdYw9vAKb0v8fQ/132", "nickName": "游客账号" }); // success: (res) => {
wx.setStorageSync('userSession', { "sessionKey": "EOlbKKzWol0meLnDQOZb8g==" }); // if (res.confirm) {
this.goOutSite(); // wx.setStorageSync('userInfo', { "avatarUrl": "https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJv5HunMDDhpdaTz7aVXniaeOUxyQxwa9clFnJCm7Y8eP8gbUkF7I9NHSXSDJ1KssdYw9vAKb0v8fQ/132", "nickName": "游客账号" });
// wx.setStorageSync('userSession', { "sessionKey": "" });
// this.goOutSite();
// }
// }
// });
},
//游客登录
accountConfirms: function (e) {
const _that = this;
/* 调用接口 - 使用账号登录 */
wx.request({
url: util.config.URL_PATH2 + '/user_center/login',
data: {
login_name:'18519690645@163.com',
password: md5('uokoaduw' + '123456'.split('').reverse().join('') + 'auhgniq'),
service: 'applet.ezijing.com'
}, method: 'POST', header: {
'tenant': util.config.tenant,
'content-type': 'application/x-www-form-urlencoded',
'version': util.config.version,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N'
},
success: function (res) {
if (res.statusCode && res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return; }
wx.hideToast();
wx.setStorageSync('userSession', { sessionKey: res.data.ticket });
let _token = wx.getStorageSync('userSession').sessionKey
if (!_token) {
wx.reLaunch({ url: '/pages/index/index' })
return;
} }
} /* 获取用户信息 */
}); wx.request({
url: util.config.URL_PATH1 + '/user/check-access',
data: {}, method: 'GET', header: {
token: _token,
tenant: util.config.tenant,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N',
'version': util.config.version,
unionid: wx.getStorageSync('union_id')
},
success: res => {
if (res.statusCode != 200 && res.statusCode != 401) { wx.showToast({ title: res.data.message, icon: 'none' }); return; }
let _userInfo = {
avatarUrl: res.data.avatar || '无',
nickName: res.data.nickname || '游客登录'
}
wx.setStorageSync('userInfo', _userInfo);
_that.setData({ userInfo: _userInfo, hasUserInfo: true })
_that.popupClose()
_that.goOutSite()
}
})
},
fail: function (res) { wx.hideToast(); wx.showToast({ title: res, icon: 'none' }); }
})
}, },
/* 手机号绑定 方法 */ /* 手机号绑定 方法 */
accountLogin: BindPhone.BindPhone.accountLogin, accountLogin: BindPhone.BindPhone.accountLogin,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<image class='logo' src='./icons/hd-logo.png' mode='aspectFit'></image> <image class='logo' src='./icons/hd-logo.png' mode='aspectFit'></image>
<view class='text'>紫荆金融课堂</view> <view class='text'>紫荆金融课堂</view>
<button class='btn' open-type='getUserInfo' bindgetuserinfo='getUserInfo'>登录</button> <button class='btn' open-type='getUserInfo' bindgetuserinfo='getUserInfo'>登录</button>
<!-- <view class='test-id' bindtap='guestLogin'>游客登录</view> --> <view wx-if='{{isUseAccountLogin}}' class='test-id' bindtap='guestLogin'>游客登录</view>
<view class='userinfo'> <view class='userinfo'>
<!-- wx:if='{{!hasUserInfo && canIUse}}' --> <!-- wx:if='{{!hasUserInfo && canIUse}}' -->
<!-- <block wx:else> <!-- <block wx:else>
......
...@@ -50,16 +50,18 @@ ...@@ -50,16 +50,18 @@
<view class='table-title'>试题及主观题</view> <view class='table-title'>试题及主观题</view>
<view class='table'> <view class='table'>
<view class='th'> <view class='th'>
<view class='col2-td1'>章节</view> <view class='col3-td1'>章节</view>
<view class='col2-td2'>得分</view> <view class='col3-td2' style="width: 180rpx;">提交时间</view>
<view class='col3-td3' style="width: 64rpx;">得分</view>
</view> </view>
<block wx:for='{{item.assess.homewrok}}' wx:key='{{index}}' wx:for-item='item1'> <block wx:for='{{item.assess.homewrok}}' wx:key='{{index}}' wx:for-item='item1'>
<view class='tb'> <view class='tb'>
<view class='tt'>{{item1.title}}</view> <view class='tt'>{{item1.title}}</view>
<block wx:for='{{item1.arr}}' wx:key='{{index}}' wx:for-item='item2'> <block wx:for='{{item1.arr}}' wx:key='{{index}}' wx:for-item='item2'>
<view class='rd'> <view class='rd'>
<view class='col2-td1'>{{item2.name}}</view> <view class='col3-td1'>{{item2.name}}</view>
<view class='col2-td2'>{{item2.score}}</view> <view class='col3-td2' style="width: 190rpx; font-size: 18rpx;">{{item2.created_time}}</view>
<view class='col3-td3' style="width: 54rpx;">{{item2.score}}</view>
</view> </view>
</block> </block>
</view> </view>
...@@ -69,6 +71,9 @@ ...@@ -69,6 +71,9 @@
</block> </block>
</view> </view>
<view class='table-title'>大作业</view> <view class='table-title'>大作业</view>
<block wx:if='{{item.assess.essay.created_time}}'>
<view class='status-text'>提交时间:{{item.assess.essay.created_time}}</view>
</block>
<view class='status-text'>状 态:{{item.assess.essay.status}}</view> <view class='status-text'>状 态:{{item.assess.essay.status}}</view>
<view class='status-text'>得 分:{{item.assess.essay.score}}</view> <view class='status-text'>得 分:{{item.assess.essay.score}}</view>
</view> </view>
......
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
<view class='tabs-item'>{{item1}}</view> <view class='tabs-item'>{{item1}}</view>
</block> </block>
<block wx:if='{{headerInfo.isStart && tabs[1].chapterList.currentChapterId}}'> <block wx:if='{{headerInfo.isStart && tabs[1].chapterList.currentChapterId}}'>
<view class='btn' bindtap='startLearn' data-cid='{{headerInfo.id}}' data-sid='{{headerInfo.sid}}' data-vid='{{tabs[1].chapterList.currentChapterId}}'>继续学习</view> <view class='btn' bindtap='startLearn' data-cid='{{headerInfo.id}}' data-sid='{{headerInfo.sid}}' data-vid='{{tabs[1].chapterList.currentChapterId}}' data-type='{{tabs[1].chapterList.videoType}}'>继续学习</view>
</block> </block>
<block wx:elif='{{headerInfo.isStart}}'> <block wx:elif='{{headerInfo.isStart}}'>
<view class='btn' bindtap='startLearn' data-cid='{{headerInfo.id}}' data-sid='{{headerInfo.sid}}' data-vid='{{tabs[1].chapterList.course[0].chapters[0].vid}}'>开始学习</view> <view class='btn' bindtap='startLearn' data-cid='{{headerInfo.id}}' data-sid='{{headerInfo.sid}}' data-vid='{{tabs[1].chapterList.course[0].chapters[0].vid}}' data-type='{{tabs[1].chapterList.course[0].chapters[0].videoType}}'>开始学习</view>
</block> </block>
<block wx:else> <block wx:else>
<view class='btn' bindtap='wantThisCourse' data-cid='{{headerInfo.id}}' data-sid='{{headerInfo.sid}}'>选课</view> <view class='btn' bindtap='wantThisCourse' data-cid='{{headerInfo.id}}' data-sid='{{headerInfo.sid}}'>选课</view>
......
...@@ -2,13 +2,15 @@ ...@@ -2,13 +2,15 @@
<view class='course-list'> <view class='course-list'>
<block wx:for='{{item.chapterList.course}}' wx:key='{{index}}' wx:for-item='_item'> <block wx:for='{{item.chapterList.course}}' wx:key='{{index}}' wx:for-item='_item'>
<view class='content-group {{!_item.chapters.length ? "no-child" : ""}} {{_item.isUp ? "up" : ""}}'> <view class='content-group {{!_item.chapters.length ? "no-child" : ""}} {{_item.isUp ? "up" : ""}}'>
<view class='title' bindtap='clickJumpOrStatus' data-index='{{index}}' data-status='{{!!_item.chapters.length}}'>{{_item.title}} <form report-submit='true' bindsubmit="formSubmit" >
<image class='side' style='{{!_item.chapters.length ? "display: none;" : ""}} {{_item.isUp ? "display: none;" : ""}}' mode='aspectFill' src='../icons/courseContent/up.png'></image> <button form-type="submit" class='title' bindtap='clickJumpOrStatus' data-index='{{index}}' data-status='{{!!_item.chapters.length}}'>{{_item.title}}
<image class='side' style='{{!_item.chapters.length ? "display: none;" : ""}} {{_item.isUp ? "" : "display: none;"}}' mode='aspectFill' src='../icons/courseContent/down.png'></image> <image class='side' style='{{!_item.chapters.length ? "display: none;" : ""}} {{_item.isUp ? "display: none;" : ""}}' mode='aspectFill' src='../icons/courseContent/up.png'></image>
</view> <image class='side' style='{{!_item.chapters.length ? "display: none;" : ""}} {{_item.isUp ? "" : "display: none;"}}' mode='aspectFill' src='../icons/courseContent/down.png'></image>
</button>
</form>
<block wx:for='{{_item.chapters}}' wx:key='{{index1}}' wx:for-item='item1' wx:for-index='index1'> <block wx:for='{{_item.chapters}}' wx:key='{{index1}}' wx:for-item='item1' wx:for-index='index1'>
<view class='body {{item1.id === item.chapterList.currentChapterId && "on"}}'> <view class='body {{item1.id === item.chapterList.currentChapterId && "on"}}'>
<view class='name' data-vid='{{item1.vid}}' data-cid='{{item1.cid}}' data-sid='{{item1.sid}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}'> <view class='name' data-vid='{{item1.vid}}' data-cid='{{item1.cid}}' data-sid='{{item1.sid}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}' data-type='{{item1.videoType}}'>
{{item1.name}} {{item1.name}}
<view class='time'>{{item1.time}}</view> <view class='time'>{{item1.time}}</view>
</view> </view>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
.course-list .content-group.no-child { margin-bottom: 20rpx; } .course-list .content-group.no-child { margin-bottom: 20rpx; }
.course-list .content-group.up { margin-bottom: 20rpx; } .course-list .content-group.up { margin-bottom: 20rpx; }
.course-list .content-group.up .body { display: none; } .course-list .content-group.up .body { display: none; }
.course-list .content-group .title { position: relative; padding: 20rpx 54rpx 20rpx 24rpx; color: #313131; font-size: 30rpx; line-height: 40rpx; background: #e5e5e5; } .course-list .content-group .title { position: relative; padding: 20rpx 54rpx 20rpx 24rpx; color: #313131; font-size: 30rpx; line-height: 40rpx; background: #e5e5e5; text-align: left;}
.course-list .content-group .title .side { position: absolute; top: 32rpx; right: 24rpx; width: 30rpx; height: 17rpx; } .course-list .content-group .title .side { position: absolute; top: 32rpx; right: 24rpx; width: 30rpx; height: 17rpx; }
.course-list .content-group .body { position: relative; padding: 0 24rpx; font-size: 30rpx; line-height: 42rpx; color: #505050; } .course-list .content-group .body { position: relative; padding: 0 24rpx; font-size: 30rpx; line-height: 42rpx; color: #505050; }
.course-list .content-group .body.on .name { color: #b2183e; } .course-list .content-group .body.on .name { color: #b2183e; }
......
...@@ -40,6 +40,29 @@ Page({ ...@@ -40,6 +40,29 @@ Page({
startTime: '', startTime: '',
/* 记录所有题目是否都答过 */ /* 记录所有题目是否都答过 */
recordAll: [], recordAll: [],
arrRandomSort: function (arr) {
/* 对json.questions 进行一次乱序排列 */
let tmpJson = null
tmpJson = arr.shift()
arr.push(tmpJson)
tmpJson = arr.shift()
arr.push(tmpJson)
tmpJson = arr.shift()
arr.push(tmpJson)
},
unArrRandomSort: function (arr) {
/* 取消乱序排列,恢复原顺序 */
let tmpJson = null
tmpJson = arr.pop()
arr.unshift(tmpJson)
tmpJson = arr.pop()
arr.unshift(tmpJson)
tmpJson = arr.pop()
arr.unshift(tmpJson)
},
/** /**
* 将返回值 - 对照到对应 data上 * 将返回值 - 对照到对应 data上
*/ */
...@@ -54,6 +77,7 @@ Page({ ...@@ -54,6 +77,7 @@ Page({
score: 0 score: 0
} }
this.startTime = new Date().getTime() this.startTime = new Date().getTime()
this.arrRandomSort(json.questions)
let _data = { let _data = {
id: json.id, id: json.id,
semester_id: json.semester_id, semester_id: json.semester_id,
...@@ -71,6 +95,10 @@ Page({ ...@@ -71,6 +95,10 @@ Page({
case 3: str += 'D,'; break; case 3: str += 'D,'; break;
case 4: str += 'E,'; break; case 4: str += 'E,'; break;
case 5: str += 'F,'; break; case 5: str += 'F,'; break;
case 6: str += 'G,'; break;
case 7: str += 'H,'; break;
case 8: str += 'I,'; break;
case 9: str += 'J,'; break;
} }
} }
}) })
...@@ -100,8 +128,10 @@ Page({ ...@@ -100,8 +128,10 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
wx.showLoading({ title: '页面加载中...', mask: true }) wx.showLoading({ title: '页面加载中...', mask: true })
this.setData({ 'exam': this.updateData(wx.getStorageSync('_homework')) }) if (wx.getStorageSync('_homework')) {
CourseApi.getExamDetail(this.data.exam.id, this.data.exam.semester_id, (res) => { this.setData({ 'exam': this.updateData(wx.getStorageSync('_homework')) })
}
CourseApi.getExamDetail(this.data.exam.id, this.data.exam.semester_id, this.param.course_id, (res) => {
let _data = res.data let _data = res.data
let json = _data.homework let json = _data.homework
if (json) { if (json) {
...@@ -182,12 +212,13 @@ Page({ ...@@ -182,12 +212,13 @@ Page({
options: group[i].arr options: group[i].arr
}) })
} }
this.unArrRandomSort(arr)
this.param.work_contents = JSON.stringify(arr) this.param.work_contents = JSON.stringify(arr)
this.param.score = (score/total*100).toFixed(1) this.param.score = (score/total*100).toFixed(1);
wx.showLoading({ title: '提交中...', mask: true }) wx.showLoading({ title: '提交中...', mask: true })
CourseApi.submitExamDetail(this.param, (res) => { CourseApi.submitExamDetail(this.param, (res) => {
if (res.data.status) { if (res.data.status) {
CourseApi.getExamDetail(this.data.exam.id, this.data.exam.semester_id, (res) => { CourseApi.getExamDetail(this.data.exam.id, this.data.exam.semester_id, this.param.course_id, (res) => {
let _data = res.data let _data = res.data
let json = _data.homework let json = _data.homework
if (json) { if (json) {
...@@ -203,6 +234,11 @@ Page({ ...@@ -203,6 +234,11 @@ Page({
} }
}) })
}, },
/* 重做试题 */
repeatExam: function (e) {
this.setData({ 'exam': this.updateData(wx.getStorageSync('_homework')) })
wx.pageScrollTo({ scrollTop: 0 })
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<view class='q-num'>{{index+1}}.</view><rich-text class='q-title' nodes='{{item.title}}'></rich-text><view class='q-type'>(单选题)</view> <view class='q-num'>{{index+1}}.</view><rich-text class='q-title' nodes='{{item.title}}'></rich-text><view class='q-type'>(单选题)</view>
<radio-group class='radio-group' bindchange='radioChange' data-index='{{index}}'> <radio-group class='radio-group' bindchange='radioChange' data-index='{{index}}'>
<block wx:for='{{item.arr}}' wx:key='{{index}}' wx:for-item='item1' wx:for-index='index1'> <block wx:for='{{item.arr}}' wx:key='{{index}}' wx:for-item='item1' wx:for-index='index1'>
<label class='radio {{item.cur && item1.checked && "success"}} {{item.cur && !item1.checked && item1.selected && "error"}}'><radio value='{{index1}}' disabled='{{item.cur}}' checked='{{item1.selected}}'/>{{ index1 == 0 ? "A" : (index1 == 1 ? "B" : (index1 == 2 ? "C" : (index1 == 3 ? "D" : (index1 == 4 ? "E" : (index1 == 5 ? "F" : "G"))))) }}. {{item1.option}}</label> <label class='radio {{item.cur && item1.checked && "success"}} {{item.cur && !item1.checked && item1.selected && "error"}}'><radio value='{{index1}}' disabled='{{item.cur}}' checked='{{item1.selected}}'/>{{ index1 == 0 ? "A" : (index1 == 1 ? "B" : (index1 == 2 ? "C" : (index1 == 3 ? "D" : (index1 == 4 ? "E" : (index1 == 5 ? "F" : (index1 == 6 ? "G" : (index1 == 7 ? "H" : (index1 == 8 ? "I" : (index1 == 9 ? "J" : "K"))))))))) }}. {{item1.option}}</label>
</block> </block>
</radio-group> </radio-group>
<block wx:if='{{item.cur}}'><view class='result'>正确答案:{{item.cur}}</view></block> <block wx:if='{{item.cur}}'><view class='result'>正确答案:{{item.cur}}</view></block>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<view class='q-num'>{{index+1}}.</view><rich-text class='q-title' nodes='{{item.title}}'></rich-text><view class='q-type'>(多选题)</view> <view class='q-num'>{{index+1}}.</view><rich-text class='q-title' nodes='{{item.title}}'></rich-text><view class='q-type'>(多选题)</view>
<checkbox-group class='checkbox-group' bindchange='checkboxChange' data-index='{{index}}'> <checkbox-group class='checkbox-group' bindchange='checkboxChange' data-index='{{index}}'>
<block wx:for='{{item.arr}}' wx:key='{{index}}' wx:for-item='item1' wx:for-index='index1'> <block wx:for='{{item.arr}}' wx:key='{{index}}' wx:for-item='item1' wx:for-index='index1'>
<label class='checkbox {{item.cur && item1.checked && "success"}} {{item.cur && !item1.checked && item1.selected && "error"}}'><checkbox value='{{index1}}' disabled='{{item.cur}}' checked='{{item1.selected}}'/>{{ index1 == 0 ? "A" : (index1 == 1 ? "B" : (index1 == 2 ? "C" : (index1 == 3 ? "D" : (index1 == 4 ? "E" : (index1 == 5 ? "F" : "G"))))) }}. {{item1.option}}</label> <label class='checkbox {{item.cur && item1.checked && "success"}} {{item.cur && !item1.checked && item1.selected && "error"}}'><checkbox value='{{index1}}' disabled='{{item.cur}}' checked='{{item1.selected}}'/>{{ index1 == 0 ? "A" : (index1 == 1 ? "B" : (index1 == 2 ? "C" : (index1 == 3 ? "D" : (index1 == 4 ? "E" : (index1 == 5 ? "F" : (index1 == 6 ? "G" : (index1 == 7 ? "H" : (index1 == 8 ? "I" : (index1 == 9 ? "J" : "K"))))))))) }}. {{item1.option}}</label>
</block> </block>
</checkbox-group> </checkbox-group>
<block wx:if='{{item.cur}}'><view class='result'>正确答案:{{item.cur}}</view></block> <block wx:if='{{item.cur}}'><view class='result'>正确答案:{{item.cur}}</view></block>
...@@ -34,4 +34,7 @@ ...@@ -34,4 +34,7 @@
</view> </view>
<view class='btn {{exam.work_contents && "on"}}' bindtap='submitExam' data-submit='{{!!exam.work_contents}}'>{{exam.work_contents ? "已提交" : "提交"}}</view> <view class='btn {{exam.work_contents && "on"}}' bindtap='submitExam' data-submit='{{!!exam.work_contents}}'>{{exam.work_contents ? "已提交" : "提交"}}</view>
<view class='care'>(注意:测试只有一次提交机会)</view> <view class='care'>(注意:测试只有一次提交机会)</view>
<!--<block wx:if='{{!!exam.work_contents}}'>
<view class='btn' bindtap='repeatExam'>重做</view>
</block>-->
</view> </view>
...@@ -26,8 +26,8 @@ Page({ ...@@ -26,8 +26,8 @@ Page({
arrItem: [ arrItem: [
{ val: '-1', name: '全部' }, { val: '-1', name: '全部' },
{ val: '1', name: '必修课' }, { val: '1', name: '必修课' },
{ val: '2', name: '选修课' }, { val: '2', name: '选修课' }
{ val: '3', name: '重修课' } // { val: '3', name: '重修课' }
] ]
}, { }, {
name: '选修状态', name: '选修状态',
......
const util = require('../../../utils/util.js')
// pages/learnSystem/my/my.js // pages/learnSystem/my/my.js
Page({ Page({
/* 页面的初始数据 */ /* 页面的初始数据 */
...@@ -11,7 +12,20 @@ Page({ ...@@ -11,7 +12,20 @@ Page({
/* 我的学分 */ /* 我的学分 */
goMyScore: function () { wx.navigateTo({ url: '/pages/learnSystem/myScore/myScore' }) }, goMyScore: function () { wx.navigateTo({ url: '/pages/learnSystem/myScore/myScore' }) },
/* 退出系统 */ /* 退出系统 */
outSystem: function () { wx.setStorageSync('userInfo', {}); wx.setStorageSync('userSession', {}); wx.reLaunch({ url: '/pages/index/index' }) }, outSystem: function () {
let _token = wx.getStorageSync('userSession').sessionKey
if (!_token) {
wx.reLaunch({ url: '/pages/index/index' })
return ;
}
util.requestApi({
url: util.config.URL_PATH2 + '/user_center/logout',
method: 'POST',
data: {
token: _token,
service: 'applet.ezijing.com'
}, callback: function (res) {}}); wx.setStorageSync('userInfo', {}); wx.setStorageSync('userSession', {}); wx.reLaunch({ url: '/pages/index/index' }) },
/* 输出信息 */ /* 输出信息 */
printMsg: function (detail) { console.log(detail.status) } printMsg: function (detail) { console.log(detail.status) }
}) })
\ No newline at end of file
...@@ -15,7 +15,8 @@ Page({ ...@@ -15,7 +15,8 @@ Page({
myMustStr: '0%', myMustStr: '0%',
unmust: 0, unmust: 0,
myUnmust: 0, myUnmust: 0,
myUnmustStr: '0%' myUnmustStr: '0%',
lists: []
} }
}, },
/** /**
...@@ -24,7 +25,7 @@ Page({ ...@@ -24,7 +25,7 @@ Page({
onLoad: function (options) { onLoad: function (options) {
wx.showLoading({ title: '页面加载中...', mask: true }) wx.showLoading({ title: '页面加载中...', mask: true })
ScoreApi.getMyScore((json) => { ScoreApi.getMyScore((json) => {
this.setData({ 'score': json }) this.setData({ 'score': json });
wx.hideLoading() wx.hideLoading()
}) })
}, },
......
...@@ -3,24 +3,46 @@ ...@@ -3,24 +3,46 @@
<view class='title'>总计学分<view class='score'>{{score.total}}</view></view> <view class='title'>总计学分<view class='score'>{{score.total}}</view></view>
<view class='pro-line total'> <view class='pro-line total'>
<view class='active' style='width: {{score.myTotalStr}};'> <view class='active' style='width: {{score.myTotalStr}};'>
<view class='text {{score.myTotal/score.total>0.2 ? "" : "left"}}'>{{score.myTotal}} ({{score.myTotalStr}})</view> <view class='text {{score.myTotal/score.total>0.2 ? "" : "left"}}'>{{score.myTotal}} ()</view>
</view> </view>
</view> </view>
<view class='col-5'>
<view class='title'>必修学分<view class='score'>{{score.must+1}}</view></view> <view class="col">
<view class='pro-line must'> <view class='col-5'>
<view class='active' style='width: {{score.myMustStr}};'> <view class='title'>必修学分<view class='score'>{{score.must}}</view></view>
<view class='text {{score.myMust/score.must>0.4 ? "" : "left"}}'>{{score.myMust}} ({{score.myMustStr}})</view> <view class='pro-line must'>
<view class='active' style='width: {{score.myMustStr}};'>
<view class='text {{score.myMust/score.must>0.4 ? "" : "left"}}'>{{score.myMust}} (分)</view>
</view>
</view> </view>
</view> </view>
</view> <view class='col-5 right'>
<!-- <view class='col-5 right'> <view class='title'>选修学分<view class='score'>{{score.unmust}}</view></view>
<view class='title'>选修学分<view class='score'>{{score.unmust}}</view></view> <view class='pro-line unmust'>
<view class='pro-line unmust'> <view class='active' style='width: {{score.myUnmustStr}};'>
<view class='active' style='width: {{score.myUnmustStr}};'> <view class='text {{score.myUnmust/score.unmust>0.4 ? "" : "left"}}'>{{score.myUnmust}} (分)</view>
<view class='text {{score.myUnmust/score.unmust>0.4 ? "" : "left"}}'>{{score.myUnmust}} ({{score.myUnmustStr}})</view> </view>
</view> </view>
</view> </view>
</view> --> </view>
<view></view> <view class="list" hover-class="none" hover-stop-propagation="false" wx:if="{{score.lists.length}}">
<view class='list-title'>
<text class="col6-td1">序号</text>
<text class="col6-td2">学期</text>
<text class="col6-td3" style="text-align: center;">课程</text>
<text class="col6-td4">状态</text>
<text class="col6-td5">学分</text>
<text class="col6-td6">成绩</text>
</view>
<view class="list-title" hover-class="none" hover-stop-propagation="false" wx:for="{{score.lists}}" wx:for-index="idx" wx:for-item="itemName" wx:key="idx">
<text class="col6-td1">{{idx}}</text>
<text class="col6-td2">{{itemName.semester_name}}</text>
<text class="col6-td3">{{itemName.course_name}}</text>
<text class="col6-td4">{{itemName.passed ? '通过':'未通过'}}</text>
<text class="col6-td5">{{itemName.credit}}</text>
<text class="col6-td6">{{itemName.score}}</text>
</view>
</view>
</view> </view>
...@@ -10,4 +10,48 @@ ...@@ -10,4 +10,48 @@
.my-score .pro-line.must .active { background: #8ca4cf; } .my-score .pro-line.must .active { background: #8ca4cf; }
.my-score .pro-line.unmust .active { background: #66c6bd; } .my-score .pro-line.unmust .active { background: #66c6bd; }
.my-score .col-5 { float: left; width: 49%; } .my-score .col-5 { float: left; width: 49%; }
.my-score .col-5.right { float: right; } .my-score .col-5.right { float: right; }
\ No newline at end of file .my-score .col{
height:110rpx;
overflow: hidden;
}
.my-score .list{
width: 100%;
padding-top: 30rpx;
}
.my-score .list-title{
width: 100%;
box-sizing: border-box;
-webkit-box-sizing: border-box;
border: 1rpx solid rgb(96, 98, 102);
border-top: none;
line-height: 40rpx;
overflow: hidden;
}
.my-score .list .list-title:first-child{
border-top: 1rpx solid rgb(96, 98, 102);
}
.my-score .list-title text {
float: left;
font-size: 25rpx;
text-align: center;
}
.my-score .list-title .col6-td1 {
width: 60rpx;
}
.my-score .list-title .col6-td2{
width: 134rpx;
}
.my-score .list-title .col6-td3{
width: 300rpx;
text-align: left;
}
.my-score .list-title .col6-td4{
width: 80rpx;
}
.my-score .list-title .col6-td5{
width: 60rpx;
}
.my-score .list-title .col6-td6{
width: 60rpx;
}
\ No newline at end of file
...@@ -28,7 +28,7 @@ Page({ ...@@ -28,7 +28,7 @@ Page({
audioPause: function () { this._audio.pause(); this.playAudio = false; }, audioPause: function () { this._audio.pause(); this.playAudio = false; },
videoPause: function () { this._video.pause(); this.playVideo = false; }, videoPause: function () { this._video.pause(); this.playVideo = false; },
videoShowOrHide: function () { this.setData({ 'isVideoShow': !this.data.isVideoShow }) }, videoShowOrHide: function () { this.setData({ 'isVideoShow': !this.data.isVideoShow }) },
changeVideo: function () { this.setData({ 'video.src': 'http://pd4t7ae3m.bkt.clouddn.com/test.mp4' }); }, changeVideo: function () { this.setData({ 'video.src': 'https://pd4t7ae3m.bkt.clouddn.com/test.mp4' }); },
timeUpdate: function (e) { timeUpdate: function (e) {
let _data = this.data, _status = _data.status, _detail = e.detail, _obj = {} let _data = this.data, _status = _data.status, _detail = e.detail, _obj = {}
console.log('视频时间变化', parseInt(_detail.currentTime)) console.log('视频时间变化', parseInt(_detail.currentTime))
...@@ -46,9 +46,9 @@ Page({ ...@@ -46,9 +46,9 @@ Page({
let _ = this let _ = this
wx.previewImage({ wx.previewImage({
urls: [ urls: [
'http://pd4t7ae3m.bkt.clouddn.com/imgs-test1.jpg', 'https://pd4t7ae3m.bkt.clouddn.com/imgs-test1.jpg',
'http://pd4t7ae3m.bkt.clouddn.com/imgs-test2.jpg', 'https://pd4t7ae3m.bkt.clouddn.com/imgs-test2.jpg',
'http://pd4t7ae3m.bkt.clouddn.com/imgs-test3.jpg' 'https://pd4t7ae3m.bkt.clouddn.com/imgs-test3.jpg'
], ],
current: 0, current: 0,
success: () => { success: () => {
...@@ -71,9 +71,9 @@ Page({ ...@@ -71,9 +71,9 @@ Page({
wx.previewImage({ wx.previewImage({
urls: [ urls: [
'http://pd4t7ae3m.bkt.clouddn.com/imgs-test1.jpg', 'https://pd4t7ae3m.bkt.clouddn.com/imgs-test1.jpg',
'http://pd4t7ae3m.bkt.clouddn.com/imgs-test2.jpg', 'https://pd4t7ae3m.bkt.clouddn.com/imgs-test2.jpg',
'http://pd4t7ae3m.bkt.clouddn.com/imgs-test3.jpg' 'https://pd4t7ae3m.bkt.clouddn.com/imgs-test3.jpg'
], ],
current: 0, current: 0,
success: () => {} success: () => {}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<button bindtap='videoShowOrHide'>视频显示/隐藏</button> <button bindtap='videoShowOrHide'>视频显示/隐藏</button>
<view class='start-time'>播放时间:{{currentTime}}</view> <view class='start-time'>播放时间:{{currentTime}}</view>
<view class='end-time'>总时间:{{totalTime}}</view> <view class='end-time'>总时间:{{totalTime}}</view>
<audio id='audio-play' src='http://pd4t7ae3m.bkt.clouddn.com/audio-test.mp3'></audio> <audio id='audio-play' src='https://pd4t7ae3m.bkt.clouddn.com/audio-test.mp3'></audio>
<view style='{{isVideoShow ? "": "display:none"}}'> <view style='{{isVideoShow ? "": "display:none"}}'>
<video id='video-play' style="width: 750rpx;" src='{{video.src}}' bindtimeupdate='timeUpdate' show-center-play-btn='{{false}}' controls='{{false}}'></video> <video id='video-play' style="width: 750rpx;" src='{{video.src}}' bindtimeupdate='timeUpdate' show-center-play-btn='{{false}}' controls='{{false}}'></video>
</view> </view>
\ No newline at end of file
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</view> </view>
<view class='main-btns'> <view class='main-btns'>
<view class='btn-back'> <view class='btn-back'>
<image class='img' src='./controlBar/icons/btn-back.png' mode='scaleToFill' data-id='{{chapterList.prevVideo.id}}' data-hasVA='{{chapterList.prevVideo.time}}' data-name='{{chapterList.prevVideo.name}}' bindtap='prevChapter'></image> <image class='img' src='./controlBar/icons/btn-back.png' mode='scaleToFill' data-id='{{chapterList.prevVideo.id}}' data-hasVA='{{chapterList.prevVideo.time}}' data-name='{{chapterList.prevVideo.name}}' bindtap='prevChapter' data-type='{{chapterList.nextVideo.videoType}}' ></image>
</view> </view>
<view class='opt'> <view class='opt'>
<image class='img init-page {{initVAFlag ? "" : "none"}}' src='./controlBar/icons/loading_small.gif' mode='aspectFit'></image> <image class='img init-page {{initVAFlag ? "" : "none"}}' src='./controlBar/icons/loading_small.gif' mode='aspectFit'></image>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<image class='img pause {{initVAFlag ? "none" : ""}} {{!ctrlBar.isPlay ? "none" : ""}}' src='./controlBar/icons/btn-pause.png' mode='scaleToFill' bindtap='pauseVA'></image> <image class='img pause {{initVAFlag ? "none" : ""}} {{!ctrlBar.isPlay ? "none" : ""}}' src='./controlBar/icons/btn-pause.png' mode='scaleToFill' bindtap='pauseVA'></image>
</view> </view>
<view class='btn-front'> <view class='btn-front'>
<image class='img' src='./controlBar/icons/btn-front.png' mode='scaleToFill' data-id='{{chapterList.nextVideo.id}}' data-hasVA='{{chapterList.nextVideo.time}}' data-name='{{chapterList.nextVideo.name}}' bindtap='nextChapter'></image> <image class='img' src='./controlBar/icons/btn-front.png' mode='scaleToFill' data-id='{{chapterList.nextVideo.id}}' data-hasVA='{{chapterList.nextVideo.time}}' data-name='{{chapterList.nextVideo.name}}' data-type='{{chapterList.nextVideo.videoType}}' bindtap='nextChapter'></image>
</view> </view>
</view> </view>
<view class='right-btn' bindtap='openSetContent'> <view class='right-btn' bindtap='openSetContent'>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<view class='title'>{{item.title}}</view> <view class='title'>{{item.title}}</view>
<block wx:for='{{item.chapters}}' wx:key='{{index1}}' wx:for-item="item1" wx:for-index='index1'> <block wx:for='{{item.chapters}}' wx:key='{{index1}}' wx:for-item="item1" wx:for-index='index1'>
<view class='body {{item1.id === chapterList.currentChapterId && "on"}}'> <view class='body {{item1.id === chapterList.currentChapterId && "on"}}'>
<view class='name' data-id='{{item1.id}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}'> <view class='name' data-id='{{item1.id}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}' data-type='{{item1.videoType}}'>
{{item1.name}} {{item1.name}}
<view class='time'>{{item1.time}}</view> <view class='time'>{{item1.time}}</view>
</view> </view>
......
...@@ -31,20 +31,20 @@ Page({ ...@@ -31,20 +31,20 @@ Page({
/* 视频地址 */ /* 视频地址 */
video: { video: {
src: '', // 视频播放地址 src: '', // 视频播放地址
spareSrc: 'http://pd4t7ae3m.bkt.clouddn.com/test.mp4' // 正常视频播放地址,浏览器不支持时,使用备用地址 spareSrc: 'https://pd4t7ae3m.bkt.clouddn.com/test.mp4' // 正常视频播放地址,浏览器不支持时,使用备用地址
}, },
/* 音频地址 */ /* 音频地址 */
audio: { audio: {
src: '', // 音频播放地址 src: '', // 音频播放地址
spareSrc: 'http://pd4t7ae3m.bkt.clouddn.com/audio-test.mp3', // 音频备用地址 spareSrc: 'https://pd4t7ae3m.bkt.clouddn.com/audio-test.mp3', // 音频备用地址
poster: 'http://pd4t7ae3m.bkt.clouddn.com/imgs-test3.jpg' // 音频播放封面 poster: 'https://pd4t7ae3m.bkt.clouddn.com/imgs-test3.jpg' // 音频播放封面
}, },
/* PPT对象 */ /* PPT对象 */
image: { image: {
imgUrls: [ imgUrls: [
'http://pd4t7ae3m.bkt.clouddn.com/imgs-test1.jpg', 'https://pd4t7ae3m.bkt.clouddn.com/imgs-test1.jpg',
'http://pd4t7ae3m.bkt.clouddn.com/imgs-test2.jpg', 'https://pd4t7ae3m.bkt.clouddn.com/imgs-test2.jpg',
'http://pd4t7ae3m.bkt.clouddn.com/imgs-test3.jpg' 'https://pd4t7ae3m.bkt.clouddn.com/imgs-test3.jpg'
], // 所有图片数组 ], // 所有图片数组
current: 0, // 当前跟着音视频走,播放的是第几个图片 current: 0, // 当前跟着音视频走,播放的是第几个图片
selectIndex: 0, selectIndex: 0,
...@@ -142,12 +142,14 @@ Page({ ...@@ -142,12 +142,14 @@ Page({
}, 200); }, 200);
}, },
/* 页面初始入口,会 先走 AJAX 读取 章节列表数据、音视频和PPT数据、进度数据 */ /* 页面初始入口,会 先走 AJAX 读取 章节列表数据、音视频和PPT数据、进度数据 */
ajaxInitGetInfo: function (vid) { ajaxInitGetInfo: function (vid,videoType) {
let cid = this.data.options.cid, sid = this.data.options.sid, did = 'jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8'; let cid = this.data.options.cid, sid = this.data.options.sid, did = 'jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8';
ChapterApi.getChapterList(cid, sid, vid, (json) => { ChapterApi.getChapterList(cid, sid, vid, (json) => {
this.setData({ 'chapterList': json }) this.setData({ 'chapterList': json })
}) })
ChapterApi.getCurrentChapterDetail(vid, (json) => { // CC视频走这个接口
ChapterApi.getCurrentChapterDetail(vid,videoType, (json) => {
// 播放的视频数据
this.setData({ 'video': json.video }) this.setData({ 'video': json.video })
this.setData({ 'audio': json.audio }) this.setData({ 'audio': json.audio })
this.setData({ 'image': json.image }) this.setData({ 'image': json.image })
...@@ -160,7 +162,23 @@ Page({ ...@@ -160,7 +162,23 @@ Page({
}) })
}) })
}, },
onLoad: function (options) { this.data.options = options; }, onLoad: function (options) {
if(!options.vid){
wx.showToast({
title: '获取视频失败',
icon: 'loading',
duration: 3000,
success:function(){
setTimeout(function(){
wx.navigateBack({
delta: 1
})
},2000)
}
})
}
this.data.options = options;
},
onHide: function () { this.isBackend = true; this.pauseVA(); clearInterval(this.heartbeat); }, onHide: function () { this.isBackend = true; this.pauseVA(); clearInterval(this.heartbeat); },
onUnload: function () { this.pauseVA(); }, onUnload: function () { this.pauseVA(); },
onShow: function () { onShow: function () {
...@@ -175,7 +193,7 @@ Page({ ...@@ -175,7 +193,7 @@ Page({
} }
}, },
/* 生命周期函数--监听页面初次渲染完成 */ /* 生命周期函数--监听页面初次渲染完成 */
onReady: function () { this.ajaxInitGetInfo(this.data.options.vid); }, onReady: function () { this.ajaxInitGetInfo(this.data.options.vid,this.data.options.type); },
/* controlBar页面 - 切换音频页面 - bindTap事件 */ /* controlBar页面 - 切换音频页面 - bindTap事件 */
showContentAudio: function () { showContentAudio: function () {
...@@ -212,6 +230,8 @@ Page({ ...@@ -212,6 +230,8 @@ Page({
/* controlBar页面 和 selectChapterList页面 - 切换章节列表 - bindTap事件 */ /* controlBar页面 和 selectChapterList页面 - 切换章节列表 - bindTap事件 */
jumpToOtherVA: function (e) { jumpToOtherVA: function (e) {
/* 跳转时,清空当前播放状态 */
this.heartbeat && clearInterval(this.heartbeat)
let _data = e.target.dataset; let _data = e.target.dataset;
if (!_data.hasva) { if (!_data.hasva) {
/* 如果存在 - 课后习题类型, type:3、work_type:1 */ /* 如果存在 - 课后习题类型, type:3、work_type:1 */
...@@ -229,7 +249,7 @@ Page({ ...@@ -229,7 +249,7 @@ Page({
} }
this.isFirstInitAndSwitchVideo = true; this.isFirstInitAndSwitchVideo = true;
this.statusClear(_data.name, _data.id); this.statusClear(_data.name, _data.id);
this.ajaxInitGetInfo(_data.id); this.ajaxInitGetInfo(_data.id,_data.type);
}, },
/* controlBar页面 和 selectChapterList页面 - 切换章节列表: 辅助方法 - 1. 暂停视频;2. 关闭章节选择列表;3. 状态清理(status、videoCacheCtrlBar、audioCacheCtrlBar);4. 设置微信导航头 */ /* controlBar页面 和 selectChapterList页面 - 切换章节列表: 辅助方法 - 1. 暂停视频;2. 关闭章节选择列表;3. 状态清理(status、videoCacheCtrlBar、audioCacheCtrlBar);4. 设置微信导航头 */
statusClear: function (name, id) { statusClear: function (name, id) {
...@@ -282,8 +302,8 @@ Page({ ...@@ -282,8 +302,8 @@ Page({
playVA: function () { playVA: function () {
let _data = this.data, _status = _data.status let _data = this.data, _status = _data.status
this.setData({ 'ctrlBar.isPlay': true }) this.setData({ 'ctrlBar.isPlay': true })
_status.isVideo && this._video.play() _status.isVideo && this._video.play();
_status.isAudio && this._audio.play() _status.isAudio && this._audio.play();
this.setHeartbeat() this.setHeartbeat()
}, },
/* controlBar页面 - 暂停音视频 - bindTap事件和内部调用 */ /* controlBar页面 - 暂停音视频 - bindTap事件和内部调用 */
...@@ -316,7 +336,10 @@ Page({ ...@@ -316,7 +336,10 @@ Page({
beginAndOutFullScreen: function (e) {}, beginAndOutFullScreen: function (e) {},
/* VideoOrAudio标签 - 开始/继续播放时触发play事件时,触发 - bindplay事件 */ /* VideoOrAudio标签 - 开始/继续播放时触发play事件时,触发 - bindplay事件 */
beginPlayVA: function () { beginPlayVA: function () {
this.setData({ 'initVAFlag': false }) if(this.data.initVAFlag){
this.setData({ 'initVAFlag': false })
this.setHeartbeat() //安卓手机播放之后才会上送进度
}
/* iphone6 8.4.1 首次初始化时,不能直接 设置进度并播放 */ /* iphone6 8.4.1 首次初始化时,不能直接 设置进度并播放 */
if (this.isFirstInitAndSwitchVideo) { if (this.isFirstInitAndSwitchVideo) {
if (!this._cache) this._cache = wx.getStorageSync('videoCacheCtrlBar') || {} if (!this._cache) this._cache = wx.getStorageSync('videoCacheCtrlBar') || {}
...@@ -350,7 +373,7 @@ Page({ ...@@ -350,7 +373,7 @@ Page({
} }
}, },
/* 增加定时器,每过2000ms,把数据存入localStorage一次 并 提交一次 */ /* 增加定时器,每过10000ms,把数据存入localStorage一次 并 提交一次 */
setHeartbeat: function () { setHeartbeat: function () {
let _data = this.data let _data = this.data
/* 页面进入时只初始化一次 */ /* 页面进入时只初始化一次 */
...@@ -361,17 +384,24 @@ Page({ ...@@ -361,17 +384,24 @@ Page({
if (this.data.initVAFlag) return; if (this.data.initVAFlag) return;
let arr = _data.ctrlBar.currentTime.split(':'), tempTime = parseInt(arr[0] * 60) + parseInt(arr[1]); let arr = _data.ctrlBar.currentTime.split(':'), tempTime = parseInt(arr[0] * 60) + parseInt(arr[1]);
this.setData({ 'ctrlBar.initial_time': tempTime }) this.setData({ 'ctrlBar.initial_time': tempTime })
wx.setStorageSync('videoCacheCtrlBar', _data.ctrlBar) /* 这里改成异步的,试一下 */
wx.setStorageSync('audioCacheCtrlBar', _data.ctrlBar) wx.setStorage({
'key': 'videoCacheCtrlBar',
'data': _data.ctrlBar
})
wx.setStorage({
'key': 'audioCacheCtrlBar',
'data': _data.ctrlBar
})
/* 由于 音视频相同,所以 设置方式设置成一致就可以了 */ /* 由于 音视频相同,所以 设置方式设置成一致就可以了 */
/* 提交进度请求 */ /* 提交进度请求, 进度进行中,才计算上进度时间 */
if (this.realTimeProgress) { if (this.realTimeProgress && tempTime != this.realTimeProgress.cpt) {
let _rProgress = this.realTimeProgress let _rProgress = this.realTimeProgress
_rProgress.pt = parseInt(_rProgress.pt) + parseInt((tempTime - _rProgress.cpt > 0) && (tempTime - _rProgress.cpt < 8) ? (tempTime - _rProgress.cpt) : 0) _rProgress.pt = parseInt(_rProgress.pt) + (10000 / 1000) * 1.5
_rProgress.cpt = tempTime _rProgress.cpt = tempTime
_rProgress.mpt = tempTime > _rProgress.mpt ? tempTime : _rProgress.mpt _rProgress.mpt = tempTime > _rProgress.mpt ? tempTime : _rProgress.mpt
ChapterApi.updateProgress(_rProgress) ChapterApi.updateProgress(_rProgress)
} }
}, 1000) }, 10000)
} }
}) })
\ No newline at end of file
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
"appid": "wx80b4557ad9355bdc", "appid": "wx80b4557ad9355bdc",
"projectname": "learnOnline-survey", "projectname": "learnOnline-survey",
"isGameTourist": false, "isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": { "condition": {
"search": { "search": {
"current": -1, "current": -1,
......
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
\ No newline at end of file
!function(n){"use strict";function t(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function r(n,t){return n<<t|n>>>32-t}function e(n,e,o,u,c,f){return t(r(t(t(e,n),t(u,f)),c),o)}function o(n,t,r,o,u,c,f){return e(t&r|~t&o,n,t,u,c,f)}function u(n,t,r,o,u,c,f){return e(t&o|r&~o,n,t,u,c,f)}function c(n,t,r,o,u,c,f){return e(t^r^o,n,t,u,c,f)}function f(n,t,r,o,u,c,f){return e(r^(t|~o),n,t,u,c,f)}function i(n,r){n[r>>5]|=128<<r%32,n[14+(r+64>>>9<<4)]=r;var e,i,a,d,h,l=1732584193,g=-271733879,v=-1732584194,m=271733878;for(e=0;e<n.length;e+=16)i=l,a=g,d=v,h=m,g=f(g=f(g=f(g=f(g=c(g=c(g=c(g=c(g=u(g=u(g=u(g=u(g=o(g=o(g=o(g=o(g,v=o(v,m=o(m,l=o(l,g,v,m,n[e],7,-680876936),g,v,n[e+1],12,-389564586),l,g,n[e+2],17,606105819),m,l,n[e+3],22,-1044525330),v=o(v,m=o(m,l=o(l,g,v,m,n[e+4],7,-176418897),g,v,n[e+5],12,1200080426),l,g,n[e+6],17,-1473231341),m,l,n[e+7],22,-45705983),v=o(v,m=o(m,l=o(l,g,v,m,n[e+8],7,1770035416),g,v,n[e+9],12,-1958414417),l,g,n[e+10],17,-42063),m,l,n[e+11],22,-1990404162),v=o(v,m=o(m,l=o(l,g,v,m,n[e+12],7,1804603682),g,v,n[e+13],12,-40341101),l,g,n[e+14],17,-1502002290),m,l,n[e+15],22,1236535329),v=u(v,m=u(m,l=u(l,g,v,m,n[e+1],5,-165796510),g,v,n[e+6],9,-1069501632),l,g,n[e+11],14,643717713),m,l,n[e],20,-373897302),v=u(v,m=u(m,l=u(l,g,v,m,n[e+5],5,-701558691),g,v,n[e+10],9,38016083),l,g,n[e+15],14,-660478335),m,l,n[e+4],20,-405537848),v=u(v,m=u(m,l=u(l,g,v,m,n[e+9],5,568446438),g,v,n[e+14],9,-1019803690),l,g,n[e+3],14,-187363961),m,l,n[e+8],20,1163531501),v=u(v,m=u(m,l=u(l,g,v,m,n[e+13],5,-1444681467),g,v,n[e+2],9,-51403784),l,g,n[e+7],14,1735328473),m,l,n[e+12],20,-1926607734),v=c(v,m=c(m,l=c(l,g,v,m,n[e+5],4,-378558),g,v,n[e+8],11,-2022574463),l,g,n[e+11],16,1839030562),m,l,n[e+14],23,-35309556),v=c(v,m=c(m,l=c(l,g,v,m,n[e+1],4,-1530992060),g,v,n[e+4],11,1272893353),l,g,n[e+7],16,-155497632),m,l,n[e+10],23,-1094730640),v=c(v,m=c(m,l=c(l,g,v,m,n[e+13],4,681279174),g,v,n[e],11,-358537222),l,g,n[e+3],16,-722521979),m,l,n[e+6],23,76029189),v=c(v,m=c(m,l=c(l,g,v,m,n[e+9],4,-640364487),g,v,n[e+12],11,-421815835),l,g,n[e+15],16,530742520),m,l,n[e+2],23,-995338651),v=f(v,m=f(m,l=f(l,g,v,m,n[e],6,-198630844),g,v,n[e+7],10,1126891415),l,g,n[e+14],15,-1416354905),m,l,n[e+5],21,-57434055),v=f(v,m=f(m,l=f(l,g,v,m,n[e+12],6,1700485571),g,v,n[e+3],10,-1894986606),l,g,n[e+10],15,-1051523),m,l,n[e+1],21,-2054922799),v=f(v,m=f(m,l=f(l,g,v,m,n[e+8],6,1873313359),g,v,n[e+15],10,-30611744),l,g,n[e+6],15,-1560198380),m,l,n[e+13],21,1309151649),v=f(v,m=f(m,l=f(l,g,v,m,n[e+4],6,-145523070),g,v,n[e+11],10,-1120210379),l,g,n[e+2],15,718787259),m,l,n[e+9],21,-343485551),l=t(l,i),g=t(g,a),v=t(v,d),m=t(m,h);return[l,g,v,m]}function a(n){var t,r="",e=32*n.length;for(t=0;t<e;t+=8)r+=String.fromCharCode(n[t>>5]>>>t%32&255);return r}function d(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var e=8*n.length;for(t=0;t<e;t+=8)r[t>>5]|=(255&n.charCodeAt(t/8))<<t%32;return r}function h(n){return a(i(d(n),8*n.length))}function l(n,t){var r,e,o=d(n),u=[],c=[];for(u[15]=c[15]=void 0,o.length>16&&(o=i(o,8*n.length)),r=0;r<16;r+=1)u[r]=909522486^o[r],c[r]=1549556828^o[r];return e=i(u.concat(d(t)),512+8*t.length),a(i(c.concat(e),640))}function g(n){var t,r,e="";for(r=0;r<n.length;r+=1)t=n.charCodeAt(r),e+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return e}function v(n){return unescape(encodeURIComponent(n))}function m(n){return h(v(n))}function p(n){return g(m(n))}function s(n,t){return l(v(n),v(t))}function C(n,t){return g(s(n,t))}function A(n,t,r){return t?r?s(t,n):C(t,n):r?m(n):p(n)}"object"==typeof module&&module.exports?module.exports=A:n.md5=A}(this);
/** /**
* 所有相关配置项 * 所有相关配置项
*/ */
const config = { const url_test = {
// URL_PATH: 'http://dev.ezijing.com:3000/api', // 本地开发域名 // URL_PATH: 'http://dev.ezijing.com:3000/api', // 本地开发域名
// outSiteLink: 'https://applets.ezijing.com', // 本地测试外链 // outSiteLink: 'https://applets.ezijing.com', // 本地测试外链
// URL_PATH: 'https://api2.ezijing.com', // 测试域名 // URL_PATH: 'https://api2.ezijing.com', // 测试域名
// outSiteLink: 'https://kelley2.ezijing.com', // 测试外链 // outSiteLink: 'https://kelley2.ezijing.com', // 测试外链
URL_PATH: 'https://api.ezijing.com/ep', // 正式域名 - 由于项目变动域名 URL_PATH: 'https://api.ezijing.com/tenant', // 正式域名 - 由于项目变动域名
URL_PATH1: 'https://lms-api2.ezijing.com', // 正式域名 - 由于项目变动域名
URL_PATH2: 'https://sso2.ezijing.com', // 正式域名 - 由于项目变动域名
outSiteLink: 'https://e-learning.ezijing.com', // 正式外链 outSiteLink: 'https://e-learning.ezijing.com', // 正式外链
tenant: 'zjkelley' tenant: 'zjkelley',
version: '3.1.3'
};
const url_online = {
URL_PATH: 'https://api.ezijing.com/tenant', // 正式域名 - 由于项目变动域名
URL_PATH1: 'https://lms-api.ezijing.com', // 正式域名 - 由于项目变动域名
URL_PATH2: 'https://sso.ezijing.com', // 正式域名 - 由于项目变动域名
outSiteLink: 'https://e-learning.ezijing.com', // 正式外链
tenant: 'zjkelley',
version: '3.1.3'
} }
let config = url_online;
/* 请求接口统一 重定义 */ /* 请求接口统一 重定义 */
const requestApi = (obj) => { const requestApi = (obj) => {
let _token = wx.getStorageSync('userSession').sessionKey;
if (!_token) {
wx.reLaunch({ url: '/pages/index/index' })
return ;
}
wx.request({ wx.request({
url: obj.url, url: obj.url,
data: obj.data || '', // 不必填 data: obj.data || '', // 不必填
header: { header: {
'skey': wx.getStorageSync('userSession').sessionKey, 'token': _token,
'tenant': config.tenant, 'tenant': config.tenant,
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
// 测试用 'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N',
// 'Cookie': '_idt=jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8; _ga=GA1.2.1777311393.1531910388; Hm_lvt_64d86060eda3e464ab4928484860b4ea=1531998677; pt_37c2513b=uid=K0MVCaW1zOQbL9Hlh4nwcA&nid=0&vid=j38J/KRanp7TFqxsiK0Ryw&vn=14&pvn=3&sact=1533523932802&to_flag=0&pl=NbnhKybdedL6K-YTE0zzsQ*pt*1533523932802; _pk_id.8.50b6=5e9684d55d7b51d1.1534129436.5.1534223988.1534222943.; Hm_lvt_35891a16eff03ec8bb219e4a00dbaf7a=1534307203; looyu_id=3aa78c2b7a744584f9f6fef015c4157b66_10036753%3A6; Qs_lvt_217181=1534307202; pt_s_6d83a9d6=vt=1534308606705&cad=; Hm_lpvt_35891a16eff03ec8bb219e4a00dbaf7a=1534308607; Qs_pv_217181=4039008301502242300%2C2643992663734177300%2C23948192170497664%2C3823352575569261000; pt_6d83a9d6=uid=EXg24v5T9wUibq5/wWWZCg&nid=0&vid=4NDbaXQ0RlX8HEv7TTSzkA&vn=8&pvn=2&sact=1534308606705&to_flag=1&pl=Rcddj0FCL0MTlYRofJeCeA*pt*1534308606705; Hm_lvt_81efeffaf531027591c4d577ee4a5cb4=1533525823,1534473796; _SUP=00da585a6b1b53bd453d1b30cbf9812ff9ef0313e4f5756651f3218543452c27a%3A2%3A%7Bi%3A0%3Bs%3A4%3A%22_SUP%22%3Bi%3A1%3Bs%3A144%3A%22MFpTR3h1QmtTSlM1Z3JvLmVscG1heGUuMTBzYWMtZWRPWnFoeDdsMFlCTkFiTFNjZFl3UVVDZkVwa3N3UlgxZEFVQTlkTnFhRU54c3RLUGEtMTI1LVRHVDAuNDI3NDQ0ODQ4ODA1MzQ5MDU%3D%22%3B%7D; Hm_lpvt_81efeffaf531027591c4d577ee4a5cb4=1535072424; _pk_id.7.50b6=a73f1add4efca30d.1531815381.52.1535110040.1535110040.; _pk_ses.7.50b6=*' 'version': config.version
}, },
method: obj.method || 'GET', // 不必填,默认 GET method: obj.method || 'GET', // 不必填,默认 GET
dataType: 'json', dataType: 'json',
...@@ -32,6 +50,11 @@ const requestApi = (obj) => { ...@@ -32,6 +50,11 @@ const requestApi = (obj) => {
// wx.showToast({ title: JSON.stringify(res.data), icon: 'none' }) // 自己后台封装返回 // wx.showToast({ title: JSON.stringify(res.data), icon: 'none' }) // 自己后台封装返回
// } // }
obj.callback(res) obj.callback(res)
} else if (res.statusCode === 403 || res.statusCode === 401) {
/* 未授权登录,跳转首页 */
wx.reLaunch({
url: '/pages/index/index'
})
} else { } else {
wx.showToast({ title: res.errMsg, icon: 'none' }) // 微信封装返回 wx.showToast({ title: res.errMsg, icon: 'none' }) // 微信封装返回
} }
...@@ -40,7 +63,7 @@ const requestApi = (obj) => { ...@@ -40,7 +63,7 @@ const requestApi = (obj) => {
wx.showToast({ title: JSON.stringify(res), icon: 'none' }) wx.showToast({ title: JSON.stringify(res), icon: 'none' })
} }
}) })
} };
/* 工具方法 - 播放时间 转化 h:m:s */ /* 工具方法 - 播放时间 转化 h:m:s */
const durationToTimeString = (duration) => { const durationToTimeString = (duration) => {
let h = Math.floor(duration / 3600); let h = Math.floor(duration / 3600);
...@@ -52,7 +75,7 @@ const durationToTimeString = (duration) => { ...@@ -52,7 +75,7 @@ const durationToTimeString = (duration) => {
let to = { h: tenify(h), m: tenify(m), s: tenify(s) } let to = { h: tenify(h), m: tenify(m), s: tenify(s) }
let format = 'h:m:s'; let format = 'h:m:s';
return format.replace(/h|m|s/g, k => to[k]).replace(/^00\:/, ''); return format.replace(/h|m|s/g, k => to[k]).replace(/^00\:/, '');
} };
/** /**
* 小程序 - 获取用户信息 * 小程序 - 获取用户信息
...@@ -94,7 +117,7 @@ const miniGetInfo = (callback) => { ...@@ -94,7 +117,7 @@ const miniGetInfo = (callback) => {
}, },
fail: res => { wx.hideLoading(); wx.showToast({ title: '用户凭证code获取失败,请重试', icon: 'none' }); } fail: res => { wx.hideLoading(); wx.showToast({ title: '用户凭证code获取失败,请重试', icon: 'none' }); }
}) })
} };
/** /**
* 登录api - 获取 openId 、userName等内容 * 登录api - 获取 openId 、userName等内容
...@@ -121,13 +144,69 @@ const loginApi = (obj, callback) => { ...@@ -121,13 +144,69 @@ const loginApi = (obj, callback) => {
semester_id = '' semester_id = ''
} }
wx.request({ wx.request({
<<<<<<< HEAD
url: config.URL_PATH + '/user/authorization', url: config.URL_PATH + '/user/authorization',
data: { code: obj.code, encrypted_data: obj.encryptedData, iv: obj.iv, course_ids: cids, semester_id: semester_id, class_id: class_id, survey_id: wenti_id, idt: config.tenant }, method: 'POST', header: { data: { code: obj.code, encrypted_data: obj.encryptedData, iv: obj.iv, course_ids: cids, semester_id: semester_id, class_id: class_id, survey_id: wenti_id, idt: config.tenant }, method: 'POST', header: {
tenant: config.tenant tenant: config.tenant
=======
url: config.URL_PATH1 + '/user/check-unionid',
data: { code: obj.code, encrypted_data: obj.encryptedData, iv: obj.iv }, method: 'POST', header: {
tenant: config.tenant,
'version': config.version,
apikey: 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N'
>>>>>>> master
}, },
success: res => { callback(res, obj); } success: res => {
if (res.statusCode == 200) {
wx.setStorageSync('union_id', res.data.union_id);
wx.setStorageSync('openId', res.data.open_id);
wx.request({
url: config.URL_PATH2 + '/user_center/wechat_login',
data: { wechat_unionid: res.data.union_id, service: 'applet.ezijing.com' }, method: 'POST', header: {
'tenant': config.tenant,
'content-type': 'application/x-www-form-urlencoded',
'version': config.version,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N'
},
success: res1 => {
if (res1.statusCode == 200) {
let _token = res1.data.ticket;
if (!_token) {
wx.reLaunch({ url: '/pages/index/index' })
return ;
}
wx.setStorageSync('userSession', { 'sessionKey': _token });
/* 获取用户信息 */
wx.request({
url: config.URL_PATH1 + '/user/check-access',
data: {}, method: 'GET', header: {
token: _token,
tenant: config.tenant,
'version': config.version,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N',
unionid: res.data.union_id
},
success: res2 => {
if (res2.statusCode != 200) { wx.showToast({ title: res2.data.message||'获取用户信息失败', icon: 'none' }); return; }
wx.setStorageSync("sid", res2.data.id);
wx.setStorageSync("uid", res1.data.uid);
callback(res1, obj);
}
})
}else{
callback(res1, obj);
}
}
})
} else {
callback(res, obj);
}
}
}) })
} };
/** /**
* 小程序 - 判断是否需要再次登录 并 跳转页面 * 小程序 - 判断是否需要再次登录 并 跳转页面
...@@ -151,15 +230,32 @@ const LoginAgainAndJumpPage = (callback) => { ...@@ -151,15 +230,32 @@ const LoginAgainAndJumpPage = (callback) => {
// miniGetInfo((res, obj) => { callback(res, obj); }) // miniGetInfo((res, obj) => { callback(res, obj); })
// } // }
miniGetInfo((res, obj) => { callback(res, obj); }) miniGetInfo((res, obj) => { callback(res, obj); })
} };
// 上报formid
module.exports = { const sendformid = (formId) => {
config: config, let _token = wx.getStorageSync('userSession').sessionKey;
requestApi: requestApi, if (!_token) {
durationToTimeString: durationToTimeString, wx.reLaunch({ url: '/pages/index/index' })
LoginAgainAndJumpPage: LoginAgainAndJumpPage, return ;
}
wx.request({
url: config.URL_PATH1 + '/v2/education/formid',
data:{
openid: wx.getStorageSync('openId'),
formid: formId
},
header:{
'token': _token,
'tenant': config.tenant,
'content-type': 'application/x-www-form-urlencoded',
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N',
'version': config.version
},
method:'POST'
})
} }
/** /**
* localStorage 中存放的 各种值 * localStorage 中存放的 各种值
* userSession - 调用 login 获取对应的 sessionKey openId等值 * userSession - 调用 login 获取对应的 sessionKey openId等值
...@@ -167,4 +263,12 @@ module.exports = { ...@@ -167,4 +263,12 @@ module.exports = {
* *
* videoCacheCtrlBar * videoCacheCtrlBar
* audioCacheCtrlBar * audioCacheCtrlBar
*/ */
\ No newline at end of file
module.exports = {
'config': config,
requestApi: requestApi,
durationToTimeString: durationToTimeString,
sendformid: sendformid,
LoginAgainAndJumpPage: LoginAgainAndJumpPage
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论