Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cocosTest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
cocosTest
Commits
bce5060a
Commit
bce5060a
authored
Sep 15, 2019
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加接口修改
parent
29ed7445
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
27 deletions
+104
-27
.gitignore
.gitignore
+1
-0
form.component.ts
src/app/form/form.component.ts
+29
-9
play.component.ts
src/app/play/play.component.ts
+15
-10
index.html
src/index.html
+59
-8
No files found.
.gitignore
View file @
bce5060a
...
...
@@ -9,6 +9,7 @@
# dependencies
/node_modules
/publish
# profiling files
chrome-profiler-events*.json
...
...
src/app/form/form.component.ts
View file @
bce5060a
...
...
@@ -8,19 +8,37 @@ import * as _ from 'lodash';
})
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// titleObj = {
// audio_url: 'http://iplayabc-courseware.oss-cn-beijing.aliyuncs.com/dev/imman/audios/d108d5d06105fda0526059a3e372f926.mp3',
// content: 'what is this? ',
// icons: [],
// type: 'a'
// };
titleObj
=
{
audio_url
:
'
http://iplayabc-courseware.oss-cn-beijing.aliyuncs.com/dev/imman/audios/d108d5d06105fda0526059a3e372f926.mp3
'
,
content
:
'
what is this?
'
,
audio_url
:
''
,
content
:
''
,
icons
:
[],
type
:
'
a
'
type
:
''
};
constructor
()
{
teststr
=
""
;
constructor
()
{
}
ngOnInit
()
{
var
_this
=
this
;
setTimeout
(()
=>
{
this
.
titleObj
.
content
=
"
Hello world!!!
"
;
this
.
teststr
=
"
************
"
},
2000
);
// (<any>window).courseware.getData(function(data){
// if(data){
// _this.titleObj.content = data.content;
// }
// });
}
ngOnChanges
()
{
...
...
@@ -32,15 +50,17 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
updateTitleObjSuccess
(
titleObj
)
{
this
.
titleObj
=
titleObj
;
this
.
save
();
}
onTitleAudioUploadSuccess
(
res
)
{
this
.
titleObj
.
audio_url
=
res
.
url
;
this
.
save
();
}
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
titleObj
);
}
}
src/app/play/play.component.ts
View file @
bce5060a
...
...
@@ -20,7 +20,12 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
audioElement
:
ElementRef
;
data
=
{
contentObj
:{
titleObj
:
null
}
contentObj
:{
titleObj
:{
audio_url
:
'
http://iplayabc-courseware.oss-cn-beijing.aliyuncs.com/dev/imman/audios/d108d5d06105fda0526059a3e372f926.mp3
'
,
content
:
'
what is this?
'
,
icons
:
[],
type
:
'
a
'
}}
};
letters
=
[];
...
...
@@ -37,14 +42,14 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
return
(
new
Array
(
end
-
start
+
1
)).
fill
(
undefined
).
map
((
_
,
i
)
=>
i
+
start
);
}
ngOnInit
()
{
if
(
!
this
.
data
.
contentObj
.
titleObj
)
{
this
.
data
.
contentObj
.
titleObj
=
{
audio_url
:
'
http://iplayabc-courseware.oss-cn-beijing.aliyuncs.com/dev/imman/audios/d108d5d06105fda0526059a3e372f926.mp3
'
,
content
:
'
what is this?
'
,
icons
:
[],
type
:
'
a
'
};
let
_this
=
this
;
(
<
any
>
window
).
courseware
.
getData
(
function
(
data
){
if
(
data
){
_this
.
data
.
contentObj
.
titleObj
=
data
;
}
});
// const letters = _.shuffle( [...this.range(97, 122), ...this.range(65, 90)]);
[...
this
.
range
(
97
,
122
),
...
this
.
range
(
65
,
90
)].
forEach
(
c
=>
{
this
.
lettersAscii
[
c
]
=
String
.
fromCharCode
(
c
);
...
...
src/index.html
View file @
bce5060a
...
...
@@ -7,15 +7,66 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"icon"
type=
"image/x-icon"
href=
"favicon.ico"
>
<script>
window
.
courseware
=
(
function
(){
if
(
window
.
parent
.
net
){
window
.
net
=
window
.
parent
.
net
;
var
id
=
window
.
frameElement
.
getAttribute
(
"
dataid
"
);
return
{
getData
:
function
(
callback
){
net
.
getData
(
"
getCoursewareData
"
,
id
,
function
(
res
){
if
(
res
){
res
=
JSON
.
parse
(
res
);
if
(
res
.
msg
===
"
success
"
){
let
callData
=
null
;
if
(
res
.
data
&&
res
.
data
!=
'
null
'
){
callData
=
JSON
.
parse
(
res
.
data
);
}
callback
&&
callback
(
callData
);
}
else
{
alert
(
'
数据加载失败!
'
);
}
}
else
{
alert
(
'
数据加载失败!
'
);
}
});
},
setData
:
function
(
data
,
callback
){
let
str
=
JSON
.
stringify
(
data
);
net
.
getData
(
"
setCoursewareData
"
,{
id
:
id
,
data
:
str
},
function
(
res
){
if
(
res
){
res
=
JSON
.
parse
(
res
);
if
(
res
.
msg
===
"
success
"
){
callback
&&
callback
();
}
else
{
alert
(
'
数据保存失败!
'
);
}
}
else
{
alert
(
'
数据保存失败!
'
);
}
});
}
}
}
else
{
return
{
getData
:
function
(
callback
){
let
data
=
localStorage
.
getItem
(
"
courseware_data
"
);
callback
&&
callback
(
data
);
},
setData
:
function
(
data
,
callback
){
localStorage
.
setItem
(
"
courseware_data
"
,
data
);
callback
&&
callback
();
}
}
}
})();
</script>
</head>
<body>
<app-root></app-root>
</body>
<script>
window
.
net
=
window
.
parent
.
net
||
{};
window
.
net
.
doUpload
=
function
(){
console
.
log
(
"
*********
"
);
}
</script>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment