Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dfzx_ac2
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
dfzx_ac2
Commits
5735033e
Commit
5735033e
authored
Mar 20, 2021
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add form
parent
0fd3e414
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
445 additions
and
128 deletions
+445
-128
angular.json
form/angular.json
+5
-2
form.component.css
form/src/app/form/form.component.css
+0
-35
form.component.html
form/src/app/form/form.component.html
+202
-30
form.component.scss
form/src/app/form/form.component.scss
+65
-0
form.component.ts
form/src/app/form/form.component.ts
+163
-58
index.html
form/src/index.html
+1
-1
Scene.fire
play/assets/tmpGame/scene/Scene.fire
+1
-1
Scene.js
play/assets/tmpGame/script/Scene.js
+8
-1
No files found.
form/angular.json
View file @
5735033e
...
...
@@ -128,5 +128,8 @@
}
}
},
"defaultProject"
:
"ng-template-generator"
"defaultProject"
:
"ng-template-generator"
,
"cli"
:
{
"analytics"
:
false
}
}
\ No newline at end of file
form/src/app/form/form.component.css
deleted
100644 → 0
View file @
0fd3e414
@import
'../style/common_mixin.css'
;
.model-content
{
width
:
100%
;
height
:
100%
;
}
.radioPaire
{
float
:
left
;
margin
:
3px
;
border-style
:
dashed
;
border-color
:
#000
;
border-width
:
1px
;
}
.border
{
border-radius
:
20px
;
border-style
:
dashed
;
padding
:
20px
;
margin
:
20px
;
/*width: 500px; */
/*//border-radius: 20px;*/
/*//border-width: 2px;*/
/*//border-color: #000000;*/
}
.border-lite
{
border
:
2px
dashed
#ddd
;
border-radius
:
0.5rem
;
padding
:
10px
;
margin
:
10px
;
}
form/src/app/form/form.component.html
View file @
5735033e
This diff is collapsed.
Click to expand it.
form/src/app/form/form.component.scss
0 → 100644
View file @
5735033e
@import
"../style/common_mixin"
;
.model-content
{
margin
:
10px
;
.card-config
{
// width: 100%;
height
:
100%
;
// display: flex;
flex-wrap
:
wrap
;
box-sizing
:
border-box
;
// width: 500px;
.card-item
{
margin-bottom
:
40px
;
.border
{
border-radius
:
20px
;
border-style
:
dashed
;
padding
:
20px
;
width
:
100%
;
}
.card-item-content
{
.title
{
font-size
:
24px
;
width
:
100%
;
text-align
:
center
;
}
.section
{
border-top
:
1px
solid
;
padding
:
10px
0
;
.section-title
{
font-size
:
24px
;
width
:
100%
;
}
.section-content
{
display
:
flex
;
flex-direction
:
row
;
margin
:
5px
0
10px
0
;
}
}
.pic-sound-box
{
width
:
50%
;
display
:
flex
;
flex-direction
:
column
;
}
.add-btn-box
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
height
:
20vw
;
padding
:
10px
;
padding-top
:
5vw
;
}
}
}
}
}
.hidden
{
display
:
none
;
}
.clearfix
:before
,
.clearfix
:after
{
content
:
""
;
display
:
block
;
clear
:
both
;
}
form/src/app/form/form.component.ts
View file @
5735033e
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
JsonPipe
}
from
'
@angular/common
'
;
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
}
from
'
@angular/core
'
;
// import defauleFormData from '../../assets/default/formData/defaultData_LST08.js'
@
Component
({
selector
:
'
app-form
'
,
templateUrl
:
'
./form.component.html
'
,
styleUrls
:
[
'
./form.component.css
'
]
styleUrls
:
[
'
./form.component.
s
css
'
]
})
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
saveKey
=
"
test_001
"
;
// 储存对象
item
;
_item
:
any
;
dataArray
:
Array
<
Object
>
=
[];
constructor
(
private
appRef
:
ApplicationRef
,
private
changeDetectorRef
:
ChangeDetectorRef
)
{
contentObj
=
{
dataArray
:
[],
}
defauleFormData
=
{
version
:
"
1.0
"
,
key
:
"
DataKey_dfzx_ppp
"
,
question
:
{},
dataArray
:
[
{
correct
:
[
{
type
:
"
Text
"
,
text
:
""
,
audio_url
:
""
,
image_url
:
""
,
}
],
incorrect
:
[
]
}
]
}
KEY
=
'
DataKey_dfzx_ppp
'
;
createShell
()
{
this
.
item
.
wordList
.
push
({
word
:
''
,
audio
:
''
,
backWord
:
''
,
backWordAudio
:
''
,
});
this
.
save
();
set
item
(
item
)
{
this
.
_item
=
item
;
}
get
item
()
{
return
this
.
_item
;
}
removeShell
(
idx
)
{
this
.
item
.
wordList
.
splice
(
idx
,
1
);
this
.
save
();
@
Output
()
update
=
new
EventEmitter
();
constructor
(
private
appRef
:
ApplicationRef
)
{
}
ngOnInit
()
{
this
.
item
=
{};
// 获取存储的数据
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
this
.
item
.
contentObj
=
{};
const
getData
=
(
<
any
>
window
).
courseware
.
getData
;
getData
((
data
)
=>
{
// console.log("读取数据", data)
if
(
data
)
{
this
.
item
=
data
;
}
else
{
this
.
item
=
{};
}
if
(
!
this
.
item
.
contentObj
)
{
this
.
item
.
contentObj
=
{};
}
this
.
init
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
},
this
.
saveKey
);
this
.
save
()
},
this
.
KEY
);
}
ngOnChanges
()
{
}
ngOnDestroy
()
{
}
saveData
(
e
){
this
.
save
();
}
init
()
{
if
(
Object
.
keys
(
this
.
item
.
contentObj
).
length
!=
0
&&
this
.
item
.
contentObj
.
version
&&
this
.
item
.
contentObj
.
version
==
this
.
defauleFormData
.
version
)
{
// console.log("使用默认数据", this.item.contentObj)
this
.
contentObj
=
this
.
item
.
contentObj
;
this
.
dataArray
=
this
.
item
.
contentObj
.
dataArray
;
}
else
{
this
.
contentObj
=
this
.
defauleFormData
;
this
.
dataArray
=
this
.
defauleFormData
.
dataArray
// console.log("使用默认数据", this.contentObj)
this
.
item
.
contentObj
=
this
.
contentObj
;
this
.
item
.
contentObj
.
dataArray
=
this
.
dataArray
;
this
.
item
.
contentObj
.
question
=
this
.
defauleFormData
.
question
;
}
}
cardItemData
(){
return
{
correct
:
[
{
type
:
"
Text
"
,
text
:
""
,
audio_url
:
""
,
image_url
:
""
,
}
],
incorrect
:
[
]
}
}
cardChoiceData
(){
return
{
type
:
"
Text
"
,
image_url
:
""
,
text
:
""
,
audio_url
:
""
}
}
addChoice
(
item
)
{
console
.
log
(
item
)
item
.
push
(
this
.
cardChoiceData
());
this
.
saveItem
();
}
deleteChoice
(
item
,
index
){
item
.
splice
(
index
,
1
)
this
.
save
()
}
getDefaultPicArr
()
{
let
arr
=
[];
return
arr
;
}
initData
()
{
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess
(
e
,
key
)
{
}
this
.
item
[
key
]
=
e
.
url
;
onUploadSuccessByItem
(
e
,
item
,
key
)
{
item
[
key
]
=
e
.
url
;
this
.
save
();
}
/**
* 储存音频数据
* @param e
*/
onAudioUploadSuccess
(
e
,
key
)
{
this
.
item
[
key
]
=
e
.
url
;
onImageUploadSuccessByItem
(
e
,
item
,
key
)
{
item
[
key
]
=
e
.
url
this
.
save
();
}
on
WordAudioUploadSuccess
(
e
,
idx
)
{
this
.
item
.
wordList
[
idx
].
audio
=
e
.
url
;
on
AudioUploadSuccessByItem
(
e
,
item
,
key
)
{
item
[
key
]
=
e
.
url
;
this
.
save
();
}
on
BackWordAudioUploadSuccess
(
e
,
idx
)
{
this
.
item
.
wordList
[
idx
].
backWordAudio
=
e
.
url
;
on
TitleAudioUploadSuccess
(
e
)
{
this
.
item
.
contentObj
.
titleAudio_url
=
e
.
url
;
this
.
save
();
}
/**
* 储存数据
*/
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
addItem
(
type
)
{
let
item
=
this
.
cardItemData
();
this
[
type
].
push
(
item
);
this
.
saveItem
();
}
deleteItem
(
type
,
index
){
this
[
type
].
splice
(
index
,
1
)
this
.
save
()
}
handleMoveItemUp
(
key
,
index
){
if
(
index
!=
0
){
this
[
key
][
index
]
=
this
[
key
].
splice
(
index
-
1
,
1
,
this
[
key
][
index
])[
0
];
}
else
{
this
[
key
].
push
(
this
[
key
].
shift
());
}
this
.
save
()
}
handleMoveItemDown
(
key
,
index
){
if
(
index
!=
this
[
key
].
length
-
1
){
this
[
key
][
index
]
=
this
[
key
].
splice
(
index
+
1
,
1
,
this
[
key
][
index
])[
0
];
}
else
{
this
[
key
].
unshift
(
this
[
key
].
splice
(
index
,
1
)[
0
]);
}
this
.
save
()
}
radioClick
(
it
,
radioValue
)
{
it
.
radioValue
=
radioValue
;
this
.
saveItem
();
}
clickCheckBox
()
{
this
.
saveItem
();
}
saveItem
()
{
this
.
save
();
}
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
KEY
);
this
.
refresh
();
console
.
log
(
'
this.item =
'
+
JSON
.
stringify
(
this
.
item
));
/* Remove this when commit */
if
(
location
.
href
.
indexOf
(
"
localhost
"
)
!=
-
1
)
{
(
<
any
>
window
).
axios
.
post
(
`http://www.datalist.com.cn:8060/json/save/
${
this
.
KEY
}
`
,
this
.
item
)
}
/* Remove this when commit */
console
.
log
(
"
保存
"
,
this
.
item
)
}
/**
* 刷新 渲染页面
*/
refresh
()
{
setTimeout
(()
=>
{
this
.
appRef
.
tick
();
},
1
);
}
}
form/src/index.html
View file @
5735033e
...
...
@@ -8,7 +8,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"icon"
type=
"image/x-icon"
href=
"favicon.ico"
>
<script
type=
"text/javascript"
src=
"https://staging-teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"
></script>
</head>
<body>
<app-root></app-root>
...
...
play/assets/tmpGame/scene/Scene.fire
View file @
5735033e
...
...
@@ -192,7 +192,7 @@
"array": [
0,
0,
26
8.2372326687317
,
26
9.27790755516406
,
0,
0,
0,
...
...
play/assets/tmpGame/script/Scene.js
View file @
5735033e
...
...
@@ -99,7 +99,14 @@ cc.Class({
},
getData
(
cb
)
{
// cb(this.getDefaultData());
cc
.
loader
.
load
(
"
http://www.datalist.com.cn:8060/json/DataKey_dfzx_ppp
"
,
function
(
err
,
res
)
{
if
(
err
)
{
cb
(
this
.
getDefaultData
());
}
else
{
cb
(
JSON
.
parse
(
res
));
}
});
},
getDefaultData
()
{
...
...
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