xcx před 4 roky
rodič
revize
b216c1e773

+ 5
- 2
src/assets/css/iconfont.css
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 10
- 6
src/assets/css/iconfont.less
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 49
- 0
src/pages/ShouYe/index.css Zobrazit soubor

@@ -37,6 +37,47 @@
37 37
   background-image: linear-gradient(#f35844, #ff8d61);
38 38
   z-index: 1;
39 39
 }
40
+.ShouYe > view.flex-item > .PageContainer .Content > view > .NoticeContent {
41
+  padding: 0 30px;
42
+  height: 60px;
43
+  background: #FFC412;
44
+  position: relative;
45
+  overflow: hidden;
46
+  margin-bottom: 20px;
47
+  align-items: center;
48
+  display: none;
49
+}
50
+.ShouYe > view.flex-item > .PageContainer .Content > view > .NoticeContent.active {
51
+  display: flex;
52
+}
53
+.ShouYe > view.flex-item > .PageContainer .Content > view > .NoticeContent > text {
54
+  color: #fff;
55
+  font-size: 32px;
56
+  line-height: 60px;
57
+}
58
+.ShouYe > view.flex-item > .PageContainer .Content > view > .NoticeContent > .flex-item {
59
+  margin: 0 10px;
60
+  position: relative;
61
+  overflow: hidden;
62
+  height: 60px;
63
+}
64
+.ShouYe > view.flex-item > .PageContainer .Content > view > .NoticeContent > .flex-item > view {
65
+  display: block;
66
+  position: relative;
67
+  overflow: hidden;
68
+  height: 60px;
69
+}
70
+.ShouYe > view.flex-item > .PageContainer .Content > view > .NoticeContent > .flex-item > view > text {
71
+  display: inline-block;
72
+  font-size: 28px;
73
+  color: #fff;
74
+  white-space: nowrap;
75
+  line-height: 60px;
76
+  position: absolute;
77
+  top: 0;
78
+  animation: 5s move infinite linear;
79
+  -webkit-animation: 5s move infinite linear;
80
+}
40 81
 .ShouYe > view.flex-item > .PageContainer .Content > view > .Welcome {
41 82
   display: block;
42 83
   font-size: 30px;
@@ -300,3 +341,11 @@
300 341
   width: 100%;
301 342
   height: 30px;
302 343
 }
344
+@-webkit-keyframes move {
345
+  0% {
346
+    left: 100vw;
347
+  }
348
+  100% {
349
+    left: -100%;
350
+  }
351
+}

+ 44
- 0
src/pages/ShouYe/index.jsx Zobrazit soubor

@@ -33,6 +33,10 @@ export default function Index (props) {
33 33
   const [BannerList, setBannerList] = useState([])
34 34
   // const [ActivityList, setActivityList] = useState([])
35 35
   const [NewsList, setNewsList] = useState([])
36
+  const [ShowNotice, setShowNotice] = useState(false)
37
+  const [NoticeInfo, setNoticeInfo] = useState(null)
38
+  const [NoticeWidth, setNoticeWidth] = useState(0)
39
+  const [NoticeParentWidth, setNoticeParentWidth] = useState(0)
36 40
 
37 41
   // 宣传位
38 42
   const [propagandaList, setPropagandaList] = useState([])
@@ -41,7 +45,27 @@ export default function Index (props) {
41 45
     Init()
42 46
   })
43 47
 
48
+  useEffect(() => {
49
+    if (NoticeInfo !== null) {
50
+      window.setTimeout(() => {
51
+        let QueryParent = Taro.createSelectorQuery()
52
+        let QueryChild = Taro.createSelectorQuery()
53
+        QueryParent.select('#NoticeParent').boundingClientRect()
54
+        QueryChild.select('#NoticeText').boundingClientRect()
55
+        QueryParent.exec((res) => {
56
+          setNoticeParentWidth(res[0].width)
57
+          QueryChild.exec((cres) => {
58
+            setNoticeWidth(cres[0].width)
59
+          })
60
+        })
61
+      }, 100)
62
+      // let NoticeText = document.getElementById('NoticeText')
63
+      // console.log(NoticeText.boundingClientRect[0].width)
64
+    }
65
+  }, [NoticeInfo])
66
+
44 67
   const Init = (done = () => { }) => { // 初始化
68
+    GetNotice() // 获取通知
45 69
     let DownCount = 0
46 70
     GetBanner(() => { // 获取轮播图
47 71
       DownCount += 1
@@ -70,6 +94,15 @@ export default function Index (props) {
70 94
     })
71 95
   }
72 96
 
97
+  const GetNotice = () => { // 获取通知
98
+    request({ ...apis.getGongGaoList, args: { orgId: user.orgId }, params: { annType: 'notice', pageNum: 1, pageSize: 1 } }).then((res) => {
99
+      setNoticeInfo(res.records[0])
100
+      if (res.records !== null && res.records.length > 0) {
101
+        setShowNotice(true)
102
+      }
103
+    })
104
+  }
105
+
73 106
   const GetBanner = (done = () => { }) => { // 获取轮播图
74 107
     setBannerList([])
75 108
     request({ ...apis.getBanner, params: { showType: 'banner', showPosition: 'index', pageNum: 1, pageSize: 5 } }).then((res) => {
@@ -169,6 +202,17 @@ export default function Index (props) {
169 202
 
170 203
                 <view>
171 204
 
205
+                  {/* 通知栏 */}
206
+                  <view className={ShowNotice ? 'NoticeContent flex-h active' : 'NoticeContent flex-h'}>
207
+                    <text className='iconfont icontongzhi1'></text>
208
+                    <view id='NoticeParent' className='flex-item' onClick={() => { Taro.navigateTo({ url: `/pages/WuYe/GongGaoDetail/index?id=${NoticeInfo.id}` }) }}>
209
+                      <view style={{ width: `${NoticeWidth > NoticeParentWidth ? NoticeWidth : NoticeParentWidth}px` }}>
210
+                        <text id='NoticeText'>{NoticeInfo === null ? '' : NoticeInfo.announcementTitle}</text>
211
+                      </view>
212
+                    </view>
213
+                    <text className='iconfont iconguanbi' onClick={() => { setShowNotice(false) }}></text>
214
+                  </view>
215
+
172 216
                   {/* 欢迎词 */}
173 217
                   <Text className='Welcome'>欢迎来到远道智慧社区!</Text>
174 218
 

+ 58
- 0
src/pages/ShouYe/index.less Zobrazit soubor

@@ -42,6 +42,53 @@
42 42
               z-index: 1;
43 43
             }
44 44
 
45
+            >.NoticeContent {
46
+              padding: 0 30px;
47
+              height: 60px;
48
+              background: #FFC412;
49
+              position: relative;
50
+              overflow: hidden;
51
+              margin-bottom: 20px;
52
+              align-items: center;
53
+              display: none;
54
+
55
+              &.active {
56
+                display: flex;
57
+              }
58
+
59
+              >text {
60
+                color: #fff;
61
+                font-size: 32px;
62
+                line-height: 60px;
63
+              }
64
+
65
+              >.flex-item {
66
+                margin: 0 10px;
67
+                position: relative;
68
+                overflow: hidden;
69
+                height: 60px;
70
+
71
+                >view {
72
+                  display: block;
73
+                  position: relative;
74
+                  overflow: hidden;
75
+                  height: 60px;
76
+
77
+                  >text {
78
+                    display: inline-block;
79
+                    font-size: 28px;
80
+                    color: #fff;
81
+                    white-space: nowrap;
82
+                    line-height: 60px;
83
+                    position: absolute;
84
+                    top: 0;
85
+                    animation: 5s move infinite linear;
86
+                    -webkit-animation: 5s move infinite linear;
87
+                  }
88
+                }
89
+              }
90
+            }
91
+
45 92
             >.Welcome {
46 93
               display: block;
47 94
               font-size: 30px;
@@ -281,6 +328,7 @@
281 328
 
282 329
                   >view {
283 330
                     position: relative;
331
+
284 332
                     text {
285 333
                       display: block;
286 334
                       width: 100%;
@@ -402,4 +450,14 @@
402 450
       }
403 451
     }
404 452
   }
453
+}
454
+
455
+@-webkit-keyframes move {
456
+  0% {
457
+    left: 100vw;
458
+  }
459
+
460
+  100% {
461
+    left: -100%;
462
+  }
405 463
 }