index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view>
  3. <image src="../../static/images/my.png" mode="widthFix" class="top"></image>
  4. <view class="cmain">
  5. <view class="vsearch">
  6. <view class="vse">
  7. <u-search placeholder="搜索资讯" v-model="keyword" @search="search" :actionStyle="{ color: 'white' }" :animation="true" actionText="取消"></u-search>
  8. </view>
  9. <view class="icon" @click="scanCode()">&#xe60d;</view>
  10. </view>
  11. <!--轮播图-->
  12. <u-swiper circular :radius="5" :indicator="true" keyName="image" :list="bannerList" :height="140" class="uni-swiper" @click="click"></u-swiper>
  13. <!--通知公告-->
  14. <view class="notice">
  15. <u-notice-bar color="#848484" :text="noticeList" :step="true" direction="column" mode="link" bgColor="white" speed="300" url="/pages/notice/index"></u-notice-bar>
  16. </view>
  17. <!--菜单-->
  18. <view class="menu">
  19. <view class="msn" v-for="(item, index) in menuList" :key="index" @click="navTo(item.path)">
  20. <view class="out">
  21. <view class="int">
  22. <u-icon :name="item.icon" color="white" size="25" :custom-style="{ margin: '0 auto' }" class="ioc"></u-icon>
  23. <view class="tit">{{ item.menuName }}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="clear"></view>
  28. </view>
  29. <!--最新资讯-->
  30. <view class="news">
  31. <view class="vlabel">
  32. <view class="tag"></view>
  33. <text class="title">最新资讯</text>
  34. <text class="more" @click="navTo('/pages/news/list')">更多</text>
  35. <view class="clear"></view>
  36. </view>
  37. <view class="list">
  38. <view class="news_item" v-for="(item, index) in newsList" :key="index" @click="go('/pages/news/detail?id=' + item.id)">
  39. <image src="../../static/news.jpg" mode="aspectFill" class="img"></image>
  40. <view class="con">
  41. <view class="title ellip">{{ item.title }}</view>
  42. <view class="date">
  43. <text class="icon">&#xe65c;</text>
  44. <text>{{ item.readCount }}</text>
  45. </view>
  46. <text class="releaseTime">{{ item.releaseTime }}</text>
  47. </view>
  48. <view class="clear"></view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. keyword: '',
  60. bannerList: [],
  61. newsList: [],
  62. noticeList: ['边民互市贸易APP上线了', '关于边民互市贸易开通注意事项'],
  63. roleMenu: [],
  64. menuList: []
  65. };
  66. },
  67. onLoad() {
  68. this.getBannerList();
  69. this.getNewsList();
  70. this.getRoleMenu();
  71. this.getMenu();
  72. },
  73. methods: {
  74. getBannerList() {
  75. this.http.request({
  76. url: '/level-one-server/app/TbBanner/getList',
  77. success: res => {
  78. this.bannerList = res.data.data;
  79. }
  80. });
  81. },
  82. getRoleMenu() {
  83. let menu = uni.getStorageSync('menu');
  84. this.http.request({
  85. url: '/sp-admin/ReRoleMenu/getList',
  86. success: res => {
  87. res.data.data.map((item1, index) => {
  88. menu.map((item2, index1) => {
  89. if (item1.appRoleId == item2) {
  90. this.roleMenu.push(item1.appMenuId);
  91. }
  92. });
  93. });
  94. this.getMenu();
  95. }
  96. });
  97. },
  98. getMenu() {
  99. let menu = uni.getStorageSync('menu');
  100. this.http.request({
  101. url: '/sp-admin/AppMenu/getList',
  102. success: res => {
  103. let data = res.data.data;
  104. menu.map((item2, index1) => {
  105. data.map((item1, index) => {
  106. if (parseInt(item1.id) == parseInt(item2)) {
  107. this.menuList.push(item1);
  108. }
  109. });
  110. });
  111. }
  112. });
  113. },
  114. getNewsList() {
  115. this.http.request({
  116. url: '/level-one-server/app/TbPortNews/getNewestList',
  117. data: { limit: 4 },
  118. success: res => {
  119. this.newsList = res.data.data;
  120. }
  121. });
  122. },
  123. navTo(url) {
  124. uni.navigateTo({
  125. url: url,
  126. fail: res => {
  127. console.log('zx:' + JSON.stringify(res));
  128. uni.showModal({ content: '功能还在开发中', showCancel: false });
  129. }
  130. });
  131. }
  132. }
  133. };
  134. </script>
  135. <style lang="scss">
  136. page {
  137. background-color: #f6f6f7;
  138. }
  139. .top {
  140. width: 100%;
  141. position: relative;
  142. }
  143. .cmain {
  144. padding: 10px 15px 10px 15px;
  145. margin-top: -193px;
  146. position: relative;
  147. .vsearch {
  148. margin-bottom: 13px;
  149. position: relative;
  150. .vse {
  151. width: 82% !important;
  152. }
  153. .icon {
  154. position: absolute;
  155. right: 0px;
  156. top: 0px;
  157. color: white;
  158. font-size: 25px;
  159. top: 5px;
  160. }
  161. }
  162. .uni-swiper {
  163. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  164. }
  165. .notice {
  166. margin-top: 10px;
  167. border-radius: 5px !important;
  168. overflow: hidden;
  169. }
  170. .menu {
  171. background-color: white;
  172. padding-top: 3px;
  173. margin-top: 10px;
  174. padding-bottom: 7px;
  175. border-radius: 5px;
  176. .msn {
  177. float: left;
  178. width: 25%;
  179. text-align: center;
  180. .out {
  181. padding: 3px;
  182. .int {
  183. padding: 5px;
  184. animation: bounceIn 1s;
  185. .ioc {
  186. width: 45px;
  187. height: 45px;
  188. background-color: #1c9dff;
  189. border-radius: 50%;
  190. margin: 0 auto;
  191. line-height: 46px;
  192. .icon {
  193. font-size: 23px;
  194. color: white;
  195. }
  196. }
  197. .tit {
  198. font-size: 14px;
  199. margin-top: 5px;
  200. color: $font-c;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. .news {
  207. background-color: white;
  208. margin-top: 10px;
  209. padding: 10px;
  210. }
  211. }
  212. </style>