Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
10dcb8f7
Commit
10dcb8f7
authored
Sep 03, 2021
by
侯体倬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公告修改
parent
96280bca
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
64 deletions
+110
-64
src/components/birthPopup/birthPopup.vue
+4
-3
static/nativeComponents/Notice/index.js
+50
-42
static/nativeComponents/Notice/index.json
+3
-1
static/nativeComponents/Notice/index.wxml
+19
-5
static/nativeComponents/Notice/index.wxss
+34
-13
No files found.
src/components/birthPopup/birthPopup.vue
View file @
10dcb8f7
...
@@ -122,9 +122,10 @@ export default {
...
@@ -122,9 +122,10 @@ export default {
},
},
// 获取用户信息
// 获取用户信息
getUserInfo
()
{
getUserInfo
()
{
if
(
this
.
$store
.
state
.
userInfo
.
nickName
)
{
this
.
nickName
=
this
.
$store
.
state
.
userInfo
.
nickName
}
if
(
this
.
$store
.
state
.
userInfo
)
{
if
(
this
.
$store
.
state
.
userInfo
.
avatarUrl
)
{
this
.
avatar
=
this
.
$store
.
state
.
userInfo
.
avatarUrl
}
this
.
nickName
=
this
.
$store
.
state
.
userInfo
.
nickName
else
{
this
.
avatar
=
this
.
$store
.
state
.
userInfo
.
avatarUrl
}
else
{
this
.
avatar
=
"http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/jpg/02c0c235-daae-412d-bced-5fb315ad570e.jpg"
this
.
avatar
=
"http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/jpg/02c0c235-daae-412d-bced-5fb315ad570e.jpg"
}
}
},
},
...
...
static/nativeComponents/Notice/index.js
View file @
10dcb8f7
// static/nativeComponents/Notice/index.js
// static/nativeComponents/Notice/index.js
let
app
=
getApp
()
const
app
=
getApp
();
const
{
DFSImg
,
$themeToLink
}
=
app
;
Component
({
Component
({
/**
/**
* 组件的属性列表
* 组件的属性列表
...
@@ -14,61 +15,68 @@ Component({
...
@@ -14,61 +15,68 @@ Component({
* 组件的初始数据
* 组件的初始数据
*/
*/
data
:
{
data
:
{
timer
:
null
,
singleImg
:
''
,
newLeft
:
0
CommonHeight
:
0
,
NoticeMargin
:
0
,
NoticePadding
:
0
},
},
ready
(){
ready
()
{
let
marqueeWidth
=
0
;
let
{
noticeList
,
singleImage
}
=
this
.
data
.
datas
.
componentData
let
screenWidth
=
0
;
singleImage
=
DFSImg
(
singleImage
)
let
_this
=
this
for
(
let
i
=
0
;
i
<
noticeList
.
length
;
i
++
)
{
this
.
createSelectorQuery
().
select
(
'.marquee'
).
boundingClientRect
(
function
(
res
){
let
imageUrl
=
DFSImg
(
noticeList
[
i
].
imageUrl
)
if
(
res
)
{
noticeList
[
i
].
imageUrl
=
imageUrl
marqueeWidth
=
res
.
width
_this
.
createSelectorQuery
().
select
(
'.notice'
).
boundingClientRect
(
function
(
res1
)
{
if
(
res1
)
{
screenWidth
=
res1
.
width
console
.
log
(
marqueeWidth
,
screenWidth
,
'screenWidth'
)
if
(
marqueeWidth
>
screenWidth
)
{
_this
.
marqueeMove
(
marqueeWidth
,
screenWidth
);
}
else
{
clearInterval
(
_this
.
data
.
timer
);
_this
.
setData
({
newLeft
:
0
})
}
}
}
}).
exec
()
this
.
setData
({
}
singleImg
:
singleImage
,
}).
exec
()
"data.datas.componentData.noticeList"
:
noticeList
})
this
.
getNoticeHeight
()
this
.
getNoticeMargin
()
this
.
getNoticePadding
()
},
},
/**
/**
* 组件的方法列表
* 组件的方法列表
*/
*/
methods
:
{
methods
:
{
marqueeMove
(
marqueeWidth
,
screenWidth
)
{
onclickHandle
(
e
)
{
clearInterval
(
this
.
data
.
timer
);
app
.
$themeToLink
(
this
.
data
.
datas
.
componentData
.
noticeList
[
e
.
currentTarget
.
dataset
.
index
].
link
)
},
this
.
data
.
timer
=
setInterval
(()
=>
{
getNoticeMargin
()
{
this
.
setData
({
this
.
setData
({
newLeft
:
this
.
data
.
newLeft
-
1
NoticeMargin
:
this
.
data
.
datas
.
componentData
.
verticalMargin
+
'px '
+
this
.
data
.
datas
.
componentData
.
horizontalMargin
+
'px'
})
})
if
(
Math
.
abs
(
this
.
data
.
newLeft
)
>=
marqueeWidth
+
200
){
},
getNoticePadding
()
{
this
.
setData
({
this
.
setData
({
newLeft
:
screenWidth
NoticePadding
:
this
.
data
.
datas
.
componentData
.
verticalPadding
+
'px '
+
this
.
data
.
datas
.
componentData
.
horizontalPadding
+
'px'
})
})
}
},
10
)
},
},
onclickHandle
(){
getNoticeHeight
()
{
app
.
$themeToLink
(
this
.
data
.
datas
.
componentData
.
link
)
if
(
this
.
data
.
datas
.
componentData
.
isChange
)
{
if
(
this
.
data
.
datas
.
componentData
.
imageWidth
>
this
.
data
.
datas
.
componentData
.
noticeWidth
)
{
this
.
setData
({
CommonHeight
:
this
.
data
.
datas
.
componentData
.
imageWidth
<
53
?
'53px'
:
this
.
data
.
datas
.
componentData
.
imageWidth
+
'px'
})
return
}
else
if
(
this
.
data
.
datas
.
componentData
.
noticeWidth
>=
this
.
data
.
datas
.
componentData
.
imageWidth
)
{
this
.
setData
({
CommonHeight
:
this
.
data
.
datas
.
componentData
.
noticeWidth
<
53
?
'53px'
:
this
.
data
.
datas
.
componentData
.
noticeWidth
+
'px'
})
return
}
this
.
setData
({
CommonHeight
:
this
.
data
.
datas
.
componentData
.
noticeWidth
>
this
.
data
.
datas
.
componentData
.
imageWidth
?
this
.
data
.
datas
.
componentData
.
noticeWidth
+
'px'
:
this
.
data
.
datas
.
componentData
.
imageWidth
+
'px'
})
return
}
else
{
this
.
setData
({
CommonHeight
:
this
.
data
.
datas
.
componentData
.
noticeWidth
<
53
?
'53px'
:
this
.
data
.
datas
.
componentData
.
noticeWidth
+
'px'
})
return
}
}
}
}
}
})
})
static/nativeComponents/Notice/index.json
View file @
10dcb8f7
{
{
"component"
:
true
,
"component"
:
true
,
"usingComponents"
:
{}
"usingComponents"
:
{
"van-icon"
:
"/static/vant/icon/index"
}
}
}
static/nativeComponents/Notice/index.wxml
View file @
10dcb8f7
<!--static/nativeComponents/Notice/index.wxml-->
<!--static/nativeComponents/Notice/index.wxml-->
<view class="notice-wrap" style="background-color:{{datas.componentData.backgroundColor}}">
<view class="notice" style="border-radius:{{datas.componentData.borderRadius}}px;background-color:{{datas.componentData.backgroundColor}};margin:{{NoticeMargin}};padding:{{NoticePadding}};height:{{(CommonHeight)}}">
<view class="notice" style="text-align:left;color:{{datas.componentData.fontColor}}; ">
<swiper autoplay interval="3000" vertical style="height:{{CommonHeight}}" circular>
<view class="marquee" style="left:{{newLeft * 2}}rpx" bindtap="onclickHandle">{{datas.componentData.content}}</view>
<swiper-item wx:for="{{datas.componentData.noticeList}}" wx:key="{{index}}">
<view class="container" bindtap="onclickHandle" data-index="{{index}}" style="width: 100%;height:{{CommonHeight}}">
<block wx:if="{{item.imageUrl||datas.componentData.singleImage}}">
<view wx:if="{{datas.componentData.styleType===1}}">
<image class="notice-icon" style="width:{{datas.componentData.imageWidth}}px !important;height:{{datas.componentData.imageWidth}}px;" src="{{item.imageUrl}}" />
</view>
<view wx:else>
<image class="notice-icon" style="width:{{datas.componentData.imageWidth}}px !important;height:{{datas.componentData.imageWidth}}px;" src="{{singleImg}}" />
</view>
</block>
<view class="notice-content" style="font-size:{{datas.componentData.fontSize}}px;color:{{datas.componentData.fontColor}}">
<text class="content">{{item.title}}</text>
</view>
<van-icon class="notice-arrowhead" name="arrow" color="#000" wx:if="{{!datas.componentData.showArrow}}"></van-icon>
</view>
</swiper-item>
</swiper>
</view>
</view>
</view>
static/nativeComponents/Notice/index.wxss
View file @
10dcb8f7
/* static/nativeComponents/Notice/index.wxss */
/* static/nativeComponents/Notice/index.wxss */
.notice{
.notice {
font-size: 32rpx;
position: relative;
position: relative;
}
.notice .container {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.container .notice-icon {
margin-left: 15px;
width: 100%;
border-radius: 6px;
}
.container .notice-content {
flex: auto;
margin-left: 15px;
}
.notice-content .content {
flex: auto;
word-wrap: break-word;
word-break: break-all;
overflow: hidden;
overflow: hidden;
height: 80rpx;
text-overflow: ellipsis;
width: calc(100vw - 40rpx);
display: -webkit-box;
margin-left: 20rpx;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
.marquee {
position: absolute;
.container .notice-arrowhead {
height: 80rpx;
margin: 0 15px;
line-height: 80rpx;
width: 17px;
/* width: 100%; */
height: 17px;
margin: 0 auto;
white-space: nowrap;
box-sizing: border-box;
}
}
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