index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. console.log(this.menuList)
  114. },
  115. getNewsList() {
  116. this.http.request({
  117. url: '/level-one-server/app/TbPortNews/getNewestList',
  118. data: { limit: 4 },
  119. success: res => {
  120. this.newsList = res.data.data;
  121. }
  122. });
  123. },
  124. navTo(url) {
  125. uni.navigateTo({
  126. url: url,
  127. fail: res => {
  128. console.log('zx:' + JSON.stringify(res));
  129. uni.showModal({ content: '功能还在开发中', showCancel: false });
  130. }
  131. });
  132. },
  133. go(url) {
  134. uni.navigateTo({ url: url });
  135. },
  136. }
  137. };
  138. </script>
  139. <style lang="scss">
  140. page {
  141. background-color: #f6f6f7;
  142. }
  143. .top {
  144. width: 100%;
  145. position: relative;
  146. }
  147. .cmain {
  148. padding: 10px 15px 10px 15px;
  149. margin-top: -193px;
  150. position: relative;
  151. .vsearch {
  152. margin-bottom: 13px;
  153. position: relative;
  154. .vse {
  155. width: 82% !important;
  156. }
  157. .icon {
  158. position: absolute;
  159. right: 0px;
  160. top: 0px;
  161. color: white;
  162. font-size: 25px;
  163. top: 5px;
  164. }
  165. }
  166. .uni-swiper {
  167. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  168. }
  169. .notice {
  170. margin-top: 10px;
  171. border-radius: 5px !important;
  172. overflow: hidden;
  173. }
  174. .menu {
  175. background-color: white;
  176. padding-top: 3px;
  177. margin-top: 10px;
  178. padding-bottom: 7px;
  179. border-radius: 5px;
  180. .msn {
  181. float: left;
  182. width: 25%;
  183. text-align: center;
  184. .out {
  185. padding: 3px;
  186. .int {
  187. padding: 5px;
  188. animation: bounceIn 1s;
  189. .ioc {
  190. width: 45px;
  191. height: 45px;
  192. background-color: #1c9dff;
  193. border-radius: 50%;
  194. margin: 0 auto;
  195. line-height: 46px;
  196. .icon {
  197. font-size: 23px;
  198. color: white;
  199. }
  200. }
  201. .tit {
  202. font-size: 14px;
  203. margin-top: 5px;
  204. color: $font-c;
  205. }
  206. }
  207. }
  208. }
  209. }
  210. .news {
  211. background-color: white;
  212. margin-top: 10px;
  213. padding: 10px;
  214. }
  215. }
  216. </style>