From 67d794932cdf67b221287e7406633bd75524f8ce Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Fri, 11 Mar 2022 17:29:32 +0800
Subject: [PATCH] +加判断是否首次弹窗

---
 pages/home/home.vue       |   61 ++++++++++++++
 static/home/img/laba.png  |    0 
 static/style/app.scss     |  115 ++++++++++++++++++++++++++++
 static/home/img/laba2.png |    0 
 store/websocket.js        |    9 ++
 static/home/img/paper.jpg |    0 
 store/mutations.js        |    2 
 store/state.js            |    1 
 store/actions.js          |   12 +-
 9 files changed, 189 insertions(+), 11 deletions(-)

diff --git a/pages/home/home.vue b/pages/home/home.vue
index feaf420..d89dc1e 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -1,6 +1,24 @@
 <template>
 	<view class="container">
 		<!-- 头部 start -->
+		<!-- <view> -->
+		<u-popup v-model="showOnceLogin" mode="center" :closeable="true" :custom-style="OnceLoginStyle"
+			class="OnceLoginStyles">
+				<img class="imgs1" src="../../static/home/img/laba2.png" mode=""></img>
+				<view class="onceBody">
+					<view class="names">
+						管理员{{$store.state.puserName}}:
+					</view>
+					<view class="texts">
+						恭喜您加入洪城义警,
+						我们期待与您共建平安家园,
+						即日起您可参与治安防范巡查等任务,获得积分
+					</view>
+				</view>
+				<!-- <button type="default" class="buts">点击进入</button> -->
+		</u-popup>
+		<u-button @click="showOnceLogin = true">打开</u-button>
+		<!-- </view> -->
 		<view class="head">
 			<u-navbar :is-fixed="false" :border-bottom="false" :is-back="false" title=""
 				:background="{ background: '#103289' }">
@@ -119,6 +137,7 @@
 		<u-toast ref="uToast" />
 		<!-- 底部导航条 -->
 		<u-tabbar :list="tabbar" :mid-button="false" height="50px" icon-size="40"></u-tabbar>
+
 	</view>
 </template>
 
@@ -150,7 +169,14 @@
 				tabbar: this.$store.state.tabbar,
 				gdlist: [
 					'南昌一波重磅“官宣”!来了!'
-				]
+				],
+				showOnceLogin: true, //首次进入显示祝贺信
+				OnceLoginStyle: {
+					// width: '60%',
+					// height: '50%',
+					// backgroundColor: '#fff',
+					// margin: 'auto'
+				}
 			};
 		},
 		onShow() {
@@ -181,6 +207,8 @@
 			});
 			//获取新闻信息
 			this.getArtcilePageList();
+
+			//读取是否是第一次进入
 		},
 		onReachBottom() {
 			if (this.status == 'nomore') return;
@@ -189,9 +217,36 @@
 				this.getArtcilePageList();
 			}, 2000);
 		},
+		computed: {
+			firstlogin() {
+				return this.$store.state.firstlogin;
+			}
+		},
+		watch: {
+			firstlogin: {
+				handler(newVal, oldVal) {
+					if (this.$store.state.firstlogin == '1' || this.$store.state.firstlogin == 1) {
+						this.showOnceLogin = true;
+					}
+				},
+				immediate: true
+			},
+			showOnceLogin() {
+				if (!this.showOnceLogin) {
+					console.log("窗口已关闭")
+					uni.request({
+						url: this.$store.state.piAPI + '/blade-user/firstLogin?id=' + this.$store.state.puserID,
+						method: 'GET',
+						success: (res) => {
+							// console.log(res)
+						}
+					});
+				}
+			}
+		},
 		methods: {
 			//温馨提示跳转页面
-			wxtsGo(){
+			wxtsGo() {
 				//去跳转
 				let detail = {
 					id: "991"
@@ -265,7 +320,7 @@
 					},
 					success: (res) => {
 						var data = res.data.data;
-						var num = Number(data.px)  + Number(data.xcha) + Number(data.xchuan);
+						var num = Number(data.px) + Number(data.xcha) + Number(data.xchuan);
 						this.cout = num;
 					}
 				});
diff --git a/static/home/img/laba.png b/static/home/img/laba.png
new file mode 100644
index 0000000..d1e5a26
--- /dev/null
+++ b/static/home/img/laba.png
Binary files differ
diff --git a/static/home/img/laba2.png b/static/home/img/laba2.png
new file mode 100644
index 0000000..08a3090
--- /dev/null
+++ b/static/home/img/laba2.png
Binary files differ
diff --git a/static/home/img/paper.jpg b/static/home/img/paper.jpg
new file mode 100644
index 0000000..4a5c81f
--- /dev/null
+++ b/static/home/img/paper.jpg
Binary files differ
diff --git a/static/style/app.scss b/static/style/app.scss
index 582188b..edf4b44 100644
--- a/static/style/app.scss
+++ b/static/style/app.scss
@@ -124,4 +124,117 @@
 		
 		
 	}
-		
\ No newline at end of file
+		
+		
+		
+		// .OnceLoginStyles {
+		// 	.u-mode-center-box{
+		// 		background-color: transparent !important;
+		// 		width: 80% !important;
+		// 		height: 50% !important;
+		// 		.backimgs{
+		// 			background-image: url('/static/home/img/paper.jpg');
+		// 			width: 100% !important;
+		// 			height: 300px !important;
+		// 			border-radius: 100px 100px 0 0;
+		// 		}
+		// 		.onceHead{
+		// 			height: 50% !important;
+		// 			width: 100% !important;
+		// 			border-radius: 100px;
+					
+		// 		}
+		// 		.onceBody{
+		// 			display: flex !important;
+		// 					align-items: center !important;
+		// 					justify-content: center !important;
+		// 					flex-direction: column;
+		// 			height:50% !important;
+		// 			width: 100% !important;
+		// 			position: relative;
+		// 			top: -25%;
+		// 			.names{
+		// 				font-size: 1.4rem;
+		// 				font-weight: 500;
+		// 			}
+		// 			.texts{
+		// 				font-size: 1.4rem;
+		// 				text-indent: 2rem;
+		// 				line-height: 2rem;
+		// 			}
+		// 		}
+		// 	}
+		// }
+		.OnceLoginStyles {
+			.u-mode-center-box{
+				// background-color: transparent !important;
+				background-color: #fff !important;
+				width: 80% !important;
+				height: auto !important;
+				border-radius: 20px;
+				// .backimgs{
+				// background-image: url('/static/home/img/paper.jpg');
+				// padding: 20px;
+				// 	width: 100% !important;
+				// 	height: 300px !important;
+				// 	border-radius: 100px 100px 0 0;
+				// }
+				position: relative;
+				
+				display: flex !important;
+				align-items: center !important;
+				justify-content: center !important;
+				$iconsize:30px;
+				// &::after{
+				// 	content: "";
+				// 	// background-color: red;
+				// 	width: $iconsize;
+				// 	height: $iconsize;
+				// 	position: absolute;
+				// 	top: -$iconsize;
+				// 	left: -$iconsize;
+				// }
+				.imgs1{
+					width: $iconsize !important;
+					height: $iconsize !important;
+					position: absolute;
+					top: 0px;
+					left: 5px;
+				}
+				// .onceHead{
+					
+				// 	width: 30px !important;
+				// 	height: 30px !important;
+				// 	background-color: red !important;
+				// 	top: -10px !important;
+				// 	left: -0px !important;
+				// }
+				.onceBody{
+					margin: 30px 20px 20px 20px;
+					// height:100% !important;
+					// width: 100% !important;
+					
+				// 	position: relative;
+				// 	top: -25%;
+				$fontsize:1.1rem;
+					.names{
+						font-size: $fontsize;
+						font-weight: 500;
+					}
+					.texts{
+						font-size: $fontsize;
+						text-indent: $fontsize * 2;
+						line-height: 2rem;
+					}
+				}
+				// .buts{
+				// 	width: calc(100% + 2px);
+				// 	position: relative;
+				// 	left: -1px;
+				// 	top: 2px;
+				// 	border-radius: 0 0 20px 20px ;
+				// 	background-color: #103289 !important;
+				// 	color: #fff;
+				// }
+			}
+		}
\ No newline at end of file
diff --git a/store/actions.js b/store/actions.js
index bfb6f81..e1b398c 100644
--- a/store/actions.js
+++ b/store/actions.js
@@ -63,14 +63,14 @@
 					data.isit = true
 					store.state.roleid = res.data.role_id; //角色id
 					store.state.Jurisdiction = res.data.workjurisdiction; //角色辖区
-					data.userName = res.data.nick_name //警袁姓名
-					data.userID = res.data.user_id //警袁id
-					data.avatar = res.data.avatar //头像
-					data.accounts = data.name
-					data.pass = data.pass
+					data.userName = res.data.nick_name; //警袁姓名
+					data.userID = res.data.user_id; //警袁id
+					data.avatar = res.data.avatar; //头像
+					data.accounts = data.name;
+					data.pass = data.pass;
+					data.firstlogin = res.data.firstlogin;
 					// data.userPhon = res.user_id;
 					store.commit('login', data)
-
 					wx.request({
 						url: "http://223.82.109.183:2080/api/userVip/getUserVipInfo?idCardNo=" +
 							res
diff --git a/store/mutations.js b/store/mutations.js
index 0622fe1..813e08e 100644
--- a/store/mutations.js
+++ b/store/mutations.js
@@ -13,6 +13,8 @@
 			state.puserName = data.userName;
 			state.puserID = data.userID;
 			state.avatar = data.avatar;
+			state.avatar = data.avatar;
+			state.firstlogin = data.firstlogin;
 		}
 		$store.dispatch("connectws");
 		//储存用户
diff --git a/store/state.js b/store/state.js
index baf39aa..0d92cb8 100644
--- a/store/state.js
+++ b/store/state.js
@@ -20,6 +20,7 @@
 	// piAPI: 'http://192.168.0.222:83/',
 	//piAPI: 'http://223.82.109.183:2082/api/',
 	BaopiAPI: 'http://223.82.109.183:2080/api/',
+	firstlogin: null,
 	puserName: '',
 	puserID: '',
 	puserIphone: '',
diff --git a/store/websocket.js b/store/websocket.js
index 37a2c84..6f8ade0 100644
--- a/store/websocket.js
+++ b/store/websocket.js
@@ -139,7 +139,14 @@
 						}
 					},
 				});
-
+			} else if (type === "change") {
+				let routes = getCurrentPages(); //获取当前页面栈
+				let curRoute = routes[routes.length - 1].route; //获取当前页面的路由
+				let d = {
+					serid: uni.getStorageSync("ids") || $store.state.puserID,
+					type: 0,
+					tasktype: route == "grabOrdersZAXC" ? 0 : (route == "grabOrdersZAYWXC" ? 1 : 2)
+				};
 			}
 		},
 		//本地建造数据传递

--
Gitblit v1.9.3