Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
肖康
/
H5_2.0
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
b1243184
authored
May 27, 2023
by
LJM
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
css
parent
2bc7ce15
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
205 additions
and
208 deletions
App.vue
assets/css/mine/news.scss
pages.json
pages/mine/article.vue
uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue
uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json
uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json
uni_modules/uni-popup/components/uni-popup/uni-popup.vue
App.vue
View file @
b1243184
...
@@ -22,5 +22,23 @@ uni-page-head {
...
@@ -22,5 +22,23 @@ uni-page-head {
body
{
body
{
background
:
#f5f5f5
;
background
:
#f5f5f5
;
}
}
::v-deep
uni-modal
.uni-modal
{
border-radius
:
10
rpx
;
}
::v-deep
uni-modal
.uni-modal__hd
{
color
:
#323233
;
}
::v-deep
uni-modal
.uni-modal__btn_default
{
color
:
#323233
!important
;
}
::v-deep
uni-modal
.uni-modal__btn_primary
{
color
:
#1969f9
!important
;
}
::v-deep
uni-modal
.uni-modal__btn
:after
{
border-left
:
1px
solid
#ebedf0
;
}
::v-deep
uni-modal
.uni-modal__ft
:after
{
border-top
:
1px
solid
#ebedf0
;
}
/* #endif */
/* #endif */
</
style
>
</
style
>
assets/css/mine/news.scss
View file @
b1243184
...
@@ -198,11 +198,14 @@
...
@@ -198,11 +198,14 @@
}
}
.ad
{
.ad
{
padding
:
28rpx
24rpx
30rpx
24rpx
;
padding
:
28rpx
24rpx
30rpx
24rpx
;
.box
{
margin-bottom
:
24rpx
;
image
{
image
{
width
:
100%
;
width
:
100%
;
height
:
302px
;
height
:
302px
;
}
}
}
}
}
}
}
.no-data
{
.no-data
{
...
...
pages.json
View file @
b1243184
...
@@ -229,7 +229,7 @@
...
@@ -229,7 +229,7 @@
}
}
],
],
"globalStyle"
:
{
"globalStyle"
:
{
"maxWidth"
:
750
},
},
"uniIdRouter"
:
{}
"uniIdRouter"
:
{}
}
}
\ No newline at end of file
pages/mine/article.vue
View file @
b1243184
...
@@ -20,17 +20,19 @@
...
@@ -20,17 +20,19 @@
</view>
</view>
<view
class=
"content"
v-html=
"detail.content"
></view>
<view
class=
"content"
v-html=
"detail.content"
></view>
</view>
</view>
<view
class=
"hot-article"
>
<view
class=
"hot-article"
v-if=
"detail.hot_article_list && detail.hot_article_list.length > 0"
>
<view
class=
"title row verCenter"
>
<view
class=
"title row verCenter"
>
<text
class=
"t1"
>
热门文章
</text>
<text
class=
"t1"
>
热门文章
</text>
<text
class=
"iconfont icon-a-juxing1"
></text>
<text
class=
"iconfont icon-a-juxing1"
></text>
</view>
</view>
<view
class=
"list"
v-if=
"detail.hot_article_list && detail.hot_article_list.length > 0"
>
<view
class=
"list"
>
<view
class=
"box"
v-for=
"(item, index) in detail.hot_article_list"
:key=
"index"
>
{{ index + 1 }}. {{ item.title }}
</view>
<view
class=
"box"
v-for=
"(item, index) in detail.hot_article_list"
:key=
"index"
>
{{ index + 1 }}. {{ item.title }}
</view>
</view>
</view>
</view>
</view>
<view
class=
"ad"
v-if=
"detail.h5_news_detail_ad && detail.h5_news_detail_ad.length > 0"
><image
v-for=
"(item, index) in detail.h5_news_detail_ad"
:key=
"index"
:src=
"item.images"
></image></view>
<view
class=
"ad"
v-if=
"detail.h5_news_detail_ad && detail.h5_news_detail_ad.length > 0"
>
<uni-popup
ref=
"share"
type=
"share"
safeArea
backgroundColor=
"#fff"
><uni-popup-share></uni-popup-share></uni-popup>
<a
class=
"box"
:href=
"item.url"
v-for=
"(item, index) in detail.h5_news_detail_ad"
:key=
"index"
><image
mode=
"aspectFill"
:src=
"item.images"
lazy-load=
"true"
></image></a>
</view>
<uni-popup
ref=
"share"
type=
"share"
safeArea
backgroundColor=
"#fff"
><uni-popup-share
@
select=
"selectChange"
></uni-popup-share></uni-popup>
</view>
</view>
</template>
</template>
...
@@ -58,19 +60,6 @@ export default {
...
@@ -58,19 +60,6 @@ export default {
onShow
()
{
onShow
()
{
this
.
getData
();
this
.
getData
();
},
},
filters
:
{
formatDate
(
value
)
{
// 过滤器函数
const
date
=
new
Date
(
value
*
1000
);
const
year
=
date
.
getFullYear
();
const
month
=
(
'0'
+
(
date
.
getMonth
()
+
1
)).
slice
(
-
2
);
const
day
=
(
'0'
+
date
.
getDate
()).
slice
(
-
2
);
const
hour
=
(
'0'
+
date
.
getHours
()).
slice
(
-
2
);
const
minute
=
(
'0'
+
date
.
getMinutes
()).
slice
(
-
2
);
const
second
=
(
'0'
+
date
.
getSeconds
()).
slice
(
-
2
);
return
`
${
year
}
-
${
month
}
-
${
day
}
${
hour
}
:
${
minute
}
:
${
second
}
`
;
}
},
methods
:
{
methods
:
{
handleChangeTitle
(
e
)
{
handleChangeTitle
(
e
)
{
uni
.
navigateTo
({
uni
.
navigateTo
({
...
@@ -80,6 +69,9 @@ export default {
...
@@ -80,6 +69,9 @@ export default {
open
()
{
open
()
{
this
.
$refs
.
share
.
open
(
'bottom'
);
this
.
$refs
.
share
.
open
(
'bottom'
);
},
},
selectChange
(
e
)
{
console
.
log
(
e
);
},
toUrl
(
id
,
type
,
name
)
{
toUrl
(
id
,
type
,
name
)
{
if
(
type
==
1
)
{
if
(
type
==
1
)
{
uni
.
navigateTo
({
uni
.
navigateTo
({
...
...
uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue
View file @
b1243184
<
template
>
<
template
>
<view
class=
"uni-popup-share"
>
<view
class=
"uni-popup-share"
>
<view
class=
"uni-share-title"
><text
class=
"uni-share-title-text"
>
{{
shareTitleText
}}
</text></view>
<view
class=
"uni-share-title"
>
<text
class=
"uni-share-title-text"
>
{{
shareTitleText
}}
</text>
</view>
<view
class=
"uni-share-content"
>
<view
class=
"uni-share-content"
>
<view
class=
"uni-share-content-box"
>
<view
class=
"uni-share-content-box"
>
<view
class=
"uni-share-content-item"
v-for=
"(item,index) in bottomData"
:key=
"index"
@
click
.
stop=
"select(item,
index)"
>
<view
class=
"uni-share-content-item"
v-for=
"(item, index) in bottomData"
:key=
"index"
@
click
.
stop=
"select(item,
index)"
>
<image
class=
"uni-share-image"
:src=
"item.icon"
mode=
"aspectFill"
></image>
<image
class=
"uni-share-image"
:src=
"item.icon"
mode=
"aspectFill"
></image>
<text
class=
"uni-share-text"
>
{{
item
.
text
}}
</text>
<text
class=
"uni-share-text"
>
{{
item
.
text
}}
</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view
class=
"uni-share-button-box"
>
<view
class=
"uni-share-button-box"
>
<button
class=
"uni-share-button"
@
click=
"close"
>
{{
cancelText
}}
</button
>
<view
class=
"uni-share-button"
@
click=
"close"
>
{{
cancelText
}}
</view
>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
popup
from
'../uni-popup/popup.js'
import
popup
from
'../uni-popup/popup.js'
;
import
{
import
{
initVueI18n
}
from
'@dcloudio/uni-i18n'
;
initVueI18n
import
messages
from
'../uni-popup/i18n/index.js'
;
}
from
'@dcloudio/uni-i18n'
const
{
t
}
=
initVueI18n
(
messages
);
import
messages
from
'../uni-popup/i18n/index.js'
export
default
{
const
{
t
}
=
initVueI18n
(
messages
)
export
default
{
name
:
'UniPopupShare'
,
name
:
'UniPopupShare'
,
mixins
:
[
popup
],
mixins
:
[
popup
],
emits
:
[
'select'
],
emits
:
[
'select'
],
props
:
{
props
:
{
title
:
{
title
:
{
type
:
String
,
type
:
String
,
...
@@ -39,46 +38,37 @@
...
@@ -39,46 +38,37 @@
},
},
data
()
{
data
()
{
return
{
return
{
bottomData
:
[{
bottomData
:
[
{
text
:
'微信'
,
text
:
'微信'
,
icon
:
'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/c2b17470-50be-11eb-b680-7980c8a877b8
.png'
,
icon
:
'https://img.ichunt.com/images/ichunt/202305/27/5bbbd6fb77046c311d544937f89284d9
.png'
,
name
:
'wx'
name
:
'wx'
},
},
{
{
text
:
'支付宝
'
,
text
:
'朋友圈
'
,
icon
:
'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/d684ae40-50be-11eb-8ff1-d5dcf8779628
.png'
,
icon
:
'https://img.ichunt.com/images/ichunt/202305/27/a92b05438b5c89daff38c729cb63faba
.png'
,
name
:
'wx'
name
:
'wx'
},
},
{
{
text
:
'QQ
'
,
text
:
'复制链接
'
,
icon
:
'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/e7a79520-50be-11eb-b997-9918a5dda011
.png'
,
icon
:
'https://img.ichunt.com/images/ichunt/202305/27/726bff17f48ad6866f9e6956c19cb1a8
.png'
,
name
:
'qq
'
name
:
'link
'
},
},
{
{
text
:
'新浪'
,
text
:
'二维码'
,
icon
:
'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/0dacdbe0-50bf-11eb-8ff1-d5dcf8779628.png'
,
icon
:
'https://img.ichunt.com/images/ichunt/202305/27/8478b5b31e6bc6f84676369ff18a9556.png'
,
name
:
'sina'
name
:
'code'
},
// {
// text: '百度',
// icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png',
// name: 'copy'
// },
// {
// text: '其他',
// icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/2e0fdfe0-50bf-11eb-b997-9918a5dda011.png',
// name: 'more'
// }
]
}
}
]
};
},
},
created
()
{},
created
()
{},
computed
:
{
computed
:
{
cancelText
()
{
cancelText
()
{
return
t
(
"uni-popup.cancel"
)
return
t
(
'uni-popup.cancel'
);
},
},
shareTitleText
()
{
shareTitleText
()
{
return
this
.
title
||
t
(
"uni-popup.shareTitle"
)
return
this
.
title
||
t
(
'uni-popup.shareTitle'
);
}
}
},
},
methods
:
{
methods
:
{
...
@@ -89,27 +79,26 @@
...
@@ -89,27 +79,26 @@
this
.
$emit
(
'select'
,
{
this
.
$emit
(
'select'
,
{
item
,
item
,
index
index
})
});
this
.
close
()
this
.
close
();
},
},
/**
/**
* 关闭窗口
* 关闭窗口
*/
*/
close
()
{
close
()
{
if
(
this
.
beforeClose
)
return
if
(
this
.
beforeClose
)
return
;
this
.
popup
.
close
()
this
.
popup
.
close
();
}
}
}
}
}
};
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
.uni-popup-share
{
.uni-popup-share
{
background-color
:
#fff
;
background-color
:
#fff
;
border-top-left-radius
:
11
px
;
border-top-left-radius
:
10
r
px
;
border-top-right-radius
:
11
px
;
border-top-right-radius
:
10
r
px
;
}
}
.uni-share-title
{
.uni-share-title
{
/* #ifndef APP-NVUE */
/* #ifndef APP-NVUE */
display
:
flex
;
display
:
flex
;
/* #endif */
/* #endif */
...
@@ -117,30 +106,31 @@
...
@@ -117,30 +106,31 @@
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
height
:
40px
;
height
:
40px
;
}
}
.uni-share-title-text
{
.uni-share-title-text
{
font-size
:
14px
;
font-size
:
28
rpx
;
color
:
#666
;
color
:
#292b33
;
}
font-weight
:
600
;
.uni-share-content
{
}
.uni-share-content
{
/* #ifndef APP-NVUE */
/* #ifndef APP-NVUE */
display
:
flex
;
display
:
flex
;
/* #endif */
/* #endif */
flex-direction
:
row
;
flex-direction
:
row
;
justify-content
:
center
;
justify-content
:
center
;
padding-top
:
10px
;
padding-top
:
10px
;
}
}
.uni-share-content-box
{
.uni-share-content-box
{
/* #ifndef APP-NVUE */
/* #ifndef APP-NVUE */
display
:
flex
;
display
:
flex
;
/* #endif */
/* #endif */
flex-direction
:
row
;
flex-direction
:
row
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
width
:
360px
;
width
:
360px
;
}
}
.uni-share-content-item
{
.uni-share-content-item
{
width
:
90px
;
width
:
90px
;
/* #ifndef APP-NVUE */
/* #ifndef APP-NVUE */
display
:
flex
;
display
:
flex
;
...
@@ -149,39 +139,41 @@
...
@@ -149,39 +139,41 @@
justify-content
:
center
;
justify-content
:
center
;
padding
:
10px
0
;
padding
:
10px
0
;
align-items
:
center
;
align-items
:
center
;
}
}
.uni-share-content-item
:active
{
.uni-share-content-item
:active
{
background-color
:
#f5f5f5
;
background-color
:
#f5f5f5
;
}
}
.uni-share-image
{
.uni-share-image
{
width
:
30
px
;
width
:
96
r
px
;
height
:
30
px
;
height
:
96
r
px
;
}
}
.uni-share-text
{
.uni-share-text
{
margin-top
:
10px
;
margin-top
:
10px
;
font-size
:
14px
;
font-size
:
14px
;
color
:
#3B
4144
;
color
:
#3b
4144
;
}
}
.uni-share-button-box
{
.uni-share-button-box
{
/* #ifndef APP-NVUE */
/* #ifndef APP-NVUE */
display
:
flex
;
display
:
flex
;
/* #endif */
/* #endif */
flex-direction
:
row
;
flex-direction
:
row
;
padding
:
10px
15px
;
padding
:
10px
15px
;
}
border-top
:
16
rpx
solid
#f7f8fa
;
}
.uni-share-button
{
.uni-share-button
{
flex
:
1
;
flex
:
1
;
border-radius
:
50px
;
border-radius
:
50px
;
color
:
#666
;
color
:
#484b59
;
font-size
:
16px
;
font-size
:
16px
;
}
text-align
:
center
;
}
.uni-share-button
::after
{
.uni-share-button
::after
{
border-radius
:
50px
;
border-radius
:
50px
;
}
}
</
style
>
</
style
>
uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json
View file @
b1243184
...
@@ -3,5 +3,5 @@
...
@@ -3,5 +3,5 @@
"uni-popup.ok"
:
"确定"
,
"uni-popup.ok"
:
"确定"
,
"uni-popup.placeholder"
:
"请输入"
,
"uni-popup.placeholder"
:
"请输入"
,
"uni-popup.title"
:
"提示"
,
"uni-popup.title"
:
"提示"
,
"uni-popup.shareTitle"
:
"分享到
"
"uni-popup.shareTitle"
:
"立即分享给好友
"
}
}
\ No newline at end of file
uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json
View file @
b1243184
...
@@ -3,5 +3,5 @@
...
@@ -3,5 +3,5 @@
"uni-popup.ok"
:
"確定"
,
"uni-popup.ok"
:
"確定"
,
"uni-popup.placeholder"
:
"請輸入"
,
"uni-popup.placeholder"
:
"請輸入"
,
"uni-popup.title"
:
"提示"
,
"uni-popup.title"
:
"提示"
,
"uni-popup.shareTitle"
:
"分享到
"
"uni-popup.shareTitle"
:
"立即分享给好友
"
}
}
\ No newline at end of file
uni_modules/uni-popup/components/uni-popup/uni-popup.vue
View file @
b1243184
<
template
>
<
template
>
<view
v-if=
"showPopup"
class=
"uni-popup"
:class=
"[popupstyle, isDesktop ? 'fixforpc-z-index' : '']"
>
<view
v-if=
"showPopup"
class=
"uni-popup"
:class=
"[popupstyle, isDesktop ? 'fixforpc-z-index' : '']"
>
<view
@
touchstart=
"touchstart"
>
<view
@
touchstart=
"touchstart"
>
<uni-transition
key=
"1"
v-if=
"maskShow"
name=
"mask"
mode-class=
"fade"
:styles=
"maskClass"
<uni-transition
key=
"1"
v-if=
"maskShow"
name=
"mask"
mode-class=
"fade"
:styles=
"maskClass"
:duration=
"duration"
:show=
"showTrans"
@
click=
"onTap"
/>
:duration=
"duration"
:show=
"showTrans"
@
click=
"onTap"
/>
<uni-transition
key=
"2"
:mode-class=
"ani"
name=
"content"
:styles=
"transClass"
:duration=
"duration"
:show=
"showTrans"
@
click=
"onTap"
>
<uni-transition
key=
"2"
:mode-class=
"ani"
name=
"content"
:styles=
"transClass"
:duration=
"duration"
<view
class=
"uni-popup__wrapper"
:style=
"
{ backgroundColor: bg }" :class="[popupstyle]" @click="clear">
<slot
/></view>
:show=
"showTrans"
@
click=
"onTap"
>
<view
class=
"uni-popup__wrapper"
:style=
"
{ backgroundColor: bg }" :class="[popupstyle]" @click="clear">
<slot
/>
</view>
</uni-transition>
</uni-transition>
</view>
</view>
<!-- #ifdef H5 -->
<!-- #ifdef H5 -->
...
@@ -17,11 +13,11 @@
...
@@ -17,11 +13,11 @@
</
template
>
</
template
>
<
script
>
<
script
>
// #ifdef H5
// #ifdef H5
import
keypress
from
'./keypress.js'
import
keypress
from
'./keypress.js'
;
// #endif
// #endif
/**
/**
* PopUp 弹出层
* PopUp 弹出层
* @description 弹出层组件,为了解决遮罩弹层的问题
* @description 弹出层组件,为了解决遮罩弹层的问题
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
...
@@ -44,7 +40,7 @@
...
@@ -44,7 +40,7 @@
* @event {Function} maskClick 点击遮罩触发
* @event {Function} maskClick 点击遮罩触发
*/
*/
export
default
{
export
default
{
name
:
'uniPopup'
,
name
:
'uniPopup'
,
components
:
{
components
:
{
// #ifdef H5
// #ifdef H5
...
@@ -85,7 +81,7 @@
...
@@ -85,7 +81,7 @@
maskBackgroundColor
:
{
maskBackgroundColor
:
{
type
:
String
,
type
:
String
,
default
:
'rgba(0, 0, 0, 0.4)'
default
:
'rgba(0, 0, 0, 0.4)'
},
}
},
},
watch
:
{
watch
:
{
...
@@ -94,15 +90,15 @@
...
@@ -94,15 +90,15 @@
*/
*/
type
:
{
type
:
{
handler
:
function
(
type
)
{
handler
:
function
(
type
)
{
if
(
!
this
.
config
[
type
])
return
if
(
!
this
.
config
[
type
])
return
;
this
[
this
.
config
[
type
]](
true
)
this
[
this
.
config
[
type
]](
true
);
},
},
immediate
:
true
immediate
:
true
},
},
isDesktop
:
{
isDesktop
:
{
handler
:
function
(
newVal
)
{
handler
:
function
(
newVal
)
{
if
(
!
this
.
config
[
newVal
])
return
if
(
!
this
.
config
[
newVal
])
return
;
this
[
this
.
config
[
this
.
type
]](
true
)
this
[
this
.
config
[
this
.
type
]](
true
);
},
},
immediate
:
true
immediate
:
true
},
},
...
@@ -112,13 +108,13 @@
...
@@ -112,13 +108,13 @@
*/
*/
maskClick
:
{
maskClick
:
{
handler
:
function
(
val
)
{
handler
:
function
(
val
)
{
this
.
mkclick
=
val
this
.
mkclick
=
val
;
},
},
immediate
:
true
immediate
:
true
},
},
isMaskClick
:
{
isMaskClick
:
{
handler
:
function
(
val
)
{
handler
:
function
(
val
)
{
this
.
mkclick
=
val
this
.
mkclick
=
val
;
},
},
immediate
:
true
immediate
:
true
},
},
...
@@ -126,7 +122,7 @@
...
@@ -126,7 +122,7 @@
showPopup
(
show
)
{
showPopup
(
show
)
{
// #ifdef H5
// #ifdef H5
// fix by mehaotian 处理 h5 滚动穿透的问题
// fix by mehaotian 处理 h5 滚动穿透的问题
document
.
getElementsByTagName
(
'body'
)[
0
].
style
.
overflow
=
show
?
'hidden'
:
'visible'
document
.
getElementsByTagName
(
'body'
)[
0
].
style
.
overflow
=
show
?
'hidden'
:
'visible'
;
// #endif
// #endif
}
}
},
},
...
@@ -164,44 +160,37 @@
...
@@ -164,44 +160,37 @@
maskShow
:
true
,
maskShow
:
true
,
mkclick
:
true
,
mkclick
:
true
,
popupstyle
:
this
.
isDesktop
?
'fixforpc-top'
:
'top'
popupstyle
:
this
.
isDesktop
?
'fixforpc-top'
:
'top'
}
};
},
},
computed
:
{
computed
:
{
isDesktop
()
{
isDesktop
()
{
return
this
.
popupWidth
>=
500
&&
this
.
popupHeight
>=
500
return
this
.
popupWidth
>=
500
&&
this
.
popupHeight
>=
500
;
},
},
bg
()
{
bg
()
{
if
(
this
.
backgroundColor
===
''
||
this
.
backgroundColor
===
'none'
)
{
if
(
this
.
backgroundColor
===
''
||
this
.
backgroundColor
===
'none'
)
{
return
'transparent'
return
'transparent'
;
}
}
return
this
.
backgroundColor
return
this
.
backgroundColor
;
}
}
},
},
mounted
()
{
mounted
()
{
const
fixSize
=
()
=>
{
const
fixSize
=
()
=>
{
const
{
const
{
windowWidth
,
windowHeight
,
windowTop
,
safeArea
,
screenHeight
,
safeAreaInsets
}
=
uni
.
getSystemInfoSync
();
windowWidth
,
this
.
popupWidth
=
windowWidth
;
windowHeight
,
this
.
popupHeight
=
windowHeight
+
(
windowTop
||
0
);
windowTop
,
safeArea
,
screenHeight
,
safeAreaInsets
}
=
uni
.
getSystemInfoSync
()
this
.
popupWidth
=
windowWidth
this
.
popupHeight
=
windowHeight
+
(
windowTop
||
0
)
// TODO fix by mehaotian 是否适配底部安全区 ,目前微信ios 、和 app ios 计算有差异,需要框架修复
// TODO fix by mehaotian 是否适配底部安全区 ,目前微信ios 、和 app ios 计算有差异,需要框架修复
if
(
safeArea
&&
this
.
safeArea
)
{
if
(
safeArea
&&
this
.
safeArea
)
{
// #ifdef MP-WEIXIN
// #ifdef MP-WEIXIN
this
.
safeAreaInsets
=
screenHeight
-
safeArea
.
bottom
this
.
safeAreaInsets
=
screenHeight
-
safeArea
.
bottom
;
// #endif
// #endif
// #ifndef MP-WEIXIN
// #ifndef MP-WEIXIN
this
.
safeAreaInsets
=
safeAreaInsets
.
bottom
this
.
safeAreaInsets
=
safeAreaInsets
.
bottom
;
// #endif
// #endif
}
else
{
}
else
{
this
.
safeAreaInsets
=
0
this
.
safeAreaInsets
=
0
;
}
}
}
};
fixSize
()
fixSize
();
// #ifdef H5
// #ifdef H5
// window.addEventListener('resize', fixSize)
// window.addEventListener('resize', fixSize)
// this.$once('hook:beforeDestroy', () => {
// this.$once('hook:beforeDestroy', () => {
...
@@ -212,135 +201,135 @@
...
@@ -212,135 +201,135 @@
// #ifndef VUE3
// #ifndef VUE3
// TODO vue2
// TODO vue2
destroyed
()
{
destroyed
()
{
this
.
setH5Visible
()
this
.
setH5Visible
();
},
},
// #endif
// #endif
// #ifdef VUE3
// #ifdef VUE3
// TODO vue3
// TODO vue3
unmounted
()
{
unmounted
()
{
this
.
setH5Visible
()
this
.
setH5Visible
();
},
},
// #endif
// #endif
created
()
{
created
()
{
// this.mkclick = this.isMaskClick || this.maskClick
// this.mkclick = this.isMaskClick || this.maskClick
if
(
this
.
isMaskClick
===
null
&&
this
.
maskClick
===
null
)
{
if
(
this
.
isMaskClick
===
null
&&
this
.
maskClick
===
null
)
{
this
.
mkclick
=
true
this
.
mkclick
=
true
;
}
else
{
}
else
{
this
.
mkclick
=
this
.
isMaskClick
!==
null
?
this
.
isMaskClick
:
this
.
maskClick
this
.
mkclick
=
this
.
isMaskClick
!==
null
?
this
.
isMaskClick
:
this
.
maskClick
;
}
}
if
(
this
.
animation
)
{
if
(
this
.
animation
)
{
this
.
duration
=
300
this
.
duration
=
300
;
}
else
{
}
else
{
this
.
duration
=
0
this
.
duration
=
0
;
}
}
// TODO 处理 message 组件生命周期异常的问题
// TODO 处理 message 组件生命周期异常的问题
this
.
messageChild
=
null
this
.
messageChild
=
null
;
// TODO 解决头条冒泡的问题
// TODO 解决头条冒泡的问题
this
.
clearPropagation
=
false
this
.
clearPropagation
=
false
;
this
.
maskClass
.
backgroundColor
=
this
.
maskBackgroundColor
this
.
maskClass
.
backgroundColor
=
this
.
maskBackgroundColor
;
},
},
methods
:
{
methods
:
{
setH5Visible
()
{
setH5Visible
()
{
// #ifdef H5
// #ifdef H5
// fix by mehaotian 处理 h5 滚动穿透的问题
// fix by mehaotian 处理 h5 滚动穿透的问题
document
.
getElementsByTagName
(
'body'
)[
0
].
style
.
overflow
=
'visible'
document
.
getElementsByTagName
(
'body'
)[
0
].
style
.
overflow
=
'visible'
;
// #endif
// #endif
},
},
/**
/**
* 公用方法,不显示遮罩层
* 公用方法,不显示遮罩层
*/
*/
closeMask
()
{
closeMask
()
{
this
.
maskShow
=
false
this
.
maskShow
=
false
;
},
},
/**
/**
* 公用方法,遮罩层禁止点击
* 公用方法,遮罩层禁止点击
*/
*/
disableMask
()
{
disableMask
()
{
this
.
mkclick
=
false
this
.
mkclick
=
false
;
},
},
// TODO nvue 取消冒泡
// TODO nvue 取消冒泡
clear
(
e
)
{
clear
(
e
)
{
// #ifndef APP-NVUE
// #ifndef APP-NVUE
e
.
stopPropagation
()
e
.
stopPropagation
();
// #endif
// #endif
this
.
clearPropagation
=
true
this
.
clearPropagation
=
true
;
},
},
open
(
direction
)
{
open
(
direction
)
{
// fix by mehaotian 处理快速打开关闭的情况
// fix by mehaotian 处理快速打开关闭的情况
if
(
this
.
showPopup
)
{
if
(
this
.
showPopup
)
{
return
return
;
}
}
let
innerType
=
[
'top'
,
'center'
,
'bottom'
,
'left'
,
'right'
,
'message'
,
'dialog'
,
'share'
]
let
innerType
=
[
'top'
,
'center'
,
'bottom'
,
'left'
,
'right'
,
'message'
,
'dialog'
,
'share'
];
if
(
!
(
direction
&&
innerType
.
indexOf
(
direction
)
!==
-
1
))
{
if
(
!
(
direction
&&
innerType
.
indexOf
(
direction
)
!==
-
1
))
{
direction
=
this
.
type
direction
=
this
.
type
;
}
}
if
(
!
this
.
config
[
direction
])
{
if
(
!
this
.
config
[
direction
])
{
console
.
error
(
'缺少类型:'
,
direction
)
console
.
error
(
'缺少类型:'
,
direction
);
return
return
;
}
}
this
[
this
.
config
[
direction
]]()
this
[
this
.
config
[
direction
]]();
this
.
$emit
(
'change'
,
{
this
.
$emit
(
'change'
,
{
show
:
true
,
show
:
true
,
type
:
direction
type
:
direction
})
});
},
},
close
(
type
)
{
close
(
type
)
{
this
.
showTrans
=
false
this
.
showTrans
=
false
;
this
.
$emit
(
'change'
,
{
this
.
$emit
(
'change'
,
{
show
:
false
,
show
:
false
,
type
:
this
.
type
type
:
this
.
type
})
});
clearTimeout
(
this
.
timer
)
clearTimeout
(
this
.
timer
);
// // 自定义关闭事件
// // 自定义关闭事件
// this.customOpen && this.customClose()
// this.customOpen && this.customClose()
this
.
timer
=
setTimeout
(()
=>
{
this
.
timer
=
setTimeout
(()
=>
{
this
.
showPopup
=
false
this
.
showPopup
=
false
;
},
300
)
},
300
);
},
},
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
touchstart
()
{
touchstart
()
{
this
.
clearPropagation
=
false
this
.
clearPropagation
=
false
;
},
},
onTap
()
{
onTap
()
{
if
(
this
.
clearPropagation
)
{
if
(
this
.
clearPropagation
)
{
// fix by mehaotian 兼容 nvue
// fix by mehaotian 兼容 nvue
this
.
clearPropagation
=
false
this
.
clearPropagation
=
false
;
return
return
;
}
}
this
.
$emit
(
'maskClick'
)
this
.
$emit
(
'maskClick'
);
if
(
!
this
.
mkclick
)
return
if
(
!
this
.
mkclick
)
return
;
this
.
close
()
this
.
close
();
},
},
/**
/**
* 顶部弹出样式处理
* 顶部弹出样式处理
*/
*/
top
(
type
)
{
top
(
type
)
{
this
.
popupstyle
=
this
.
isDesktop
?
'fixforpc-top'
:
'top'
this
.
popupstyle
=
this
.
isDesktop
?
'fixforpc-top'
:
'top'
;
this
.
ani
=
[
'slide-top'
]
this
.
ani
=
[
'slide-top'
];
this
.
transClass
=
{
this
.
transClass
=
{
position
:
'fixed'
,
position
:
'fixed'
,
left
:
0
,
left
:
0
,
right
:
0
,
right
:
0
,
backgroundColor
:
this
.
bg
backgroundColor
:
this
.
bg
}
};
// TODO 兼容 type 属性 ,后续会废弃
// TODO 兼容 type 属性 ,后续会废弃
if
(
type
)
return
if
(
type
)
return
;
this
.
showPopup
=
true
this
.
showPopup
=
true
;
this
.
showTrans
=
true
this
.
showTrans
=
true
;
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
if
(
this
.
messageChild
&&
this
.
type
===
'message'
)
{
if
(
this
.
messageChild
&&
this
.
type
===
'message'
)
{
this
.
messageChild
.
timerClose
()
this
.
messageChild
.
timerClose
();
}
}
})
});
},
},
/**
/**
* 底部弹出样式处理
* 底部弹出样式处理
*/
*/
bottom
(
type
)
{
bottom
(
type
)
{
this
.
popupstyle
=
'bottom'
this
.
popupstyle
=
'bottom'
;
this
.
ani
=
[
'slide-bottom'
]
this
.
ani
=
[
'slide-bottom'
];
this
.
transClass
=
{
this
.
transClass
=
{
position
:
'fixed'
,
position
:
'fixed'
,
left
:
0
,
left
:
0
,
...
@@ -348,18 +337,18 @@
...
@@ -348,18 +337,18 @@
bottom
:
0
,
bottom
:
0
,
paddingBottom
:
this
.
safeAreaInsets
+
'px'
,
paddingBottom
:
this
.
safeAreaInsets
+
'px'
,
backgroundColor
:
this
.
bg
backgroundColor
:
this
.
bg
}
};
// TODO 兼容 type 属性 ,后续会废弃
// TODO 兼容 type 属性 ,后续会废弃
if
(
type
)
return
if
(
type
)
return
;
this
.
showPopup
=
true
this
.
showPopup
=
true
;
this
.
showTrans
=
true
this
.
showTrans
=
true
;
},
},
/**
/**
* 中间弹出样式处理
* 中间弹出样式处理
*/
*/
center
(
type
)
{
center
(
type
)
{
this
.
popupstyle
=
'center'
this
.
popupstyle
=
'center'
;
this
.
ani
=
[
'zoom-out'
,
'fade'
]
this
.
ani
=
[
'zoom-out'
,
'fade'
];
this
.
transClass
=
{
this
.
transClass
=
{
position
:
'fixed'
,
position
:
'fixed'
,
/* #ifndef APP-NVUE */
/* #ifndef APP-NVUE */
...
@@ -372,15 +361,15 @@
...
@@ -372,15 +361,15 @@
top
:
0
,
top
:
0
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
alignItems
:
'center'
alignItems
:
'center'
}
};
// TODO 兼容 type 属性 ,后续会废弃
// TODO 兼容 type 属性 ,后续会废弃
if
(
type
)
return
if
(
type
)
return
;
this
.
showPopup
=
true
this
.
showPopup
=
true
;
this
.
showTrans
=
true
this
.
showTrans
=
true
;
},
},
left
(
type
)
{
left
(
type
)
{
this
.
popupstyle
=
'left'
this
.
popupstyle
=
'left'
;
this
.
ani
=
[
'slide-left'
]
this
.
ani
=
[
'slide-left'
];
this
.
transClass
=
{
this
.
transClass
=
{
position
:
'fixed'
,
position
:
'fixed'
,
left
:
0
,
left
:
0
,
...
@@ -391,15 +380,15 @@
...
@@ -391,15 +380,15 @@
display
:
'flex'
,
display
:
'flex'
,
flexDirection
:
'column'
flexDirection
:
'column'
/* #endif */
/* #endif */
}
};
// TODO 兼容 type 属性 ,后续会废弃
// TODO 兼容 type 属性 ,后续会废弃
if
(
type
)
return
if
(
type
)
return
;
this
.
showPopup
=
true
this
.
showPopup
=
true
;
this
.
showTrans
=
true
this
.
showTrans
=
true
;
},
},
right
(
type
)
{
right
(
type
)
{
this
.
popupstyle
=
'right'
this
.
popupstyle
=
'right'
;
this
.
ani
=
[
'slide-right'
]
this
.
ani
=
[
'slide-right'
];
this
.
transClass
=
{
this
.
transClass
=
{
position
:
'fixed'
,
position
:
'fixed'
,
bottom
:
0
,
bottom
:
0
,
...
@@ -410,20 +399,20 @@
...
@@ -410,20 +399,20 @@
display
:
'flex'
,
display
:
'flex'
,
flexDirection
:
'column'
flexDirection
:
'column'
/* #endif */
/* #endif */
}
};
// TODO 兼容 type 属性 ,后续会废弃
// TODO 兼容 type 属性 ,后续会废弃
if
(
type
)
return
if
(
type
)
return
;
this
.
showPopup
=
true
this
.
showPopup
=
true
;
this
.
showTrans
=
true
this
.
showTrans
=
true
;
}
}
}
}
}
};
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
.uni-popup
{
.uni-popup
{
position
:
fixed
;
position
:
fixed
;
/* #ifndef APP-NVUE */
/* #ifndef APP-NVUE */
z-index
:
99
;
z-index
:
99
99
;
/* #endif */
/* #endif */
&.top,
&.top,
...
@@ -459,15 +448,15 @@
...
@@ -459,15 +448,15 @@
flex
:
1
;
flex
:
1
;
}
}
}
}
}
}
.fixforpc-z-index
{
.fixforpc-z-index
{
/* #ifndef APP-NVUE */
/* #ifndef APP-NVUE */
z-index
:
999
;
z-index
:
999
;
/* #endif */
/* #endif */
}
}
.fixforpc-top
{
.fixforpc-top
{
top
:
0
;
top
:
0
;
}
}
</
style
>
</
style
>
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