xcx hace 4 años
padre
commit
b216c1e773

+ 5
- 2
src/assets/css/iconfont.css
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 10
- 6
src/assets/css/iconfont.less
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 49
- 0
src/pages/ShouYe/index.css Ver fichero

37
   background-image: linear-gradient(#f35844, #ff8d61);
37
   background-image: linear-gradient(#f35844, #ff8d61);
38
   z-index: 1;
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
 .ShouYe > view.flex-item > .PageContainer .Content > view > .Welcome {
81
 .ShouYe > view.flex-item > .PageContainer .Content > view > .Welcome {
41
   display: block;
82
   display: block;
42
   font-size: 30px;
83
   font-size: 30px;
300
   width: 100%;
341
   width: 100%;
301
   height: 30px;
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 Ver fichero

33
   const [BannerList, setBannerList] = useState([])
33
   const [BannerList, setBannerList] = useState([])
34
   // const [ActivityList, setActivityList] = useState([])
34
   // const [ActivityList, setActivityList] = useState([])
35
   const [NewsList, setNewsList] = useState([])
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
   const [propagandaList, setPropagandaList] = useState([])
42
   const [propagandaList, setPropagandaList] = useState([])
41
     Init()
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
   const Init = (done = () => { }) => { // 初始化
67
   const Init = (done = () => { }) => { // 初始化
68
+    GetNotice() // 获取通知
45
     let DownCount = 0
69
     let DownCount = 0
46
     GetBanner(() => { // 获取轮播图
70
     GetBanner(() => { // 获取轮播图
47
       DownCount += 1
71
       DownCount += 1
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
   const GetBanner = (done = () => { }) => { // 获取轮播图
106
   const GetBanner = (done = () => { }) => { // 获取轮播图
74
     setBannerList([])
107
     setBannerList([])
75
     request({ ...apis.getBanner, params: { showType: 'banner', showPosition: 'index', pageNum: 1, pageSize: 5 } }).then((res) => {
108
     request({ ...apis.getBanner, params: { showType: 'banner', showPosition: 'index', pageNum: 1, pageSize: 5 } }).then((res) => {
169
 
202
 
170
                 <view>
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
                   <Text className='Welcome'>欢迎来到远道智慧社区!</Text>
217
                   <Text className='Welcome'>欢迎来到远道智慧社区!</Text>
174
 
218
 

+ 58
- 0
src/pages/ShouYe/index.less Ver fichero

42
               z-index: 1;
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
             >.Welcome {
92
             >.Welcome {
46
               display: block;
93
               display: block;
47
               font-size: 30px;
94
               font-size: 30px;
281
 
328
 
282
                   >view {
329
                   >view {
283
                     position: relative;
330
                     position: relative;
331
+
284
                     text {
332
                     text {
285
                       display: block;
333
                       display: block;
286
                       width: 100%;
334
                       width: 100%;
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
 }