index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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="message()">&#xe60d;</view>
  10. <view class="bage" v-if="count > 0"></view>
  11. </view>
  12. <!--轮播图-->
  13. <u-swiper circular :radius="5" :indicator="true" keyName="image" :list="bannerList" :height="110" class="uni-swiper" @click="click"></u-swiper>
  14. <!--通知公告-->
  15. <view class="notice">
  16. <u-notice-bar color="#848484" :text="noticeList" :step="true" direction="column" mode="link" bgColor="white" speed="300" url="/pages/notice/index"></u-notice-bar>
  17. </view>
  18. <!--菜单-->
  19. <view class="menu">
  20. <view class="msn" v-for="(item, index) in menuList" :key="index" @click="navTo(item.path)">
  21. <view class="out">
  22. <view class="int">
  23. <image :src="item.icon" mode="widthFix" style="width: 54px; height: 54px"></image>
  24. <view class="tit">{{ item.menuName }}</view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="clear"></view>
  29. </view>
  30. <!--最新资讯-->
  31. <view class="news">
  32. <view class="vlabel">
  33. <view class="tag"></view>
  34. <text class="title">最新资讯</text>
  35. <text class="more" @click="navTo('/pages/news/list')">
  36. <text>更多</text>
  37. <text class="icon">&#xe8f2;</text>
  38. </text>
  39. </view>
  40. <view class="list animated fadeInDown">
  41. <view class="news_item" v-for="(item, index) in newsList" :key="index" @click="go('/pages/news/detail?id=' + item.id)">
  42. <image src="../../static/tp.jpg" mode="aspectFill" class="img"></image>
  43. <view class="con">
  44. <view class="title ellip">{{ item.title }}</view>
  45. <view class="source omit">
  46. <text class="icon">&#xe639;</text>
  47. <text>{{ item.readCount }}</text>
  48. </view>
  49. <view class="releaseTime">{{ item.releaseTime }}</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <u-popup :show="show" @close="close()" round="15" mode="center" :closeOnClickOverlay="false" :customStyle="{ width: '90%' }">
  56. <view class="ppopup">
  57. <u-divider text="交易订单提醒" textSize="16"></u-divider>
  58. <view class="contents">
  59. <view class="item omit">
  60. <text class="label">商品名称:</text>
  61. <text class="desc">河虾(活体)(沼虾属Macrobrachium)</text>
  62. </view>
  63. <view class="item omit">
  64. <text class="label">数量:</text>
  65. <text class="desc">河虾(活体)(沼虾属Macrobrachium)</text>
  66. </view>
  67. <view class="item omit">
  68. <text class="label">价格:</text>
  69. <text class="desc">¥ 1000</text>
  70. </view>
  71. </view>
  72. <button class="btn" @click="confirm()">去处理</button>
  73. </view>
  74. </u-popup>
  75. </view>
  76. </template>
  77. <script>
  78. export default {
  79. data() {
  80. return {
  81. keyword: '',
  82. bannerList: [],
  83. newsList: [],
  84. noticeList: ['边民互市贸易APP上线了', '关于边民互市贸易开通注意事项'],
  85. roleMenu: [],
  86. menuList: [],
  87. count: 0,
  88. show: true,
  89. order: {}
  90. };
  91. },
  92. onLoad() {
  93. this.getMenu();
  94. this.getBannerList();
  95. this.getNewsList();
  96. },
  97. onShow() {
  98. this.keyword = '';
  99. this.getRead();
  100. },
  101. methods: {
  102. //获取待处理的订单弹出
  103. getOrderConfirm() {
  104. this.http.request({
  105. url: '/level-two-server/app/TbOrders/xxxxx',
  106. loading: 'false',
  107. success: res => {
  108. if (res.data.data) {
  109. this.order=res.data.data;
  110. this.show = true;
  111. }
  112. }
  113. });
  114. },
  115. confirm() {
  116. uni.navigateTo({ url: '/pages/market/one/leader/handle?orderId=' + this.order.id });
  117. this.show = false;
  118. },
  119. getRead() {
  120. this.http.request({
  121. url: '/sp-admin/app/TbMessage/getRead',
  122. loading: 'false',
  123. success: res => {
  124. if (res.data.data.count > 0) {
  125. this.count = res.data.data.count;
  126. uni.setTabBarBadge({ index: 1, text: res.data.data.count });
  127. } else {
  128. this.count = 0;
  129. }
  130. }
  131. });
  132. },
  133. getBannerList() {
  134. this.http.request({
  135. url: '/level-one-server/app/TbBanner/getList',
  136. success: res => {
  137. this.bannerList = res.data.data;
  138. }
  139. });
  140. },
  141. getMenu() {
  142. this.menuList = [];
  143. let menu = uni.getStorageSync('menu');
  144. this.http.request({
  145. url: '/sp-admin/app/AppMenu/getList',
  146. success: res => {
  147. let data = res.data.data;
  148. menu.map((item2, index1) => {
  149. data.map((item1, index) => {
  150. if (parseInt(item1.id) == parseInt(item2)) {
  151. this.menuList.push(item1);
  152. }
  153. });
  154. });
  155. this.menuList.sort((a, b) => a.sort - b.sort);
  156. }
  157. });
  158. },
  159. getNewsList() {
  160. this.http.request({
  161. url: '/level-one-server/app/TbPortNews/getNewestList',
  162. data: { limit: 5 },
  163. success: res => {
  164. this.newsList = res.data.data;
  165. }
  166. });
  167. },
  168. //点击轮播图
  169. click(index) {
  170. uni.navigateTo({ url: '/pages/news/detail?id=8' });
  171. },
  172. message() {
  173. uni.switchTab({ url: '/pages/message/message' });
  174. },
  175. search() {
  176. uni.navigateTo({ url: '/pages/news/list?keyword=' + this.keyword });
  177. },
  178. navTo(url) {
  179. uni.navigateTo({
  180. url: url,
  181. fail: res => {
  182. console.log('zx:' + JSON.stringify(res));
  183. uni.showModal({ content: '功能还在开发中', showCancel: false });
  184. }
  185. });
  186. },
  187. go(url) {
  188. uni.navigateTo({ url: url });
  189. }
  190. },
  191. //下拉刷新
  192. onPullDownRefresh() {
  193. setTimeout(() => {
  194. uni.stopPullDownRefresh();
  195. this.getMenu();
  196. }, 1000);
  197. }
  198. };
  199. </script>
  200. <style lang="scss">
  201. page {
  202. background-color: $pg;
  203. }
  204. .top {
  205. width: 100%;
  206. position: relative;
  207. }
  208. .cmain {
  209. padding: 10px 15px 10px 15px;
  210. margin-top: -193px;
  211. position: relative;
  212. .vsearch {
  213. margin-bottom: 13px;
  214. position: relative;
  215. .vse {
  216. width: 82% !important;
  217. }
  218. .icon {
  219. position: absolute;
  220. right: 0px;
  221. top: 0px;
  222. color: white;
  223. font-size: 25px;
  224. top: 5px;
  225. }
  226. .bage {
  227. width: 8px;
  228. height: 8px;
  229. border-radius: 50%;
  230. background-color: #f44336;
  231. top: 0px;
  232. right: 0px;
  233. position: absolute;
  234. }
  235. }
  236. .uni-swiper {
  237. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  238. }
  239. .notice {
  240. margin-top: 10px;
  241. border-radius: 5px !important;
  242. overflow: hidden;
  243. }
  244. .news {
  245. margin-top: 15px;
  246. }
  247. }
  248. .ppopup {
  249. .item {
  250. padding: 5px 0px 5px 0px;
  251. color: $font-c;
  252. .label {
  253. width: 70px;
  254. float: left;
  255. text-align: left;
  256. padding-right: 10px;
  257. font-weight: bold;
  258. }
  259. }
  260. }
  261. </style>