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
61d06f96
authored
Nov 23, 2023
by
golton_gao
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update: 优化代码
parent
345c915e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
25 deletions
build/webpack.base.conf.js
src/config/prod.js
src/config/test.js
src/js/index.js
src/js/polyfill/cordova.js
build/webpack.base.conf.js
View file @
61d06f96
...
...
@@ -70,7 +70,7 @@ var baseWebpackConfig = {
extensions
:
[
'.js'
,
'.json'
],
alias
:
{
'@'
:
resolve
(
'src'
),
'configuration'
:
resolve
(
process
.
env
.
NODE_ENV
===
'production
'
'configuration'
:
resolve
(
process
.
env
.
PACK_ENV
===
'product
'
?
'./src/config/prod'
:
'./src/config/test'
)
}
...
...
src/config/prod.js
View file @
61d06f96
...
...
@@ -3,14 +3,8 @@ import common from './common';
const
config
=
{
product
:
true
,
ssoToken
:
'token'
,
// baseUrl: 'https://jffcvp.cndrealty.com:4433/',
// appkey: '781d2ec4', // 正式
baseUrl
:
'https://mxytest.cndrealty.com:4433/'
,
//测试
appkey
:
'd504275e'
,
// 测试
baseUrl
:
'https://jffcvp.cndrealty.com:4433/'
,
appkey
:
'781d2ec4'
// 正式
};
const
isProdPack
=
process
.
env
.
PACK_ENV
===
'product'
config
.
baseUrl
=
isProdPack
?
'https://jffcvp.cndrealty.com:4433/'
:
'https://mxytest.cndrealty.com:4433/'
export
default
Object
.
assign
(
config
,
common
);
src/config/test.js
View file @
61d06f96
...
...
@@ -42,10 +42,7 @@ import common from './common';
const
config
=
{
product
:
false
,
ssoToken
:
'token'
,
userid
:
'10001285'
,
appkey
:
'd504275e'
,
uid
:
'xycao@cndrealty.com'
,
token
:
'T4777979921957888'
,
baseUrl
:
'https://mxytest.cndrealty.com:4433/'
,
};
...
...
src/js/index.js
View file @
61d06f96
...
...
@@ -12,6 +12,10 @@ const PhotoSwipeUI_Default = require('./lib/photoswipe-ui-default.min')
const
FastClick
=
require
(
'fastclick'
)
// const IScroll = require('iscroll/build/iscroll-probe')
// shr员工编号字段
const
employeenumberField
=
process
.
env
.
PACK_ENV
===
'product'
?
'5893b734-4537-4036-9f1c-16ff831b64b2'
:
'72f1d584-bc3d-4616-85d0-4a67c1829d1c'
window
.
topHeight
=
115
;
let
_uid
=
''
;
...
...
@@ -52,19 +56,82 @@ app.ready(() => {
FastClick
.
attach
(
document
.
body
);
},
configuration
.
product
);
function
getUrlParamVal
(
paramName
)
{
const
params
=
location
.
search
.
slice
(
1
)
const
reg
=
new
RegExp
(
`(?:^|&)
${
paramName
}
=([^&]+)`
)
if
(
reg
.
test
(
params
))
{
return
decodeURIComponent
(
RegExp
.
$1
)
}
return
null
}
function
getUserInfoByOid
(
oId
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
// 直接点击“简历”应用,是没有openId的,这时候不能报错。
if
(
!
oId
)
{
resolve
({})
return
}
const
opt
=
{
url
:
'/gateway/xmjf-other-service/person/role/query/openId'
,
serializer
:
'form'
,
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
,
'Cloudoffice-Version'
:
'v0.0.1'
},
data
:
{
oid
:
oId
}
}
opt
.
success
=
function
(
result
)
{
const
success
=
(
result
||
{}).
success
||
false
const
data
=
(
result
||
{}).
data
||
[]
if
(
String
(
success
).
toLowerCase
()
!==
'true'
)
{
reject
(
result
.
error
||
'获取人员信息失败!'
)
return
}
const
userInfo
=
data
.
userInfo
||
{}
const
extra
=
data
.
extra
||
[]
const
employeenumberInfo
=
extra
.
filter
(({
publicid
})
=>
{
return
employeenumberField
===
publicid
})
resolve
({
uid
:
userInfo
.
username
||
''
,
employeenumber
:
(
employeenumberInfo
[
0
]
||
{}).
value
})
}
opt
.
error
=
function
(
e
)
{
reject
(
e
)
}
window
.
qing
.
call
(
'request'
,
opt
)
})
}
function
initUser
()
{
// return Promise.all([app.getUser(), app.getExtra(configuration.identifier)])
return
app
.
getUser
()
.
then
((
user
)
=>
{
const
openId
=
getUrlParamVal
(
'openId'
)
const
isFromPersonDetail
=
'persondetail'
===
getUrlParamVal
(
'source'
)
// 判断是否来自人员详情。
// 如果是从人员详情过来的,需要对employeenumber、uid做强校验。
// 如果不是从人员详情过来的,employeenumber、uid从当前人员的获取。
return
Promise
.
all
([
app
.
getUser
(),
getUserInfoByOid
(
openId
)])
.
then
(([
user
,
viewee
])
=>
{
// user 查看者
// viewee 被查看者
console
.
log
(
'user:'
,
user
)
// todo: 需要通过接口抓取。
console
.
log
(
'viewee:'
,
viewee
)
// todo:目前先写死房产,待黄延龄确认orgType怎么获取后再将orgType变成动态的。
const
extra
=
{
employeenumber
:
'10004534'
,
employeenumber
:
viewee
.
employeenumber
,
uid
:
viewee
.
uid
,
extra
:
'{"orgType": 1}'
}
userid
=
extra
.
employeenumber
||
user
.
employeenumber
;
userid
=
isFromPersonDetail
?
extra
.
employeenumber
:
user
.
employeenumber
;
_uid
=
isFromPersonDetail
?
extra
.
uid
:
user
.
uid
;
if
(
!
userid
||
!
_uid
)
{
alert
(
'应用启动发生错误,请联系开发人员'
);
}
token
=
user
.
ssoToken
;
_uid
=
extra
.
uid
||
user
.
uid
;
appKey
=
extra
.
appkey
||
configuration
.
appkey
;
let
orgType
;
if
(
!
extra
.
extra
)
{
...
...
src/js/polyfill/cordova.js
View file @
61d06f96
...
...
@@ -183,6 +183,49 @@
}
var
handlers
=
{
MIDEACOMMON
:
{
launchExternalAPPByThird
:
function
(
params
,
successFn
,
failFn
)
{
params
=
params
||
[]
if
(
!
params
.
length
)
{
failFn
(
'未检测到要打开应用的包名!'
)
return
}
let
scheme
=
params
[
0
]
if
(
!
scheme
)
{
failFn
(
'未检测到要打开应用的包名!'
)
return
}
// 针对scheme可能丢失尾部的://的情况进行追加
scheme
=
`
${
scheme
}
://`
scheme
=
scheme
.
replace
(
'://://'
,
'://'
)
qing
.
call
(
'gotoApp'
,
{
data
:
`
${
scheme
}
p?`
,
success
:
function
(
result
)
{
const
success
=
(
result
||
{}).
success
||
false
if
(
`
${
success
}
`
.
toLowerCase
()
===
'true'
)
{
successFn
(
true
)
}
else
{
failFn
(
'打开应用失败!'
)
}
},
error
:
function
()
{
failFn
(
'打开应用失败!'
)
}
})
},
setBounces
:
function
(
p
,
successFn
,
failFn
)
{
p
=
p
||
[
0
]
var
enable
=
p
[
0
]
var
map
=
{
'0'
:
0
,
'1'
:
1
}
qing
.
call
(
'setBounce'
,
{
enable
:
map
[
`
${
enable
}
`
]
||
0
})
successFn
(
'success'
)
},
saveToGallery
:
function
(
urls
,
successFn
,
failFn
)
{
if
(
!
urls
.
length
)
{
failFn
(
'未检测到要保存的图片url!'
)
...
...
@@ -208,12 +251,6 @@
qing
.
call
(
'closeWebView'
)
successFn
(
'success'
)
},
orgChoose1
:
function
(
p
,
successFn
,
failFn
)
{
selectPersons
([],
false
,
successFn
,
failFn
)
},
orgMuChoose1
:
function
(
selected
,
successFn
,
failFn
)
{
selectPersons
(
selected
,
true
,
successFn
,
failFn
)
},
openSysBrowser
:
function
(
urls
,
successFn
,
failFn
)
{
var
u
=
urls
||
[]
if
(
!
u
.
length
)
{
...
...
@@ -288,7 +325,15 @@
}
},
MIDEAUSER
:
{
orgChoose
:
function
(
p
,
successFn
,
failFn
)
{
selectPersons
([],
false
,
successFn
,
failFn
)
},
orgMuChoose
:
function
(
selected
,
successFn
,
failFn
)
{
selectPersons
(
selected
,
true
,
successFn
,
failFn
)
},
getUser
:
function
(
param
,
successFn
,
failFn
)
{
// shr员工编号字段
var
employeenumberField
=
process
.
env
.
PACK_ENV
===
'product'
?
'5893b734-4537-4036-9f1c-16ff831b64b2'
:
'72f1d584-bc3d-4616-85d0-4a67c1829d1c'
getCurrentUserInfo
(
function
(
result
)
{
var
success
=
(
result
||
{}).
success
var
error
=
(
result
||
{}).
error
...
...
@@ -298,7 +343,12 @@
return
}
var
userInfo
=
data
.
userInfo
||
{}
var
extra
=
data
.
extra
||
[]
var
employeenumberInfo
=
extra
.
filter
(
function
(
item
)
{
return
employeenumberField
===
item
.
publicid
})
successFn
({
employeenumber
:
(
employeenumberInfo
[
0
]
||
{}).
value
,
uid
:
userInfo
.
username
,
email
:
userInfo
.
email
,
avatar
:
userInfo
.
avatar
,
...
...
@@ -310,6 +360,9 @@
ssoToken
:
data
.
ssoToken
})
})
},
getUserPassword
:
function
(
param
,
successFn
,
failFn
)
{
successFn
({})
}
},
MIDEAPDF
:
{
...
...
@@ -377,6 +430,7 @@
}
}
/*
var CAMERA = {
PictureSourceType: {
0: 'photo',
...
...
@@ -384,6 +438,7 @@
2: 'photo'
}
}
*/
global
.
navigator
.
camera
=
{
getPicture
:
function
(
successFn
,
failFn
,
params
)
{
...
...
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