Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
52c53448
Commit
52c53448
authored
Mar 05, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
e6271c96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
36 deletions
+38
-36
bpo-web/app/config/routes/vue-ui.js
+38
-36
No files found.
bpo-web/app/config/routes/vue-ui.js
View file @
52c53448
var
fs
=
require
(
"fs"
);
var
fs
=
require
(
"fs"
);
var
settings
=
require
(
"../settings"
);
var
settings
=
require
(
"../settings"
);
async
function
asycReadFile
(
path
){
var
os
=
require
(
"os"
);
var
p
=
new
Promise
(
function
(
reslv
,
reject
){
fs
.
readFile
(
path
,
function
(
err
,
r
){
async
function
asycReadFile
(
path
)
{
if
(
err
){
var
p
=
new
Promise
(
function
(
reslv
,
reject
)
{
reject
(
err
);
fs
.
readFile
(
path
,
function
(
err
,
r
)
{
}
else
{
if
(
err
)
{
reslv
(
r
);
reject
(
err
);
}
}
else
{
});
reslv
(
r
);
});
}
return
p
;
});
});
return
p
;
}
}
async
function
buildComponent
(
compname
){
async
function
buildComponent
(
compname
)
{
var
htmlpath
=
settings
.
basepath
+
"/app/front/vues/pages/"
+
compname
+
"/"
+
compname
+
".html"
;
var
htmlpath
=
settings
.
basepath
+
"/app/front/vues/pages/"
+
compname
+
"/"
+
compname
+
".html"
;
var
jspath
=
settings
.
basepath
+
"/app/front/vues/pages/"
+
compname
+
"/"
+
compname
+
".js"
;
var
jspath
=
settings
.
basepath
+
"/app/front/vues/pages/"
+
compname
+
"/"
+
compname
+
".js"
;
var
html
=
await
asycReadFile
(
htmlpath
);
var
html
=
await
asycReadFile
(
htmlpath
);
var
tmpl
=
html
.
toString
(
"utf-8"
);
var
tmpl
=
html
.
toString
(
"utf-8"
);
var
js
=
await
asycReadFile
(
jspath
);
var
js
=
await
asycReadFile
(
jspath
);
var
jsstr
=
js
.
toString
(
"utf-8"
);
var
jsstr
=
js
.
toString
(
"utf-8"
);
jsstr
=
jsstr
.
replace
(
"${tmpl}"
,
tmpl
);
jsstr
=
jsstr
.
replace
(
"${tmpl}"
,
tmpl
);
return
jsstr
;
return
jsstr
;
}
}
module
.
exports
=
function
(
app
)
{
module
.
exports
=
function
(
app
)
{
app
.
get
(
'/vue/comp/base'
,
function
(
req
,
res
)
{
app
.
get
(
'/vue/comp/base'
,
function
(
req
,
res
)
{
var
vuePath
=
settings
.
basepath
+
"/app/front/vues/base"
;
var
vuePath
=
settings
.
basepath
+
"/app/front/vues/base"
;
var
baseComps
=
[];
var
baseComps
=
[];
fs
.
readdir
(
vuePath
,
function
(
err
,
rs
)
{
fs
.
readdir
(
vuePath
,
function
(
err
,
rs
)
{
if
(
rs
)
{
if
(
rs
)
{
rs
.
forEach
(
function
(
r
)
{
rs
.
forEach
(
function
(
r
)
{
delete
require
.
cache
[
require
.
resolve
(
vuePath
+
"/"
+
r
)];
delete
require
.
cache
[
require
.
resolve
(
vuePath
+
"/"
+
r
)];
var
comp
=
require
(
vuePath
+
"/"
+
r
).
replace
(
/
\n
/g
,
""
);
var
comp
=
require
(
vuePath
+
"/"
+
r
).
replace
(
/
\n
/g
,
""
);
baseComps
.
push
(
comp
);
baseComps
.
push
(
comp
);
});
});
res
.
end
(
JSON
.
stringify
(
baseComps
))
res
.
end
(
JSON
.
stringify
(
baseComps
))
}
}
});
});
});
});
app
.
get
(
'/vue/comp/:cname'
,
function
(
req
,
res
)
{
app
.
get
(
'/vue/comp/:cname'
,
function
(
req
,
res
)
{
var
componentName
=
req
.
params
.
cname
;
var
componentName
=
req
.
params
.
cname
;
buildComponent
(
componentName
).
then
(
function
(
r
)
{
buildComponent
(
componentName
).
then
(
function
(
r
)
{
let
platform
=
os
.
platform
();
let
platform
=
os
.
platform
();
console
.
log
(
platform
,
'----------------'
);
console
.
log
(
platform
,
'----------------'
);
// windows
// windows
if
(
platform
.
startsWith
(
'win'
))
{
if
(
platform
.
toLocaleLowerCase
()
.
startsWith
(
'win'
))
{
res
.
end
(
r
.
replace
(
/
\n\r
/g
,
""
));
res
.
end
(
r
.
replace
(
/
[\n\r]
/g
,
""
));
}
else
{
}
else
{
res
.
end
(
r
.
replace
(
/
\n
/g
,
""
));
res
.
end
(
r
.
replace
(
/
\n
/g
,
""
));
}
}
});
});
});
});
...
...
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