index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="container">
  3. <!-- 动画 -->
  4. <uni-transition ref="ani" class="dhbox" custom-class="transition" :mode-class="modeClass" v-if="dhshow" :show="dhshow" :styles="styles">
  5. <img src="https://fuyu.scapp.cn/static/wxa/dh.jpg" class="dhimg">
  6. <view class="to" @click="show">
  7. 跳过
  8. </view>
  9. </uni-transition>
  10. <view v-show="!dhshow">
  11. <view class="page-section page-section-spacing swiper">
  12. <swiper class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
  13. <swiper-item v-for="(item, index) in bannerList" :key="index">
  14. <image style="width: 100%; height: 100%;" :src="item"></image>
  15. </swiper-item>
  16. </swiper>
  17. </view>
  18. <uni-notice-bar moreColor="#000" scrollable show-get-more show-icon :text="notice" more-text="更多>>" @getmore="getMore" />
  19. <!-- 党建 -->
  20. <uni-section titleFontSize="16px" class="mb-10 sectionBox" title="党建引领" type="line">
  21. <view class="card" v-for="(item, index) in construct" :key="index" :border="false" @click="illnessBtn(item)">
  22. <image style="width: 50%; height: 55px; margin: 0 auto; display: block;" :src="item.url"></image>
  23. <text class="title">{{ item.title }}</text>
  24. </view>
  25. </uni-section>
  26. <!-- 治理 -->
  27. <uni-section titleFontSize="16px" class="mb-10 sectionBox" title="精细治理" type="line">
  28. <view class="card" v-for="(item, index) in govern" :key="index" :border="false" @click="illnessBtn(item)">
  29. <image style="width: 50%; height: 55px; margin: 0 auto; display: block;" :src="item.url"></image>
  30. <text class="title">{{ item.title }}</text>
  31. </view>
  32. </uni-section>
  33. <!-- 疫情 -->
  34. <uni-section titleFontSize="16px" class="mb-10 sectionBox" title="便民服务" type="line">
  35. <view class="card" v-for="(item, index) in list" :key="index" :border="false" @click="illnessBtn(item)">
  36. <image style="width: 50%; height: 55px; margin: 0 auto; display: block;" :src="item.url"></image>
  37. <text class="title">{{ item.title }}</text>
  38. </view>
  39. </uni-section>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import request from '../../api/system.js';
  45. import requestLogin from '../../api/login.js';
  46. const appid = uni.getAccountInfoSync().miniProgram.appId;
  47. export default {
  48. data() {
  49. return {
  50. styles: {
  51. width: '100vw',
  52. height: '100vh',
  53. },
  54. modeClass: ['fade', 'zoom-in'],
  55. dhshow: true,
  56. list: [],
  57. policyList: [],
  58. notice: '通知公告',
  59. autoplay: true,
  60. interval: 3000,
  61. duration: 500,
  62. indicatorDots: false,
  63. bannerList: [],
  64. govern: [],
  65. construct: [],
  66. timeout: null
  67. }
  68. },
  69. async mounted() {
  70. wx.hideTabBar();
  71. this.timeout = setTimeout(() => {
  72. this.show();
  73. }, 3000)
  74. const config = await requestLogin.getJson();
  75. const { list, bannerList, governList, construct } = config.data;
  76. this.list = list;
  77. this.bannerList = bannerList;
  78. this.govern = governList;
  79. this.construct = construct;
  80. const _this = this;
  81. wx.login({
  82. success: async ({ code }) => {
  83. const res = await requestLogin.login({ code, appId: appid });
  84. if (res && res.code == 200) {
  85. uni.setStorageSync('token', res.data.token);
  86. uni.setStorageSync('userinfo', res.data.user);
  87. uni.setStorageSync('role', res.data.role);
  88. const notice = await request.getSystemNoticeNew();
  89. _this.notice = notice.data?.noticeTitle;
  90. }
  91. }
  92. })
  93. },
  94. methods: {
  95. show() {
  96. clearTimeout(this.timeout);
  97. this.dhshow = !this.dhshow;
  98. wx.showTabBar();
  99. },
  100. morBtn() {
  101. uni.switchTab({ url: '/pages/policy/index' });
  102. },
  103. illnessBtn(e) {
  104. const role = uni.getStorageSync('role');
  105. if (e.isUser && role && role == 'guest') {
  106. uni.navigateTo({
  107. url: `/pages/register/index?path=${e.path}`
  108. })
  109. return;
  110. }
  111. if (!e.path) {
  112. uni.showToast({
  113. title: '敬请期待',
  114. icon: 'error',
  115. duration: 2000,
  116. });
  117. return;
  118. }
  119. uni.navigateTo({ url: e.path });
  120. },
  121. policyBtn(e) {
  122. uni.navigateTo({ url: e.path });
  123. },
  124. // 查看更多
  125. getMore() {
  126. uni.navigateTo({ url: `/pages/notice/index` });
  127. }
  128. },
  129. onShow:function(){
  130. uni.removeStorageSync('policyItem')
  131. }
  132. }
  133. </script>
  134. <style>
  135. .container {
  136. background: #fff;
  137. }
  138. .swiper {
  139. height: 45vw;
  140. overflow: hidden;
  141. }
  142. .uni-section-content {
  143. display: flex;
  144. flex-wrap: wrap;
  145. }
  146. .card {
  147. margin: 10px;
  148. width: 29%;
  149. margin-right: 1%;
  150. }
  151. .card2 {
  152. width: 29%;
  153. margin-right: 1%;
  154. }
  155. .cover {
  156. display: block;
  157. width: 40px;
  158. height: 40px;
  159. margin: 5px auto;
  160. }
  161. .sectionBox {
  162. margin-bottom: 10px;
  163. display: block;
  164. }
  165. .sectionBox .uni-section-content {
  166. display: flex;
  167. }
  168. .uni-section__content-title {
  169. font-weight: 600;
  170. }
  171. .uni-card {
  172. padding: 0 !important;
  173. margin: 0 !important;
  174. }
  175. .uni-card__content {
  176. /* padding: 0 !important; */
  177. }
  178. h2 {
  179. font-weight: 700;
  180. width: 100%;
  181. text-align: center;
  182. font-size: 16px;
  183. }
  184. .title {
  185. display: block;
  186. margin: 0 auto;
  187. width: 100%;
  188. text-align: center;
  189. font-size: 14px;
  190. }
  191. .cardText {
  192. display: block;
  193. width: 100%;
  194. text-align: center;
  195. font-size: 12px;
  196. margin-bottom: 5px;
  197. color: #999;
  198. }
  199. .dhbox {
  200. position: fixed;
  201. z-index: 999;
  202. width: 100vw;
  203. height: 100vh;
  204. }
  205. .dhimg {
  206. width: 100%;
  207. height: 100%;
  208. display: block;
  209. }
  210. .to {
  211. width: 60px;
  212. height: 20px;
  213. opacity: 0.8;
  214. background-color: #000;
  215. color: #fff;
  216. position: absolute;
  217. top: 10px;
  218. right: 10px;
  219. text-align: center;
  220. border-radius: 12px;
  221. font-size: 12px;
  222. }
  223. </style>