From 82265520c440140660d9b9a4cb381cf899fc506e Mon Sep 17 00:00:00 2001
From: wjt <1797368093@qq.com>
Date: 星期四, 20 六月 2024 14:15:26 +0800
Subject: [PATCH] 数据看板添加

---
 policy/components/mine.vue         |   11 +
 pages.json                         |    9 +
 policy/dataLook/dataLook.vue       |   22 ++++
 policy/changePhone/changePhone.vue |  199 ++++++++++++++++++++++++++++++++++++++-
 4 files changed, 231 insertions(+), 10 deletions(-)

diff --git a/pages.json b/pages.json
index 0167170..f020353 100644
--- a/pages.json
+++ b/pages.json
@@ -61,7 +61,14 @@
 					"path" : "changePhone/changePhone",
 					"style" : 
 					{
-						"navigationBarTitleText" : ""
+						"navigationBarTitleText" : "淇敼鎵嬫満鍙�"
+					}
+				},
+				{
+					"path" : "dataLook/dataLook",
+					"style" : 
+					{
+						"navigationBarTitleText" : "鏁版嵁鐪嬫澘"
 					}
 				}
 			]
diff --git a/policy/changePhone/changePhone.vue b/policy/changePhone/changePhone.vue
index 8183fd0..86217f4 100644
--- a/policy/changePhone/changePhone.vue
+++ b/policy/changePhone/changePhone.vue
@@ -1,22 +1,207 @@
+<!-- 浼佷笟鐧诲綍 -->
 <template>
-	<view>
-		
+	<view class="companylogin">
+		<view class="content-box">
+			<view class="form">
+				<view class="form-item margin-bottom">
+					<view class="form-label">
+						鎵嬫満鍙�
+					</view>
+					<view class="form-input">
+						<input type="number"  placeholder="璇疯緭鍏�11浣嶆墜鏈哄彿"/>
+					</view>
+				</view>
+				<view class="form-item">
+					<view class="form-label">
+						楠岃瘉鐮�
+					</view>
+					<view class="form-input set-flex set-flex-content-between">
+						<input type="number" placeholder="璇疯緭鍏ラ獙璇佺爜"/>
+						<view @click="getCode">
+							<text class="driver"></text>
+							<text class="getcode">{{tips}}</text>
+						</view>
+					</view>
+				</view>
+			</view>
+			<view style="margin-top: 56rpx;">
+				<view class="per-button" @click="loging">淇敼鎵嬫満鍙�</view>
+			</view>
+		</view>
 	</view>
 </template>
 
 <script>
+	// 00钀ュ晢鍔�,01鎵ф硶,02浼佷笟 鍖哄垎涓嶅悓鐨勭櫥闄嗛〉闈�
+	import { getCode, codeLogin, getInfo } from '@/api/auth.js'
 	export default {
 		data() {
 			return {
-				
+				tips: '鑾峰彇楠岃瘉鐮�',
+				form: {
+					phone: '',
+					code: '',
+					userType: ''
+				},
+				loginToken: '',
+				isSendCode: false,
+				countdownTime: 20,
+				timer: ''
+			}
+		},
+		onLoad(options) {
+			if(options.code) {
+				this.form.userType = options.code
+			}
+		},
+		onUnload() {
+			if(this.timer) {
+				clearTimeout(this.timer)
+				this.timer = null
 			}
 		},
 		methods: {
-			
+			getCode() {
+				if(!this.form.phone){
+					uni.showToast({
+						title: '璇疯緭鍏ユ墜鏈哄彿',
+						icon: 'none'
+					})
+					return
+				}
+				if(!this.$u.test.mobile(this.form.phone)){
+					uni.showToast({
+						title: '璇疯緭鍏ユ纭殑鎵嬫満鍙�',
+						icon: 'none'
+					})
+					return
+				}
+				if (!this.isSendCode) {
+					this.isSendCode = true
+					uni.showLoading({
+						title: '姝e湪鑾峰彇楠岃瘉鐮�'
+					})
+					getCode({phone: this.form.phone }).then(val => {
+							this.startCountdown()
+							uni.hideLoading();
+							uni.$u.toast('楠岃瘉鐮佸凡鍙戦��');
+					})
+				} else {
+					uni.$u.toast('鍊掕鏃剁粨鏉熷悗鍐嶅彂閫�');
+				}
+			},
+			startCountdown() {
+				if(this.timer) {
+					clearTimeout(this.timer)
+					this.timer = null
+				}
+				if(this.countdownTime <= 0) {
+					this.tips = "閲嶆柊鑾峰彇"
+					this.isSendCode = false
+					this.countdownTime = 20
+					return
+				}
+				this.timer = setTimeout(() => {
+					this.countdownTime--
+					this.tips = `${this.countdownTime}s鍚庨噸鏂拌幏鍙朻
+					this.startCountdown()
+				}, 1000)
+			},
+			loging() {
+				codeLogin(this.form).then(val => {
+					if(val.data.token) {
+						this.loginToken = val.data.token
+						uni.setStorageSync('sessionToken', this.loginToken)
+						this.getInfo()
+					}
+				})
+			},
+			getInfo() {
+				getInfo().then(val => {
+					console.log(val)
+					uni.setStorageSync('userInfo',  val.data.data)
+					
+					if(this.form.userType == '02') {
+						uni.redirectTo({
+							url:`/pages/companyIndex/companyIndex`
+						})
+					} else if(this.form.userType == '01'){
+						uni.redirectTo({
+							url:`/policy/policyIndex/policyIndex`
+						})
+					}
+				})
+			},
+			goRegister() {
+				uni.navigateTo({
+					url: `/pages/registerCompany/registerCompany`
+				})
+			}
 		}
 	}
 </script>
 
-<style>
-
-</style>
+<style scoped lang="scss">
+	.companylogin {
+		padding-top: 60rpx;
+		&>.image-box {
+			width: 100%;
+			height: 345rpx;
+			text-align: center;
+			background-color: #111;
+			&>image{
+				width: 100%;
+				height: 345rpx;
+			}
+		}
+		.content-box{
+			border-radius: 40rpx 40rpx 0 0;
+			padding: 40rpx 32rpx;
+			position: relative;
+			top: -40rpx;
+			background-color: white;
+			.form {
+				.form-item{
+					.form-label{
+						font-size: 34rpx;
+						margin: 0 0 24rpx 16rpx;
+					}
+					.form-input{
+						background-color: #F7F7F7;
+						padding: 20rpx;
+						border-radius: 20rpx;
+					}
+				}
+			}
+			.margin-bottom{
+				margin-bottom: 36rpx;
+			}
+			.getcode{
+				color: #1171E0;
+				font-size: 34rpx;
+				font-weight: 500;
+				width: 20%;
+			}
+			.driver{
+				display: inline-block;
+				vertical-align: middle;
+				margin-right: 20rpx;
+				width: 2rpx;
+				height: 48rpx;
+				background-color: #C3C6CD;
+			}
+		}
+		.company-register{
+			position: fixed;
+			bottom: 32rpx;
+			left: 50%;
+			transform: translateX(-50%);
+			padding: 16rpx 46rpx;
+			color: #1171E0;
+			display: inline-block;
+			border-radius: 12rpx;
+			border: 2rpx solid #ABD2FF;
+			background: #F0F8FF;
+		}
+	}
+</style>
\ No newline at end of file
diff --git a/policy/components/mine.vue b/policy/components/mine.vue
index bcc1b48..8cbca3a 100644
--- a/policy/components/mine.vue
+++ b/policy/components/mine.vue
@@ -20,10 +20,10 @@
 				<text class="label">鑱旂郴鐢佃瘽</text>
 				<text>168****4164</text>
 			</view>
-			<view class="show-phone-number">
+			<view class="show-phone-number" @click="goChangePhone">
 				<view class="set-flex">
 					<u-icon name="phone" size="22"></u-icon>
-					<text class="change">淇敼鎵嬫満鍙�</text>
+					<text class="change" >淇敼鎵嬫満鍙�</text>
 				</view>
 				<u-icon name="arrow-right"></u-icon>
 			</view>
@@ -40,6 +40,13 @@
 			return {
 				src: ''
 			}
+		},
+		methods: {
+			goChangePhone() {
+				uni.navigateTo({
+					url: '/policy/changePhone/changePhone'
+				})
+			}
 		}
 	}
 </script>
diff --git a/policy/dataLook/dataLook.vue b/policy/dataLook/dataLook.vue
new file mode 100644
index 0000000..8183fd0
--- /dev/null
+++ b/policy/dataLook/dataLook.vue
@@ -0,0 +1,22 @@
+<template>
+	<view>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		methods: {
+			
+		}
+	}
+</script>
+
+<style>
+
+</style>

--
Gitblit v1.9.1