yuanyiming 1 ano atrás
pai
commit
fcd0614730

+ 30 - 12
components/listBlock1/listBlock1.vue

@@ -1,7 +1,6 @@
 <template>
 	<view class="">
 
-		<msgPop :itemlist="animationDataArr"></msgPop>
 		<view class="listBlock1" v-for="(i,index) in classList" :key="index" @click="gotoDetail" :data-aid="i.acId">
 			<view class="img cell-img">
 				<image :src="i.pic" mode="aspectFill"></image>
@@ -56,6 +55,9 @@
 <script>
 	export default {
 		name: "listBlock1",
+		// computed: {
+		//     ...mapState(['msgpop']) // 将 Vuex 中的 items 映射为组件的计算属性
+		// },
 		props: {
 			classList: {
 				type: Array,
@@ -75,10 +77,11 @@
 			return {
 				// 收藏list
 				collArr: [],
-
+				// 节流阀
+				stopTimer:0,
 
 				timer: null,
-				animationDataArr: [],
+				// animationDataArr: [],
 
 				// 收藏悬浮窗
 				collpopulShow: false,
@@ -94,9 +97,7 @@
 		},
 		onShow() {},
 
-		onUnload() {
-			this.timer.clear()
-		},
+
 		methods: {
 			// 收藏事件
 			coll(event) {
@@ -110,6 +111,16 @@
 					return
 				}
 
+				if (this.stopTimer) return uni.showToast({
+					icon: 'none',
+					title: '点击过快'
+				})
+				this.stopTimer = 1
+				
+				setTimeout(()=>{
+					this.stopTimer=0
+				},500)
+
 				// return	console.log(event);
 				let aId = event.currentTarget.dataset.e.acId
 
@@ -130,7 +141,10 @@
 
 					// iscoll为true表示已经收藏过,执行删除  为true则收藏
 					if (iscoll) {
-						this.animationDataArr.push({
+						// this.animationDataArr.push({
+						// 	collAoff: 0
+						// })
+						this.$store.dispatch('asyncUpdatemsg', {
 							collAoff: 0
 						})
 						// this.praiseMe()
@@ -138,21 +152,25 @@
 						this.$request('/deleteOperator', 'POST', data).then(res => {
 							this.getdata()
 							setTimeout(() => {
-								this.animationDataArr.shift()
-								console.log(this.animationDataArr);
+								this.$store.dispatch('asyncDelMsg')
 							}, 1500)
 						})
 					} else {
 
-						this.animationDataArr.push({
+						// this.animationDataArr.push({
+						// 	collAoff: 1
+						// })
+						// console.log('msgpop',this.$store.state.msgpop);
+						this.$store.dispatch('asyncUpdatemsg', {
 							collAoff: 1
 						})
+						// let aaa={collAoff: 1}
 						console.log('执行添加');
 						this.$request('/insertOperator', 'POST', data).then(res => {
 							this.getdata()
+							// console.log(this.h);
 							setTimeout(() => {
-								this.animationDataArr.shift()
-								// console.log(this.animationDataArr);
+								this.$store.dispatch('asyncDelMsg')
 							}, 1500)
 						})
 					}

+ 33 - 23
components/msgPop/msgPop.vue

@@ -1,30 +1,35 @@
 <template>
 	<view class="">
-			<view class="collpopul" @tap.stop v-for="(i,index) in itemlist" :key="index">
-				<view class="contxt">
-					<image src="../../static/mine/Collect_yellow.png" mode="aspectFill" style="width: 30rpx;height: 30rpx;">
-					</image>
-					{{i.collAoff?'收藏成功':'已取消'}}
-					<!-- 收藏成功 -->
+		<view class="collpopul" v-for="(i,index) in msgpop" :key="index">
+			<view class="contxt">
+				<image src="../../static/mine/Collect_yellow.png" mode="aspectFill" style="width: 30rpx;height: 30rpx;">
+				</image>
+				{{i.collAoff?'收藏成功':'已取消'}}
+				<!-- 收藏成功 -->
+			</view>
+			<!-- <view class="goMore" @click="goMore"> -->
+			<view class="goMore" @click="goMore" v-if="i.collAoff">
+				<view class="">
+					去看看
 				</view>
-				<!-- <view class="goMore" @click="goMore"> -->
-				<view class="goMore" @click="goMore" v-if="i.collAoff">
-					<view class="">
-						去看看
-					</view>
-					<view class="" style="display: flex;height: 100%;justify-content: center;align-items: center;">
-						<image src="../../static/yyyou.png" mode="aspectFill" style="width: 30rpx;height: 32rpx;">
-						</image>
-					</view>
-					
+				<view class="" style="display: flex;height: 100%;justify-content: center;align-items: center;">
+					<image src="../../static/yyyou.png" mode="aspectFill" style="width: 30rpx;height: 32rpx;">
+					</image>
 				</view>
+
 			</view>
+		</view>
 	</view>
 </template>
 
 <script>
 	export default {
 		name: "msgPop",
+		computed: {
+			msgpop() {
+			      return this.$store.state.msgpop; // 直接访问 Vuex 中的状态数据
+			}
+		},
 		props: {
 			itemlist: {
 				type: Array,
@@ -32,18 +37,23 @@
 					return []
 				}
 			},
-			goNum:{
-				type:Number,
-				default(){
+			// 0 活动 1课程
+			goNum: {
+				type: Number,
+				default () {
 					return 0
 				}
 			}
 		},
-		data(){
-			return{
-			}
+		data() {
+			return {}
 		},
 		methods: {
+			// 删除
+			delData() {
+				this.itemlist.shift()
+			},
+
 			// 跳转收藏页面
 			goMore() {
 				uni.navigateTo({
@@ -55,12 +65,12 @@
 </script>
 
 <style lang="scss">
-	
 	.collpopul {
 		position: fixed;
 		padding: 0 30rpx;
 		background-color: #fff;
 		top: 15%;
+		box-shadow: 0rpx 10rpx 10rpx 5rpx rgba(0, 0, 0, .1);
 		// bottom: 10%;
 		z-index: 100;
 		width: 650rpx;

+ 52 - 27
components/teaching-case/teaching-case.vue

@@ -1,14 +1,12 @@
 <template>
 	<view class="teaching_case">
-		<msgPop :itemlist="animationDataArr" :goNum="1"></msgPop>
-		
-		<view class="cont" @click="gotoWeb" v-for="(item, index) in acList" :key="index"
-			:data-kid="item.href">
-			<image class="star" :src="collArr.includes(item.cid) ? pic_coll2 : pic_coll " @click.stop="coll" :data-e="item"
-				mode="aspectFill"></image>
+
+		<view class="cont" @click="gotoWeb" v-for="(item, index) in acList" :key="index" :data-kid="item.href">
+			<image class="star" :src="collArr.includes(item.cid) ? pic_coll2 : pic_coll " @click.stop="coll"
+				:data-e="item" mode="aspectFill"></image>
 			<image class="img" :src="item.img" mode="aspectFill" />
 			<view class="tit btn-font">{{ item.ctit }}</view>
-			<view class="teacher fz-font">{{ item.school }}</view>
+			<!-- <view class="teacher fz-font">{{ item.school }}</view> -->
 			<view class="mon" v-if="indexId">
 				¥<text class="cost"></text>
 			</view>
@@ -36,7 +34,10 @@
 			return {
 				// 收藏列表
 				collArr: [],
-				
+
+				// 节流阀
+				stopTimer: 0,
+
 				timer: null,
 				animationDataArr: [],
 				// 收藏星星
@@ -48,12 +49,25 @@
 			// 收藏事件
 			coll(event) {
 				const value = this.$store.state.user.openid;
-				if(!value){
-					uni.showToast({title: '未登录,请登录',icon: 'none'})
-					setTimeout(this.goLog,1000)
+				if (!value) {
+					uni.showToast({
+						title: '未登录,请登录',
+						icon: 'none'
+					})
+					setTimeout(this.goLog, 1000)
 					return
 				}
+
+				if (this.stopTimer) return uni.showToast({
+					icon: 'none',
+					title: '点击过快'
+				})
+				this.stopTimer = 1
 				
+				setTimeout(()=>{
+					this.stopTimer=0
+				},500)
+
 				// return	console.log(event);
 				let cId = event.currentTarget.dataset.e.cid
 
@@ -75,27 +89,35 @@
 					// iscoll为true表示已经收藏过,执行删除  为true则收藏
 					if (iscoll) {
 						console.log('执行删除');
-						this.animationDataArr.push({
+						// this.animationDataArr.push({
+						// 	collAoff: 0
+						// })
+						this.$store.dispatch('asyncUpdatemsg', {
 							collAoff: 0
 						})
 						this.$request('/deleteOperator', 'POST', data).then(res => {
 							this.getdata()
-							setTimeout(()=>{
-								this.animationDataArr.shift()
-								console.log(this.animationDataArr);
-							},1500)
+							setTimeout(() => {
+								// this.animationDataArr.shift()
+								// console.log(this.animationDataArr);
+								this.$store.dispatch('asyncDelMsg')
+							}, 1500)
 						})
 					} else {
 						console.log('执行添加');
-						this.animationDataArr.push({
+						// this.animationDataArr.push({
+						// 	collAoff: 1
+						// })
+						this.$store.dispatch('asyncUpdatemsg', {
 							collAoff: 1
 						})
 						this.$request('/insertOperator', 'POST', data).then(res => {
 							this.getdata()
-							setTimeout(()=>{
-								this.animationDataArr.shift()
+							setTimeout(() => {
+								// this.animationDataArr.shift()
+								this.$store.dispatch('asyncDelMsg')
 								// console.log(this.animationDataArr);
-							},1500)
+							}, 1500)
 						})
 					}
 				})
@@ -111,12 +133,15 @@
 			// 查看课程内容
 			gotoWeb(e) {
 				const value = this.$store.state.user.openid;
-				if(!value){
-					uni.showToast({title: '未登录,请登录',icon: 'none'})
-					setTimeout(this.goLog,1000)
+				if (!value) {
+					uni.showToast({
+						title: '未登录,请登录',
+						icon: 'none'
+					})
+					setTimeout(this.goLog, 1000)
 					return
 				}
-				
+
 				// return console.log('aaaaaa', e.currentTarget.dataset);
 				let acid = e.currentTarget.dataset.kid
 				uni.navigateTo({
@@ -127,9 +152,9 @@
 			// 获取课程收藏事件
 			getdata() {
 				const value = this.$store.state.user.openid;
-				if(!value) return this.collArr = []
-				
-				
+				if (!value) return this.collArr = []
+
+
 				// 触发收藏事件
 				// console.log('触发收藏事件');
 				let data = {

+ 46 - 11
pages/activityDetailNew/activityDetailNew.vue

@@ -2,7 +2,9 @@
 	<!-- 教研室详情 -->
 	<view class="activityDetailNew">
 		<statusBar :item="navbar"></statusBar>
-
+		<!-- 消息提示 -->
+		<msgPop></msgPop>
+		
 		<view class="top">
 			<image class="img1" src="https://teacherapi.cocorobo.cn/teaching-file/static/yym/Rectangle25.png"
 				mode="widthFix">
@@ -60,8 +62,14 @@
 				<view class="britit">
 					活动介绍
 				</view>
-				<view class="bricon">
-					{{actItemList.brief}}<text style="color: blue;" @click="gotoLink" :data-link="actItemList.link">查看详情</text>
+				<view class="bricon" >
+					{{actItemList.brief}}
+					<view style="color: blue;display: inline-block;" :data-link="actItemList.link"  @click="gotoLink">
+						<!-- 查看更多 -->
+						<!-- <uni-icons type="forward" size="17"  color="blue"></uni-icons> -->
+						<u-icon name="arrow-right" labelSize='14' size='14' labelColor='blue' space='2' color='blue' labelPos='left' label='查看更多'></u-icon>
+					</view>
+					<!-- <u-icon name="arrow-right" label='查看更多'></u-icon> -->
 				</view>
 				<image class="briImg" :src="actItemList.pic" mode="widthFix"></image>
 			</view>
@@ -84,7 +92,8 @@
 						<image class="icoimg" style="height: 70%;width: 65%;" src="../../static/union.png"
 							mode="aspectFill"></image>
 					</view>
-					<button open-type="share" style="background-color: aquamarine;opacity: 0; position: absolute;left: 0;width: 100%;height: 100%;"></button>
+					<button open-type="share"
+						style="background-color: aquamarine;opacity: 0; position: absolute;left: 0;width: 100%;height: 100%;"></button>
 					<text class="icotxt">分享</text>
 				</view>
 			</view>
@@ -142,6 +151,9 @@
 
 				// 用户订阅列表
 				// subArr: [],
+				
+				// 收藏按钮节流
+				stopTimer:0,
 
 				//控制弹窗
 				showPopup: false,
@@ -155,7 +167,7 @@
 				// pic_sub2: 'https://teacherapi.cocorobo.cn/teaching-file/static/dingyue_blue.png',
 			};
 		},
-		onShareAppMessage(){
+		onShareAppMessage() {
 			uni.share({
 				provider: "weixin",
 				scene: "WXSceneSession",
@@ -169,24 +181,27 @@
 				}
 			});
 		},
+		onUnload() {
+			this.$store.dispatch('asyncDelAll')
+		},
 		methods: {
 			//跳转到第三方链接
 			gotoLink(e) {
-				
+
 				let link = e.currentTarget.dataset.link;
 				uni.navigateTo({
 					url: "/pages/skipone/skipone?url=" + encodeURIComponent(link),
 				});
 			},
 			share() {
-			
+
 				// onShareAppMessage() {
 				uni.showToast({
 					title: '暂未开发,还不能分享哦',
 					icon: 'none'
 				})
-				
-				
+
+
 			},
 			// 获取页面数据
 			getdata() {
@@ -264,7 +279,7 @@
 					url: `/pages/dy/dy?acId=${this.acId}`
 				})
 			},
-			
+
 
 			//获取是否报名
 			btnEnroll() {
@@ -280,6 +295,17 @@
 			},
 			// 收藏事件
 			coll() {
+				// this.stopTimer=0
+				if(this.stopTimer) return uni.showToast({
+					icon:'none',
+					title:'点击过快'
+				})
+				this.stopTimer=1
+				
+				setTimeout(()=>{
+					this.stopTimer=0
+				},500)
+				
 				//判断是否收藏
 				let iscoll = null
 
@@ -292,19 +318,27 @@
 				this.$request('/selectOneOperator', 'POST', data).then(res => {
 					// console.log('查询是否收藏过',res);
 					res[0].length ? iscoll = true : iscoll = false;
-
+					
 					// iscoll为true表示已经收藏过,执行删除  为true则收藏
 					if (iscoll) {
+						this.$store.dispatch('asyncUpdatemsg',{collAoff: 0})
 						console.log('执行删除');
 						this.$request('/deleteOperator', 'POST', data).then(res => {
 							// console.log(res);
 							this.getColl()
+							setTimeout(() => {
+								this.$store.dispatch('asyncDelMsg')
+							}, 1500)
 						})
 					} else {
+						this.$store.dispatch('asyncUpdatemsg',{collAoff: 1})
 						console.log('执行添加');
 						this.$request('/insertOperator', 'POST', data).then(res => {
 							// console.log(res);
 							this.getColl()
+							setTimeout(() => {
+								this.$store.dispatch('asyncDelMsg')
+							}, 1500)
 						})
 					}
 				})
@@ -345,6 +379,7 @@
 
 		},
 		onLoad(e) {
+			// this.stopTimer=0
 			// console.log('接收参数',e);
 			this.acId = e.acId
 			this.oid = this.$store.state.user.openid

+ 6 - 2
pages/activityPageNew/activityPageNew.vue

@@ -1,7 +1,8 @@
 <template>
 	<view class="activityPageNew">
 		<statusBar :item="navBarData"></statusBar>
-	
+		<!-- 消息提示 -->
+		<msgPop></msgPop>
 		<view class="search">
 			<uni-search-bar v-model="searchText" bgColor="#f0f2f5" class="btntop" placeholder="搜索" cancelButton="none"
 				clearButton="none"></uni-search-bar>
@@ -145,8 +146,11 @@
 				return this.searchText ? filterdList2 : this.pulist;
 			},
 		},
+		onUnload() {
+			this.$store.dispatch('asyncDelAll')
+		},
 		methods: {
-			
+
 			repulling() {
 				this.trigger = true
 				// this.isrepulling = true

+ 37 - 24
pages/index/index.vue

@@ -1,8 +1,9 @@
 <template>
 	<view class="content">
 		<statusBar :item="navBarData"></statusBar>
-		
-		
+		<!-- 消息提示 -->
+		<msgPop></msgPop>
+
 		<view class="top">
 			<image src="https://teacherapi.cocorobo.cn/teaching-file/static/yym/Rectangle25.png" mode="aspectFill"
 				@click="gotoHome">
@@ -19,7 +20,7 @@
 						<text class="di">暂未开放</text>
 					</view>
 				</view>
-				
+
 				<view class="costimgblc">
 					<image src="../../static/Framezzz.png" class="costImg" mode="aspectFill"></image>
 				</view>
@@ -73,45 +74,47 @@
 					title: "首页", //导航栏标题
 					btn: 0, //是否显示返回按钮 0不显示  1 显示
 				},
+				
+				// 推荐课程
 				classList: [],
 				sortList: [{
 						tit: '活动专区',
 						bri: '精彩纷呈',
 						img: '../../static/Framehhh.png',
 						cla: 'sortcon',
-						briCla:'di'
+						briCla: 'di'
 					},
 					{
 						tit: '课程专区',
 						bri: '海量资源',
 						img: '../../static/Framesss.png',
 						cla: 'sortcon sortcon2',
-						briCla:'di2'
+						briCla: 'di2'
 					}
 				]
 			};
 		},
 		methods: {
-			gotoTab(e){
+			gotoTab(e) {
 				console.log(e.currentTarget.dataset.index.tit);
-				let aaa=e.currentTarget.dataset.index.tit
-				if(aaa=='活动专区'){
+				let aaa = e.currentTarget.dataset.index.tit
+				if (aaa == '活动专区') {
 					return uni.switchTab({
-						url:'/pages/activityPageNew/activityPageNew'
+						url: '/pages/activityPageNew/activityPageNew'
 					})
-				}else{
+				} else {
 					uni.switchTab({
-						url:'/pages/resource/resource'
+						url: '/pages/resource/resource'
 					})
 				}
 			},
-			gotoCost(){
+			gotoCost() {
 				uni.showToast({
-					title:'功能暂未开放,敬请期待',
-					icon:'none'
+					title: '功能暂未开放,敬请期待',
+					icon: 'none'
 				})
 			},
-			
+
 			// 获取教研室活动list 数据
 			getlistBlock1Data() {
 				let data = {
@@ -136,7 +139,7 @@
 				});
 
 			},
-			
+
 			// 顶部大图跳转外部链接
 			gotoHome() {
 				// const web = this.classList[this.current];
@@ -153,11 +156,11 @@
 
 		},
 		onLoad() {
-					// this.animation = uni.createAnimation()	
+			// this.animation = uni.createAnimation()	
 		},
 		onShow() {
-		
-			this.classList=[]
+			// 清空推荐课程
+			this.classList = []
 			// 获取数据
 			this.getlistBlock1Data()
 			this.getAllMessage() // 调用app.js中的方法
@@ -165,7 +168,7 @@
 			// 因为组件没有onshow
 			// 获取收藏事件
 			this.$refs.listBlock1.getdata()
-			
+
 		}
 	};
 </script>
@@ -211,15 +214,17 @@
 						margin: 10rpx 0;
 					}
 				}
-				.costimgblc{
+
+				.costimgblc {
 					display: flex;
 					justify-content: flex-end;
+
 					.costImg {
 						width: 162rpx;
 						height: 162rpx;
 					}
 				}
-				
+
 			}
 
 			.sortleft {
@@ -229,9 +234,10 @@
 				justify-content: space-between;
 				margin-left: 20rpx;
 
-				.sortcon2{
+				.sortcon2 {
 					background-image: url('https://teacherapi.cocorobo.cn/teaching-file/static/Rectangle938.png') !important;
 				}
+
 				.sortcon {
 					width: 336rpx;
 					height: 140rpx;
@@ -254,24 +260,29 @@
 						width: 100%;
 						height: 100%;
 						color: #000;
+
 						.contentl {
 							width: 70%;
+
 							.tit {
 								font-size: 36rpx;
 								line-height: 48rpx;
 							}
+
 							.bri {
 								font-size: 24rpx;
 								height: 48rpx;
 								width: 144rpx;
 								line-height: 32rpx;
 								position: relative;
+
 								.di {
 									position: absolute;
 									bottom: 0;
 									left: 0;
 									color: rgba(243, 189, 91, 1);
 								}
+
 								.di2 {
 									position: absolute;
 									bottom: 0;
@@ -280,8 +291,10 @@
 								}
 							}
 						}
-						.sortleftImgBlock{
+
+						.sortleftImgBlock {
 							position: relative;
+
 							.sortleftImg {
 								position: absolute;
 								bottom: -10rpx;

+ 1 - 1
pages/mine/mine.vue

@@ -32,7 +32,7 @@
 
 					<view class="optionItem" @click="goMsg">
 						<view class="option_left">
-							<view class="option_icon">
+							<view class="option_icon" style="display: flex;justify-content: center;">
 								<image style="width: 80%;height: 80%;" src="../../static/Vectorldang.png" mode="aspectFill">
 								</image>
 							</view>

+ 5 - 0
pages/mineActive/mineActive.vue

@@ -1,6 +1,8 @@
 <template>
 	<view class="mineActive">
 		<statusBar :item="navBarData"></statusBar>
+		<!-- 消息提示 -->
+		<msgPop></msgPop>
 		
 		<scroll-view class="scrollV" scroll-y="true" @scrolltolower="relower">
 			<view>
@@ -29,6 +31,9 @@
 				currentPage: 1, //页数
 			};
 		},
+		onUnload() {
+			this.$store.dispatch('asyncDelAll')
+		},
 		methods: {
 			gotoDetail(e) {
 				let data=e.currentTarget.dataset.all

+ 1 - 1
pages/mineCollNew/mineCollNew.vue

@@ -85,7 +85,7 @@
 							</image>
 							<image class="img" :src="item.img" mode="aspectFill" />
 							<view class="tit btn-font">{{ item.ctit }}</view>
-							<view class="teacher fz-font">{{ item.school }}</view>
+							<!-- <view class="teacher fz-font">{{ item.school }}</view> -->
 						</view>
 					</view>
 					<view class="loading">

+ 3 - 2
pages/msg/msg.vue

@@ -48,9 +48,9 @@
 								<view class="contxt">恭喜!您已成功完成<text
 										style="color: rgba(0, 86, 168, 1);">“{{item.acName}}”</text>活动报名。您的参与信息已经成功提交,您现在是我们活动的一部分,我们非常期待与您共度美好时光。
 								</view>
-								<view class="contxt">
+								<!-- <view class="contxt">
 									以下是一些额外信息,以确保您充分了解您的参与:
-								</view>
+								</view> -->
 								<!-- <view class="contxt1">
 									<view class="" style="width: 2em;text-align: center;">•</view>
 									<view class="uiTit"> <view class="uiAcTit">活动名称:</view> [{{item.acName}}]</view>
@@ -482,6 +482,7 @@
 				.contxt1 {
 					color: rgba(0, 0, 0, 0.6);
 					font-size: 28rpx;
+					margin-top: 10rpx;
 					line-height: 40rpx;
 					display: flex;
 					.uiTit{

+ 8 - 1
pages/resource/resource.vue

@@ -1,6 +1,8 @@
 <template>
 	<view class="resource">
 		<statusBar :item="navBarData"></statusBar>
+		<!-- 消息提示 -->
+		<msgPop :goNum='1'></msgPop>
 		<view class="search">
 			<uni-search-bar v-model="searchText" bgColor="#f0f2f5" class="btntop" placeholder="搜索" cancelButton="none"
 				clearButton="none"></uni-search-bar>
@@ -77,8 +79,10 @@
 					title: "课程",
 					btn: 0,
 				},
+				
+				
 				indexId: 1,
-				current: 0, //登录方式切换
+				current: 0, //页面切换
 				info1: "info1", //类名
 				info2: "info2",
 				// swiper: 0,
@@ -119,6 +123,9 @@
 			},
 
 		},
+		onUnload() {
+			this.$store.dispatch('asyncDelAll')
+		},
 		methods: {
 			// 资源库下拉刷新
 			repulling() {

+ 5 - 1
pages/teachingList/teachingList.vue

@@ -1,7 +1,8 @@
 <template>
 	<view class="teachingList">
 		<statusBar :item="navbarData"></statusBar>
-		
+		<!-- 消息提示 -->
+		<msgPop></msgPop>
 		<view class="list">
 			<scroll-view style="height: 100%;" scroll-y="true" refresher-enabled='true' :refresher-triggered="trigger"
 					@refresherrefresh='pulling'  @scrolltolower="lower">
@@ -36,6 +37,9 @@
 				currentPage: 1,
 			};
 		},
+		onUnload() {
+			this.$store.dispatch('asyncDelAll')
+		},
 		methods: {
 			// 资源库下拉刷新
 			pulling() {

+ 27 - 6
store/index.js

@@ -15,11 +15,21 @@ const store = new Vuex.Store({
 		//相当于异步的操作,不能直接改变state的值,只能通过触发mutations的方法才能改变
 		asyncUpdateUser(context, user) {
 			context.commit('updateUser', user);
+		},
+		asyncUpdatemsg(context, data) {
+			context.commit('updatemsg', data);
+		},
+		asyncDelMsg(context, data) {
+			context.commit('delMsg', data);
+		},
+		asyncDelAll(context, data) {
+			context.commit('delAll', data);
 		}
 	},
 	mutations: {
 		//相当于同步的操作
 		updateUser(state, user) {
+			// console.log('啊啊啊啊啊');
 			state.user = user;
 		},
 		// 修改头像
@@ -30,14 +40,24 @@ const store = new Vuex.Store({
 		updateNc(state, data) {
 			state.user.nc = data;
 		},
-		// 添加聊天信息
-		addMsg(state, data) {
-			state.message.push(data)
+		// 添加消息提示
+		updatemsg(state,msg) {
+			// console.log('data:',msg);
+			state.msgpop.push(msg);
+			// state.msgpop.splice(0,1,msg);
 		},
-		// 保存发布内容
-		saveformData(state, formData) {
-			state.formData = formData;
+		// 删除消息提示
+		delMsg(state, data) {
+			state.msgpop.shift();
 		},
+		delAll(state, data) {
+			state.msgpop=[];
+		},
+		
+		// 保存发布内容
+		// saveformData(state, formData) {
+		// 	state.formData = formData;
+		// },
 		removeData(state) {
 			state.formData = {};
 		}
@@ -57,6 +77,7 @@ const store = new Vuex.Store({
 			brief: '', //用户简介
 			tel: "",//联系方式
 		},
+		msgpop:[]
 		// 聊天记录
 		// message: [],