Browse Source

首页接口

qukaidi 4 years ago
parent
commit
53ced6594a
6 changed files with 88 additions and 54 deletions
  1. 3 0
      App.vue
  2. 75 44
      pages/home/index.vue
  3. 1 5
      pages/login/index.vue
  4. 1 1
      pages/login/register_3.vue
  5. 0 2
      pages/me/index.vue
  6. 8 2
      pages/me/setting/setting.vue

+ 3 - 0
App.vue

@@ -32,4 +32,7 @@
 		background-color: #F4F4F4;
 		font-weight: 500;
 	}
+	.u-skeleton{
+		height: 100%;
+	}
 </style>

+ 75 - 44
pages/home/index.vue

@@ -1,84 +1,115 @@
 <template>
-	<view style="background-color: #FFFFFF;height: 100%;">
+	<view style="background-color: #FFFFFF;height: 100%;" class="u-skeleton">
 		<view class="status_bar">
 			<!-- 这里是状态栏 -->
 		</view>
 		<view class="u-page" style="margin-bottom: 20rpx;">
 			<view class="u-m-t-20">
-				<u-swiper :list="tabbarList" :height="310" :effect3d="true" border-radius="20" effect3d-previous-margin="20" bg-color="#FFF"></u-swiper>
+				<u-swiper :list="bannersList" :height="310" :effect3d="true" border-radius="20" effect3d-previous-margin="20"
+				 bg-color="#FFF" class="u-skeleton-fillet"></u-swiper>
 			</view>
-			<view class="u-flex u-m-t-20  u-m-l-20 u-m-r-20">
-				<view class="u-flex u-row-center" style="width: 450rpx; height: 70rpx;border-radius: 50rpx;background: rgba(52,140,245,0.1);font-size: 20rpx;color: #348CF5; font-size: 500;">
+			<view class="u-flex u-m-t-20  u-m-l-20 u-m-r-20 u-skeleton-fillet" style="width:710rpx;">
+				<!-- <view class="u-flex u-row-center" style="width: 150rpx; height: 70rpx;border-radius: 50rpx;background: rgba(52,140,245,0.1);font-size: 20rpx;color: #348CF5; font-size: 500;">
 					<u-image width="45rpx" height="35rpx" src="../../static/sailun/speaker.png" style="margin:10rpx;"></u-image>公告
-				</view>
-				<u-notice-bar mode="horizontal" :list="noticebarList" :volume-icon="false" bg-color="#FFF" color="#2B2B2B" padding="18rpx 12rpx"></u-notice-bar>
+					<u-notice-bar mode="horizontal" :list="noticebarList" :volume-icon="false" bg-color="#FFF" color="#2B2B2B" padding="18rpx 12rpx" :is-circular="false"></u-notice-bar> -->
+				<u-notice-bar mode="vertical" :list="noticebarList" style="width: 710rpx;" type="primary"></u-notice-bar>
 			</view>
 			<view class="u-flex u-m-t-20 u-row-around u-m-l-10 u-m-r-10">
-				<u-image width="350rpx" src="../../static/sailun/scan_in.png" @click="scancodeIn" mode="widthFix"></u-image>
-				<u-image width="350rpx" src="../../static/sailun/scan_out.png" @click="scancodeOut" mode="widthFix"></u-image>
+				<u-image width="350rpx" src="../../static/sailun/scan_in.png" @click="scancodeIn" mode="widthFix" class="u-skeleton-fillet"></u-image>
+				<u-image width="350rpx" src="../../static/sailun/scan_out.png" @click="scancodeOut" mode="widthFix" class="u-skeleton-fillet"></u-image>
 			</view>
 			<view class="u-m-t-20">
 				<view class="u-m-l-30" style="font-size: 34rpx;">
 					快捷服务
 				</view>
 				<view class="u-flex u-flex-wrap u-row-center">
-					<u-image width="350rpx" height="212rpx" src="../../static/sailun/1.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
+					<u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/1.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
 					 @click="inStock"></u-image>
-					<u-image width="350rpx" height="212rpx" src="../../static/sailun/2.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"></u-image>
-					<u-image width="350rpx" height="212rpx" src="../../static/sailun/3.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
+					<u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/2.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"></u-image>
+					<u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/3.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
 					 @click="inInlineshop"></u-image>
-					<u-image width="350rpx" height="212rpx" src="../../static/sailun/4.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
+					<u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/4.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
 					 @click="inIntegral"></u-image>
 				</view>
 			</view>
-			<view class="" @click="ceshi">
-				测试接口是否连接
-			</view>
 			<view class="u-flex u-row-center u-m-t-30">
-				<u-image width="680rpx" src="../../static/sailun/88reward.png" mode="widthFix"></u-image>
+				<u-image class="u-skeleton-fillet" width="680rpx" src="../../static/sailun/88reward.png" mode="widthFix"></u-image>
 			</view>
-		
+
 		</view>
 		<!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
 		<!-- <u-tabbar v-model="current" :list="list"></u-tabbar> -->
+		<u-skeleton :loading="loading" :animation="true"></u-skeleton>
 	</view>
 </template>
 
 <script>
-	import {request} from '../../common/request/request'
+	import {
+		request
+	} from '../../common/request/request'
 	require("promise.prototype.finally").shim()
 	export default {
 		data() {
 			return {
-				tabbarList: [{
-						image: '../../static/sailun/swiper1.png'
-					},
-					{
-						image: '../../static/sailun/swiper1.png'
-					},
-					{
-						image: '../../static/sailun/swiper1.png'
-					}
-				],
-				noticebarList: ['恭喜您获得10000000元积分红包', '恭喜您获得10000000元积分红包', '恭喜您获得10000000元积分红包'],
+				bannersList: [],
+				noticebarList: [],
+				loading: true, // 是否显示骨架屏组件
 			};
 		},
+		created() {
+			this.getBanners();
+			this.getTiceList()
+		},
 		methods: {
-			ceshi(){
+			//轮播图
+			getBanners() {
+				uni.showLoading({
+					title: '加载中...'
+				});
 				request({
-				    url: '/homepage/getBanners',
-					method:'post',
-					data:{
-						storeid:'1000'
-					}
-				}).then(res => {
-				    console.log(res)
-				}).catch(err => {
-				    console.log(err)
-				})
-				.finally(() => {
-				    // Loading.close()
-				})
+						url: '/homepage/getBanners',
+						method: 'post',
+						data: {
+							"storeId": '1000',
+							"showPosition": 0, //门店0
+						}
+					}).then(res => {
+						this.list = res.data.data
+						this.bannersList = this.list.map(t => t.imgPath)
+					}).catch(err => {
+						console.log(err)
+					})
+					.finally(() => {
+						setTimeout(() => {
+							uni.hideLoading();
+							this.loading = false;
+						}, 1000)
+					})
+			},
+			//消息文字跑马灯
+			getTiceList() {
+				uni.showLoading({
+					title: '加载中...'
+				});
+				request({
+						url: '/homepage/noticeList',
+						method: 'post',
+						data: {
+							"storeId": "1000",
+							"contentType": "1" //门店1
+						}
+					}).then(res => {
+						this.list = res.data.data
+						this.noticebarList = this.list.map(t => t.msgContent)
+					}).catch(err => {
+						console.log(err)
+					})
+					.finally(() => {
+						setTimeout(() => {
+							uni.hideLoading();
+							this.loading = false;
+						}, 1000)
+					})
 			},
 			scancodeIn() {
 				this.$u.route({
@@ -115,4 +146,4 @@
 		width: 100%;
 		background-color: #FFF;
 	}
-</style>
+</style>

+ 1 - 5
pages/login/index.vue

@@ -39,11 +39,7 @@
 		</view>
 		<view class="foot">
 			<view class="u-flex u-row-center u-col-center">
-				<u-line color="#0095FF" length="15%" />
-				<view style="margin: 0 20rpx;color:#0095FF;font-family: Source Han Sans CN;">
-					赛轮店管家
-				</view>
-				<u-line color="#0095FF" length="15%" />
+				<u-divider color="#0095FF" border-color="#0095FF" bg-color="#F4F4F4" fontSize="30">赛轮店管家</u-divider>
 			</view>
 		</view>
 		<u-toast ref="uToast" />

+ 1 - 1
pages/login/register_3.vue

@@ -92,7 +92,7 @@
 			</u-form-item>
 		</u-form>
 		<view style="margin:0 30rpx;">
-			<u-button @click="nextStep" type="primary" @tap="$u.debounce(submit, 2000,immediate = true)" :loading="loading">确认注册</u-button>
+			<u-button @click="nextStep" type="primary" @tap="$u.debounce(submit, 2000,immediate = true)" :loading="loading" :ripple="true" ripple-bg-color="#99d4ff">确认注册</u-button>
 		</view>
 	</view>
 </template>

+ 0 - 2
pages/me/index.vue

@@ -194,8 +194,6 @@
 				</u-cell-group>
 			</view>
 		</view>
-		<!-- 与包裹页面所有内容的元素u-page同级, -->
-		<!-- <u-tabbar v-model="current" :list="list"></u-tabbar> -->
 	</view>
 </template>
 

+ 8 - 2
pages/me/setting/setting.vue

@@ -42,13 +42,14 @@
 						<u-cell-item title="隐私政策">
 							<u-icon slot="icon" size="42" name="info-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx;"></u-icon>
 						</u-cell-item>
-						<u-cell-item title="版本检测" value="1.29" :arrow="false">
+						<u-cell-item title="版本检测" value="1.29" :arrow="false"  :border-bottom="false">
 							<u-icon slot="icon" size="42" name="setting-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx;"></u-icon>
 						</u-cell-item>
 					</u-cell-group>
 				</template>
 			</view>
 		</u-card>
+		<u-button type="primary" @click="exit" :ripple="true" ripple-bg-color="#99d4ff" style="margin: 20rpx;">安全退出</u-button>
 	</view>
 </template>
 
@@ -60,7 +61,12 @@
 			}
 		},
 		methods: {
-
+			exit(){
+			this.$u.route({
+				url: "pages/login/index",
+				type:"reLaunch"
+			})	
+			}
 		}
 	}
 </script>