zhengkaixin 1 år sedan
förälder
incheckning
1ba692d66e

+ 3 - 3
.env.dev.js

@@ -4,7 +4,7 @@ const UNI_APP = {
 	//
 	//BASE_URL: 'https://charging.xiaoxinda.com/charging-station-test/',
 
-	BASE_URL: 'http://192.168.77.162:8081/charging-station/' ,
+	//BASE_URL: 'http://192.168.77.162:8081/charging-station/' ,
 	//PARK_URL: 'http://192.168.11.120:8082/charging-parking/' ,
 	PARK_URL: 'https://51team.xiaoxinda.com/charging-parking/' ,
 	XPGJ_URL: 'https://xpgjapi.xiaoxinda.com/' ,
@@ -16,13 +16,13 @@ const UNI_APP = {
 	openId:"zkxtest23",//zkx
 	
 	openId:"oK9Wr54VbEh3xvWYmD_zT5NbH4AY",//zkx
-	//openId:"oK9Wr59rru-i3bm7dtTtxnkR-i4s",//杨所
+	openId:"oK9Wr59rru-i3bm7dtTtxnkR-i4s",//杨所
 	//openId:"oK9Wr56vX9nP_B56_Pyigg5n5Ce8",//
 	//openId:"oK9Wr5_2USr1yP4MRew9KbJA0-ng",//老板
 	//openId:"oK9Wr5-ViXQMUP2cjiW3bGIABj1Q",
 	//openId:"oK9Wr5wkU3OwWhQ7mRrLZ5MDZNHo",
 	//openId:"oK9Wr53qHzp7kOSiue_PYjwEqivM",
-	openId:"oK9Wr55J1J1eL6BqI2tW749NTxNU",//zq
+	//openId:"oK9Wr55J1J1eL6BqI2tW749NTxNU",//zq
 	//openId:"oK9Wr50iQUjEAam1s_RpHpXJS5xg",//月卡用户
 	//openId:"oK9Wr5zv8lvirni3txbxRkmpg8d0",//sz
 	//小鹏管家appid

+ 284 - 0
components/u-column-notice/u-column-notice.vue

@@ -0,0 +1,284 @@
+<template>
+	<view
+		class="u-notice-bar"
+		:style="{
+			background: computeBgColor,
+			padding: padding
+		}"
+		:class="[
+			type ? `u-type-${type}-light-bg` : ''
+		]"
+	>
+		<view class="u-icon-wrap">
+			<u-icon class="u-left-icon" v-if="volumeIcon" name="volume-fill" :size="volumeSize" :color="computeColor"></u-icon>
+		</view>
+		
+		<swiper  ref="swiperRef"  @change="change" 
+		 :vertical="true" :current="current2"
+		  circular  class="u-swiper">
+			<swiper-item v-for="(item, index) in list" :key="index" class="u-swiper-item">
+				<view
+					class="u-news-item u-line-1"
+					:style="[textStyle]"
+					@tap="click(index)"
+					:class="['u-type-' + type]"
+				>
+					<ujp-row-notice
+						:type="type"
+						:color="color"
+						:bgColor="bgColor"
+						:list="[item]"
+						:volumeIcon="volumeIcon"
+						:moreIcon="moreIcon"
+						:volumeSize="volumeSize"
+						:closeIcon="closeIcon"
+						:mode="mode"
+						:fontSize="fontSize"
+						:speed="speed"
+						:playState="current2==index?'play':'playState'"
+						:an="an"
+						:padding="padding"
+						@getMore="getMore"
+						@close="close"
+						@click="click"
+						@getAnimationend="getAnimationend(index)"
+					></ujp-row-notice>
+				</view>
+			</swiper-item>
+		</swiper>
+		<view class="u-icon-wrap">
+			<u-icon @click="getMore" class="u-right-icon" v-if="moreIcon" name="arrow-right" :size="26" :color="computeColor"></u-icon>
+			<u-icon @click="close" class="u-right-icon" v-if="closeIcon" name="close" :size="24" :color="computeColor"></u-icon>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	props: {
+		// 显示的内容,数组
+		list: {
+			type: Array,
+			default() {
+				return [];
+			}
+		},
+		// 显示的主题,success|error|primary|info|warning
+		type: {
+			type: String,
+			default: 'warning'
+		},
+		// 是否显示左侧的音量图标
+		volumeIcon: {
+			type: Boolean,
+			default: true
+		},
+		// 是否显示右侧的右箭头图标
+		moreIcon: {
+			type: Boolean,
+			default: false
+		},
+		// 是否显示右侧的关闭图标
+		closeIcon: {
+			type: Boolean,
+			default: false
+		},
+		// 是否自动播放
+		autoplay: {
+			type: Boolean,
+			default: true
+		},
+		// 文字颜色,各图标也会使用文字颜色
+		color: {
+			type: String,
+			default: ''
+		},
+		// 背景颜色
+		bgColor: {
+			type: String,
+			default: ''
+		},
+		// 滚动方向,row-水平滚动,column-垂直滚动
+		direction: {
+			type: String,
+			default: 'row'
+		},
+		// 是否显示
+		show: {
+			type: Boolean,
+			default: true
+		},
+		// 字体大小,单位rpx
+		fontSize: {
+			type: [Number, String],
+			default: 26
+		},
+		// 滚动一个周期的时间长,单位ms
+		duration: {
+			type: [Number, String],
+			default: 2000
+		},
+		// 音量喇叭的大小
+		volumeSize: {
+			type: [Number, String],
+			default: 34
+		},
+		// 水平滚动时的滚动速度,即每秒滚动多少rpx,这有利于控制文字无论多少时,都能有一个恒定的速度
+		speed: {
+			type: Number,
+			default: 160
+		},
+		// 水平滚动时,是否采用衔接形式滚动
+		isCircular: {
+			type: Boolean,
+			default: true
+		},
+		// 滚动方向,horizontal-水平滚动,vertical-垂直滚动
+		mode: {
+			type: String,
+			default: 'horizontal'
+		},
+		// 播放状态,play-播放,paused-暂停
+		playState: {
+			type: String,
+			default: 'play'
+		},
+		// 是否禁止用手滑动切换
+		// 目前HX2.6.11,只支持App 2.5.5+、H5 2.5.5+、支付宝小程序、字节跳动小程序
+		disableTouch: {
+			type: Boolean,
+			default: true
+		},
+		// 通知的边距
+		padding: {
+			type: [Number, String],
+			default: '18rpx 24rpx'
+		}
+	},
+	computed: {
+		// 计算字体颜色,如果没有自定义的,就用uview主题颜色
+		computeColor() {
+			if (this.color) return this.color;
+			// 如果是无主题,就默认使用content-color
+			else if(this.type == 'none') return '#606266';
+			else return this.type;
+		},
+		// 文字内容的样式
+		textStyle() {
+			let style = {};
+			if (this.color) style.color = this.color;
+			else if(this.type == 'none') style.color = '#606266';
+			style.fontSize = this.fontSize + 'rpx';
+			return style;
+		},
+		// 垂直或者水平滚动
+		vertical() {
+			if(this.mode == 'horizontal') return false;
+			else return true;
+		},
+		// 计算背景颜色
+		computeBgColor() {
+			if (this.bgColor) return this.bgColor;
+			else if(this.type == 'none') return 'transparent';
+		}
+	},
+	data() {
+		return {
+			an:true,
+			current2:0
+			// animation: false
+		};
+	},
+	methods: {
+		getAnimationend(index){
+			
+			if(index==this.current2){
+				
+				console.log("getAnimationend")
+				var c=this.current2+1;
+				if(c==this.list.length){
+					this.current2=0
+				}else{
+					this.current2=c
+				}
+				//this.$forceUpdate()
+				this.an=false,
+				setTimeout(()=>{
+					this.an=true
+				},10)
+				
+				console.log(this.current2)
+			}
+			
+		},
+		// 点击通告栏
+		click(index) {
+			this.$emit('click', index);
+		},
+		// 点击关闭按钮
+		close() {
+			this.$emit('close');
+		},
+		// 点击更多箭头按钮
+		getMore() {
+			this.$emit('getMore');
+		},
+		change(e) {
+			let index = e.detail.current;
+			if(index == this.list.length - 1) {
+				this.$emit('end');
+			}
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+
+.u-notice-bar {
+	width: 100%;
+
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	flex-wrap: nowrap;
+	padding: 18rpx 24rpx;
+	overflow: hidden;
+}
+
+.u-swiper {
+	font-size: 26rpx;
+	height: 32rpx;
+	
+	display: flex;
+	align-items: center;
+	flex: 1;
+	margin-left: 12rpx;
+}
+
+.u-swiper-item {
+	
+	display: flex;
+	align-items: center;
+	overflow: hidden;
+}
+
+.u-news-item {
+	overflow: hidden;
+}
+
+.u-right-icon {
+	margin-left: 12rpx;
+	/* #ifndef APP-NVUE */
+	display: inline-flex;		
+	/* #endif */
+	align-items: center;
+}
+
+.u-left-icon {
+	/* #ifndef APP-NVUE */
+	display: inline-flex;		
+	/* #endif */
+	align-items: center;
+}
+</style>

+ 7 - 24
components/u-notice-bar/u-notice-bar.vue

@@ -2,28 +2,9 @@
 	<view class="u-notice-bar-wrap" v-if="isShow" :style="{
 		borderRadius: borderRadius + 'rpx',
 	}">
-		<block v-if="mode == 'horizontal' && isCircular">
-			<ujp-row-notice
-				:type="type"
-				:color="color"
-				:bgColor="bgColor"
-				:list="list"
-				:volumeIcon="volumeIcon"
-				:moreIcon="moreIcon"
-				:volumeSize="volumeSize"
-				:closeIcon="closeIcon"
-				:mode="mode"
-				:fontSize="fontSize"
-				:speed="speed"
-				:playState="playState"
-				:padding="padding"
-				@getMore="getMore"
-				@close="close"
-				@click="click"
-			></ujp-row-notice>
-		</block>
-		<block v-if="mode == 'vertical' || (mode == 'horizontal' && !isCircular)">
-			<u-column-notice
+		 
+		<block >
+			<ujp-column-notice
 				:type="type"
 				:color="color"
 				:bgColor="bgColor"
@@ -42,7 +23,9 @@
 				@close="close"
 				@click="click"
 				@end="end"
-			></u-column-notice>
+			>
+				
+			</ujp-column-notice>
 		</block>
 	</view>
 </template>
@@ -116,7 +99,7 @@ export default {
 		// 是否自动播放
 		autoplay: {
 			type: Boolean,
-			default: true
+			default: false
 		},
 		// 文字颜色,各图标也会使用文字颜色
 		color: {

+ 19 - 6
components/u-row-notice/u-row-notice.vue

@@ -14,16 +14,19 @@
 		]"
 	>
 		<view class="u-direction-row">
-			<view class="u-icon-wrap">
-				<u-icon class="u-left-icon" v-if="volumeIcon" name="volume-fill" :size="volumeSize" :color="computeColor"></u-icon>
-			</view>
+			
 			<view class="u-notice-box" id="u-notice-box">
 				<view
-					class="u-notice-content"
+					:class="{
+						'u-notice-content':an
+					}"
 					id="u-notice-content"
+					@animationend="getAnimationend"
 					:style="{
+						 
 						animationDuration: animationDuration,
 						animationPlayState: animationPlayState,
+						animationIterationCount:1,
 					}"
 				>
 					<text class="u-notice-text" @tap="click" :style="[textStyle]"
@@ -41,6 +44,10 @@
 <script>
 export default {
 	props: {
+		an: {
+			type: Boolean,
+			default: true
+		},
 		// 滚动通知设置圆角
 		borderRadius: {
 			type: [Number, String],
@@ -157,7 +164,10 @@ export default {
 		},
 		// 文字内容的样式
 		textStyle() {
-			let style = {};
+			let style = {
+				 
+			};
+			//style.width="700rpx"
 			if (this.color) style.color = this.color;
 			else if(this.type == 'none') style.color = '#606266';
 			style.fontSize = this.fontSize + 'rpx';
@@ -212,6 +222,9 @@ export default {
 		// 点击更多箭头按钮
 		getMore() {
 			this.$emit('getMore');
+		},getAnimationend(){
+			console.log(this.playState)
+			this.$emit('getAnimationend');
 		}
 	}
 };
@@ -253,7 +266,7 @@ export default {
 }
 
 .u-notice-content {
-	animation: u-loop-animation 10s linear infinite both;
+	animation:u-loop-animation 10s linear  both;
 	text-align: right;
 	// 这一句很重要,为了能让滚动左右连接起来
 	padding-left: 100%;

+ 31 - 9
pages/index/index.vue

@@ -7,14 +7,14 @@
 		<!-- 头部图片 -->
 		<view class="background">
 			<!-- 新闻 -->
-			
+
 			<view class=" options-item" v-show="flag&&newsList.length > 0" >
-				
 			
-						<u-notice-bar  v-if=""
-						@click="toNewsArticleDetails" :mode="newsList.length==1?'horizontal':'vertical'"
+			<!-- ////@click="toNewsArticleDetails" -->
+						<ujp-notice-bar
+						@click="toNewsArticleDetails"
 						 color="#FF3D00" bg-color="#fff"
-						 :list="newsList"></u-notice-bar>
+						 :list="newsList"></ujp-notice-bar>
 						 
 					
 			
@@ -659,10 +659,10 @@
 
 				
 					 
-					 <u-notice-bar  v-if=""
-					 @click="toNewsArticleDetails" :mode="newsList.length==1?'horizontal':'vertical'"
+					 <ujp-notice-bar 
+					 @click="toNewsArticleDetails"
 					  color="#FF3D00" bg-color="#fff"
-					  :list="newsList"></u-notice-bar>
+					  :list="newsList"></ujp-notice-bar>
 
 		</view>
 		<view class="news-title"  >
@@ -2977,5 +2977,27 @@
 				    right: 0;
 				    top: 0;
 				    z-index: 991;
-	}
+	}
+	
+	
+	.news-text {  
+	  width: 100%;  
+	  white-space: nowrap;  
+	  overflow: hidden;  
+	  text-overflow: ellipsis;  
+	}  
+	  
+	.rotate-animation {  
+	  animation: rotate 3s linear infinite;  
+	}  
+	  
+	@keyframes rotate {  
+	  from {  
+	    transform: rotate(0deg);  
+	  }  
+	  to {  
+	    transform: rotate(360deg);  
+	  }  
+	}
+	
 </style>