dever 4 years ago
parent
commit
4c7d90732b

File diff suppressed because it is too large
+ 16 - 3
lib/community/y-Fab/y-Fab.vue


+ 2 - 1
lib/dever/components/audio.nvue

@@ -198,6 +198,7 @@ export default {
 		start : function()  {
 			this.$emit('update:load', true);
 			if (!this.play) {
+				this.Dever.bgm().stop();
 				this.audio.play();
 				this.play = true;
 				this.playButton = true;
@@ -265,7 +266,7 @@ export default {
 				currentTime = parseInt(currentTime);
 				if (!this.time[currentTime]) {
 					this.time[currentTime] = currentTime;
-					this.$emit('play', 'time', currentTime);
+					this.$emit('play', 'time', [this, currentTime]);
 				}
 			}
 		}

+ 18 - 8
lib/dever/components/seat.vue

@@ -115,6 +115,7 @@
 				hall_index : 0,
 				//手动停止播放
 				setStop : false,
+				source : false,
 				
 			};
 		},
@@ -208,18 +209,25 @@
 			setDisabled : function() {
 				this.$emit('setDisabled', this.fetch.disabled);
 			},
-			tips : function(id, content) {
+			tips : function(id, content, curtime) {
 				var id = '#tips_' + this.type_id + '_' + id;
 				if (this.tipsData[id]) {
 					this.Dever.layer.close(this.tipsData[id]);
 				}
+				var self = this;
 				this.tipsData[id] = this.Dever.layer.tips(content, id, {
 				  tips: [1, '#0FA6D8'],
-				  tipsMore: true
+				  tipsMore: true,
+				  end : function() {
+					  if (self.source && curtime) {
+						  self.source.time[curtime] = false;
+					  }
+				  }
+				  //time : 100000,
 				});
 			},
 			getRefresh : function(cate_id, type, type_id, content) {
-				this.tips(type_id, content);
+				this.tips(type_id, content, this.playtime);
 				if (!this.tipsTimeData[this.playtime]) {
 					this.tipsTimeData[this.playtime] = [];
 				}
@@ -263,11 +271,13 @@
 				this.play = false;
 				this.Dever.layer.closeAll();
 			},
-			time : function(time) {
+			time : function(data) {
+				var time = data[1];
+				this.source = data[0];
 				this.playtime = time;
 				//console.info(time);
 				if (this.tipsTimeData[time]) {
-					this.handle(this.tipsTimeData[time]);
+					this.handle(this.tipsTimeData[time], time);
 				}
 			},
 			// 获取聊天历史数据
@@ -286,14 +296,14 @@
 				this.getData();
 			},
 			//执行聊天泡泡
-			handle : function(items) {
+			handle : function(items, curtime) {
 				if (!this.play) {
 					return;
 				}
 				this.cycle && (clearInterval(this.cycle));
 				var i = 0;
 				var len = items.length;
-				this.tips(items[i]['type_id'], items[i]['content']);
+				this.tips(items[i]['type_id'], items[i]['content'], curtime);
 				i++;
 				this.cycle = setInterval(() => {
 					var time = 5;
@@ -303,7 +313,7 @@
 					if (!this.play) {
 						clearInterval(this.cycle);
 					} else if (i < len) {
-						this.tips(items[i]['type_id'], items[i]['content']);
+						this.tips(items[i]['type_id'], items[i]['content'], curtime);
 						i++;
 					} else {
 						clearInterval(this.cycle);

+ 2 - 1
lib/dever/components/video.nvue

@@ -170,6 +170,7 @@ export default {
 				return;
 			}
 			this.setStart();
+			this.Dever.bgm().stop();
 			this.video.play();
 		},
 		stop : function(state) {
@@ -215,7 +216,7 @@ export default {
 				currentTime = parseInt(currentTime);
 				if (!this.time[currentTime]) {
 					this.time[currentTime] = currentTime;
-					this.$emit('play', 'time', currentTime);
+					this.$emit('play', 'time', [this, currentTime]);
 					//记录播放进度
 					this.Dever.data('video_' + this.vid, this.currentTime);
 				}

+ 1 - 1
lib/dever/config.js

@@ -11,7 +11,7 @@ const im = {
 const request = {
 	//	服务器接口地址
 	host: "https://he.shemic.com/",
-	//host: "http://dev.shemic.com/dreamland/",
+	host: "http://dev.shemic.com/dreamland/",
 	
 	//	请求的参数	
 	data: {},

+ 88 - 2
lib/dever/index.js

@@ -30,7 +30,7 @@ var http = {
 		var self = this;
 		if (vue == 'post') {
 			config.request.method = 'POST';
-			//config.request.method = 'GET';
+			config.request.method = 'GET';
 			vue = false;
 		} else {
 			config.request.method = 'GET';
@@ -751,7 +751,87 @@ var share =
 		var url = this.url + 'collect?callback=?' + '&project='+project+'&url=' + url + '&actType=' + actType + '&actResult=' + actResult + '&ua=' + ua + '&token=' + token + '&type=' + wechat
 		http.request('post', url, {noloading:1});
     }
-}
+}
+
+var bgm = {
+	show : false,
+	playing : false,
+	manager : false,
+	control : false,
+	dever : false,
+	vue : false,
+	
+	init : function(vue, music, title, signer, pic, autoplay) {
+		this.vue = vue;
+		this.vue.bgm = {
+			show : false,
+			playing : false,
+		};
+		if (music) {
+			this.show = true;
+			this.vue.bgm.show = true;
+			if (this.dever.source == 'h5') {
+				this.manager = uni.createInnerAudioContext()
+				this.manager.src = music;
+				this.manager.obeyMuteSwitch = false;
+				this.manager.loop = true;
+			} else {
+				this.manager = uni.getBackgroundAudioManager()
+				this.manager.title = title;
+				this.manager.singer = signer;
+				this.manager.coverImgUrl = pic;
+				this.manager.src = music;
+				this.manager.loop = true;
+			}
+			
+			if (autoplay == 1) {
+				if (this.dever.source == 'h5') {
+					this.manager.autoplay = true;
+					this.start();
+				} else {
+					this.start();
+				}
+			} else {
+				this.stop();
+			}
+		} else {
+			this.show = false;
+			this.vue.bgm.show = false;
+		}
+	},
+	
+	control : function() {
+		if (this.playing) {
+			this.stop();
+		} else {
+			this.start();
+		}
+	},
+	
+	start : function() {
+		if (this.manager) {
+			if (this.vue.control) {
+				var i = 0;
+				for (i in this.vue.control) {
+					if (this.vue.control[i].load) {
+						this.vue.control[i].stop();
+					}
+				}
+			}
+			this.manager.play();
+			this.playing = true;
+			this.vue.bgm.playing = true;
+		}
+	},
+	
+	stop : function() {
+		if (this.manager) {
+			this.manager.pause();
+			this.playing = false;
+			this.vue.bgm.playing = false;
+		}
+	}
+};
 
 var dever = {
 	login : 'user/login',
@@ -1854,6 +1934,12 @@ var dever = {
 				}
 			}
 		})
+	},
+	
+	//bgm
+	bgm : function() {
+		bgm.dever = this;
+		return bgm;
 	}
 }
 

File diff suppressed because it is too large
+ 42 - 61
pages/dream/view.vue


File diff suppressed because it is too large
+ 0 - 0
static/layer/layer.js


Some files were not shown because too many files changed in this diff