yuanyiming 1 år sedan
förälder
incheckning
5920795b4c
2 ändrade filer med 58 tillägg och 34 borttagningar
  1. 19 5
      components/listBlock1/listBlock1.vue
  2. 39 29
      pages/mineCollect/mineCollect.vue

+ 19 - 5
components/listBlock1/listBlock1.vue

@@ -29,7 +29,7 @@
 							</view>
 							<text class="fz-font">收藏</text>
 						</view>
-						<view class="opr" @click="sub" :data-e="i">
+						<view class="opr" @click="subaaa" :data-e="i">
 							<view class="icon">
 								<image :src="subArr.includes(i.acId) ? pic_sub2 : pic_sub "
 									style="width: 22rpx; height: 26rpx" mode="aspectFill"></image>
@@ -143,7 +143,8 @@
 			},
 			
 			// 订阅事件
-			sub(event){
+			subaaa(event){
+				console.log('sub',111111111);
 				console.log(this.$store.state.user.openid);
 				let aId=event.currentTarget.dataset.e.acId
 				// 先获取用户订阅信息
@@ -234,8 +235,13 @@
 					oid:this.$store.state.user.openid, //用户id
 				}
 				this.$request('/selectColl','POST',data).then(res=>{
-					this.collArr=JSON.parse(res[0][0].coll)
-					console.log('进来就显示',this.collArr);
+					let a=JSON.parse(res[0][0].coll)
+					if(a==null || a=='undefined'){
+						this.collArr=[]
+					}else{
+						this.collArr=JSON.parse(res[0][0].coll)
+					}
+					console.log('进来就显示111111',this.collArr);
 				})
 			},
 			getSub(){
@@ -243,7 +249,15 @@
 					oid:this.$store.state.user.openid, //用户id
 				}
 				this.$request('/selectSub','POST',data).then(res=>{
-					this.subArr=JSON.parse(res[0][0].sub)
+					console.log('呵呵呵',res[0][0].sub);
+					let a=JSON.parse(res[0][0].sub)
+					if(a==null || a=='undefined'){
+						this.sub=[]
+					}else{
+						this.subArr=JSON.parse(res[0][0].sub)
+					}
+					
+					// this.subArr=JSON.parse(res[0][0].sub)
 					console.log('进来就显示',this.subArr);
 				})
 			}

+ 39 - 29
pages/mineCollect/mineCollect.vue

@@ -4,26 +4,27 @@
 
 		<view class="collectBox">
 			<view class="collect_length">
-				<span>共{{ collArr.length }}条收藏</span>
+				<text>共{{ collArr.length }}条收藏</text>
 			</view>
 			<!-- <view class="classBox" @click="gotoWeb(index)" v-for="(item,index) in classList" :key="index"> -->
-			<view class="classBox"  v-for="(item,index) in classList" :key="index">
+			<view class="classBox" v-for="(item,index) in classList" :key="index">
 				<view class="classTitle">
-					<span>{{ item.acName }}</span>
-					<image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/Collect_yellow.png" mode="aspectFill" @click="coll" :data-e="item"></image>
+					<text>{{ item.acName }}</text>
+					<image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/Collect_yellow.png"
+						mode="aspectFill" @click="coll" :data-e="item"></image>
 					<!-- <image :src="collArr.includes(item.acId) ? pic2 : '' " style="width: 28rpx; height: 26rpx" mode="aspectFill"  @click="coll" :data-e="item"></image> -->
 
 				</view>
 				<view class="classContent">
 					<view class="contentLeft">
 						<view class="constDate">
-							<span class="manage">类型</span>
-							<span>|</span>
-							<span class="c_data">{{item.Crdate}}</span>
-							<!-- <span class="c_time">21:07</span> -->
+							<text class="manage">类型</text>
+							<text>|</text>
+							<text class="c_data">{{item.Crdate}}</text>
+							<!-- <text class="c_time">21:07</text> -->
 						</view>
 						<view class="classIntro">
-							<span>{{ item.brief }}</span>
+							<text>{{ item.brief }}</text>
 						</view>
 					</view>
 					<view class="contentRight">
@@ -55,45 +56,48 @@
 				this.$request('/selectColl', 'POST', data).then(res => {
 					this.collArr = JSON.parse(res[0][0].coll)
 					// let a=this.collArr.join(', ');
-					// return console.log({a});
+					// console.log( '不行吗',this.collArr);
 					let data = {
 						oid: this.$store.state.user.openid, //用户id
 						list: this.collArr
 					}
 					// return console.log(data);
 					this.$request('/selectCollList', 'POST', data).then(res => {
-						console.log(res);
+						console.log('enenenen?',res[0]);
 						// this.collArr=res[0]
 						this.classList = res[0]
 					})
 				})
 			},
 			// 这里获取的活动肯定是已收藏的,就不用判断直接删除就可以了
-			coll(event){
-				console.log(this.$store.state.user.openid);
-				let aId=event.currentTarget.dataset.e.acId
+			coll(event) {
+				// console.log(this.$store.state.user.openid);
+				let aId = event.currentTarget.dataset.e.acId
 				// 先获取用户收藏信息
-				let data={
-					oid:this.$store.state.user.openid, //用户id
+				let data = {
+					oid: this.$store.state.user.openid, //用户id
 				}
-				
-				this.$request('/selectColl','POST',data).then(res=>{
-					
-					let colls=JSON.parse(res[0][0].coll)
-					
+
+				this.$request('/selectColl', 'POST', data).then(res => {
+
+					let colls = JSON.parse(res[0][0].coll)
+					console.log('取消不了?',colls);
 					// 把未取消收藏的数据提取出来
+					console.log('aid',aId);
 					const newArray = colls.filter(item => item !== aId);
-					let arr3={
-						oid:this.$store.state.user.openid, //用户id
-						acid:JSON.stringify(newArray) 
+					
+					console.log('新',newArray);
+					let arr3 = {
+						oid: this.$store.state.user.openid, //用户id
+						acid: JSON.stringify(newArray)
 					}
-					this.$request('/updateColl','POST',arr3).then(res=>{
+					this.$request('/updateColl', 'POST', arr3).then(res => {
 						// 删除后重新获取数据进行渲染
 						this.getData()
 					})
 				})
 			},
-			
+
 		},
 		onShow() {
 			this.getData()
@@ -133,9 +137,15 @@
 				justify-content: space-between;
 				margin-bottom: 6px;
 
-				span {
+				text {
 					font-size: 32rpx;
 					font-weight: 500;
+					display: -webkit-box;
+					word-break: break-all;
+					text-overflow: ellipsis;
+					overflow: hidden;
+					-webkit-box-orient: vertical;
+					-webkit-line-clamp: 1;
 				}
 
 				image {
@@ -157,7 +167,7 @@
 						display: flex;
 						margin-bottom: 6px;
 
-						span {
+						text {
 							color: #00000066;
 							font-size: 24rpx;
 							font-weight: 400;
@@ -195,7 +205,7 @@
 					.classIntro {
 						width: 93%;
 
-						span {
+						text {
 							color: #00000099;
 							font-size: 28rpx;
 							display: -webkit-box;