Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
高东东-金蝶建发
/
jf-yzj-resume
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d460e8cf
authored
Sep 23, 2025
by
钟乾明
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
u: 优化开发环境配置
parent
61a0da9d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
14 deletions
index.html
src/config/common.js
src/config/test.js
src/js/index.js
src/js/polyfill/index.js
src/js/polyfill/request.js
index.html
View file @
d460e8cf
...
...
@@ -4,8 +4,39 @@
<meta
charset=
'utf-8'
>
<meta
name=
'viewport'
content=
'initial-scale=1.0, maximum-scale=1.0, user-scalable=0'
>
<title>
简历
</title>
<script
src=
'miniapp://common/js/qing/qing.js'
></script
>
<!-- <script src='miniapp://common/js/qing/qing.js'></script>--
>
<!-- <script src='https://staging.jffctest.com/public/js/qing/latest/qing.js'></script>-->
<script>
console
.
log
(
'开始引入库>>'
);
const
ua
=
window
.
navigator
.
userAgent
.
toLocaleLowerCase
();
if
(
ua
.
indexOf
(
'qing'
)
>
-
1
)
{
console
.
log
(
'ua qing>>'
)
if
(
ua
.
indexOf
(
'miniapp'
)
>
-
1
)
{
console
.
log
(
'ua 云之家小程序>>'
)
document
.
write
(
'
<
scr
' + '
ipt
src
=
"miniapp://common/js/qing/qing.js"
><
/scr' + 'ipt>'
)
;
sessionStorage
.
setItem
(
'runClientEnv'
,
'miniapp'
);
}
else
{
console
.
log
(
'轻应用>>'
);
const
testFlags
=
[
'test'
,
'localhost'
,
'192.168'
];
// 测试环境的url标志
if
(
testFlags
.
some
(
flag
=>
location
.
origin
.
includes
(
flag
)))
{
sessionStorage
.
setItem
(
'env'
,
'test'
);
}
else
{
sessionStorage
.
setItem
(
'env'
,
'prod'
);
}
const
qingUrl
=
sessionStorage
.
getItem
(
'env'
)
===
'test'
?
'https://staging.jffctest.com/public/js/qing/latest/qing.js'
:
'https://portal.cndrealty.com/public/js/qing/latest/qing.js'
;
document
.
write
(
'
<
scr
' + '
ipt
src
=
"'+qingUrl+'"
><
/scr' + 'ipt>'
)
;
// 轻应用从url上取ticket
let
urlParamStr
=
location
.
href
.
split
(
'?'
)[
1
]
||
''
;
urlParamStr
=
urlParamStr
.
split
(
'/'
)[
0
]
||
''
;
// 截止/。用于去除尾部 /
urlParamStr
=
urlParamStr
.
split
(
'#'
)[
0
]
||
''
;
// 截止#。用于去除尾部 #
const
urlParams
=
new
URLSearchParams
(((
location
.
href
.
split
(
'?'
)[
1
]
||
''
).
split
(
'/'
)[
0
]
||
''
).
split
(
'#'
)[
0
]);
// 从url上取ticket 存至全局
sessionStorage
.
setItem
(
'ticket'
,
urlParams
.
get
(
'ticket'
)
||
''
);
sessionStorage
.
setItem
(
'runClientEnv'
,
'qing'
);
}
}
</script>
</head>
<body>
<div
class=
'header'
>
...
...
src/config/common.js
View file @
d460e8cf
...
...
@@ -71,6 +71,17 @@ let config = {
note
:
[
'jobstarttime'
,
'jobendtime'
],
},
},
mVoList
:
{
name
:
'干部考核'
,
type
:
RENDER_TYPE
.
G
,
img
:
'cadre'
,
list
:
{
title
:
'year'
,
note
:
'result'
,
chilkey
:
[
'attachmentName'
,
'attachmentFile'
],
children
:
'attachmentArray'
,
},
},
cadreEvaluationVoList
:
{
name
:
'干部考核'
,
type
:
RENDER_TYPE
.
G
,
...
...
src/config/test.js
View file @
d460e8cf
...
...
@@ -62,7 +62,7 @@ const config = {
loginuserid
:
'46000011'
,
appkey
:
'd504275e'
,
uid
:
'hqhuang@cndrealty.com'
,
token
:
'yzj_
6082c32a80f913acd16a0e8e9364914d
'
,
token
:
'yzj_
199aa82fe0a735a740f446f4d1929e03
'
,
baseUrl
:
'https://staging.jffctest.com/'
,
};
...
...
src/js/index.js
View file @
d460e8cf
This diff is collapsed.
Click to expand it.
src/js/polyfill/index.js
View file @
d460e8cf
...
...
@@ -33,8 +33,7 @@ window.customEvt = {
var
customEvt
=
window
.
customEvt
var
qing
=
window
.
qing
console
.
log
(
'qing---1'
);
qing
.
ready
(
function
()
{
qing
&&
qing
.
ready
(
function
()
{
// 重写左侧返回按钮
qing
.
call
(
'defback'
,
{
success
:
function
()
{
...
...
src/js/polyfill/request.js
View file @
d460e8cf
import
axios
from
'axios'
;
var
originAdapter
=
axios
.
defaults
.
adapter
;
console
.
log
(
'r process.env.PACK_ENV>>'
,
process
.
env
.
PACK_ENV
);
axios
.
defaults
.
adapter
=
function
(
config
)
{
// 区分美信云cordova环境、云之家qing环境
if
(
!
process
.
env
.
PACK_ENV
||
process
.
env
.
PACK_ENV
===
'dev'
)
{
return
originAdapter
(
config
);
}
else
{
if
(
sessionStorage
.
getItem
(
'runClientEnv'
)
===
'qing'
)
{
console
.
log
(
'轻应用request config>>'
,
config
);
return
request
(
config
);
}
if
(
!
/^https
?
/
.
test
(
config
.
url
))
{
console
.
log
(
'is https>>'
);
return
originAdapter
(
config
);
}
return
request
(
config
);
}
};
function
isObject
(
value
)
{
...
...
@@ -33,10 +45,7 @@ function params2object(url) {
if
(
typeof
url
===
'object'
)
{
return
url
;
}
else
if
(
typeof
url
===
'string'
)
{
url
.
replace
(
/^.*
\?
|#.*$/g
,
''
)
.
split
(
'&'
)
.
forEach
((
n
)
=>
{
url
.
replace
(
/^.*
\?
|#.*$/g
,
''
).
split
(
'&'
).
forEach
((
n
)
=>
{
n
=
n
.
split
(
'='
);
if
(
n
.
length
===
2
)
{
params
[
n
[
0
]
]
=
decodeURIComponent
(
n
[
1
]);
...
...
@@ -67,8 +76,7 @@ function request(opt) {
opt
.
url
=
opt
.
url
.
split
(
'?'
)[
0
]
+
'?'
+
Object
.
keys
(
urlParams
)
.
map
((
key
)
=>
{
Object
.
keys
(
urlParams
).
map
((
key
)
=>
{
var
val
=
urlParams
[
key
];
if
(
isObject
(
val
))
{
val
=
JSON
.
stringify
(
val
);
...
...
@@ -77,8 +85,7 @@ function request(opt) {
val
=
encodeURIComponent
(
val
);
}
return
key
+
'='
+
val
;
})
.
join
(
'&'
);
}).
join
(
'&'
);
// post非json即是form。
if
(
opt
.
method
.
toLowerCase
()
===
'post'
)
{
...
...
@@ -107,8 +114,7 @@ function request(opt) {
opt
.
headers
=
opt
.
headers
||
{};
const
headers
=
{};
// headers字段值必须是字符串型
Object
.
keys
(
opt
.
headers
)
.
forEach
(
function
(
key
)
{
Object
.
keys
(
opt
.
headers
).
forEach
(
function
(
key
)
{
var
val
=
opt
.
headers
[
key
];
if
(
val
)
{
var
type
=
typeof
val
;
...
...
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