Commit 2db0f7f6 authored by 李维's avatar 李维

完成课程简介、课前导读

parent 6c758790
...@@ -16237,12 +16237,12 @@ ...@@ -16237,12 +16237,12 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 309.1, "width": 300,
"height": 200 "height": 200
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 1,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
...@@ -16276,7 +16276,7 @@ ...@@ -16276,7 +16276,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn_preview", "_name": "btn_works",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 355 "__id__": 355
...@@ -16302,8 +16302,8 @@ ...@@ -16302,8 +16302,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 132, "width": 134,
"height": 146 "height": 145
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -16314,7 +16314,7 @@ ...@@ -16314,7 +16314,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-88.55000000000001, 87.54999999999998,
0, 0,
0, 0,
0, 0,
...@@ -16337,7 +16337,7 @@ ...@@ -16337,7 +16337,7 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "acy2oxTeJHdrW4+lZ0/Qwt" "_id": "3eacMuXltPr7Dw6KEcip9i"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
...@@ -16355,7 +16355,7 @@ ...@@ -16355,7 +16355,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "33f68cc0-1138-4bef-8a65-0ec0dd6affc7" "__uuid__": "a3061d2b-c5dd-49ee-8f2a-4f1286bbd1e3"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
...@@ -16369,7 +16369,7 @@ ...@@ -16369,7 +16369,7 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": null, "_atlas": null,
"_id": "f1C1GGKNpN8q+9BC/CcO6K" "_id": "75CPT2R49BkaCxHpjhhKA2"
}, },
{ {
"__type__": "cc.Button", "__type__": "cc.Button",
...@@ -16441,7 +16441,7 @@ ...@@ -16441,7 +16441,7 @@
"hoverSprite": null, "hoverSprite": null,
"_N$disabledSprite": null, "_N$disabledSprite": null,
"_N$target": null, "_N$target": null,
"_id": "72amS9jGdEq4Zqz2Gl2Glv" "_id": "e7uYE8HhdMg7XnDwecbJcL"
}, },
{ {
"__type__": "cc.ClickEvent", "__type__": "cc.ClickEvent",
...@@ -16450,18 +16450,18 @@ ...@@ -16450,18 +16450,18 @@
}, },
"component": "", "component": "",
"_componentId": "0648bu4mu5LTadZtHOrsA2O", "_componentId": "0648bu4mu5LTadZtHOrsA2O",
"handler": "onClickPreview", "handler": "onClickMyWork",
"customEventData": "" "customEventData": ""
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn_works", "_name": "btn_preview",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 355 "__id__": 355
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 361 "__id__": 361
...@@ -16481,8 +16481,8 @@ ...@@ -16481,8 +16481,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 134, "width": 132,
"height": 145 "height": 146
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -16493,7 +16493,7 @@ ...@@ -16493,7 +16493,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
87.54999999999998, -88.55000000000001,
0, 0,
0, 0,
0, 0,
...@@ -16516,7 +16516,7 @@ ...@@ -16516,7 +16516,7 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "3eacMuXltPr7Dw6KEcip9i" "_id": "acy2oxTeJHdrW4+lZ0/Qwt"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
...@@ -16534,7 +16534,7 @@ ...@@ -16534,7 +16534,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "a3061d2b-c5dd-49ee-8f2a-4f1286bbd1e3" "__uuid__": "33f68cc0-1138-4bef-8a65-0ec0dd6affc7"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
...@@ -16548,7 +16548,7 @@ ...@@ -16548,7 +16548,7 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": null, "_atlas": null,
"_id": "75CPT2R49BkaCxHpjhhKA2" "_id": "f1C1GGKNpN8q+9BC/CcO6K"
}, },
{ {
"__type__": "cc.Button", "__type__": "cc.Button",
...@@ -16620,7 +16620,7 @@ ...@@ -16620,7 +16620,7 @@
"hoverSprite": null, "hoverSprite": null,
"_N$disabledSprite": null, "_N$disabledSprite": null,
"_N$target": null, "_N$target": null,
"_id": "e7uYE8HhdMg7XnDwecbJcL" "_id": "72amS9jGdEq4Zqz2Gl2Glv"
}, },
{ {
"__type__": "cc.ClickEvent", "__type__": "cc.ClickEvent",
...@@ -16629,7 +16629,7 @@ ...@@ -16629,7 +16629,7 @@
}, },
"component": "", "component": "",
"_componentId": "0648bu4mu5LTadZtHOrsA2O", "_componentId": "0648bu4mu5LTadZtHOrsA2O",
"handler": "onClickMyWork", "handler": "onClickPreview",
"customEventData": "" "customEventData": ""
}, },
{ {
...@@ -16657,10 +16657,10 @@ ...@@ -16657,10 +16657,10 @@
"_N$paddingRight": 0, "_N$paddingRight": 0,
"_N$paddingTop": 0, "_N$paddingTop": 0,
"_N$paddingBottom": 0, "_N$paddingBottom": 0,
"_N$spacingX": 43.1, "_N$spacingX": 30,
"_N$spacingY": 0, "_N$spacingY": 0,
"_N$verticalDirection": 1, "_N$verticalDirection": 1,
"_N$horizontalDirection": 0, "_N$horizontalDirection": 1,
"_N$affectedByScale": false, "_N$affectedByScale": false,
"_id": "82t6uGX5ZCQa3ul0X0rEY2" "_id": "82t6uGX5ZCQa3ul0X0rEY2"
}, },
...@@ -16676,8 +16676,8 @@ ...@@ -16676,8 +16676,8 @@
"_target": null, "_target": null,
"_alignFlags": 33, "_alignFlags": 33,
"_left": 0, "_left": 0,
"_right": 128.50399999999996, "_right": 50,
"_top": 10.853000000000065, "_top": 10,
"_bottom": 0, "_bottom": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
...@@ -16709,10 +16709,10 @@ ...@@ -16709,10 +16709,10 @@
"__id__": 288 "__id__": 288
}, },
"btn_preview": { "btn_preview": {
"__id__": 356 "__id__": 360
}, },
"btn_works": { "btn_works": {
"__id__": 360 "__id__": 356
}, },
"LessonBrief": { "LessonBrief": {
"__id__": 367 "__id__": 367
...@@ -17714,7 +17714,7 @@ ...@@ -17714,7 +17714,7 @@
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0.5,
"y": 0.5 "y": 1
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
...@@ -17860,7 +17860,7 @@ ...@@ -17860,7 +17860,7 @@
"_N$spacingY": 0, "_N$spacingY": 0,
"_N$verticalDirection": 1, "_N$verticalDirection": 1,
"_N$horizontalDirection": 0, "_N$horizontalDirection": 0,
"_N$affectedByScale": false, "_N$affectedByScale": true,
"_id": "ef7aaH09FMxo1kWgHv8HXv" "_id": "ef7aaH09FMxo1kWgHv8HXv"
}, },
{ {
...@@ -20271,12 +20271,12 @@ ...@@ -20271,12 +20271,12 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 307.1, "width": 300,
"height": 200 "height": 200
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 1,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
...@@ -20310,7 +20310,7 @@ ...@@ -20310,7 +20310,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn_preview", "_name": "btn_report",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 447 "__id__": 447
...@@ -20337,7 +20337,7 @@ ...@@ -20337,7 +20337,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 132, "width": 132,
"height": 146 "height": 156
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -20348,7 +20348,7 @@ ...@@ -20348,7 +20348,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-87.55000000000001, 87.54999999999998,
0, 0,
0, 0,
0, 0,
...@@ -20371,7 +20371,7 @@ ...@@ -20371,7 +20371,7 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "daZbKDXeRL6p61ia9th4DH" "_id": "bbYm4ulkdLWayJ6XXfJlN7"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
...@@ -20389,7 +20389,7 @@ ...@@ -20389,7 +20389,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "d7732bc5-b894-4e65-8941-163c7e811c27" "__uuid__": "08b55b20-8445-4a76-a7ed-7533aa2d1e29"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
...@@ -20403,7 +20403,7 @@ ...@@ -20403,7 +20403,7 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": null, "_atlas": null,
"_id": "1djEPfj/lAMqKZNjET09y3" "_id": "0588Nk8WtKwLTMcAfjArFE"
}, },
{ {
"__type__": "cc.Button", "__type__": "cc.Button",
...@@ -20475,7 +20475,7 @@ ...@@ -20475,7 +20475,7 @@
"hoverSprite": null, "hoverSprite": null,
"_N$disabledSprite": null, "_N$disabledSprite": null,
"_N$target": null, "_N$target": null,
"_id": "12YBaiZg5LerlPq+z3+5cQ" "_id": "1cyxW8pn9Id631u1KoSVdD"
}, },
{ {
"__type__": "cc.ClickEvent", "__type__": "cc.ClickEvent",
...@@ -20484,18 +20484,18 @@ ...@@ -20484,18 +20484,18 @@
}, },
"component": "", "component": "",
"_componentId": "9b9bchIHGtCaZ5ox/9QJGCT", "_componentId": "9b9bchIHGtCaZ5ox/9QJGCT",
"handler": "onClickOpenLessonPreview", "handler": "onClickOpenLessonReport",
"customEventData": "" "customEventData": ""
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn_report", "_name": "btn_preview",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 447 "__id__": 447
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 453 "__id__": 453
...@@ -20516,7 +20516,7 @@ ...@@ -20516,7 +20516,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 132, "width": 132,
"height": 156 "height": 146
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -20527,7 +20527,7 @@ ...@@ -20527,7 +20527,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
87.54999999999998, -87.55000000000001,
0, 0,
0, 0,
0, 0,
...@@ -20550,7 +20550,7 @@ ...@@ -20550,7 +20550,7 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "bbYm4ulkdLWayJ6XXfJlN7" "_id": "daZbKDXeRL6p61ia9th4DH"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
...@@ -20568,7 +20568,7 @@ ...@@ -20568,7 +20568,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "08b55b20-8445-4a76-a7ed-7533aa2d1e29" "__uuid__": "d7732bc5-b894-4e65-8941-163c7e811c27"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
...@@ -20582,7 +20582,7 @@ ...@@ -20582,7 +20582,7 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": null, "_atlas": null,
"_id": "0588Nk8WtKwLTMcAfjArFE" "_id": "1djEPfj/lAMqKZNjET09y3"
}, },
{ {
"__type__": "cc.Button", "__type__": "cc.Button",
...@@ -20654,7 +20654,7 @@ ...@@ -20654,7 +20654,7 @@
"hoverSprite": null, "hoverSprite": null,
"_N$disabledSprite": null, "_N$disabledSprite": null,
"_N$target": null, "_N$target": null,
"_id": "1cyxW8pn9Id631u1KoSVdD" "_id": "12YBaiZg5LerlPq+z3+5cQ"
}, },
{ {
"__type__": "cc.ClickEvent", "__type__": "cc.ClickEvent",
...@@ -20663,7 +20663,7 @@ ...@@ -20663,7 +20663,7 @@
}, },
"component": "", "component": "",
"_componentId": "9b9bchIHGtCaZ5ox/9QJGCT", "_componentId": "9b9bchIHGtCaZ5ox/9QJGCT",
"handler": "onClickOpenLessonReport", "handler": "onClickOpenLessonPreview",
"customEventData": "" "customEventData": ""
}, },
{ {
...@@ -20691,10 +20691,10 @@ ...@@ -20691,10 +20691,10 @@
"_N$paddingRight": 0, "_N$paddingRight": 0,
"_N$paddingTop": 0, "_N$paddingTop": 0,
"_N$paddingBottom": 0, "_N$paddingBottom": 0,
"_N$spacingX": 43.1, "_N$spacingX": 30,
"_N$spacingY": 0, "_N$spacingY": 0,
"_N$verticalDirection": 1, "_N$verticalDirection": 1,
"_N$horizontalDirection": 0, "_N$horizontalDirection": 1,
"_N$affectedByScale": false, "_N$affectedByScale": false,
"_id": "92yqrv+SlC4pdSNZb8yreX" "_id": "92yqrv+SlC4pdSNZb8yreX"
}, },
...@@ -20710,8 +20710,8 @@ ...@@ -20710,8 +20710,8 @@
"_target": null, "_target": null,
"_alignFlags": 33, "_alignFlags": 33,
"_left": 0, "_left": 0,
"_right": 129.50399999999996, "_right": 50,
"_top": 10.853000000000065, "_top": 10,
"_bottom": 0, "_bottom": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
...@@ -21028,10 +21028,10 @@ ...@@ -21028,10 +21028,10 @@
"__uuid__": "3a7bb79f-32fd-422e-ada2-96f518fed422" "__uuid__": "3a7bb79f-32fd-422e-ada2-96f518fed422"
}, },
"btn_preview": { "btn_preview": {
"__id__": 448 "__id__": 452
}, },
"btn_report": { "btn_report": {
"__id__": 452 "__id__": 448
}, },
"headNode": { "headNode": {
"__id__": 459 "__id__": 459
......
...@@ -20,19 +20,27 @@ export default class LessonBrief extends cc.Component { ...@@ -20,19 +20,27 @@ export default class LessonBrief extends cc.Component {
} }
data data
setData(data) {
setData(data){ this.data = data
this.data=data
} }
refreshUI(){ async refreshUI() {
if(!this.data) return if (!this.data) return
const sv = cc.find("/contentSV", this.node).getComponent(cc.ScrollView)
sv.scrollToTop()
this.content.removeAllChildren() this.content.removeAllChildren()
getSprNodeByUrl(this.data.image, (spr) => { for(let index = 0; index <this.data.length; index ++) {
this.content.addChild(spr.node); const imgNode = await this.getImage(this.data[index].image);
spr.srcBlendFactor = cc.macro.BlendFactor.ONE this.content.addChild(imgNode);
}); }
} }
getImage(url) {
return new Promise(resovle=>{
getSprNodeByUrl(url, (spr) => {
spr.node.scale = (this.content.width - 50) / spr.node.width;
resovle(spr.node)
});
})
}
} }
...@@ -25,7 +25,7 @@ export default class NewClass extends cc.Component { ...@@ -25,7 +25,7 @@ export default class NewClass extends cc.Component {
loading: cc.Node = null; loading: cc.Node = null;
@property(cc.Material) @property(cc.Material)
gray:cc.Material = null; gray: cc.Material = null;
@property(cc.Node) @property(cc.Node)
btn_preview: cc.Node = null; btn_preview: cc.Node = null;
...@@ -40,8 +40,8 @@ export default class NewClass extends cc.Component { ...@@ -40,8 +40,8 @@ export default class NewClass extends cc.Component {
@property(cc.Node) @property(cc.Node)
LessonReport: cc.Node = null; LessonReport: cc.Node = null;
data=[]; data = [];
configData=[]; configData = [];
userInfo = null userInfo = null
handleClickBackBtn() { handleClickBackBtn() {
...@@ -80,71 +80,67 @@ export default class NewClass extends cc.Component { ...@@ -80,71 +80,67 @@ export default class NewClass extends cc.Component {
} }
async initData() { async initData() {
const {rows} = await asyncCallNetworkApiGet(`/api/syllabus/v1/list`, {pid: this.node['syllabus_pid']}); const { rows } = await asyncCallNetworkApiGet(`/api/syllabus/v1/list`, { pid: this.node['syllabus_pid'], deep: 2 });
this.data=[] this.data = []
let _configData = [] let _configData = null;
this.configData=[] for (let v of rows) {
for (let v of rows){ if (v.name == "config") {
if (v.name == "config"){ _configData = v
_configData.push(v)
} else { } else {
this.data.push(v) this.data.push(v)
} }
} }
if (_configData[0]){ if (_configData) {
const {rows} = await asyncCallNetworkApiGet(`/api/courseware/v2/${_configData[0].id}/list`, {}); const { rows } = await asyncCallNetworkApiGet(`/api/courseware/v2/${_configData.id}/list`, {});
if (rows && rows[0] && rows[0].data){ if (rows && rows[0] && rows[0].data) {
let _data = JSON.parse(rows[0].data) let _data = JSON.parse(rows[0].data)
this.configData=_data.pages this.configData = _data.pages
this.nameLblStr=_data.title this.nameLblStr = _data.title
this.headSprStr=_data.teacher_avatar this.headSprStr = _data.teacher_avatar
} }
} }
this.refreshConfig() this.refreshConfig()
// 数据汇报 // 数据汇报
if (this.node["pData"] && this.node["pData"].id!=null){ if (this.node["pData"] && this.node["pData"].id != null) {
const {code, msg, results} = await asyncCallNetworkApiGet(`/api/kyxq/v1/user/course/report`, {syllabusid:this.node["pData"].id}) const { code, msg, results } = await asyncCallNetworkApiGet(`/api/kyxq/v1/user/course/report`, { syllabusid: this.node["pData"].id })
if (code != '200'){ if (code != '200') {
// 当前没有数据不显示按钮 // 当前没有数据不显示按钮
this.btn_report.active=false this.btn_report.active = false
} else { } else {
this.btn_report.active=true this.btn_report.active = true
this.reportData=results this.reportData = results
} }
} else { } else {
this.btn_report.active=false this.btn_report.active = false
} }
} }
nameLblStr = "" nameLblStr = "";
headSprStr = "" headSprStr = "";
refreshConfig(){ refreshConfig() {
if (this.configData && this.configData.length>0){ if (this.configData && this.configData.length > 0) {
this.btn_preview.active=true this.btn_preview.active = true;
// this.nameLbl.node.active=true this.headNode.active = false;
// this.nameLbl.string=this.nameLblStr
this.headNode.active=false
getSprNodeByUrl(this.headSprStr, (spr) => { getSprNodeByUrl(this.headSprStr, (spr) => {
this.headNode.addChild(spr.node); this.headNode.addChild(spr.node);
spr.srcBlendFactor = cc.macro.BlendFactor.ONE spr.srcBlendFactor = cc.macro.BlendFactor.ONE;
setSprNodeMaxLen(spr.node, this.headNode.width, this.headNode.height); setSprNodeMaxLen(spr.node, this.headNode.width, this.headNode.height);
this.headNode.active=true this.headNode.active = true;
}); });
} else { } else {
this.btn_preview.active=false this.btn_preview.active = false;
this.headNode.active=false this.headNode.active = false;
// this.nameLbl.node.active=false
} }
} }
getConfigData(){ getConfigData() {
return this.configData return this.configData
} }
reportData reportData
getReportData(){ getReportData() {
return this.reportData return this.reportData
} }
...@@ -154,7 +150,7 @@ export default class NewClass extends cc.Component { ...@@ -154,7 +150,7 @@ export default class NewClass extends cc.Component {
return; return;
} }
const syllabuses = this.data.map(item => item.id); const syllabuses = this.data.map(item => item.id);
const {rows} = await asyncCallNetworkApiGet(`/api/kyxq/v1/user/syllabus/status`, {syllabuses: syllabuses.join(",")}); const { rows } = await asyncCallNetworkApiGet(`/api/kyxq/v1/user/syllabus/status`, { syllabuses: syllabuses.join(",") });
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
const row = rows[i]; const row = rows[i];
if (syllabuses.includes(row.id)) { if (syllabuses.includes(row.id)) {
...@@ -162,7 +158,7 @@ export default class NewClass extends cc.Component { ...@@ -162,7 +158,7 @@ export default class NewClass extends cc.Component {
} }
} }
} }
async initView() { async initView() {
this.initTitle(); this.initTitle();
this.initListView(); this.initListView();
...@@ -170,20 +166,20 @@ export default class NewClass extends cc.Component { ...@@ -170,20 +166,20 @@ export default class NewClass extends cc.Component {
async initTitle() { async initTitle() {
const titleLabelNode = cc.find("bg/bg_title/label", this.node); const titleLabelNode = cc.find("bg/bg_title/label", this.node);
const titleLabel = titleLabelNode.getComponent(cc.Label); const titleLabel = titleLabelNode.getComponent(cc.Label);
titleLabel.string = this.node['pData'].name; titleLabel.string = this.node['pData'].name;
const bgTitle = titleLabelNode.parent; const bgTitle = titleLabelNode.parent;
if (!bgTitle['baseW']) { if (!bgTitle['baseW']) {
bgTitle['baseW'] = bgTitle.width; bgTitle['baseW'] = bgTitle.width;
} }
const baseW = bgTitle['baseW']; const baseW = bgTitle['baseW'];
await asyncDelay(0.01); await asyncDelay(0.01);
if (titleLabelNode.width * 1.2 > baseW) { if (titleLabelNode.width * 1.2 > baseW) {
bgTitle.width = titleLabelNode.width * 1.2; bgTitle.width = titleLabelNode.width * 1.2;
} else { } else {
bgTitle.width = baseW; bgTitle.width = baseW;
} }
} }
...@@ -214,12 +210,12 @@ export default class NewClass extends cc.Component { ...@@ -214,12 +210,12 @@ export default class NewClass extends cc.Component {
this.initScrollViewItem(sv, itemArr, 1); this.initScrollViewItem(sv, itemArr, 1);
const content = sv.content; const content = sv.content;
const canvas = cc.find("Canvas"); const canvas = cc.find("Canvas");
if (content.width > canvas.width) { if (content.width > canvas.width) {
content.x = -canvas.width / 2; content.x = -canvas.width / 2;
} else { } else {
content.x = -content.width / 2; content.x = -content.width / 2;
} }
} }
...@@ -232,17 +228,17 @@ export default class NewClass extends cc.Component { ...@@ -232,17 +228,17 @@ export default class NewClass extends cc.Component {
const data = dataArr[i]; const data = dataArr[i];
const itemNode = cc.instantiate(this.listItem); const itemNode = cc.instantiate(this.listItem);
let unLock = this.userInfo.detail.cross_status == 1 ? true : this.syllabusLockStatusStore[data.id]==='unlock'; let unLock = this.userInfo.detail.cross_status == 1 ? true : this.syllabusLockStatusStore[data.id] === 'unlock';
if (i==0 && !unLock) { if (i == 0 && !unLock) {
// 如果第一个是未解锁的状态,需要上报一个解锁并且渲染成解锁的状态 // 如果第一个是未解锁的状态,需要上报一个解锁并且渲染成解锁的状态
asyncCallNetworkApiPost(`/api/kyxq/v1/user/unlock`, {syllabus_id: data.id}).then((res) => { asyncCallNetworkApiPost(`/api/kyxq/v1/user/unlock`, { syllabus_id: data.id }).then((res) => {
if (res.code != 200) { if (res.code != 200) {
global.middleLayer.showTips(`解锁失败`); global.middleLayer.showTips(`解锁失败`);
} }
}); });
unLock = true; unLock = true;
} }
data.unLock = unLock; data.unLock = unLock;
itemNode['data'] = data; itemNode['data'] = data;
...@@ -268,19 +264,19 @@ export default class NewClass extends cc.Component { ...@@ -268,19 +264,19 @@ export default class NewClass extends cc.Component {
} }
cardClick(evt: cc.Event) { cardClick(evt: cc.Event) {
const {id, unLock} = evt.currentTarget.data; const { id, unLock } = evt.currentTarget.data;
if (!unLock) { if (!unLock) {
global.middleLayer.showTips(`未解锁`); global.middleLayer.showTips(`未解锁`);
return; return;
} }
if ( global.middleLayer ) { if (global.middleLayer) {
global.middleLayer.backPageNode = this.node; global.middleLayer.backPageNode = this.node;
// global.middleLayer.loadOnlineCourseWare(id); // global.middleLayer.loadOnlineCourseWare(id);
global.middleLayer.loadOnlineCourseWare(id, null, (flag)=>{ global.middleLayer.loadOnlineCourseWare(id, null, (flag) => {
this.node.active=!flag this.node.active = !flag
}); });
} }
} }
...@@ -325,43 +321,43 @@ export default class NewClass extends cc.Component { ...@@ -325,43 +321,43 @@ export default class NewClass extends cc.Component {
} }
onClickOpenLessonPreview(){ onClickOpenLessonPreview() {
this.LessonPreview.active=true this.LessonPreview.active = true
this.LessonPreview.getComponent("LessonPreview").setData(this.getConfigData()) this.LessonPreview.getComponent("LessonPreview").setData(this.getConfigData())
this.LessonPreview.getComponent("LessonPreview").refreshUI() this.LessonPreview.getComponent("LessonPreview").refreshUI()
} }
onClickOpenLessonReport(){ onClickOpenLessonReport() {
this.LessonReport.active=true this.LessonReport.active = true
this.LessonReport.getComponent("LessonReport").setData(this.getReportData()) this.LessonReport.getComponent("LessonReport").setData(this.getReportData())
this.LessonReport.getComponent("LessonReport").refreshUI() this.LessonReport.getComponent("LessonReport").refreshUI()
} }
async onClickDebug(){ async onClickDebug() {
const {code, msg, results} = await asyncCallNetworkApiGet(`/api/kyxq/v1/user/course/report`, {syllabusid:34396}) const { code, msg, results } = await asyncCallNetworkApiGet(`/api/kyxq/v1/user/course/report`, { syllabusid: 34396 })
this.LessonReport.active=true this.LessonReport.active = true
results.excellents.push({ results.excellents.push({
overall:94, overall: 94,
record_url:"https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3", record_url: "https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3",
example_url:"https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3", example_url: "https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3",
test_text:"one two three", test_text: "one two three",
}) })
results.excellents.push({ results.excellents.push({
overall:80, overall: 80,
record_url:"https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3", record_url: "https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3",
example_url:"https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3", example_url: "https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3",
test_text:"what's is your name", test_text: "what's is your name",
}) })
results.tryagains.push({ results.tryagains.push({
overall:55, overall: 55,
record_url:"https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3", record_url: "https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3",
example_url:"https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3", example_url: "https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3",
test_text:"what's is your name", test_text: "what's is your name",
}) })
results.tryagains.push({ results.tryagains.push({
overall:23, overall: 23,
record_url:"https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3", record_url: "https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3",
example_url:"https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3", example_url: "https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3",
test_text:"what's is your name", test_text: "what's is your name",
}) })
this.LessonReport.getComponent("LessonReport").setData(results) this.LessonReport.getComponent("LessonReport").setData(results)
this.LessonReport.getComponent("LessonReport").refreshUI() this.LessonReport.getComponent("LessonReport").refreshUI()
......
...@@ -97,7 +97,6 @@ export default class NewClass extends cc.Component { ...@@ -97,7 +97,6 @@ export default class NewClass extends cc.Component {
} }
const saveKey = `SyllabusTree_${syllabus_pid}`; const saveKey = `SyllabusTree_${syllabus_pid}`;
const treeData = this.getStatus(saveKey); const treeData = this.getStatus(saveKey);
console.log(treeData)
const nowDate = new Date().getTime(); const nowDate = new Date().getTime();
const expTime = 10 * 60 * 1000; // 10分钟超期 const expTime = 10 * 60 * 1000; // 10分钟超期
if(treeData && (nowDate - treeData.updateTime) < expTime) { if(treeData && (nowDate - treeData.updateTime) < expTime) {
......
...@@ -46,7 +46,6 @@ export default class NewClass extends cc.Component { ...@@ -46,7 +46,6 @@ export default class NewClass extends cc.Component {
} }
async onEnable() { async onEnable() {
console.log("Unit page on Enabel")
await this.initView(); await this.initView();
} }
...@@ -118,27 +117,25 @@ export default class NewClass extends cc.Component { ...@@ -118,27 +117,25 @@ export default class NewClass extends cc.Component {
} }
configData=[] configData = []
async initUnitListView() { async initUnitListView() {
console.log("initUnitListView")
const svNode = this.unitScrollView; const svNode = this.unitScrollView;
svNode.opacity = 0; svNode.opacity = 0;
const resData = await this.Viewer.getComponent("PageViewer").getSyllabusTreeByPid(this.node['syllabus_pid']) const resData = await this.Viewer.getComponent("PageViewer").getSyllabusTreeByPid(this.node['syllabus_pid'])
let rows=[] let rows = []
this.configData=[] this.configData = null
for (let v of resData.rows){ for (let v of resData.rows) {
if (v.name=="config"){ if (v.name == "config") {
const {rows} = await asyncCallNetworkApiGet(`/api/courseware/v2/${v.id}/list`, {}); // 课程配置文件
if (rows && rows[0] && rows[0].data){ const _strData = (v.children && v.children[0] && v.children[0].template_name == "sn_config" && v.children[0].data) ? v.children && v.children[0] && v.children[0].data : "{}"
let _data = JSON.parse(rows[0].data) this.configData = JSON.parse(_strData)
this.configData=_data.pages
console.log("config data", this.configData)
}
} else { } else {
// 课程数据
rows.push(v) rows.push(v)
} }
} }
if (rows.length == 0) { if (rows.length == 0) {
const svNode = this.unitScrollView; const svNode = this.unitScrollView;
const sv = svNode.getComponent(cc.ScrollView); const sv = svNode.getComponent(cc.ScrollView);
...@@ -147,68 +144,55 @@ export default class NewClass extends cc.Component { ...@@ -147,68 +144,55 @@ export default class NewClass extends cc.Component {
return; return;
} }
await this.getAndStoreSyllabusStatus(rows); await this.getAndStoreSyllabusStatus(rows);
// const svNode = this.unitScrollView; // const svNode = this.unitScrollView;
const view = cc.find("view", svNode); const view = cc.find("view", svNode);
view.width = svNode.width; view.width = svNode.width;
view.height = svNode.height; view.height = svNode.height;
const itemArr = this.getUnitItemDataArr(rows); const itemArr = this.getUnitItemDataArr(rows);
const sv = svNode.getComponent(cc.ScrollView); const sv = svNode.getComponent(cc.ScrollView);
this.initScrollViewItem(sv, itemArr, 1); this.initScrollViewItem(sv, itemArr, 1);
const content = sv.content;
const content = sv.content;
const canvas = cc.find("Canvas"); const canvas = cc.find("Canvas");
if (content.width > canvas.width) { if (content.width > canvas.width) {
content.x = -canvas.width / 2; content.x = -canvas.width / 2;
} else { } else {
content.x = -content.width / 2; content.x = -content.width / 2;
} }
// console.log('content.width: ' + content.width);
svNode.opacity = 255; svNode.opacity = 255;
this.refreshConfig() this.refreshConfig()
} }
// 刷新右上角“课程简介”按钮显示隐藏
refreshConfig(){ refreshConfig() {
if (this.configData.length>0){ if (this.configData.introduces.length > 0) {
this.btn_preview.active=true this.btn_preview.active = true
} else { } else {
this.btn_preview.active=false this.btn_preview.active = false
} }
} }
listItem; listItem;
getUnitItemDataArr(dataArr) { getUnitItemDataArr(dataArr) {
let listItem = this.listItem; let listItem = this.listItem;
let subItem = cc.find("sub_item", listItem); let subItem = cc.find("sub_item", listItem);
let listLabel = cc.find("label", listItem); let listLabel = cc.find("label", listItem);
const itemArr = []; const itemArr = [];
for (let i=0; i<dataArr.length; i++) { for (let i=0; i<dataArr.length; i++) {
const data = dataArr[i]; const data = dataArr[i];
const itemNode = cc.instantiate(listItem); const itemNode = cc.instantiate(listItem);
itemNode['data'] = data; itemNode['data'] = data;
itemNode.removeAllChildren(); itemNode.removeAllChildren();
const subArr = data.children; const subArr = data.children;
const baseX = subItem.x; const baseX = subItem.x;
const baseY = subItem.y; const baseY = subItem.y;
const disX = 530; const disX = 530;
let lastX = 0; let lastX = 0;
for (let j=0; j<subArr.length; j++) { for (let j=0; j<subArr.length; j++) {
const subNode = cc.instantiate(subItem) const subNode = cc.instantiate(subItem)
subNode.x = baseX + j * disX; subNode.x = baseX + j * disX;
subNode.y = baseY; subNode.y = baseY;
...@@ -217,7 +201,6 @@ export default class NewClass extends cc.Component { ...@@ -217,7 +201,6 @@ export default class NewClass extends cc.Component {
lastX = subNode.x; lastX = subNode.x;
const subData = subArr[j]; const subData = subArr[j];
// console.log("subData: ", subData);
getSprNodeByUrl(subData.cover, (spr) => { getSprNodeByUrl(subData.cover, (spr) => {
const sprNode = spr.node; const sprNode = spr.node;
...@@ -226,7 +209,6 @@ export default class NewClass extends cc.Component { ...@@ -226,7 +209,6 @@ export default class NewClass extends cc.Component {
setSprNodeMaxLen(sprNode, picLayer.width, picLayer.height, true); setSprNodeMaxLen(sprNode, picLayer.width, picLayer.height, true);
}) })
const pointBase = cc.find("point", subNode); const pointBase = cc.find("point", subNode);
const pointLayer = cc.find("pint_layer", subNode); const pointLayer = cc.find("pint_layer", subNode);
...@@ -237,7 +219,6 @@ export default class NewClass extends cc.Component { ...@@ -237,7 +219,6 @@ export default class NewClass extends cc.Component {
const clsData = subData.children[k]; const clsData = subData.children[k];
const pointNode = cc.instantiate(pointBase); const pointNode = cc.instantiate(pointBase);
pointNode.opacity = 255; pointNode.opacity = 255;
if (clsData) { if (clsData) {
const finished = this.syllabusLockStatusStore[clsData.id]==='finished'; const finished = this.syllabusLockStatusStore[clsData.id]==='finished';
if (!finished) { if (!finished) {
...@@ -265,16 +246,12 @@ export default class NewClass extends cc.Component { ...@@ -265,16 +246,12 @@ export default class NewClass extends cc.Component {
const labelNode = cc.find("label", subNode); const labelNode = cc.find("label", subNode);
const label = labelNode.getComponent(cc.Label); const label = labelNode.getComponent(cc.Label);
label.string = subData.name; label.string = subData.name;
subNode.addComponent(cc.Button); subNode.addComponent(cc.Button);
subNode.on("click", () => { subNode.on("click", () => {
const vc = this.Viewer.getComponent("PageViewer"); const vc = this.Viewer.getComponent("PageViewer");
vc.missionPage.attr({syllabus_pid: subData.id}); vc.missionPage.attr({syllabus_pid: subData.id});
vc.missionPage.attr({pData: subData}); vc.missionPage.attr({pData: subData});
vc.toView("MissionPage", "rightIn") vc.toView("MissionPage", "rightIn")
}) })
} }
...@@ -283,56 +260,39 @@ export default class NewClass extends cc.Component { ...@@ -283,56 +260,39 @@ export default class NewClass extends cc.Component {
const label = labelNode.getComponent(cc.Label); const label = labelNode.getComponent(cc.Label);
label.string = data.name//"Unit " + (i + 1); label.string = data.name//"Unit " + (i + 1);
itemNode.addChild(labelNode); itemNode.addChild(labelNode);
// if (subArr.length > 2) { // if (subArr.length > 2) {
itemNode.width = lastX + 360; itemNode.width = lastX + 360;
setTimeout(() => { setTimeout(() => {
itemNode.width = lastX + 360; itemNode.width = lastX + 360;
}, 1); }, 1);
// } // }
itemArr.push(itemNode); itemArr.push(itemNode);
} }
return itemArr; return itemArr;
} }
initScrollViewItem(sv, itemArr, row=1) { initScrollViewItem(sv, itemArr, row=1) {
sv.scrollToTop(); sv.scrollToTop();
const content = sv.content; const content = sv.content;
content.width = sv.node.width; content.width = sv.node.width;
content.height = sv.node.height; content.height = sv.node.height;
content.removeAllChildren(); content.removeAllChildren();
const tempH = content.height / row; const tempH = content.height / row;
const disY = tempH * 0.95; const disY = tempH * 0.95;
const baseY = (row - 1) * 0.5 * disY; const baseY = (row - 1) * 0.5 * disY;
let rowCount = 0; let rowCount = 0;
const disX = 40; const disX = 40;
const baseX = itemArr[0].scaleX + disX;
let colCount = 0; let colCount = 0;
let lastX = 0; let lastX = 0;
for (let i=0; i<itemArr.length; i++) { for (let i=0; i<itemArr.length; i++) {
const item = itemArr[i]; const item = itemArr[i];
item.x = lastX + disX; item.x = lastX + disX;
item.y = baseY - rowCount * disY; item.y = baseY - rowCount * disY;
lastX = item.x + item.width * item.scale; lastX = item.x + item.width * item.scale;
content.addChild(itemArr[i]); content.addChild(itemArr[i]);
const tempW = Math.abs(item.x + disX + item.width / 2 * item.scale); const tempW = Math.abs(item.x + disX + item.width / 2 * item.scale);
content.width = lastX + disX; content.width = lastX + disX;
rowCount++; rowCount++;
if (rowCount >= row) { if (rowCount >= row) {
rowCount = 0; rowCount = 0;
...@@ -341,12 +301,9 @@ export default class NewClass extends cc.Component { ...@@ -341,12 +301,9 @@ export default class NewClass extends cc.Component {
} }
} }
onClickPreview(){ onClickPreview() {
this.LessonBrief.active=true this.LessonBrief.active = true
let _data=this.configData this.LessonBrief.getComponent("LessonBrief").setData(this.configData.introduces)
if (_data && _data[0]){
this.LessonBrief.getComponent("LessonBrief").setData(_data[0])
}
this.LessonBrief.getComponent("LessonBrief").refreshUI() this.LessonBrief.getComponent("LessonBrief").refreshUI()
} }
...@@ -361,7 +318,6 @@ export default class NewClass extends cc.Component { ...@@ -361,7 +318,6 @@ export default class NewClass extends cc.Component {
vc[`libraryVideoPage`].attr({fromPage: "UnitPage"}); vc[`libraryVideoPage`].attr({fromPage: "UnitPage"});
vc.toView(`LibraryVideoPage`, "rightIn"); vc.toView(`LibraryVideoPage`, "rightIn");
} }
// update (dt) {} // update (dt) {}
} }
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
"height": 460, "height": 460,
"rawWidth": 29, "rawWidth": 29,
"rawHeight": 460, "rawHeight": 460,
"borderTop": 0, "borderTop": 30,
"borderBottom": 0, "borderBottom": 30,
"borderLeft": 0, "borderLeft": 0,
"borderRight": 0, "borderRight": 0,
"subMetas": {} "subMetas": {}
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
"height": 460, "height": 460,
"rawWidth": 29, "rawWidth": 29,
"rawHeight": 460, "rawHeight": 460,
"borderTop": 0, "borderTop": 30,
"borderBottom": 0, "borderBottom": 30,
"borderLeft": 0, "borderLeft": 0,
"borderRight": 0, "borderRight": 0,
"subMetas": {} "subMetas": {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment