Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fns_front_2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenqikuai
fns_front_2
Commits
4a93b0ee
Commit
4a93b0ee
authored
Nov 03, 2021
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
e167dd72
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
94 deletions
+116
-94
index.vue
src/components/LiveCard/index.vue
+37
-33
live.ts
src/utils/live.ts
+9
-20
index.vue
src/views/withMenu/Home/index.vue
+70
-41
No files found.
src/components/LiveCard/index.vue
View file @
4a93b0ee
...
@@ -22,48 +22,54 @@
...
@@ -22,48 +22,54 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
defineComponent
}
from
"vue"
;
import
{
defineComponent
}
from
"vue"
;
import
Icon
from
"../common/Icon.vue"
;
import
Icon
from
"../common/Icon.vue"
;
import
Bridge
from
"@/utils/jsBridge2"
import
Bridge
from
"@/utils/jsBridge2"
;
import
{
Toast
}
from
"vant"
;
import
{
Toast
}
from
"vant"
;
import
{
enableLive
}
from
"@/service/StaffService"
;
import
{
enableLive
}
from
"@/service/StaffService"
;
import
{
getCurrentUserAvatarUrl
}
from
"@/utils/userMsg"
;
export
default
defineComponent
({
export
default
defineComponent
({
components
:
{
Icon
},
components
:
{
Icon
},
props
:
{
props
:
{
title
:
String
,
title
:
String
,
},
},
mounted
()
{
mounted
()
{},
},
methods
:
{
methods
:
{
goto
()
{
goto
()
{
const
USER_MSG
=
window
.
localStorage
.
getItem
(
'USER_MSG'
)
const
avatarUrl
=
getCurrentUserAvatarUrl
();
const
finalAvatarUrl
=
window
.
location
.
protocol
+
"//"
+
window
.
location
.
host
+
avatarUrl
;
const
USER_MSG
=
window
.
localStorage
.
getItem
(
"USER_MSG"
);
if
(
!
USER_MSG
)
{
if
(
!
USER_MSG
)
{
Toast
(
'请先登录'
)
Toast
(
"请先登录"
);
return
return
;
}
}
let
allow
=
false
let
allow
=
false
;
let
time_section
=
''
let
time_section
=
""
;
enableLive
().
then
(
res
=>
{
enableLive
()
if
(
res
.
code
===
200
)
{
.
then
((
res
)
=>
{
allow
=
res
.
data
.
allow
if
(
res
.
code
===
200
)
{
time_section
=
res
.
data
.
time_section
allow
=
res
.
data
.
allow
;
}
time_section
=
res
.
data
.
time_section
;
new
Bridge
().
bridge_gotoLiveRoom
({
}
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)?.
userInfo
.
phone
,
new
Bridge
().
bridge_gotoLiveRoom
({
avatar
:
window
.
location
.
host
+
require
(
'@/assets/icons/avatar.png'
),
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
"USER_MSG"
)
as
string
)
allow
,
?.
userInfo
.
phone
,
time_section
avatar
:
finalAvatarUrl
,
})
allow
,
}).
catch
(()
=>
{
time_section
,
new
Bridge
().
bridge_gotoLiveRoom
({
});
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)?.
userInfo
.
phone
,
avatar
:
window
.
location
.
host
+
require
(
'@/assets/icons/avatar.png'
),
allow
,
time_section
})
})
})
.
catch
(()
=>
{
new
Bridge
().
bridge_gotoLiveRoom
({
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
"USER_MSG"
)
as
string
)
?.
userInfo
.
phone
,
avatar
:
finalAvatarUrl
,
allow
,
time_section
,
});
});
},
},
}
}
,
});
});
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
...
@@ -101,14 +107,13 @@ export default defineComponent({
...
@@ -101,14 +107,13 @@ export default defineComponent({
.outer3
{
.outer3
{
overflow
:
hidden
;
overflow
:
hidden
;
background
:
url(../../assets/img/live-outer3.png)
background
:
url(../../assets/img/live-outer3.png)
100%
no-repeat
;
100%
no-repeat
;
background-size
:
cover
;
background-size
:
cover
;
}
}
.block2
{
.block2
{
background
:
url(../../assets/img/live-block2.png)
background
:
url(../../assets/img/live-block2.png)
/* background: url(https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPngb5e34933d0e615000378ebf1491cce32e934e21b7f3de7cddbddd3f05e03ed7a) */
/* background: url(https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPngb5e34933d0e615000378ebf1491cce32e934e21b7f3de7cddbddd3f05e03ed7a) */
100%
no-repeat
;
100%
no-repeat
;
background-size
:
cover
;
background-size
:
cover
;
}
}
...
@@ -139,4 +144,4 @@ export default defineComponent({
...
@@ -139,4 +144,4 @@ export default defineComponent({
line-height
:
17px
;
line-height
:
17px
;
text-align
:
left
;
text-align
:
left
;
}
}
</
style
>
</
style
>
\ No newline at end of file
src/utils/live.ts
View file @
4a93b0ee
import
Bridge
from
'@/utils/jsBridge2'
import
Bridge
from
'@/utils/jsBridge2'
import
{
Toast
}
from
'vant'
import
{
Toast
}
from
'vant'
import
{
enableLive
}
from
'@/service/StaffService/index'
import
{
enableLive
}
from
'@/service/StaffService/index'
import
{
getCurrentUserAvatarUrl
}
from
'./userMsg'
export
const
sendLive
=
()
=>
{
export
const
sendLive
=
()
=>
{
const
avatarUrl
=
getCurrentUserAvatarUrl
()
const
finalAvatarUrl
=
window
.
location
.
protocol
+
'//'
+
window
.
location
.
host
+
avatarUrl
const
USER_MSG
=
window
.
localStorage
.
getItem
(
'USER_MSG'
)
const
USER_MSG
=
window
.
localStorage
.
getItem
(
'USER_MSG'
)
if
(
!
USER_MSG
)
{
if
(
!
USER_MSG
)
{
Toast
(
'请先登录'
)
Toast
(
'请先登录'
)
...
@@ -25,11 +30,7 @@ export const sendLive = () => {
...
@@ -25,11 +30,7 @@ export const sendLive = () => {
new
Bridge
().
bridge_live
({
new
Bridge
().
bridge_live
({
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
?.
userInfo
.
phone
,
?.
userInfo
.
phone
,
avatar
:
avatar
:
finalAvatarUrl
,
window
.
location
.
protocol
+
'//'
+
window
.
location
.
host
+
require
(
'../assets/icons/avatar.png'
),
allow
,
allow
,
time_section
,
time_section
,
})
})
...
@@ -37,11 +38,7 @@ export const sendLive = () => {
...
@@ -37,11 +38,7 @@ export const sendLive = () => {
{
{
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
?.
userInfo
.
phone
,
?.
userInfo
.
phone
,
avatar
:
avatar
:
finalAvatarUrl
,
window
.
location
.
protocol
+
'//'
+
window
.
location
.
host
+
require
(
'../assets/icons/avatar.png'
),
allow
,
allow
,
time_section
,
time_section
,
},
},
...
@@ -52,11 +49,7 @@ export const sendLive = () => {
...
@@ -52,11 +49,7 @@ export const sendLive = () => {
new
Bridge
().
bridge_live
({
new
Bridge
().
bridge_live
({
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
?.
userInfo
.
phone
,
?.
userInfo
.
phone
,
avatar
:
avatar
:
finalAvatarUrl
,
window
.
location
.
protocol
+
'//'
+
window
.
location
.
host
+
require
(
'../assets/icons/avatar.png'
),
allow
,
allow
,
time_section
,
time_section
,
})
})
...
@@ -64,11 +57,7 @@ export const sendLive = () => {
...
@@ -64,11 +57,7 @@ export const sendLive = () => {
{
{
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
?.
userInfo
.
phone
,
?.
userInfo
.
phone
,
avatar
:
avatar
:
finalAvatarUrl
,
window
.
location
.
protocol
+
'//'
+
window
.
location
.
host
+
require
(
'../assets/icons/avatar.png'
),
allow
,
allow
,
time_section
,
time_section
,
},
},
...
...
src/views/withMenu/Home/index.vue
View file @
4a93b0ee
...
@@ -28,7 +28,12 @@
...
@@ -28,7 +28,12 @@
"
"
/>
/>
</Skeleton>
</Skeleton>
<group-title
class=
"mt-7"
title=
"精彩直播"
v-if=
"LiveRoomTitle"
@
seeMore=
"handleSeeMoreLive"
/>
<group-title
class=
"mt-7"
title=
"精彩直播"
v-if=
"LiveRoomTitle"
@
seeMore=
"handleSeeMoreLive"
/>
<LiveCard
class=
"mt-4"
:title=
"LiveRoomTitle"
v-if=
"LiveRoomTitle"
/>
<LiveCard
class=
"mt-4"
:title=
"LiveRoomTitle"
v-if=
"LiveRoomTitle"
/>
<group-title
<group-title
class=
"mt-7"
class=
"mt-7"
...
@@ -51,7 +56,12 @@
...
@@ -51,7 +56,12 @@
/>
/>
</div>
</div>
</Skeleton>
</Skeleton>
<group-title
class=
"mt-7"
v-if=
"hotNews"
title=
"热门资讯"
@
click=
"$router.push('News')"
/>
<group-title
class=
"mt-7"
v-if=
"hotNews"
title=
"热门资讯"
@
click=
"$router.push('News')"
/>
<HotNews
v-for=
"n in hotNews"
:key=
"n.uuid"
:info=
"n"
/>
<HotNews
v-for=
"n in hotNews"
:key=
"n.uuid"
:info=
"n"
/>
</div>
</div>
</div>
</div>
...
@@ -60,7 +70,7 @@
...
@@ -60,7 +70,7 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
onMounted
,
onUnmounted
,
watch
}
from
"vue"
;
import
{
defineComponent
,
onMounted
,
onUnmounted
,
watch
}
from
"vue"
;
import
Banner
from
"./Banner/Banner.vue"
;
import
Banner
from
"./Banner/Banner.vue"
;
import
Navbar
from
"@/components/NavBar/index.vue"
import
Navbar
from
"@/components/NavBar/index.vue"
;
import
AppList
from
"./AppList/index.vue"
;
import
AppList
from
"./AppList/index.vue"
;
import
appList
from
"./appList"
;
import
appList
from
"./appList"
;
import
Icon
from
"@/components/common/Icon.vue"
;
import
Icon
from
"@/components/common/Icon.vue"
;
...
@@ -75,7 +85,7 @@ import { queryBannerList } from "@/service/BannerService";
...
@@ -75,7 +85,7 @@ import { queryBannerList } from "@/service/BannerService";
import
{
getImageSrcFromFileHash
}
from
"@/service/FileService"
;
import
{
getImageSrcFromFileHash
}
from
"@/service/FileService"
;
import
{
queryNotifyList
}
from
"@/service/NotifyService"
;
import
{
queryNotifyList
}
from
"@/service/NotifyService"
;
import
{
queryActivityList
}
from
"@/service/ActivityService"
;
import
{
queryActivityList
}
from
"@/service/ActivityService"
;
import
Bridge
from
"@/utils/jsBridge2"
import
Bridge
from
"@/utils/jsBridge2"
;
import
{
import
{
queryLoanProductList
,
queryLoanProductList
,
queryLoanProductInfo
,
queryLoanProductInfo
,
...
@@ -83,16 +93,23 @@ import {
...
@@ -83,16 +93,23 @@ import {
import
{
number
}
from
"bitcoinjs-lib/types/script"
;
import
{
number
}
from
"bitcoinjs-lib/types/script"
;
import
{
Skeleton
}
from
"vant"
;
import
{
Skeleton
}
from
"vant"
;
import
{
eProductStatus
}
from
"@/service/LoanProductService/type"
;
import
{
eProductStatus
}
from
"@/service/LoanProductService/type"
;
import
{
get
UserMsg
}
from
"@/utils/userMsg"
import
{
get
CurrentUserAvatarUrl
,
getUserMsg
}
from
"@/utils/userMsg"
;
import
{
sendLive
}
from
"@/utils/live"
;
import
{
sendLive
}
from
"@/utils/live"
;
import
{
isReviewMode
}
from
"@/utils/vueAppEnv"
;
import
{
isReviewMode
}
from
"@/utils/vueAppEnv"
;
import
{
chatLoginActionMark
,
eLoginType
}
from
"@/store/chatStore"
;
import
{
chatLoginActionMark
,
eLoginType
}
from
"@/store/chatStore"
;
var
hiddenProperty
=
'hidden'
in
document
?
'hidden'
:
var
hiddenProperty
=
'webkitHidden'
in
document
?
'webkitHidden'
:
"hidden"
in
document
'mozHidden'
in
document
?
'mozHidden'
:
?
"hidden"
null
;
:
"webkitHidden"
in
document
var
visibilityChangeEvent
=
(
hiddenProperty
as
string
).
replace
(
/hidden/i
,
'visibilitychange'
);
?
"webkitHidden"
:
"mozHidden"
in
document
?
"mozHidden"
:
null
;
var
visibilityChangeEvent
=
(
hiddenProperty
as
string
).
replace
(
/hidden/i
,
"visibilitychange"
);
export
default
defineComponent
({
export
default
defineComponent
({
components
:
{
components
:
{
...
@@ -109,16 +126,16 @@ export default defineComponent({
...
@@ -109,16 +126,16 @@ export default defineComponent({
Skeleton
,
Skeleton
,
},
},
data
()
{
data
()
{
const
theAppList
=
appList
.
filter
(
i
=>
{
const
theAppList
=
appList
.
filter
(
(
i
)
=>
{
if
(
isReviewMode
())
{
if
(
isReviewMode
())
{
return
!
i
.
hideInReviewMode
return
!
i
.
hideInReviewMode
;
}
else
{
}
else
{
return
true
;
return
true
;
}
}
})
})
;
return
{
return
{
LiveRoomTitle
:
''
,
LiveRoomTitle
:
""
,
appList
:
theAppList
,
appList
:
theAppList
,
skeLoading
:
false
,
skeLoading
:
false
,
bannerList
:
[]
as
string
[],
bannerList
:
[]
as
string
[],
...
@@ -156,8 +173,11 @@ export default defineComponent({
...
@@ -156,8 +173,11 @@ export default defineComponent({
};
};
},
},
beforeUnmount
()
{
beforeUnmount
()
{
clearInterval
(
this
.
intervalId
)
clearInterval
(
this
.
intervalId
);
document
.
removeEventListener
(
visibilityChangeEvent
,
this
.
onVisibilityChange
)
document
.
removeEventListener
(
visibilityChangeEvent
,
this
.
onVisibilityChange
);
},
},
mounted
()
{
mounted
()
{
this
.
getHotNews
();
this
.
getHotNews
();
...
@@ -170,38 +190,48 @@ export default defineComponent({
...
@@ -170,38 +190,48 @@ export default defineComponent({
},
},
methods
:
{
methods
:
{
startGettingLiveRoom
()
{
startGettingLiveRoom
()
{
console
.
log
(
'start getting live room'
);
console
.
log
(
"start getting live room"
);
(
window
as
any
).
bridge_initLiveRoomCard
=
this
.
initLiveRoomCard
;
(
window
as
any
).
bridge_initLiveRoomCard
=
this
.
initLiveRoomCard
;
this
.
initLiveRoomCard
();
this
.
initLiveRoomCard
();
this
.
intervalId
=
window
.
setInterval
(
this
.
initLiveRoomCard
,
2000
)
this
.
intervalId
=
window
.
setInterval
(
this
.
initLiveRoomCard
,
2000
)
;
},
},
onVisibilityChange
()
{
onVisibilityChange
()
{
if
(
hiddenProperty
&&
!
(
document
as
any
)[
(
<
string
>
hiddenProperty
)
])
{
if
(
hiddenProperty
&&
!
(
document
as
any
)[
<
string
>
hiddenProperty
])
{
console
.
log
(
'进入页面'
);
console
.
log
(
"进入页面"
);
this
.
startGettingLiveRoom
();
this
.
startGettingLiveRoom
();
}
else
{
}
else
{
console
.
log
(
'离开页面'
);
console
.
log
(
"离开页面"
);
clearInterval
(
this
.
intervalId
)
clearInterval
(
this
.
intervalId
)
;
}
}
},
},
handleSeeMoreLive
()
{
handleSeeMoreLive
()
{
sendLive
()
sendLive
()
;
},
},
initLiveRoomCard
()
{
initLiveRoomCard
()
{
const
avatarUrl
=
getCurrentUserAvatarUrl
();
if
(
getUserMsg
())
{
if
(
getUserMsg
())
{
console
.
log
(
'in initLiveRoomCard: login, requesting'
);
console
.
log
(
"in initLiveRoomCard: login, requesting"
);
new
Bridge
().
bridge_getliveInfo
(
getUserMsg
()?.
userInfo
.
phone
,
(
msg
:
string
)
=>
{
new
Bridge
().
bridge_getliveInfo
(
console
.
log
(
'in initLiveRoomCard: get msg'
,
msg
);
{
phone
:
getUserMsg
()?.
userInfo
.
phone
,
if
(
msg
)
{
avatar
:
this
.
LiveRoomTitle
=
msg
;
window
.
location
.
protocol
+
}
else
{
"//"
+
this
.
LiveRoomTitle
=
''
;
window
.
location
.
host
+
avatarUrl
,
},
(
msg
:
string
)
=>
{
console
.
log
(
"in initLiveRoomCard: get msg"
,
msg
);
if
(
msg
)
{
this
.
LiveRoomTitle
=
msg
;
}
else
{
this
.
LiveRoomTitle
=
""
;
}
}
}
})
);
}
else
{
}
else
{
console
.
log
(
'in initLiveRoomCard: not login'
);
console
.
log
(
"in initLiveRoomCard: not login"
);
this
.
LiveRoomTitle
=
''
;
this
.
LiveRoomTitle
=
""
;
}
}
},
},
getHotNews
()
{
getHotNews
()
{
...
@@ -225,7 +255,7 @@ export default defineComponent({
...
@@ -225,7 +255,7 @@ export default defineComponent({
const
ret
=
await
queryNotifyList
({
notify_type
:
"1"
});
const
ret
=
await
queryNotifyList
({
notify_type
:
"1"
});
if
(
ret
.
code
===
200
)
{
if
(
ret
.
code
===
200
)
{
const
list
=
ret
.
data
.
items
;
const
list
=
ret
.
data
.
items
;
list
.
sort
((
a
,
b
)
=>
b
.
update_at
-
a
.
update_at
)
list
.
sort
((
a
,
b
)
=>
b
.
update_at
-
a
.
update_at
)
;
this
.
notifyList
=
list
;
this
.
notifyList
=
list
;
}
}
},
},
...
@@ -249,7 +279,7 @@ export default defineComponent({
...
@@ -249,7 +279,7 @@ export default defineComponent({
limit
:
1
,
limit
:
1
,
offset
:
0
,
offset
:
0
,
loan_type
:
2
,
loan_type
:
2
,
product_status
:
eProductStatus
.
hot
product_status
:
eProductStatus
.
hot
,
});
});
if
(
ret
.
code
===
200
)
{
if
(
ret
.
code
===
200
)
{
this
.
skeLoading
=
false
;
this
.
skeLoading
=
false
;
...
@@ -271,9 +301,9 @@ export default defineComponent({
...
@@ -271,9 +301,9 @@ export default defineComponent({
},
},
computed
:
{
computed
:
{
isReviewMode
()
{
isReviewMode
()
{
return
isReviewMode
()
return
isReviewMode
()
;
}
}
,
}
}
,
});
});
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
...
@@ -753,4 +783,4 @@ export default defineComponent({
...
@@ -753,4 +783,4 @@ export default defineComponent({
align-self
:
center
;
align-self
:
center
;
margin-top
:
8px
;
margin-top
:
8px
;
}
}
</
style
>
</
style
>
\ No newline at end of file
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