Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
I
init-things
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
init-things
Commits
2946d0bc
Commit
2946d0bc
authored
Feb 22, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
angular
parent
96630b34
Pipeline
#10019
passed with stages
in 1 minute and 25 seconds
Changes
9
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
204 additions
and
0 deletions
+204
-0
things/angular/.eslintrc.js
things/angular/.eslintrc.js
+24
-0
things/angular/install-npm.sh
things/angular/install-npm.sh
+12
-0
things/angular/src/app/toast.service.spec.ts
things/angular/src/app/toast.service.spec.ts
+16
-0
things/angular/src/app/toast.service.ts
things/angular/src/app/toast.service.ts
+51
-0
things/angular/src/app/toast/toast.component.css
things/angular/src/app/toast/toast.component.css
+0
-0
things/angular/src/app/toast/toast.component.html
things/angular/src/app/toast/toast.component.html
+7
-0
things/angular/src/app/toast/toast.component.spec.ts
things/angular/src/app/toast/toast.component.spec.ts
+24
-0
things/angular/src/app/toast/toast.component.ts
things/angular/src/app/toast/toast.component.ts
+13
-0
things/angular/src/styles.css
things/angular/src/styles.css
+57
-0
No files found.
things/angular/.eslintrc.js
0 → 100644
View file @
2946d0bc
module
.
exports
=
{
parser
:
'
@typescript-eslint/parser
'
,
parserOptions
:
{
project
:
'
tsconfig.json
'
,
sourceType
:
'
module
'
,
},
plugins
:
[
'
@typescript-eslint/eslint-plugin
'
],
extends
:
[
'
plugin:@typescript-eslint/recommended
'
,
'
plugin:prettier/recommended
'
,
],
root
:
true
,
env
:
{
node
:
true
,
jest
:
true
,
},
ignorePatterns
:
[
'
.*.js
'
],
rules
:
{
'
@typescript-eslint/interface-name-prefix
'
:
'
off
'
,
'
@typescript-eslint/explicit-function-return-type
'
:
'
off
'
,
'
@typescript-eslint/explicit-module-boundary-types
'
:
'
off
'
,
'
@typescript-eslint/no-explicit-any
'
:
'
off
'
,
},
};
things/angular/install-npm.sh
0 → 100755
View file @
2946d0bc
#!/bin/bash
npm
install
--save
\
bootstrap
\
@ng-bootstrap/ng-bootstrap
\
open-iconic
npm
install
--save-dev
\
'@typescript-eslint/eslint-plugin@^4.28.2'
\
'@typescript-eslint/parser@^4.28.2 '
\
'eslint@^7.30.0'
\
'eslint-config-prettier@^8.3.0'
\
'eslint-plugin-prettier@^3.4.0'
things/angular/src/app/toast.service.spec.ts
0 → 100644
View file @
2946d0bc
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
ToastService
}
from
'
./toast.service
'
;
describe
(
'
ToastService
'
,
()
=>
{
let
service
:
ToastService
;
beforeEach
(()
=>
{
TestBed
.
configureTestingModule
({});
service
=
TestBed
.
inject
(
ToastService
);
});
it
(
'
should be created
'
,
()
=>
{
expect
(
service
).
toBeTruthy
();
});
});
things/angular/src/app/toast.service.ts
0 → 100644
View file @
2946d0bc
import
{
Injectable
}
from
'
@angular/core
'
;
export
interface
ToastInfo
{
id
:
number
;
header
:
string
;
body
:
string
;
classname
?:
string
;
}
@
Injectable
({
providedIn
:
'
root
'
,
})
export
class
ToastService
{
currentId
=
0
;
toasts
:
ToastInfo
[]
=
[];
show
(
header
:
string
,
body
:
string
,
classname
?:
string
)
{
const
id
=
++
this
.
currentId
;
this
.
toasts
.
push
({
id
,
header
,
body
,
classname
});
return
id
;
}
hide
(
id
:
number
)
{
const
index
=
this
.
toasts
.
findIndex
((
t
)
=>
t
.
id
===
id
);
if
(
index
!==
-
1
)
{
this
.
toasts
.
splice
(
index
,
1
);
}
}
error
(
message
:
string
)
{
this
.
show
(
'
错误
'
,
message
,
'
bg-danger text-light
'
);
}
warn
(
message
:
string
)
{
this
.
show
(
'
警告
'
,
message
,
'
bg-warning
'
);
}
success
(
message
?:
string
)
{
this
.
show
(
'
成功
'
,
message
||
'
操作成功
'
,
'
bg-success text-light
'
);
}
attention
(
message
:
string
)
{
this
.
show
(
'
注意
'
,
message
,
'
bg-primary
'
);
}
info
(
message
:
string
)
{
this
.
show
(
'
消息
'
,
message
);
}
constructor
()
{}
}
things/angular/src/app/toast/toast.component.css
0 → 100644
View file @
2946d0bc
things/angular/src/app/toast/toast.component.html
0 → 100644
View file @
2946d0bc
<ngb-toast
*ngFor=
"let toast of toastService.toasts"
[class]=
"toast.classname"
[header]=
"toast.header"
[autohide]=
"true"
[delay]=
"5000"
(hidden)=
"toastService.hide(toast.id)"
class=
"ngb-toasts"
>
{{toast.body}}
</ngb-toast>
things/angular/src/app/toast/toast.component.spec.ts
0 → 100644
View file @
2946d0bc
import
{
ComponentFixture
,
TestBed
}
from
'
@angular/core/testing
'
;
import
{
ToastComponent
}
from
'
./toast.component
'
;
describe
(
'
ToastComponent
'
,
()
=>
{
let
component
:
ToastComponent
;
let
fixture
:
ComponentFixture
<
ToastComponent
>
;
beforeEach
(
async
()
=>
{
await
TestBed
.
configureTestingModule
({
declarations
:
[
ToastComponent
],
}).
compileComponents
();
});
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
ToastComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'
should create
'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
things/angular/src/app/toast/toast.component.ts
0 → 100644
View file @
2946d0bc
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
ToastService
}
from
'
../toast.service
'
;
@
Component
({
selector
:
'
app-toasts
'
,
templateUrl
:
'
./toast.component.html
'
,
styleUrls
:
[
'
./toast.component.css
'
],
})
export
class
ToastComponent
implements
OnInit
{
constructor
(
public
toastService
:
ToastService
)
{}
ngOnInit
():
void
{}
}
things/angular/src/styles.css
0 → 100644
View file @
2946d0bc
/* You can add global styles to this file, and also import other style files */
@import
'~bootstrap'
;
@import
'~open-iconic/font/css/open-iconic-bootstrap.css'
;
body
{
min-height
:
100vh
;
min-height
:
-webkit-fill-available
;
}
html
{
height
:
-webkit-fill-available
;
}
/*干掉站长统计的文本*/
a
[
title
=
"站长统计"
]
{
display
:
none
;
}
/*标题*/
h1
.title
{
font-family
:
'Helvetica Neue'
,
Helvetica
,
'Microsoft Yahei'
,
'Hiragino Sans GB'
,
'WenQuanYi Micro Hei'
,
sans-serif
;
font-size
:
22px
;
padding-bottom
:
15px
;
border-bottom
:
1px
solid
#eee
;
}
.index
.navbar-nav
>
li
.index
>
a
,
.index
.navbar-nav
>
li
.index
>
a
:focus
,
.index
.navbar-nav
>
li
.index
>
a
:hover
,
.download
.navbar-nav
>
li
.download
>
a
,
.download
.navbar-nav
>
li
.download
>
a
:focus
,
.download
.navbar-nav
>
li
.download
>
a
:hover
,
.usage
.navbar-nav
>
li
.usage
>
a
,
.usage
.navbar-nav
>
li
.usage
>
a
:focus
,
.usage
.navbar-nav
>
li
.usage
>
a
:hover
,
.changelog
.navbar-nav
>
li
.changelog
>
a
,
.changelog
.navbar-nav
>
li
.changelog
>
a
:focus
,
.changelog
.navbar-nav
>
li
.changelog
>
a
:hover
,
.bugs
.navbar-nav
>
li
.bugs
>
a
,
.bugs
.navbar-nav
>
li
.bugs
>
a
:focus
,
.bugs
.navbar-nav
>
li
.bugs
>
a
:hover
,
.lab
.navbar-nav
>
li
.lab
>
a
,
.lab
.navbar-nav
>
li
.lab
>
a
:focus
,
.lab
.navbar-nav
>
li
.lab
>
a
:hover
,
.pre
.navbar-nav
>
li
.pre
>
a
,
.pre
.navbar-nav
>
li
.pre
>
a
:focus
,
.pre
.navbar-nav
>
li
.pre
>
a
:hover
{
color
:
#555
;
background-color
:
#e7e7e7
;
}
h1
.title
.date
{
font-size
:
14px
;
float
:
right
;
padding-top
:
10px
;
}
h2
.title
{
font-family
:
'Helvetica Neue'
,
Helvetica
,
'Microsoft Yahei'
,
'Hiragino Sans GB'
,
'WenQuanYi Micro Hei'
,
sans-serif
;
font-size
:
16px
;
padding
:
8px
0
8px
8px
;
border-left
:
2px
solid
#ddd
;
}
footer
{
/*margin: 100px 0 10px 0;*/
color
:
#767676
;
text-align
:
center
;
}
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