From 513be798a677672644770e2b2f7025b6d4d20414 Mon Sep 17 00:00:00 2001
From: 付延余 <f-yanyu@outlook.com>
Date: 星期三, 07 九月 2022 14:44:04 +0800
Subject: [PATCH] 完善登录,登录授权

---
 pages/home/home.vue |  104 +++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 87 insertions(+), 17 deletions(-)

diff --git a/pages/home/home.vue b/pages/home/home.vue
index bfac91d..e3b171d 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -2,9 +2,13 @@
 	<view class="home">
 		<!-- 杞挱鍥� -->
 		<view class="home_swipe"><u-swiper :list="list3" indicator indicatorMode="line" circular></u-swiper></view>
+
 		<!-- 鍥捐〃 -->
 		<combined-title title="鐓や粨搴撳瓨鏄庣粏"></combined-title>
-		<view class="charts-box"><qiun-data-charts type="pie" :opts="opts" :chartData="chartData" /></view>
+		<view class="charts-box">
+			<qiun-data-charts type="pie" :opts="opts" :chartData="chartData" v-if="uchartsData.length > 0" />
+			<u-empty mode="data" iconSize="200" textSize="25" width="350" height="350" icon="http://cdn.uviewui.com/uview/empty/data.png" v-if="uchartsData.length == 0"></u-empty>
+		</view>
 		<!-- 鎴戠殑鐢宠 -->
 		<combined-title title="鎴戠殑鐢宠" detailsPath="/pages/my-application/my-application" v-if="shenqingMenu"></combined-title>
 		<view class="card-group">
@@ -21,7 +25,7 @@
 								<text>鎵�灞炴祦绋嬶細{{ item.processName }}</text>
 							</view>
 							<view class="">
-								<text>瀹℃壒鐜妭锛歿{ item.currTaskName }}</text>
+								<text>瀹℃壒鐜妭锛歿{ item.currTaskName || '' }}</text>
 							</view>
 						</view>
 						<view class="center-content__two center-margin">
@@ -54,7 +58,7 @@
 								<image src="@/static/home/jindu.png" mode=""></image>
 								<view>鏌ョ湅杩涘害</view>
 							</view>
-							<view @click="theFormDataClick(item.tableId)" v-if="item.status == 1 || item.status == 2">
+							<view @click="theFormDataClick(item.tableId)" v-if="(item.status == 1 || item.status == 2) && item.procDefId == 'WAY_BILL:4:87504'">
 								<image src="@/static/home/biaodan.png" mode=""></image>
 								<view>琛ㄥ崟鏁版嵁</view>
 							</view>
@@ -62,7 +66,7 @@
 								<image src="@/static/home/history.png" mode=""></image>
 								<view>閲嶆柊鐢宠</view>
 							</view>
-							<view @click="editMyApplication(item)" v-if="item.status == 3">
+							<view @click="editMyApplication(item)" v-if="item.status == 3 && item.procDefId == 'WAY_BILL:4:87504'">
 								<image src="@/static/home/history.png" mode=""></image>
 								<view>缂栬緫</view>
 							</view>
@@ -97,10 +101,10 @@
 					<view class="center-container">
 						<view class="center-content__one center-margin">
 							<view class="">
-								<text>浠诲姟鍚嶇О锛歿{ item.name }}</text>
+								<text>浠诲姟鍚嶇О锛歿{ item.name || '' }}</text>
 							</view>
 							<view class="">
-								<text>鎵�灞炴祦绋嬶細{{ item.processName }}</text>
+								<text>鎵�灞炴祦绋嬶細{{ item.processName || '' }}</text>
 							</view>
 						</view>
 						<view class="center-content__two center-margin">
@@ -154,7 +158,7 @@
 								<text>浠诲姟鍚嶇О锛歿{ item.name }}</text>
 							</view>
 							<view>
-								<text>鎵�灞炴祦绋嬶細{{ item.processName }}</text>
+								<text>鎵�灞炴祦绋嬶細{{ item.processName || '' }}</text>
 							</view>
 						</view>
 						<view class="center-content__two center-margin">
@@ -167,7 +171,7 @@
 						</view>
 						<view class="center-content__three center-margin">
 							<view class="">
-								<text>瀹℃壒鎰忚锛歿{ item.comment }}</text>
+								<text>瀹℃壒鎰忚锛歿{ item.comment || '' }}</text>
 							</view>
 							<view class="">
 								<text>
@@ -190,7 +194,7 @@
 					<view class="bottom-container">
 						<!-- 宸插姙鎸夐挳 -->
 						<view class="bottom-content__item">
-							<view @click="theFormDataClick(item.tableId)">
+							<view @click="theFormDataClick(item.tableId)" v-if="item.procDefId == 'WAY_BILL:4:87504'">
 								<image src="@/static/home/biaodan.png" mode=""></image>
 								<view>琛ㄥ崟鏁版嵁</view>
 							</view>
@@ -210,7 +214,7 @@
 
 		<!-- 鏃ヨ鍒� -->
 		<combined-title title="鏃ュ彂杩愯鍒�" detailsPath="/pages/jihua/jihua" v-if="rijihuaMenu"></combined-title>
-		<view class="card-group">
+		<view class="card-group bottomChild" >
 			<combination-card class="card" :showTop="false" v-for="(item, index) in fyData.slice(0, 2)" :key="item.id" v-if="rijihuaMenu">
 				<template v-slot:top></template>
 				<template v-slot:center>
@@ -298,15 +302,30 @@
 
 		<!-- 鑿滃崟鏍� -->
 		<!-- <popup-menu @menuShow="menushow" ref="menuRef"></popup-menu> -->
+		<u-gap height="15" bgColor="#eeeeee"></u-gap>
+		<view class="utils">
+			<view class="utils-container">
+				<view class="utils-container-body" @click="redirectLogin">
+					<view class="top"><u-icon name="backspace" color="#FF4233" size="70"></u-icon></view>
+					<view class="bottom-text"><text>閫�鍑�</text></view>
+				</view>
+				<view class="utils-container-body" @click="huanBang">
+					<view class="top"><u-icon name="lock-open" color="#1987FF" size="70"></u-icon></view>
+					<view class="bottom-text"><text>鎹㈢粦</text></view>
+				</view>
+			</view>
+		</view>
+		<u-gap height="60" bgColor="#eeeeee"></u-gap>
 	</view>
 </template>
 
 <script>
 import { timeConsuming } from '@/utils/nowDate.js';
+import { BaseUrl } from '@/utils/request.js';
 // import popupMenu from '@/components/common/popup-menu/popup-menu.vue';
 import combinedTitle from '@/components/common/combined-title/combined-title.vue';
 import combinationCard from '@/components/common/combination-card/combination-card.vue';
-import { setAccessToken } from '@/utils/status.js';
+import { setAccessToken, redirectLogin } from '@/utils/status.js';
 
 export default {
 	name: 'home',
@@ -344,7 +363,7 @@
 			statusColor: ['#dd8b8c', '#FF9900', '#007AFF', '#06BE00'],
 			result: ['鏈彁浜�', '澶勭悊涓�', '閫氳繃', '椹冲洖'],
 			resultColor: ['#dd8b8c', '#FF9900', '#06BE00', '#be2b2d'],
-			list3: ['https://cdn.uviewui.com/uview/swiper/swiper3.png', 'https://cdn.uviewui.com/uview/swiper/swiper2.png', 'https://cdn.uviewui.com/uview/swiper/swiper1.png'],
+			list3: ['../../../../static/groupAppTotalImg/banner.png'],
 			// 鎾ゅ洖妯℃�佹
 			withDrawShow: false,
 			fyData: [],
@@ -423,8 +442,31 @@
 	// },
 	// 鐐瑰嚮瀵艰埅鏍忚彍鍗曞悗
 	onNavigationBarButtonTap(e) {
-		console.log(e);
+		console.log('閫�鍑哄鑸爮鎸夐挳浜嬩欢', e);
 		// this.$refs.menuRef.menuClick();
+	},
+	// 鐩戝惉宸︿笂瑙掔殑鍥為��浜嬩欢
+	onUnload(event) {
+		//澶氬眰绾ц烦杞箣鍚庯紝鐩戝惉宸︿笂瑙掕繑鍥炰簨浠讹紝鐩存帴閫�鍥炲埌index
+		console.log('鐩戝惉宸︿笂瑙�', event);
+		uni
+			.request({
+				url: `${BaseUrl}/auth/token/logout`,
+				method: 'DELETE',
+				header: {
+					'TENANT-ID': 5,
+					Authorization: 'Bearer ' + uni.getStorageSync('access_token'),
+					VERSION: 'zzl'
+				}
+			})
+			.then(res => {
+				console.log('缂撳瓨娓呯悊鎴愬姛');
+			})
+			.catch(err => {
+				uni.showToast({
+					title: '缂撳瓨娓呯悊澶辫触锛�'
+				});
+			});
 	},
 	onShow() {
 		// 鑿滃崟娉ㄩ噴锛坅pp寰呯敤锛�
@@ -444,7 +486,7 @@
 			this.getProcessDataList(); // 鐢宠鍒楄〃
 			this.todoList(); // 鎴戠殑寰呭姙
 			this.doneList(); // 鎴戠殑宸插姙
-			this.xscarshippingdayplan(); //鏃ヨ鍒�
+			this.xscarshippingdayplan(); // 鏃ヨ鍒�
 		},
 		getUserInfo() {
 			this.$reqGet('getUserInfo').then(res => {
@@ -458,6 +500,7 @@
 			});
 		},
 		getServerData() {
+			console.log('鍔犺浇鍥捐〃', this.uchartsData);
 			//妯℃嫙浠庢湇鍔″櫒鑾峰彇鏁版嵁鏃剁殑寤舵椂
 			setTimeout(() => {
 				//妯℃嫙鏈嶅姟鍣ㄨ繑鍥炴暟鎹紝濡傛灉鏁版嵁鏍煎紡鍜屾爣鍑嗘牸寮忎笉鍚岋紝闇�鑷鎸変笅闈㈢殑鏍煎紡鎷兼帴
@@ -754,6 +797,14 @@
 			this.deleteApplicationModalShow = true;
 			this.procInstId = id;
 			console.log(id);
+		},
+		redirectLogin() {
+			redirectLogin();
+		},
+		huanBang() {
+			uni.navigateTo({
+				url: '/pages/register/register'
+			});
 		}
 	}
 };
@@ -764,7 +815,20 @@
 	width: 100%;
 	display: flex;
 	flex-direction: column;
-	padding-bottom: vww(20);
+
+	// 妯悜鑿滃崟鏍�
+	.utils {
+		.utils-container {
+			display: flex;
+			justify-content: space-between;
+			width: 66%;
+			margin: 0 auto;
+			.utils-container-body {
+				display: flex;
+				align-items: center;
+			}
+		}
+	}
 
 	.home_swipe {
 		width: 100%;
@@ -791,6 +855,9 @@
 		width: 91%;
 		height: vww(330);
 		margin: 0 auto;
+		.u-empty {
+			height: 100%;
+		}
 	}
 
 	.u-input {
@@ -807,6 +874,9 @@
 				}
 			}
 		}
+	}
+	.bottomChild{
+		margin-bottom: vww(20);
 	}
 
 	// 鍗$墖涓棿
@@ -893,7 +963,7 @@
 		// width:100%;
 		// height:vww(244);
 		.slot-content {
-      width:vww(330);
+			width: vww(330);
 			.rejectMesaage {
 				display: flex;
 				padding: vww(3);
@@ -1030,4 +1100,4 @@
 		}
 	}
 }
-</style>
+</style>

--
Gitblit v1.9.1