Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
schbrain-archetype-initializer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
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
tools
schbrain-archetype-initializer
Commits
fda4f68c
Commit
fda4f68c
authored
Mar 20, 2022
by
liaozan
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add loading
parent
c88197bd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
19 deletions
+15
-19
initializer-ui/.gitignore
initializer-ui/.gitignore
+1
-2
initializer-ui/src/components/BackendStarter.vue
initializer-ui/src/components/BackendStarter.vue
+7
-7
initializer-ui/src/main.js
initializer-ui/src/main.js
+1
-0
initializer-ui/src/util/loading.js
initializer-ui/src/util/loading.js
+3
-5
initializer-ui/src/util/request.js
initializer-ui/src/util/request.js
+3
-5
No files found.
initializer-ui/.gitignore
View file @
fda4f68c
...
...
@@ -21,5 +21,4 @@ pnpm-debug.log*
*.ntvs*
*.njsproj
*.sln
*.sw?
package-lock.json
\ No newline at end of file
*.sw?
\ No newline at end of file
initializer-ui/src/components/BackendStarter.vue
View file @
fda4f68c
<
template
>
<div
class=
"form"
>
<div
id=
"form"
class=
"form"
>
<p
class=
"form-title"
>
项目初始代码生成
</p>
<div
class=
"form-div
"
>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-packageName"
>
GitlabUrl
</label>
<input
id=
"input-gitlabUrl"
v-model=
"form.gitlabUrl"
class=
"form-input"
type=
"text"
>
</div>
<div
class=
"form-div
"
>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-group"
>
Group
</label>
<input
id=
"input-group"
v-model=
"form.group"
class=
"form-input"
type=
"text"
>
</div>
<div
class=
"form-div
"
>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-artifact"
>
Artifact
</label>
<input
id=
"input-artifact"
v-model=
"form.artifact"
class=
"form-input"
type=
"text"
>
</div>
<div
class=
"form-div
"
>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-projectName"
>
Project Name
</label>
<input
id=
"input-projectName"
v-model=
"form.projectName"
class=
"form-input"
type=
"text"
>
</div>
<div
class=
"form-div
"
>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-packageName"
>
Package name
</label>
<input
id=
"input-packageName"
v-model=
"form.packageName"
class=
"form-input"
type=
"text"
>
</div>
...
...
@@ -67,7 +67,7 @@ export default {
window
.
URL
.
revokeObjectURL
(
link
.
href
);
document
.
body
.
removeChild
(
link
);
},
error
=>
{
var
reader
=
new
FileReader
();
const
reader
=
new
FileReader
();
reader
.
readAsText
(
error
.
data
,
'
utf-8
'
);
reader
.
onload
=
function
(
e
)
{
alert
(
reader
.
result
)
...
...
initializer-ui/src/main.js
View file @
fda4f68c
import
{
createApp
}
from
'
vue
'
import
ElementPlus
from
'
element-plus
'
import
'
element-plus/dist/index.css
'
import
vRouter
from
'
./router
'
import
App
from
'
./App.vue
'
...
...
initializer-ui/src/util/loading.js
View file @
fda4f68c
...
...
@@ -3,7 +3,7 @@
* 当调用一次showLoading,则次数+1;当次数为0时,则显示loading
* 当调用一次hideLoading,则次数-1; 当次数为0时,则结束loading
*/
import
{
ElLoading
}
from
'
element-plus
'
;
import
{
ElLoading
}
from
'
element-plus
'
;
// 定义一个请求次数的变量,用来记录当前页面总共请求的次数
let
loadingRequestCount
=
0
;
...
...
@@ -11,11 +11,9 @@ let loadingRequestCount = 0;
let
loadingInstance
;
// 编写一个显示loading的函数 并且记录请求次数 ++
const
showLoading
=
(
target
)
=>
{
const
showLoading
=
()
=>
{
if
(
loadingRequestCount
===
0
)
{
// element的服务方式 target 我这边取的是表格class
// 类似整个表格loading和在表格配置v-loading一样的效果,这么做是全局实现了,不用每个页面单独去v-loading
loadingInstance
=
ElLoading
.
service
({
target
});
loadingInstance
=
ElLoading
.
service
({});
}
loadingRequestCount
++
}
...
...
initializer-ui/src/util/request.js
View file @
fda4f68c
import
axios
from
'
axios
'
;
import
{
showLoading
,
hideLoading
}
from
'
./loading
'
import
{
hideLoading
,
showLoading
}
from
'
./loading
'
axios
.
defaults
.
baseURL
=
'
http://localhost:8080
'
axios
.
defaults
.
timeout
=
10000
...
...
@@ -13,14 +13,12 @@ service.interceptors.request.use(config => {
service
.
interceptors
.
response
.
use
(
response
=>
{
hideLoading
()
if
(
response
.
data
.
type
==
'
application/json
'
)
{
if
(
response
.
data
.
code
!=
200
)
{
if
(
response
.
data
.
type
==
=
'
application/json
'
)
{
if
(
response
.
data
.
code
!=
=
200
)
{
return
Promise
.
reject
(
response
);
}
}
return
response
},
error
=>
{
})
export
default
service
\ No newline at end of file
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