Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨炀
/
ztx_wx_gzt
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
58c2b92e
authored
2026-06-05 17:15:20 +0800
by
lttnew
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
上传头像问题
1 parent
c9bf47f3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
273 additions
and
150 deletions
common/api.js
common/utils.js
config.js
personal/home.vue
personalVip/addVip.vue
personalVip/list.vue
common/api.js
View file @
58c2b92
...
...
@@ -141,14 +141,14 @@ export function deptTreeSelect(params) {
}
// 注册选择协会树
export
function
certifiedDeptTreeRegister
(
params
,
options
=
{})
{
return
request
({
...
options
,
url
:
'/system/user/certifiedDeptTreeWithNoDaoguan2'
,
method
:
'get'
,
params
})
}
export
function
certifiedDeptTreeRegister
(
params
,
options
=
{})
{
return
request
({
...
options
,
url
:
'/system/user/certifiedDeptTreeWithNoDaoguan2'
,
method
:
'get'
,
params
})
}
const
setIdToString
=
(
list
)
=>
{
for
(
var
l
of
list
)
{
...
...
@@ -209,14 +209,14 @@ export function reader(query) {
})
}
export
function
regionsList
(
params
,
options
=
{})
{
return
request
({
...
options
,
url
:
'/common/region/regionsList'
,
method
:
'get'
,
params
})
}
export
function
regionsList
(
params
,
options
=
{})
{
return
request
({
...
options
,
url
:
'/common/region/regionsList'
,
method
:
'get'
,
params
})
}
// 添加会员自动录入 上传图片
export
function
carUrl
(
data
,
type
)
{
...
...
@@ -323,7 +323,7 @@ export function uploadImgCorpPhoto(tempFilePath) {
title
:
'加载中'
});
return
uni
.
uploadFile
({
url
:
config
.
baseUrl_api
+
'/
upload/uploadImgToLocalServer
CaiJian'
,
url
:
config
.
baseUrl_api
+
'/
fileServer/uploadImgToMinio
CaiJian'
,
header
:
{
'Authorization'
:
uni
.
getStorageSync
(
'token'
),
},
...
...
@@ -337,18 +337,26 @@ export function uploadImgCorpPhoto(tempFilePath) {
});
}
export
function
getInfo
(
perId
)
{
return
request
({
url
:
'/person/info/'
+
perId
,
method
:
'get'
})
}
// 查询个人会员信息列表
export
function
selectPageList
(
query
)
{
return
request
({
url
:
'/person/info/selectPageList'
,
method
:
'get'
,
export
function
getInfo
(
perId
)
{
return
request
({
url
:
'/person/info/'
+
perId
,
method
:
'get'
})
}
export
function
updateInfo
(
data
)
{
return
request
({
url
:
'/person/info'
,
method
:
'put'
,
params
:
data
})
}
// 查询个人会员信息列表
export
function
selectPageList
(
query
)
{
return
request
({
url
:
'/person/info/selectPageList'
,
method
:
'get'
,
params
:
query
})
}
...
...
@@ -479,13 +487,13 @@ export function getFeeBillDetail(payId) {
}
// 获取自己团队成员信息
export
function
getMyOwnMemberInfo
(
options
=
{})
{
return
request
({
...
options
,
url
:
'/member/info/getMyOwnMemberInfo'
,
method
:
'get'
})
}
export
function
getMyOwnMemberInfo
(
options
=
{})
{
return
request
({
...
options
,
url
:
'/member/info/getMyOwnMemberInfo'
,
method
:
'get'
})
}
// 会员调入
export
function
getMobilizelist
(
params
)
{
...
...
@@ -1533,14 +1541,14 @@ export function checkPersonByPersonId(perId) {
}
// 获取单位会员优惠政策
export
function
canUseDiscount
(
params
,
options
=
{})
{
return
request
({
...
options
,
url
:
`/system/certifiedNew/canUseDiscount`
,
method
:
'get'
,
params
})
}
export
function
canUseDiscount
(
params
,
options
=
{})
{
return
request
({
...
options
,
url
:
`/system/certifiedNew/canUseDiscount`
,
method
:
'get'
,
params
})
}
// 获取单位会员一年缴费价格
export
function
getMyMemberCertUnitFee
(
params
)
{
...
...
@@ -1570,15 +1578,15 @@ export function creditCodeExist(code) {
}
// 生成单位订单renewYear
export
function
certifiedNew
(
data
)
{
let
url
=
'/system/certifiedNew/commit'
const
params
=
[]
if
(
data
.
renewYear
)
params
.
push
(
`renewYear=
${
data
.
renewYear
}
`
)
params
.
push
(
`type=
${
data
.
type
}
`
)
if
(
data
.
payType
)
params
.
push
(
`payType=
${
data
.
payType
}
`
)
if
(
data
.
contactPerson
)
params
.
push
(
`contactPerson=
${
data
.
contactPerson
}
`
)
if
(
data
.
contactTel
)
params
.
push
(
`contactTel=
${
data
.
contactTel
}
`
)
if
(
params
.
length
>
0
)
{
export
function
certifiedNew
(
data
)
{
let
url
=
'/system/certifiedNew/commit'
const
params
=
[]
if
(
data
.
renewYear
)
params
.
push
(
`renewYear=
${
data
.
renewYear
}
`
)
params
.
push
(
`type=
${
data
.
type
}
`
)
if
(
data
.
payType
)
params
.
push
(
`payType=
${
data
.
payType
}
`
)
if
(
data
.
contactPerson
)
params
.
push
(
`contactPerson=
${
data
.
contactPerson
}
`
)
if
(
data
.
contactTel
)
params
.
push
(
`contactTel=
${
data
.
contactTel
}
`
)
if
(
params
.
length
>
0
)
{
url
+=
'?'
+
params
.
join
(
'&'
)
}
return
request
({
...
...
@@ -1631,14 +1639,14 @@ export function pcallBack2(orderId) {
}
// 优惠政策回显
export
function
getZtxDiscountPolicy
(
params
,
options
=
{})
{
return
request
({
...
options
,
url
:
'/system/config/getZtxDiscountPolicy'
,
method
:
'get'
,
params
})
}
export
function
getZtxDiscountPolicy
(
params
,
options
=
{})
{
return
request
({
...
options
,
url
:
'/system/config/getZtxDiscountPolicy'
,
method
:
'get'
,
params
})
}
// 考官列表
export
function
listApi
(
params
)
{
...
...
@@ -1690,13 +1698,13 @@ export function commitExamPointApply(params) {
})
}
export
function
getMyStatus
(
options
=
{})
{
return
request
({
...
options
,
url
:
`/member/examPointApply/getMyStatus`
,
method
:
'get'
,
})
}
export
function
getMyStatus
(
options
=
{})
{
return
request
({
...
options
,
url
:
`/member/examPointApply/getMyStatus`
,
method
:
'get'
,
})
}
// 个人会员缴费支付
export
function
goPay
(
params
)
{
...
...
@@ -1789,13 +1797,13 @@ export function createMemberPayRange(data) {
}
// 获取最近认证记录 单位会员
export
function
getMyRecent
(
options
=
{})
{
return
request
({
...
options
,
url
:
'/system/certifiedNew/getMyRecent'
,
method
:
'get'
})
}
export
function
getMyRecent
(
options
=
{})
{
return
request
({
...
options
,
url
:
'/system/certifiedNew/getMyRecent'
,
method
:
'get'
})
}
// 获取最近认证记录 考点
...
...
common/utils.js
View file @
58c2b92
import
CryptoJS
from
'crypto-js'
import
config
from
'@/config.js'
export
function
szToHz
(
num
)
{
const
hzArr
=
[
'〇'
,
'一'
,
'二'
,
'三'
,
'四'
,
'五'
,
'六'
,
'七'
,
'八'
,
'九'
,
'十'
]
return
hzArr
[
parseInt
(
num
)]
...
...
@@ -52,3 +53,24 @@ export function reLaunchHomeByRole() {
url
:
isDaoGuanRole
()
?
'/pages/index/daoGuanPerson'
:
'/pages/index/home'
})
}
export
function
fillImgUrl
(
url
,
prefix
)
{
if
(
!
url
)
return
''
const
trimmedUrl
=
String
(
url
).
trim
()
if
(
!
trimmedUrl
)
return
''
if
(
trimmedUrl
.
startsWith
(
'msr:'
))
{
return
`
${
trimBaseUrl
(
config
.
baseUrl_api
)}
/fileServer/download?file=
${
encodeURIComponent
(
trimmedUrl
)}
&downFlag=0`
}
if
(
/^
(
data:|https
?
:
\/\/)
/
.
test
(
trimmedUrl
))
{
return
trimmedUrl
}
const
baseUrl
=
prefix
?
`
${
trimBaseUrl
(
config
.
baseUrl_api
)}
/
${
String
(
prefix
).
replace
(
/^
\/
+|
\/
+$/g
,
''
)}
`
:
trimBaseUrl
(
config
.
baseUrl_api
)
const
path
=
trimmedUrl
.
startsWith
(
'/'
)
?
trimmedUrl
:
`/
${
trimmedUrl
}
`
return
baseUrl
+
path
}
function
trimBaseUrl
(
url
)
{
return
String
(
url
||
''
).
replace
(
/
\/
+$/
,
''
)
}
...
...
config.js
View file @
58c2b92
// dev
// const baseUrl_api = 'http://192.168.1.222
:8787'
const
baseUrl_api
=
'http://192.168.1.159
:8787'
// const baseUrl_api = 'http://47.98.186.233:8787'
const
baseUrl_api
=
'https://tk001.wxjylt.com/stage-api/'
//
const baseUrl_api = 'https://tk001.wxjylt.com/stage-api/'
const
loginImage_api
=
'https://tk001.wxjylt.com/stage-api'
const
payUrl
=
'https://wxpay.cmbc.com.cn/mobilePlatform/appserver/lcbpPay.do'
...
...
personal/home.vue
View file @
58c2b92
...
...
@@ -23,12 +23,8 @@
</view>
<view
class=
"user-top"
>
<view
class=
"avatar-wrap"
@
click=
"showLogoutConfirm"
>
<!--
<image
class=
"avatar"
v-if=
"perInfo.photo"
:src=
"config.baseUrl_api + perInfo.photo"
mode=
"aspectFill"
>
</image>
-->
<image
:src=
"config.baseUrl_api + '/fs/static/tx@2x.png'"
class=
"avatar"
mode=
"aspectFill"
>
<view
class=
"avatar-wrap"
@
click=
"handleAvatarUpload"
>
<image
:src=
"avatarUrl"
class=
"avatar"
mode=
"aspectFill"
>
</image>
</view>
<!--
<view
class=
"member-id"
>
{{
userInfo
?.
userName
}}
</view>
-->
...
...
@@ -219,9 +215,13 @@ import to from 'await-to-js'
import
{
bindUser
,
unbindUser
,
downStuCertSingle
downStuCertSingle
,
uploadImgCorpPhoto
,
getInfo
,
updateInfo
}
from
'@/common/api.js'
import
{
onShow
}
from
"@dcloudio/uni-app"
;
import
{
fillImgUrl
}
from
'@/common/utils.js'
const
userStore
=
useUserStore
()
const
userInfo
=
computed
(()
=>
userStore
.
user
??
{})
...
...
@@ -229,6 +229,21 @@ const perInfo = computed(() => userStore.perInfo ?? {})
console
.
log
(
222
,
userInfo
.
value
)
console
.
log
(
333
,
perInfo
.
value
)
const
isValidPhotoValue
=
(
value
)
=>
{
if
(
value
===
undefined
||
value
===
null
)
return
false
const
photo
=
String
(
value
).
trim
()
return
photo
!==
''
&&
photo
!==
'null'
&&
photo
!==
'undefined'
}
const
getAvatarPhoto
=
(
info
=
{})
=>
{
return
[
info
.
photo2
,
info
.
perPhoto2
,
info
.
photo
,
info
.
perPhoto
].
find
(
isValidPhotoValue
)
||
''
}
const
avatarUrl
=
computed
(()
=>
{
const
photo
=
getAvatarPhoto
(
perInfo
.
value
)
return
photo
?
fillImgUrl
(
photo
)
:
config
.
baseUrl_api
+
'/fs/static/tx@2x.png'
})
// 是否已绑定学员:绑定非会员时只有姓名,没有会员卡号,也应视为已绑定,避免反复弹绑定框。
const
isBound
=
computed
(()
=>
{
const
perName
=
perInfo
.
value
?.
perName
...
...
@@ -538,6 +553,89 @@ const goToPay = () => {
});
};
const
handleAvatarUpload
=
()
=>
{
if
(
!
isBound
.
value
)
{
uni
.
showToast
({
title
:
'请先绑定学员'
,
icon
:
'none'
})
return
}
uni
.
chooseImage
({
count
:
1
,
sizeType
:
[
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
success
:
(
res
)
=>
{
const
imgUrl
=
res
.
tempFilePaths
?.[
0
]
if
(
!
imgUrl
)
{
uni
.
showToast
({
title
:
'未获取到图片地址,请重新选择图片'
,
icon
:
'none'
})
return
}
if
(
typeof
wx
===
'undefined'
||
typeof
wx
.
cropImage
!==
'function'
)
{
uploadAvatarPhoto
(
imgUrl
)
return
}
wx
.
cropImage
({
src
:
imgUrl
,
cropScale
:
'4:5'
,
success
:
(
cropRes
)
=>
{
uploadAvatarPhoto
(
cropRes
.
tempFilePath
||
imgUrl
)
},
fail
:
()
=>
{
uploadAvatarPhoto
(
imgUrl
)
}
})
}
})
}
const
uploadAvatarPhoto
=
async
(
path
)
=>
{
uni
.
showLoading
({
title
:
'上传中...'
,
mask
:
true
})
const
[
uploadErr
,
uploadRes
]
=
await
to
(
uploadImgCorpPhoto
(
path
))
if
(
uploadErr
||
uploadRes
?.
code
!==
200
||
!
uploadRes
?.
data
)
{
uni
.
hideLoading
()
uni
.
showToast
({
title
:
uploadRes
?.
msg
||
'头像上传失败,请重新上传'
,
icon
:
'none'
})
return
}
const
photo
=
uploadRes
.
data
.
fang
||
''
const
photo2
=
uploadRes
.
data
.
yuan
||
''
if
(
!
photo
||
!
photo2
)
{
uni
.
hideLoading
()
uni
.
showToast
({
title
:
'头像上传返回数据异常'
,
icon
:
'none'
})
return
}
const
currentPerInfo
=
userStore
.
perInfo
||
{}
const
nextPerInfo
=
{
...
currentPerInfo
,
photo
,
photo2
}
const
perId
=
userInfo
.
value
?.
perId
||
currentPerInfo
.
perId
if
(
!
perId
)
{
uni
.
hideLoading
()
uni
.
showToast
({
title
:
'未获取到人员信息,请重新登录后再试'
,
icon
:
'none'
})
return
}
const
[
detailErr
,
detailRes
]
=
await
to
(
getInfo
(
perId
))
const
saveParams
=
{
...(
detailErr
?
currentPerInfo
:
(
detailRes
?.
data
||
currentPerInfo
)),
perId
,
photo
,
photo2
}
const
[
saveErr
]
=
await
to
(
updateInfo
(
saveParams
))
uni
.
hideLoading
()
if
(
saveErr
)
{
uni
.
showToast
({
title
:
'头像已上传,保存失败请稍后重试'
,
icon
:
'none'
})
return
}
userStore
.
setPerInfo
(
nextPerInfo
)
uni
.
showToast
({
title
:
'头像上传成功'
,
icon
:
'success'
})
await
getWebInfo
().
catch
(()
=>
{})
}
// 下载电子会员证
const
downCert
=
async
()
=>
{
if
(
!
isBound
.
value
)
{
...
...
@@ -546,7 +644,12 @@ const downCert = async () => {
}
const
perId
=
userInfo
.
value
?.
perId
if
(
!
perId
)
return
if
(
!
perInfo
.
value
.
perPhoto
||
!
perInfo
.
value
.
perPhoto2
)
{
uni
.
hideLoading
()
uni
.
showToast
({
title
:
'请先上传头像照片'
,
icon
:
'none'
})
return
}
uni
.
showLoading
({
title
:
'加载中...'
,
mask
:
true
})
const
[
err
,
res
]
=
await
to
(
downStuCertSingle
(
perId
))
uni
.
hideLoading
()
...
...
personalVip/addVip.vue
View file @
58c2b92
...
...
@@ -109,8 +109,9 @@
import
{
onLoad
}
from
'@dcloudio/uni-app'
import
config
from
'@/config.js'
import
*
as
aes2
from
'@/common/utils.js'
import
config
from
'@/config.js'
import
*
as
aes2
from
'@/common/utils.js'
import
{
fillImgUrl
}
from
'@/common/utils.js'
const
current
=
ref
(
0
)
const
agree
=
ref
(
false
)
const
perId
=
ref
()
...
...
@@ -331,15 +332,16 @@
uni
.
showLoading
({
title
:
'加载中'
});
api
.
uploadImgCorpPhoto
(
path
).
then
(
data
=>
{
console
.
log
(
data
)
baseFormData
.
value
.
photo
=
data
.
data
.
fang
;
baseFormData
.
value
.
photo2
=
data
.
data
.
yuan
;
photoArr
.
value
=
{
url
:
config
.
baseUrl_api
+
baseFormData
.
value
.
photo
,
name
:
'头像'
,
extname
:
'jpg'
}
api
.
uploadImgCorpPhoto
(
path
).
then
(
data
=>
{
console
.
log
(
data
)
const
photoData
=
data
.
data
||
{}
baseFormData
.
value
.
photo
=
photoData
.
fang
||
''
;
baseFormData
.
value
.
photo2
=
photoData
.
yuan
||
''
;
photoArr
.
value
=
{
url
:
fillImgUrl
(
baseFormData
.
value
.
photo
),
name
:
'头像'
,
extname
:
'jpg'
}
}).
catch
(()
=>
{
photoArr
.
value
=
{}
baseFormData
.
value
.
photo
=
''
...
...
@@ -419,27 +421,17 @@
baseFormData
.
value
.
perCode
=
res
.
data
.
perCode
||
''
baseFormData
.
value
.
validityDateRaw
=
res
.
data
.
validityDate
||
''
baseFormData
.
value
.
validityDate
=
res
.
data
.
validityDate
?.
slice
(
0
,
10
)
//去掉时分秒
if
(
res
.
data
.
photo
)
{
console
.
log
(
res
.
data
.
photo
)
if
(
res
.
data
.
photo
.
indexOf
(
'http'
)
==
-
1
)
{
baseFormData
.
value
.
photo
=
res
.
data
.
photo
let
obj
=
{
url
:
config
.
baseUrl_api
+
res
.
data
.
photo
,
name
:
'头像'
,
extname
:
'jpg'
}
photoArr
.
value
=
obj
}
else
{
baseFormData
.
value
.
photo
=
res
.
data
.
photo
let
obj
=
{
url
:
res
.
data
.
photo
,
name
:
'头像'
,
extname
:
'jpg'
}
photoArr
.
value
=
obj
}
}
if
(
res
.
data
.
photo
)
{
console
.
log
(
res
.
data
.
photo
)
baseFormData
.
value
.
photo
=
res
.
data
.
photo
let
obj
=
{
url
:
fillImgUrl
(
res
.
data
.
photo
),
name
:
'头像'
,
extname
:
'jpg'
}
photoArr
.
value
=
obj
}
// baseFormData.value.name = res.data.name
baseFormData
.
value
.
perId
=
res
.
data
.
perId
console
.
log
(
res
.
data
.
photo
,
baseFormData
.
value
.
photo
)
...
...
@@ -462,7 +454,7 @@
}
function
giveBirthDay
()
{
function
giveBirthDay
()
{
// 判断身份证正确性/赋值生日
if
(
baseFormData
.
value
.
idcType
==
0
)
{
if
(
!
(
/
(
^
\d{15}
$
)
|
(
^
\d{17}([
0-9
]
|X
)
$
)
/
.
test
(
baseFormData
.
value
.
idcCode
)))
{
...
...
@@ -492,10 +484,9 @@
// return
// }
// }
}
function
changeIdcType
(
e
)
{
}
function
changeIdcType
(
e
)
{
console
.
log
(
e
)
// 切换证件照类型把当前页面数据清空
cardObj
.
value
=
{}
...
...
personalVip/list.vue
View file @
58c2b92
...
...
@@ -54,9 +54,9 @@
</view>
</template>
<
script
setup
>
import
*
as
api
from
'@/common/api.js'
import
config
from
'@/config.js'
<
script
setup
>
import
*
as
api
from
'@/common/api.js'
import
{
fillImgUrl
}
from
'@/common/utils.js'
import
{
onMounted
,
ref
...
...
@@ -90,18 +90,14 @@
// 道馆
query
.
value
.
multiDeptFlag
=
null
query
.
value
.
showMyPersonFlag
=
1
}
api
.
selectPageList
(
query
.
value
).
then
(
res
=>
{
for
(
var
l
of
res
.
rows
)
{
if
(
l
.
photo
&&
l
.
photo
.
indexOf
(
'http'
)
==
-
1
)
{
l
.
photo
=
config
.
baseUrl_api
+
l
.
photo
}
}
list
.
value
=
res
.
rows
paging
.
value
.
complete
(
res
.
rows
)
total
.
value
=
res
.
total
})
}
}
api
.
selectPageList
(
query
.
value
).
then
(
res
=>
{
const
rows
=
formatRows
(
res
.
rows
||
[])
list
.
value
=
rows
paging
.
value
.
complete
(
rows
)
total
.
value
=
res
.
total
})
}
function
getList
()
{
uni
.
showLoading
({
title
:
'加载中'
...
...
@@ -110,19 +106,22 @@
// 道馆
query
.
value
.
multiDeptFlag
=
null
query
.
value
.
showMyPersonFlag
=
1
}
api
.
selectPageList
(
query
.
value
).
then
(
res
=>
{
for
(
var
l
of
res
.
rows
)
{
if
(
l
.
photo
&&
l
.
photo
.
indexOf
(
'http'
)
==
-
1
)
{
l
.
photo
=
config
.
baseUrl_api
+
l
.
photo
}
}
list
.
value
=
res
.
rows
paging
.
value
.
complete
(
res
.
rows
)
total
.
value
=
res
.
total
uni
.
hideLoading
()
})
}
}
api
.
selectPageList
(
query
.
value
).
then
(
res
=>
{
const
rows
=
formatRows
(
res
.
rows
||
[])
list
.
value
=
rows
paging
.
value
.
complete
(
rows
)
total
.
value
=
res
.
total
uni
.
hideLoading
()
})
}
function
formatRows
(
rows
)
{
return
rows
.
map
(
item
=>
({
...
item
,
photo
:
fillImgUrl
(
item
.
photo
)
}))
}
function
handleDelete
(
item
)
{
uni
.
showModal
({
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment