Kaynağa Gözat

添加直播预约

unknown 4 yıl önce
ebeveyn
işleme
5eefedb2df
3 değiştirilmiş dosya ile 127 ekleme ve 25 silme
  1. 4 1
      config/api.js
  2. 18 6
      iconFont/iconfont.css
  3. 105 18
      pagesGood/liveDetail.vue

+ 4 - 1
config/api.js

@@ -38,7 +38,10 @@ module.exports = {
 	getShortVideo: WX_API_BASE + 'app/liveAndVideo/user/homePage/videoList',
 	//  获取短视商品频详情
 	getShortGoodsDetail: WX_API_BASE + 'app/liveAndVideo/user/homePage/videoProductList/',
-	
+	//  订阅直播
+	subscribeLive: WX_API_BASE + '/app/liveAndVideo/subscribeLive',
+	//查询用户是否订阅该直播
+	isSubscribed: WX_API_BASE + '/app/liveAndVideo/isSubscribed/',
 	
 	//  获取分类
 	getSortList: WX_API_BASE + 'app/productCategory/categoryInitialization',

+ 18 - 6
iconFont/iconfont.css

@@ -1,11 +1,20 @@
+/*@font-face {*/
+  /*font-family: 'iconfont';  /* project id 2119167 */
+ /*src: url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.eot');*/
+ /* src: url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.eot?#iefix') format('embedded-opentype'),*/
+  /*url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.woff2') format('woff2'),*/
+  /*url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.woff') format('woff'),*/
+ /* url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.ttf') format('truetype'),*/
+ /* url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.svg#iconfont') format('svg');*/
+/*}*/
 @font-face {
   font-family: 'iconfont';  /* project id 2119167 */
-  src: url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.eot');
-  src: url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.eot?#iefix') format('embedded-opentype'),
-  url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.woff2') format('woff2'),
-  url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.woff') format('woff'),
-  url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.ttf') format('truetype'),
-  url('https://at.alicdn.com/t/font_2119167_ibmg2t1o6u.svg#iconfont') format('svg');
+  src: url('https://at.alicdn.com/t/font_2119167_43jbldmjpr3.eot');
+  src: url('https://at.alicdn.com/t/font_2119167_43jbldmjpr3.eot?#iefix') format('embedded-opentype'),
+  url('https://at.alicdn.com/t/font_2119167_43jbldmjpr3.woff2') format('woff2'),
+  url('https://at.alicdn.com/t/font_2119167_43jbldmjpr3.woff') format('woff'),
+  url('https://at.alicdn.com/t/font_2119167_43jbldmjpr3.ttf') format('truetype'),
+  url('https://at.alicdn.com/t/font_2119167_43jbldmjpr3.svg#iconfont') format('svg');
 }
 .iconfont {
   font-family: "iconfont" !important;
@@ -187,3 +196,6 @@
   content: "\e645";
 }
 
+.tixingn:before {
+  content: "\e64f";
+}

+ 105 - 18
pagesGood/liveDetail.vue

@@ -5,6 +5,7 @@
 			<image class="top_box_img" :src="head_img" mode="aspectFill"></image>
 			<view class="top_box_text">
 				<text class="text_box_top">{{title}}</text><text class="text_box_bottom" style="display:none">{{user_name}}</text>
+				<view class="tx_btn" @click="subTap()"><text class="iconfont tixingn">{{tixing_str}}</text></view>
 			</view>
 		</view>
 		<view class="popup-open" @click="showGoods()">
@@ -70,7 +71,8 @@
 				title:"888",
 				user_name:'1',
 				head_img:"../static/images/loginLogo.png",
-				liveId: ''
+				liveId: '',
+				tixing_str:'直播提醒'
 			}
 		},
 		onLoad(options) {
@@ -78,6 +80,18 @@
 			this.roomID = options.roomId
 			this.userID = "1323565280579813376"
 			this.liveId = options.liveId
+			NET.request(API.isSubscribed + options.liveId, {}, 'GET').then(res => {
+				if(res.data==false){
+					this.tixing_str="直播提醒"
+				}else{
+					this.tixing_str="取消提醒"
+				}
+			//this.goodsList = res.data
+			}).catch(res => {
+				
+			})
+		},
+		onReady() {
 			// NET.request(API.getLiveGoodsDetail + options.liveId, {}, 'GET').then(res => {
 			// 	this.goodsList = res.data
 			// }).catch(res => {
@@ -86,8 +100,6 @@
 			// 		type: 'warning',
 			// 	})
 			// })
-		},
-		onReady() {
 			let menuButtonObject = wx.getMenuButtonBoundingClientRect();
 			 wx.getSystemInfo({
 			    success: res => {
@@ -113,6 +125,53 @@
 			});
 		},
 		methods: {
+			subTap: function() {
+			    let that = this;
+				if(that.tixing_str=="取消提醒"){
+					var post_data={liveId:that.liveId,mid:uni.getStorageSync("userData").userId}
+					post_data.isDelete=0;
+					NET.request(API.subscribeLive, post_data, 'POST').then(res => {
+						if(that.tixing_str=="取消提醒"){
+							that.tixing_str="直播提醒"
+						}else{
+							that.tixing_str="取消提醒" 
+						}
+					//this.goodsList = res.data
+					}).catch(res => {
+						
+					})
+				}else{
+					wx.requestSubscribeMessage({
+					  tmplIds: ['y0X1cZfbEMg7HdTGN_bW8v7TKeI3M0CHSVTY1zStIXM'],
+					  success(res) {
+						if(res.y0X1cZfbEMg7HdTGN_bW8v7TKeI3M0CHSVTY1zStIXM=="accept"){
+							var post_data={liveId:that.liveId,mid:uni.getStorageSync("userData").userId}
+							if(that.tixing_str=="直播提醒"){
+								post_data.isDelete=1;
+							}else{
+								post_data.isDelete=0;
+							}
+							NET.request(API.subscribeLive, post_data, 'POST').then(res => {
+								if(that.tixing_str=="取消提醒"){
+									that.tixing_str="直播提醒"
+								}else{
+									that.tixing_str="取消提醒" 
+								}
+							//this.goodsList = res.data
+							}).catch(res => {
+								
+							})
+						}else{
+							console.log('444', res);
+						}
+					    //console.log('1111', res);
+					  },
+					  fail(res) {
+					    console.log('2222', res);
+					  }
+					})
+				}
+			  },
 			//  打开弹窗
 			showGoods() {
 				this.$refs.popup.open()
@@ -471,14 +530,17 @@
 			}
 		}
 		.top_box{
-		  width: 304rpx;
-		  height: 86rpx;
-		  position: absolute;
-		  z-index: 100;
-		  background:rgba(0, 0, 0, 0.4);
-		  border-radius: 100px;
-		  top: 182rpx;
-		  left: 30rpx;
+		      width: auto;
+		      height: 86rpx;
+		      position: absolute;
+		      z-index: 100;
+		      background: rgba(0, 0, 0, 0.4);
+		      -webkit-border-radius: 100px;
+		      border-radius: 100px;
+		      top: 182rpx;
+		      left: 30rpx;
+		      padding-right: 10rpx;
+		  
 		}
 		.top_box_img{
 		  width: 86rpx;
@@ -490,21 +552,46 @@
 		  float: left;
 		  color: #fff;
 		  margin-left: 30rpx;
-		  width: 180rpx;
+		  
 		  padding-top: 2rpx;
 		}
 		.text_box_top{
-		  font-size: 34rpx;
-		  width: 100%;
-		  display: block;
-		  height: 30rpx;
-		  float: left;
-		  margin-top: 19rpx;
+		 font-size: 34rpx;
+		     /* width: 100%; */
+		     display: block;
+		     height: 30rpx;
+		     float: left;
+		     margin-top: 19rpx;
+		     display: inline-block;
 		}
 		.text_box_bottom{
 		  font-size: 22rpx;
 		  float: left;
 		  margin-top: 10rpx;
 		}
+		.tx_btn{
+			background: #4fa237;
+			display: inline-block;
+			height: 70rpx;
+			margin-top: 5rpx;
+			border-radius: 60rpx;
+			line-height: 70rpx;
+			padding: 0 30rpx;
+			margin-left: 30rpx;
+		}
+		.tx_btn image{
+			width: 60rpx;
+			height: 60rpx;
+			margin-top: 5rpx;
+			margin-right: 20rpx;
+		}
+		.tixingn{
+			font-size: 34rpx;
+			display: flex;
+		}
+		    
+		.tixingn:before {
+		  font-size: 60rpx;
+		}
 	}
 </style>