Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
folacin-front
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ynby
folacin-front
Commits
9b3830f0
Commit
9b3830f0
authored
Feb 18, 2025
by
罗成兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户id获取
parent
632dcf0b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
131 additions
and
22 deletions
+131
-22
api.js
folacin-app/src/axios/api.js
+3
-0
index.js
folacin-app/src/router/index.js
+1
-1
debugInfo.vue
folacin-app/src/views/index/debugInfo.vue
+65
-0
index.vue
folacin-app/src/views/index/index.vue
+49
-16
provideUnit.vue
folacin-app/src/views/provideUnit/provideUnit.vue
+13
-5
No files found.
folacin-app/src/axios/api.js
View file @
9b3830f0
...
@@ -36,3 +36,6 @@ export const getUserInfoLast = residentId => {
...
@@ -36,3 +36,6 @@ export const getUserInfoLast = residentId => {
export
const
getChildAreaByParentCode
=
areaCode
=>
{
export
const
getChildAreaByParentCode
=
areaCode
=>
{
return
apiInstance
.
get
(
`/v1/folacin-resident-app/resident/area-child/
${
areaCode
}
`
);
return
apiInstance
.
get
(
`/v1/folacin-resident-app/resident/area-child/
${
areaCode
}
`
);
};
};
export
const
getUserByToken
=
token
=>
{
return
apiInstance
.
get
(
`/v1/folacin-resident-app/resident/get-user-id/
${
token
}
`
);
};
folacin-app/src/router/index.js
View file @
9b3830f0
...
@@ -13,7 +13,7 @@ const routes = [
...
@@ -13,7 +13,7 @@ const routes = [
{
path
:
'/receiveDetail'
,
name
:
'receiveDetail'
,
component
:
()
=>
import
(
'../views/receiveDetail/receiveDetail.vue'
)},
{
path
:
'/receiveDetail'
,
name
:
'receiveDetail'
,
component
:
()
=>
import
(
'../views/receiveDetail/receiveDetail.vue'
)},
{
path
:
'/canvas'
,
name
:
'canvas'
,
component
:
()
=>
import
(
'../views/canvas/canvas.vue'
)},
{
path
:
'/canvas'
,
name
:
'canvas'
,
component
:
()
=>
import
(
'../views/canvas/canvas.vue'
)},
{
path
:
'/questionAnswer'
,
name
:
'canvas'
,
component
:
()
=>
import
(
'../views/questionAnswer/questionAnswer.vue'
)},
{
path
:
'/questionAnswer'
,
name
:
'canvas'
,
component
:
()
=>
import
(
'../views/questionAnswer/questionAnswer.vue'
)},
{
path
:
'/debugInfo'
,
name
:
'canvas'
,
component
:
()
=>
import
(
'../views/index/debugInfo.vue'
)},
{
path
:
'/test1'
,
name
:
'test1'
,
component
:
()
=>
import
(
'../views/test/test1.vue'
)},
{
path
:
'/test1'
,
name
:
'test1'
,
component
:
()
=>
import
(
'../views/test/test1.vue'
)},
]
]
...
...
folacin-app/src/views/index/debugInfo.vue
0 → 100644
View file @
9b3830f0
<
template
>
<div>
<van-nav-bar
fixed
>
<template
#
title
>
<div>
调试信息
</div>
</
template
>
</van-nav-bar>
<br>
<br>
<van-divider
/>
<van-list
v-model:loading=
"loading"
:finished=
"finished"
finished-text=
""
>
<van-cell
:title=
"'Token: '+userInfo.token"
/>
<van-cell
:title=
"'账号: '+userInfo.account"
/>
<van-cell
:title=
"'用户ID: '+userInfo.userId"
/>
<van-cell
:title=
"'接入地址: '+userInfo.domain"
/>
</van-list>
<br>
<van-button
style=
"margin-left: 10%;width: 80%"
round
type=
"primary"
color=
"#1989fa"
@
click=
"copyUserInfo()"
>
复制
</van-button>
<br>
<br>
<van-button
style=
"margin-left: 10%;width: 80%"
round
type=
"danger"
color=
"#EC808D"
@
click=
"handleBack()"
>
关闭
</van-button>
</div>
</template>
<
script
>
export
default
{
components
:
{},
data
()
{
return
{
loading
:
true
,
finished
:
true
,
userInfo
:
JSON
.
parse
(
sessionStorage
.
getItem
(
"userInfo"
))
||
{},
}
},
methods
:
{
copyUserInfo
(){
let
textarea
=
document
.
createElement
(
'textarea'
);
textarea
.
style
.
position
=
'fixed'
;
textarea
.
style
.
opacity
=
0
;
textarea
.
value
=
JSON
.
stringify
(
this
.
userInfo
);
document
.
body
.
appendChild
(
textarea
);
textarea
.
select
();
document
.
execCommand
(
'copy'
);
document
.
body
.
removeChild
(
textarea
);
this
.
$toast
.
tips
(
'已复制到剪贴板!'
);
},
handleBack
(){
this
.
$router
.
go
(
-
1
);
}
}
}
</
script
>
<
style
scoped
lang=
"less"
>
</
style
>
\ No newline at end of file
folacin-app/src/views/index/index.vue
View file @
9b3830f0
<
template
>
<
template
>
<div>
<div>
<van-nav-bar
fixed
>
<template
#
title
>
<div
@
click=
"debugInfo"
>
提示
</div>
</
template
>
</van-nav-bar>
<br>
<br>
<van-divider
/>
<div
v-if=
"msg"
>
<div
v-if=
"msg"
>
<br><br><br><br>
<br>
<br><br><br><br>
<van-empty
image=
"error"
:description=
"msg"
/>
<van-empty
image=
"error"
:description=
"msg"
/>
<van-button
style=
"margin-left: 10%;width: 80%"
round
type=
"danger"
color=
"#EC808D"
@
click=
"handleBack()"
>
<van-button
style=
"margin-left: 10%;width: 80%"
round
type=
"danger"
color=
"#EC808D"
@
click=
"handleBack()"
>
关闭
关闭
...
@@ -12,6 +21,7 @@
...
@@ -12,6 +21,7 @@
<
script
>
<
script
>
import
{
callMobile
,
isIOSWebKit
}
from
'@/utils/common'
;
import
{
callMobile
,
isIOSWebKit
}
from
'@/utils/common'
;
import
{
Dialog
}
from
'vant'
;
import
{
Dialog
}
from
'vant'
;
import
{
getUserByToken
}
from
"@/axios/api"
;
export
default
{
export
default
{
components
:
{},
components
:
{},
...
@@ -29,8 +39,7 @@ export default {
...
@@ -29,8 +39,7 @@ export default {
if
(
path
!=
'/'
)
{
if
(
path
!=
'/'
)
{
return
;
return
;
}
}
vm
.
initUserInfo
(
result
);
vm
.
getUserByToken
(
result
);
vm
.
showMsg
();
};
};
},
},
mounted
()
{
mounted
()
{
...
@@ -40,39 +49,60 @@ export default {
...
@@ -40,39 +49,60 @@ export default {
window
.
scrollTo
(
0
,
this
.
scrollPosition
);
window
.
scrollTo
(
0
,
this
.
scrollPosition
);
},
},
methods
:
{
methods
:
{
init
(){
init
()
{
if
(
process
.
env
.
NODE_ENV
==
"dev"
)
{
if
(
process
.
env
.
NODE_ENV
==
"dev
1
"
)
{
let
userInfo
=
{
let
userInfo
=
{
account
:
'18487125843'
,
account
:
'18487125843'
,
token
:
'7de354fd8be1484cacbc41e96fe88d7e'
,
token
:
'd2e2c11475a04436bbcf1ca96a7ee056'
,
userId
:
'11133351501171512'
,
userId
:
null
,
domain
:
window
.
location
.
href
,
};
};
window
.
sessionStorage
.
setItem
(
'userInfo'
,
JSON
.
stringify
(
userInfo
)
);
this
.
initUserInfo
(
userInfo
);
this
.
showMsg
(
);
this
.
getUserByToken
(
userInfo
);
}
else
{
}
else
{
let
query
=
this
.
$route
.
query
;
let
query
=
this
.
$route
.
query
;
let
userInfo
=
{
let
userInfo
=
{
account
:
query
.
account
,
account
:
query
.
account
,
token
:
query
.
token
,
token
:
query
.
token
,
userId
:
query
.
userId
,
userId
:
null
,
domain
:
window
.
location
.
href
,
};
};
if
(
!
userInfo
.
userId
&&
!
userInfo
.
account
)
{
this
.
initUserInfo
(
userInfo
);
if
(
!
userInfo
.
token
&&
!
userInfo
.
account
)
{
this
.
msg
=
"用户信息获取失败!"
this
.
msg
=
"用户信息获取失败!"
callMobile
(
'init'
,
{});
callMobile
(
'init'
,
{});
}
else
{
}
else
{
if
(
!
userInfo
.
userId
||
!
userInfo
.
account
)
{
if
(
!
userInfo
.
token
)
{
this
.
msg
=
"
用户信息
获取失败!"
this
.
msg
=
"
Token
获取失败!"
return
;
return
;
}
}
window
.
sessionStorage
.
setItem
(
'userInfo'
,
JSON
.
stringify
(
userInfo
));
if
(
!
userInfo
.
account
)
{
this
.
showMsg
();
this
.
msg
=
"账号获取失败!"
return
;
}
this
.
getUserByToken
(
userInfo
)
}
}
}
}
},
},
getUserByToken
(
userInfo
)
{
getUserByToken
(
userInfo
.
token
).
then
(
res
=>
{
if
(
res
.
code
==
'SUCCESS'
)
{
userInfo
.
userId
=
res
.
data
this
.
initUserInfo
(
userInfo
)
this
.
showMsg
();
}
else
{
this
.
msg
=
"用户id获取失败!"
}
})
},
handleBack
()
{
handleBack
()
{
callMobile
(
'goIndex'
,
{});
callMobile
(
'goIndex'
,
{});
},
},
initUserInfo
(
val
)
{
initUserInfo
(
val
)
{
if
(
process
.
env
.
NODE_ENV
==
"dev"
)
{
window
.
sessionStorage
.
setItem
(
'userInfo'
,
JSON
.
stringify
(
val
));
return
;
}
let
ios
=
isIOSWebKit
();
let
ios
=
isIOSWebKit
();
if
(
ios
)
{
if
(
ios
)
{
window
.
sessionStorage
.
setItem
(
'userInfo'
,
val
);
window
.
sessionStorage
.
setItem
(
'userInfo'
,
val
);
...
@@ -89,7 +119,10 @@ export default {
...
@@ -89,7 +119,10 @@ export default {
});
});
this
.
$router
.
push
(
'provideUnit'
);
this
.
$router
.
push
(
'provideUnit'
);
}
},
debugInfo
(){
this
.
$router
.
push
(
'debugInfo'
);
},
},
},
beforeRouteLeave
(
to
,
from
,
next
)
{
beforeRouteLeave
(
to
,
from
,
next
)
{
this
.
scrollPosition
=
document
.
documentElement
.
scrollTop
||
document
.
body
.
scrollTop
;
this
.
scrollPosition
=
document
.
documentElement
.
scrollTop
||
document
.
body
.
scrollTop
;
...
...
folacin-app/src/views/provideUnit/provideUnit.vue
View file @
9b3830f0
<
template
>
<
template
>
<div
class=
"provideUnit"
>
<div
class=
"provideUnit"
>
<!-- 头部 -->
<!-- 头部 -->
<van-nav-bar
fixed
title=
"选择叶酸发放单位"
>
<van-nav-bar
fixed
>
<template
#
title
>
<div
@
click=
"debugInfo"
>
选择叶酸发放单位
</div>
</
template
>
<
template
#
left
>
<
template
#
left
>
<img
src=
"../../assets/images/back.png"
alt=
""
@
click=
"handleBack"
/>
<img
src=
"../../assets/images/back.png"
alt=
""
@
click=
"handleBack"
/>
</
template
>
</
template
>
...
@@ -11,7 +16,7 @@
...
@@ -11,7 +16,7 @@
</van-nav-bar>
</van-nav-bar>
<!-- 搜索框 -->
<!-- 搜索框 -->
<van-search
@
blur=
"handleInput"
style=
"width: 88%;display: inline-block"
@
clear=
"handleCancel"
<van-search
@
blur=
"handleInput"
style=
"width: 88%;display: inline-block"
@
clear=
"handleCancel"
v-model=
"sea
chInfo.unitName"
placeholder=
"请输入搜索关键词"
/>
v-model=
"sear
chInfo.unitName"
placeholder=
"请输入搜索关键词"
/>
<van-icon
size=
"33"
style=
"float: right;margin-right: 8px;"
name=
"scan"
@
click=
"openQrCode"
/>
<van-icon
size=
"33"
style=
"float: right;margin-right: 8px;"
name=
"scan"
@
click=
"openQrCode"
/>
<!-- 申请部分 -->
<!-- 申请部分 -->
<
template
v-if=
"unitList.length != 0"
>
<
template
v-if=
"unitList.length != 0"
>
...
@@ -36,8 +41,8 @@ export default {
...
@@ -36,8 +41,8 @@ export default {
components
:
{},
components
:
{},
data
()
{
data
()
{
return
{
return
{
seachInfo
:
{
sea
r
chInfo
:
{
unitName
:
'云南省'
,
unitName
:
null
,
},
},
unitList
:
[],
unitList
:
[],
scrollPosition
:
0
,
scrollPosition
:
0
,
...
@@ -67,7 +72,7 @@ export default {
...
@@ -67,7 +72,7 @@ export default {
},
},
getProvideUnitList
()
{
getProvideUnitList
()
{
this
.
$toast
.
open
();
this
.
$toast
.
open
();
let
unitName
=
this
.
sea
chInfo
.
unitName
;
let
unitName
=
this
.
sea
rchInfo
.
unitName
||
'云南省'
;
if
(
isEmpty
(
unitName
))
{
if
(
isEmpty
(
unitName
))
{
unitName
=
undefined
;
unitName
=
undefined
;
}
}
...
@@ -83,6 +88,9 @@ export default {
...
@@ -83,6 +88,9 @@ export default {
this
.
$toast
.
close
();
this
.
$toast
.
close
();
});
});
},
},
debugInfo
(){
this
.
$router
.
push
(
'debugInfo'
);
},
// 申请
// 申请
handleClick
(
val
)
{
handleClick
(
val
)
{
let
areaFullName
=
val
.
areaFullName
?
val
.
areaFullName
:
""
;
let
areaFullName
=
val
.
areaFullName
?
val
.
areaFullName
:
""
;
...
...
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