Browse Source

阶段性提交

soft5566 2 years atrás
parent
commit
840e424a45
7 changed files with 114 additions and 50 deletions
  1. 40 35
      App.vue
  2. 1 0
      main.js
  3. 1 1
      manifest.json
  4. 26 6
      pages/myself/css/myself.css
  5. 20 8
      pages/myself/myself.vue
  6. 15 0
      pages/order_room/order_room.vue
  7. 11 0
      static/shared.js

+ 40 - 35
App.vue

@@ -2,47 +2,52 @@
 	export default {
 	export default {
 		onLaunch: function(options) {
 		onLaunch: function(options) {
 			// console.log('App Launch')
 			// console.log('App Launch')
-			// console.log('\'' + this.$utils.getEncryptedData('token') + '\'')
-			// console.log('\'' + this.$utils.getEncryptedData('cardNumber') + '\'')
-			// console.log('\'' + this.$utils.getEncryptedData('errorMsg') + '\'')
-
-			var cardNumber = options.query.card_number;
-			if (!this.$utils.isEmpty(cardNumber)) {
-				this.$utils.storeEncryptedData('cardNumber', cardNumber);
-			} else {
-				cardNumber = this.$utils.getEncryptedData('cardNumber');
-				if (this.$utils.isEmpty(cardNumber)) {
-					uni.showToast({
-						title: '未获得用户信息',
-						duration: 3000
-					})
-				}
-			}
-
-			var token = this.$utils.getEncryptedData('token');
-			var errorMsg = this.$utils.getEncryptedData('errorMsg');
-
-			if (this.$utils.isEmpty(cardNumber) && this.$utils.isEmpty(token) && this.$utils.isEmpty(errorMsg)) {
-				var url = 'https://chtech.ncjti.edu.cn/hotelReservation/zhotel/appopenid.action';
-				var encodedUrl = encodeURIComponent(url);
-				window.location.href = 'https://open.wecard.qq.com/connect/oauth/authorize' +
-					'?app_key=9FFFACD6D09F15D2' +
-					'&response_type=code' +
-					'&scope=snsapi_userinfo' +
-					'&ocode=1015730314' +
-					'&redirect_uri=' + encodedUrl +
-					'&state=' + url;
-			} else if (this.$utils.isEmpty(cardNumber) && this.$utils.isEmpty(token) && this.$utils.containsString(errorMsg, '失败')) {
-				uni.navigateTo({
-					url: '/pages/p404/p404'
-				})
-			}
+			this.accredit(options)
 		},
 		},
 		onShow: function() {
 		onShow: function() {
 			console.log('App Show')
 			console.log('App Show')
 		},
 		},
 		onHide: function() {
 		onHide: function() {
 			console.log('App Hide')
 			console.log('App Hide')
+		},
+		methods: {
+			accredit(options) {
+				// console.log('\'' + this.$utils.getEncryptedData('token') + '\'')
+				// console.log('\'' + this.$utils.getEncryptedData('cardNumber') + '\'')
+				// console.log('\'' + this.$utils.getEncryptedData('errorMsg') + '\'')
+
+				var cardNumber = options.query.card_number;
+				if (!this.$utils.isEmpty(cardNumber)) {
+					this.$utils.storeEncryptedData('cardNumber', cardNumber);
+				} else {
+					cardNumber = this.$utils.getEncryptedData('cardNumber');
+					if (this.$utils.isEmpty(cardNumber)) {
+						uni.showToast({
+							title: '未获得用户信息',
+							duration: 3000
+						})
+					}
+				}
+
+				var token = this.$utils.getEncryptedData('token');
+				var errorMsg = this.$utils.getEncryptedData('errorMsg');
+
+				if (this.$utils.isEmpty(cardNumber) && this.$utils.isEmpty(token) && this.$utils.isEmpty(errorMsg)) {
+					var url = 'https://chtech.ncjti.edu.cn/hotelReservation/zhotel/appopenid.action';
+					var encodedUrl = encodeURIComponent(url);
+					window.location.href = 'https://open.wecard.qq.com/connect/oauth/authorize' +
+						'?app_key=9FFFACD6D09F15D2' +
+						'&response_type=code' +
+						'&scope=snsapi_userinfo' +
+						'&ocode=1015730314' +
+						'&redirect_uri=' + encodedUrl +
+						'&state=' + url;
+				} else if (this.$utils.isEmpty(cardNumber) && this.$utils.isEmpty(token) && this.$utils.containsString(errorMsg, '失败')) {
+					uni.navigateTo({
+						url: '/pages/p404/p404'
+					})
+				}
+			}
 		}
 		}
 	}
 	}
 </script>
 </script>

+ 1 - 0
main.js

@@ -39,6 +39,7 @@ app.$mount()
 import {
 import {
 	createSSRApp
 	createSSRApp
 } from 'vue'
 } from 'vue'
+
 import App from './App.vue'
 import App from './App.vue'
 export function createApp() {
 export function createApp() {
 	const app = createSSRApp(App)
 	const app = createSSRApp(App)

+ 1 - 1
manifest.json

@@ -91,7 +91,7 @@
             }
             }
         },
         },
         "router" : {
         "router" : {
-            "base" : "hotelReservation/dist/"
+            "base" : "hotelReservation/h5/"
         }
         }
     }
     }
 }
 }

+ 26 - 6
pages/myself/css/myself.css

@@ -7,7 +7,8 @@
 }
 }
 
 
 .person {
 .person {
-	display: revert;
+	display: flex;
+	justify-content: space-around;
 	margin-top: 20rpx;
 	margin-top: 20rpx;
 	margin-left: 20rpx;
 	margin-left: 20rpx;
 	margin-right: 20rpx;
 	margin-right: 20rpx;
@@ -17,16 +18,36 @@
 	border-radius: 9rpx;
 	border-radius: 9rpx;
 }
 }
 
 
+.person-left {
+	display: flex;
+	flex-grow: 4;
+}
+
+.person-info {
+	display: flex;
+	flex-direction: column;
+	margin-top: 40rpx;
+}
+
+.person-right {
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	flex-grow: 1;
+	font-size: 20rpx;
+	font-weight: 400;
+	color: rgba(128, 128, 128, 1);
+}
+
 .person_touxiang {
 .person_touxiang {
 	margin-left: 30rpx;
 	margin-left: 30rpx;
 	margin-top: 40rpx;
 	margin-top: 40rpx;
 	width: 110rpx;
 	width: 110rpx;
 	height: 110rpx;
 	height: 110rpx;
-	border-radius: 55px;
+	border-radius: 50%;
 }
 }
 
 
 .person_name {
 .person_name {
-	position: absolute;
 	margin-left: 22rpx;
 	margin-left: 22rpx;
 	margin-top: 50rpx;
 	margin-top: 50rpx;
 	color: rgba(0, 0, 0, 1);
 	color: rgba(0, 0, 0, 1);
@@ -35,7 +56,6 @@
 }
 }
 
 
 .person_identity {
 .person_identity {
-	position: absolute;
 	margin-left: 14rpx;
 	margin-left: 14rpx;
 	width: 100rpx;
 	width: 100rpx;
 	height: 38rpx;
 	height: 38rpx;
@@ -46,12 +66,12 @@
 	font-weight: 400;
 	font-weight: 400;
 	line-height: 38rpx;
 	line-height: 38rpx;
 	text-align: center;
 	text-align: center;
+	padding: 0 8rpx;
 }
 }
 
 
 .person_phone {
 .person_phone {
-	position: absolute;
 	margin-left: 22rpx;
 	margin-left: 22rpx;
-	margin-top: 98rpx;
+	margin-top: 16rpx;
 	color: rgba(128, 128, 128, 1);
 	color: rgba(128, 128, 128, 1);
 	font-size: 24rpx;
 	font-size: 24rpx;
 	font-weight: 400;
 	font-weight: 400;

+ 20 - 8
pages/myself/myself.vue

@@ -1,14 +1,20 @@
 <template>
 <template>
 	<view class="content">
 	<view class="content">
 		<view class="person">
 		<view class="person">
-			<image class="person_touxiang" v-if="touxiang == ''" src="../../static/my/touxiang.svg"></image>
-			<image class="person_touxiang" v-else :src="touxiang"></image>
-			<text class="person_name">{{ cardName }}
-				<text class="person_identity">
-					<text>{{ cardIdentity }}</text>
-				</text>
-			</text>
-			<text class="person_phone">{{cardNum}}</text>
+			<view class="person-left">
+				<image class="person_touxiang" v-if="touxiang == ''" src="../../static/my/touxiang.svg"></image>
+				<image class="person_touxiang" v-else :src="touxiang"></image>
+				<view class="person-info">
+					<view>
+						<text class="person_name">{{ cardName }}</text>
+						<text class="person_identity">{{ cardIdentity }}</text>
+					</view>
+					<text class="person_phone">{{cardNum}}</text>
+				</view>
+			</view>
+			<view class="person-right">
+				<button @tap="shouquan()">重新授权</button>
+			</view>
 		</view>
 		</view>
 		<!-- 第二部分,我的订单 -->
 		<!-- 第二部分,我的订单 -->
 		<view class="my_order">
 		<view class="my_order">
@@ -63,6 +69,8 @@
 </template>
 </template>
 
 
 <script>
 <script>
+	import { accredit } from '@/static/shared.js';
+	
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
@@ -78,6 +86,10 @@
 			this.getUserInfo()
 			this.getUserInfo()
 		},
 		},
 		methods: {
 		methods: {
+			// 授权
+			shouquan() {
+				accredit()
+			},
 			// 跳转到入住须知
 			// 跳转到入住须知
 			navigateToXuzhi() {
 			navigateToXuzhi() {
 				uni.navigateTo({
 				uni.navigateTo({

+ 15 - 0
pages/order_room/order_room.vue

@@ -65,6 +65,10 @@
 </template>
 </template>
 
 
 <script>
 <script>
+	import {
+		accredit
+	} from '@/static/shared.js';
+
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
@@ -278,6 +282,17 @@
 						that.msgType = 'warn'
 						that.msgType = 'warn'
 						that.order_txt = data.message
 						that.order_txt = data.message
 						that.$refs.popup_order.open()
 						that.$refs.popup_order.open()
+
+						uni.showModal({
+							title: '提示',
+							content: '您需要重新授权!',
+							showCancel: false,
+							success(res) {
+								if (res.confirm) {
+									accredit()
+								}
+							}
+						})
 					}
 					}
 				});
 				});
 			},
 			},

+ 11 - 0
static/shared.js

@@ -0,0 +1,11 @@
+export function accredit() {
+		var url = 'https://chtech.ncjti.edu.cn/hotelReservation/zhotel/appopenid.action';
+		var encodedUrl = encodeURIComponent(url);
+		window.location.href = 'https://open.wecard.qq.com/connect/oauth/authorize' +
+			'?app_key=9FFFACD6D09F15D2' +
+			'&response_type=code' +
+			'&scope=snsapi_userinfo' +
+			'&ocode=1015730314' +
+			'&redirect_uri=' + encodedUrl +
+			'&state=' + url;
+}