Ver código fonte

修改查詢權限 修改數字英文切換

maa3520 2 anos atrás
pai
commit
887e5a5351

+ 7 - 0
resources/js/src/@core/auth/jwt/jwtService.js

@@ -66,7 +66,14 @@ export default class JwtService {
 
                     //Method to get new token
                     error = "500錯誤! 伺服器發生錯誤!"
+                }else if (error.request && error.request.status === 408) {
+                    // Set Failed Request
+                    let failedRequest = error.config;
+
+                    //Method to get new token
+                    error = "408錯誤! 伺服器沒有回應!"
                 }
+                
                 throw error;
             },
         )

+ 1 - 1
resources/js/src/router/config.js

@@ -249,7 +249,7 @@ export const settings = {
                         active: true,
                     },
                 ],
-                requiresAuth: true,
+                requiresAuth: false,
             },
         },
     ],

+ 28 - 3
resources/js/src/views/lottery/CheckIn.vue

@@ -48,10 +48,11 @@
 		<b-col md="6">
 			<b-card title="報到輸入" style="height: 65vh;">
 				<b-input-group prepend="編號" class="mt-3">
-					<b-form-input v-model="input" @keydown.native="keyListener" inputmode="numeric"
+					<b-form-input v-model="input" @keydown.native="keyListener" :inputmode="inputmode"
 						placeholder="請輸入員工編號或來賓編號..."></b-form-input>
 					<b-input-group-append>
-						<b-button @click="searchData" variant="info">送出</b-button>
+						<b-button size="sm" @click="searchData" variant="info">送出</b-button>
+						<b-button size="sm" @click="switchType">{{ mode }}</b-button>
 					</b-input-group-append>
 				</b-input-group>
 				<br>
@@ -104,6 +105,7 @@ export default {
 		return {
 			user: { name: " ", user_id: " ", department: " " },
 			input: "",
+            isNum: true,
 		}
 	},
 	created() {
@@ -138,6 +140,7 @@ export default {
 			this.user = { name: " ", user_id: " ", department: " " };
 		},
 		showToast(variant) {
+
 			useJwt.postData('/api/check_in/update', { 'user_id': this.user.user_id }).then(response => {
 				console.log(response.data)
 				this.$toast({
@@ -152,6 +155,16 @@ export default {
 				this.user.is_checked_in = 1;
 			}).catch(error => {
 				console.log(error)
+				variant = 'danger'
+				this.$toast({
+					component: ToastificationContent,
+					props: {
+						title: '報到失敗',
+						icon: 'CheckCircleIcon',
+						text: '報到失敗! 原因: ' + error,
+						variant,
+					},
+				})
 			});
 
 
@@ -166,13 +179,25 @@ export default {
 			} else {
 				return '/images/profile-picture/' + user_id + '.jpg';
 			}
-		}
+		},
+		switchType() {
+			this.isNum = !this.isNum;
+		},
 	},
 	watch: {
 
 	},
 	mounted() {
 
+	},
+	computed: {
+		mode() {
+			return this.isNum ? "ABC" : "123";
+		},
+		inputmode() {
+
+			return this.isNum ? "numeric" : "search";
+		}
 	}
 }
 

+ 22 - 6
resources/js/src/views/lottery/Search.vue

@@ -7,7 +7,7 @@
                         <b-form-input v-model="user_id" @keydown.native="keyListener"
                             placeholder="請輸入員工編號或來賓編號..."></b-form-input>
                         <b-input-group-append>
-                            <b-button @click="getUserStatus" variant="info">送出</b-button>
+                            <b-button size="sm" @click="getUserStatus" variant="info">送出</b-button>
                         </b-input-group-append>
                     </b-input-group>
                 </b-card>
@@ -21,11 +21,17 @@
                             <b-img :src="avatar(searchData.user_id)" blank-color="#ccc" fluid alt="placeholder"
                                 onerror="this.src='/images/error.png'" />
                         </b-col>
+                    </b-row>
+                </b-card>
+            </b-col>
+            <b-col md="12">
+                <b-card>
+                    <b-row>
                         <b-col>
                             <div style="font-size: 2rem;">
                                 <div>
                                     <span style="color: #0085DD">
-                                        姓名
+                                        姓  
                                     </span>
                                     <span>
                                         {{ searchData.user_name }}
@@ -33,7 +39,7 @@
                                 </div>
                                 <div>
                                     <span style="color: #0085DD">
-                                        工號
+                                        工  
                                     </span>
                                     <span>
                                         {{ searchData.user_id }}
@@ -41,23 +47,32 @@
                                 </div>
                                 <div>
                                     <span style="color: #0085DD">
-                                        部門
+                                        部  
                                     </span>
                                     <span>
                                         {{ departmentList[searchData.department_id] }}
                                     </span>
                                 </div>
                                 <div>
+                                    <span style="color: #0085DD">
+                                        報到狀態
+                                    </span>
                                     <span :style="statusColoer(searchData.is_checked_in)">
                                         {{ checkinStatus(searchData.is_checked_in) }}
                                     </span>
                                 </div>
-                                <div v-if="searchData.is_checked_in">
+                                <div>
+                                    <span style="color: #0085DD">
+                                        中獎狀態
+                                    </span>
                                     <span :style="statusColoer(searchData.is_awarded)">
                                         {{ awardStatus(searchData.is_awarded, searchData.prize_name) }}
                                     </span>
                                 </div>
-                                <div v-if="searchData.prize_name">
+                                <div>
+                                    <span style="color: #0085DD">
+                                        領獎狀態
+                                    </span>
                                     <span :style="statusColoer(searchData.is_claimed)">
                                         {{ claimStatus(searchData.is_claimed) }}
                                     </span>
@@ -113,6 +128,7 @@ export default {
         keyListener(event) {
             if (event.which === 13) {
                 this.getUserStatus()
+                event.srcElement.blur();
             }
         },
         avatar(user_id) {