index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. let info = this.getUser()
  126. if(info.userType == 4 && url=='/pages/market/one/list'){
  127. uni.showToast({
  128. title: '您当前无权限查看该选项',
  129. icon:'none',
  130. })
  131. return;
  132. }
  133. if(info.userType == 3 && url=='/pages/market/two/list'){
  134. uni.showToast({
  135. title: '您当前无权限查看该选项',
  136. icon:'none',
  137. })
  138. return;
  139. }
  140. uni.navigateTo({
  141. url: url,
  142. fail: res => {
  143. console.log('zx:' + JSON.stringify(res));
  144. uni.showModal({ content: '功能还在开发中', showCancel: false });
  145. }
  146. });
  147. },
  148. go(url) {
  149. uni.navigateTo({ url: url });
  150. },
  151. }
  152. };
  153. </script>
  154. <style lang="scss">
  155. page {
  156. background-color: #f6f6f7;
  157. }
  158. .top {
  159. width: 100%;
  160. position: relative;
  161. }
  162. .cmain {
  163. padding: 10px 15px 10px 15px;
  164. margin-top: -193px;
  165. position: relative;
  166. .vsearch {
  167. margin-bottom: 13px;
  168. position: relative;
  169. .vse {
  170. width: 82% !important;
  171. }
  172. .icon {
  173. position: absolute;
  174. right: 0px;
  175. top: 0px;
  176. color: white;
  177. font-size: 25px;
  178. top: 5px;
  179. }
  180. }
  181. .uni-swiper {
  182. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  183. }
  184. .notice {
  185. margin-top: 10px;
  186. border-radius: 5px !important;
  187. overflow: hidden;
  188. }
  189. .menu {
  190. background-color: white;
  191. padding-top: 3px;
  192. margin-top: 10px;
  193. padding-bottom: 7px;
  194. border-radius: 5px;
  195. .msn {
  196. float: left;
  197. width: 25%;
  198. text-align: center;
  199. .out {
  200. padding: 3px;
  201. .int {
  202. padding: 5px;
  203. animation: bounceIn 1s;
  204. .ioc {
  205. width: 45px;
  206. height: 45px;
  207. background-color: #1c9dff;
  208. border-radius: 50%;
  209. margin: 0 auto;
  210. line-height: 46px;
  211. .icon {
  212. font-size: 23px;
  213. color: white;
  214. }
  215. }
  216. .tit {
  217. font-size: 14px;
  218. margin-top: 5px;
  219. color: $font-c;
  220. }
  221. }
  222. }
  223. }
  224. }
  225. .news {
  226. background-color: white;
  227. margin-top: 10px;
  228. padding: 10px;
  229. }
  230. }
  231. </style>