index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <view class="vheigh"></view>
  5. <image class="top-bg" src="../../static/img/top-bg.png" mode=""></image>
  6. <view class="top-main flex">
  7. <view class="search-box flex" @click="clickSearch()">
  8. <image class="search" src="../../static/img/search.png" mode=""></image>
  9. <view class="search-font">输入关键词搜索</view>
  10. </view>
  11. </view>
  12. </view>
  13. <swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  14. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  15. @click="bannerNavToUrl(item)">
  16. <image :src="item.pic" />
  17. </swiper-item>
  18. </swiper>
  19. <view class="tongz flex">
  20. <view>
  21. <view class="tongz-bg">
  22. <image src="../../static/img/tongz-bg.png" mode=""></image>
  23. </view>
  24. <view class="tongz-left flex">
  25. <image class="image-left" src="../../static/img/ling.png" mode=""></image>
  26. <u-notice-bar style="width: 100%;" mode="vertical" type="none" :volume-icon="false"
  27. :more-icon="false" :list="text"></u-notice-bar>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="navbar">
  32. <view class="nav-item" @click="nav('/pages/index/index')">
  33. <image class="nav-img" src="../../static/img/newbanner.png" mode=""></image>
  34. </view>
  35. <view class="nav-item" @click="nav('/pages/navigation/main')">
  36. <image class="nav-img" src="../../static/img/oldbanner.png" mode=""></image>
  37. </view>
  38. </view>
  39. <view class="box margin-t-30">
  40. <!-- <view class="titlebox flex">
  41. <view class="flex-start">
  42. <image class="nametip" src="../../static/icon/quick6.png" mode="scaleToFill"></image>
  43. <text class="padding-l-10">文票趋势</text>
  44. </view>
  45. </view> -->
  46. <view class="flex item">
  47. <view class="item-box">
  48. <view class="title">
  49. {{ticketBase.fullname}}
  50. </view>
  51. <view class="mintitle margin-t-20">
  52. 价格(CNY)<text class="num font-size-lg">{{ticketBase.CurPrice}}</text>
  53. </view>
  54. </view>
  55. <view class="item-box">
  56. <view class="num righttext">
  57. <text v-if="ticketBase.CurrentGains>0">+</text>
  58. <text v-if="ticketBase.CurrentGains<0">-</text>
  59. {{ticketBase.CurrentGains*100}}%
  60. </view>
  61. <view class="mintitle margin-t-10">
  62. 近24小时涨跌幅
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <!-- #ifdef H5 -->
  68. <view class="btm">
  69. <a href="https://beian.miit.gov.cn" class="a-pm">备案编号:浙ICP备2022017146号 </a>
  70. </view>
  71. <!-- #endif -->
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. loadIndexs,
  77. store_list
  78. } from '@/api/index.js';
  79. import {
  80. getTicket
  81. } from '@/api/quick.js';
  82. import {
  83. mapState,
  84. mapMutations
  85. } from 'vuex';
  86. export default {
  87. data() {
  88. return {
  89. current: 0,
  90. titleNViewBackground: '',
  91. swiperCurrent: 0,
  92. swiperLength: 0,
  93. carouselList: [], //轮播图列表
  94. text: ['双模式 双系统 开创第三代新零售'],
  95. ticketBase:{}
  96. };
  97. },
  98. onShow() {
  99. this.loadData();
  100. this.getTicket()
  101. },
  102. methods: {
  103. ...mapMutations(['setLat', 'setLon', 'setChoose']),
  104. getTicket(){
  105. getTicket()
  106. .then(
  107. (res) => {
  108. console.log(res);
  109. this.ticketBase = res.data.v;
  110. }
  111. ).catch(
  112. (err) => {
  113. console.log(err);
  114. }
  115. )
  116. },
  117. loadData() {
  118. loadIndexs({})
  119. .then(({
  120. data
  121. }) => {
  122. let goods = data.info;
  123. this.dataList = goods.bastList; //精品推荐
  124. this.carouselList = data.banner;
  125. })
  126. .catch(e => {});
  127. },
  128. nav(url) {
  129. uni.navigateTo({
  130. url,
  131. fail() {
  132. uni.switchTab({
  133. url
  134. });
  135. }
  136. });
  137. },
  138. //轮播图切换修改背景色
  139. swiperChange(e) {
  140. const index = e.detail.current;
  141. this.swiperCurrent = index;
  142. this.titleNViewBackground = this.carouselList[index].background;
  143. },
  144. // 點擊搜索框
  145. clickSearch() {
  146. uni.navigateTo({
  147. url: '/pages/product/search'
  148. });
  149. },
  150. }
  151. };
  152. </script>
  153. <style lang="scss">
  154. .box {
  155. border-radius: 10rpx;
  156. line-height: 1;
  157. margin: 0 30rpx;
  158. background-image: url("../../static/img/indwxWp.png");
  159. background-size: 100% auto;
  160. background-repeat: no-repeat;
  161. .titlebox {
  162. padding: 10rpx 30rpx;
  163. font-weight: bold;
  164. font-size: $font-base;
  165. border-bottom: 1px solid #FFF;
  166. }
  167. .nametip {
  168. width: 50rpx;
  169. height: 50rpx;
  170. }
  171. .item {
  172. padding-top: 100rpx;
  173. padding-left: 60rpx;
  174. padding-right: 90rpx;
  175. padding-bottom: 60rpx;
  176. }
  177. .item-box {
  178. font-weight: bold;
  179. .num {
  180. text-align: center;
  181. color: $color-red;
  182. &.righttext{
  183. font-size: 50rpx;
  184. }
  185. }
  186. .title {
  187. font-size: $font-lg;
  188. color: $font-color-dark;
  189. }
  190. .mintitle{
  191. font-size: $font-sm;
  192. color: $font-color-light;
  193. }
  194. }
  195. }
  196. page,
  197. .center {
  198. min-height: 100%;
  199. height: auto;
  200. background: #ffffff;
  201. }
  202. .vheigh {
  203. height: var(--status-bar-height);
  204. background-color: $base-color;
  205. }
  206. .top {
  207. position: relative;
  208. width: 100%;
  209. height: 360rpx;
  210. .top-bg {
  211. position: absolute;
  212. top: 0;
  213. left: 0;
  214. right: 0;
  215. width: 100%;
  216. height: 100%;
  217. }
  218. .top-main {
  219. position: relative;
  220. z-index: 2;
  221. padding: 30rpx;
  222. .search-box {
  223. justify-content: center;
  224. width: 698rpx;
  225. height: 60rpx;
  226. background: rgba(255, 240, 245, 0.4);
  227. box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  228. border-radius: 30rpx;
  229. .search {
  230. width: 34rpx;
  231. height: 34rpx;
  232. }
  233. .search-font {
  234. margin-left: 14rpx;
  235. font-size: 28rpx;
  236. font-family: PingFang SC;
  237. font-weight: 500;
  238. color: #ffffff;
  239. }
  240. }
  241. }
  242. }
  243. .carousel {
  244. width: 700rpx;
  245. height: 276rpx;
  246. /* #ifndef APP-PLUS */
  247. margin: -240rpx auto 0;
  248. /* #endif */
  249. /* #ifdef APP-PLUS */
  250. margin: -180rpx auto 0;
  251. /* #endif */
  252. border-radius: 40rpx;
  253. image {
  254. border-radius: 40rpx;
  255. width: 700rpx;
  256. height: 276rpx;
  257. }
  258. }
  259. .tongz {
  260. width: 690rpx;
  261. height: 70rpx;
  262. margin: 32rpx auto 0;
  263. padding: 18rpx 30rpx 18rpx 24rpx;
  264. align-items: center;
  265. position: relative;
  266. .tongz-bg {
  267. position: absolute;
  268. top: 0;
  269. right: 0;
  270. left: 0;
  271. width: 690rpx;
  272. height: 70rpx;
  273. image {
  274. width: 100%;
  275. height: 100%;
  276. }
  277. }
  278. .tongz-left {
  279. width: 640rpx;
  280. .image-left {
  281. width: 28rpx;
  282. height: 34rpx;
  283. }
  284. .tongz-font {
  285. margin-left: 22rpx;
  286. font-size: 28rpx;
  287. font-family: Source Han Sans CN;
  288. font-weight: 400;
  289. color: #0f253a;
  290. }
  291. }
  292. .tongz-right {
  293. position: relative;
  294. z-index: 11;
  295. width: 12rpx;
  296. height: 26rpx;
  297. image {
  298. width: 100%;
  299. height: 100%;
  300. }
  301. }
  302. }
  303. .nav-item {
  304. width: 698rpx;
  305. height: 219rpx;
  306. background: linear-gradient(150deg, #F5BE41 0%, #DF4226 100%);
  307. border-radius: 14rpx;
  308. margin: 40rpx auto 0;
  309. .nav-img {
  310. width: 100%;
  311. height: 100%;
  312. border-radius: 14rpx;
  313. }
  314. }
  315. .btm {
  316. position: fixed;
  317. bottom: 0;
  318. width: 100%;
  319. height: 50rpx;
  320. line-height: 50rpx;
  321. text-align: center;
  322. .a-pm {
  323. text-decoration: none;
  324. width: 100%;
  325. height: 50rpx;
  326. line-height: 50rpx;
  327. color: navigator;
  328. }
  329. }
  330. </style>