Blame view

yslvdao-miniapp/pages/login/login.vue 4.07 KB
d64cd58f   wesley88   上传验收小程序
1
  <template>
29cad55a   杨鑫   '验收'
2
3
4
5
  	<view class="page" :style="{backgroundImage:`url(${$imgUrl('/homePhoto.png')})`}">
  		<view style="height: 100vh;width: 100%;position: fixed;bottom: 0;left: 0;">
  			<view style="width: 45%;margin: 0 auto;margin-top: 15vh;">
  				<image src="../../static/login/logo1.png" style="width: 100%;" mode="widthFix"></image>
d64cd58f   wesley88   上传验收小程序
6
  			</view>
29cad55a   杨鑫   '验收'
7
8
  			<view style="width:60%;margin: 0 auto;">
  				<image src="../../static/login/logo2.png" style="width: 100%;" mode="widthFix"></image>
d64cd58f   wesley88   上传验收小程序
9
  			</view>
29cad55a   杨鑫   '验收'
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  			<!-- 填写区 -->
  			<view class="input-info" style="margin-top: 5vh;">
  				<view class="info">
  					<view class="info-icon">
  						<image src="../../static/login/icon1.png" mode="heightFix"></image>
  					</view>
  					<input type="tel" maxlength="11" v-model="phone" placeholder="请输入您的手机号">
  					<view class="more"></view>
  				</view>
  				<view class="info">
  					<view class="info-icon">
  						<image src="../../static/login/icon2.png" mode="heightFix"></image>
  					</view>
  					<input type="tel" v-model="code" maxlength="6" placeholder="请输入验证码">
  					<view class="more">
  						<text class="mo" v-if="!isTrue" @click="sendCode">获取验证码</text>
  						<text class="mo" v-else>{{num}}秒后重试</text>
  					</view>
  				</view>
d64cd58f   wesley88   上传验收小程序
29
  			</view>
29cad55a   杨鑫   '验收'
30
31
32
33
34
  			<!-- 按钮 -->
  			<view class="btn-info">
  				<view class="btn" @click="register">
  					<text>登录</text>
  				</view>
d64cd58f   wesley88   上传验收小程序
35
  			</view>
29cad55a   杨鑫   '验收'
36
  
d64cd58f   wesley88   上传验收小程序
37
  		</view>
29cad55a   杨鑫   '验收'
38
39
40
41
42
43
  		<view
  			style="position: fixed;left: 0;bottom: 49rpx;display: flex;flex-direction: row;justify-content: center;width: 100%;">
  			<u-checkbox-group @change="checkboxGroupChange" shape="circle" :label-disabled="true">
  				<u-checkbox active-color="#3f9b6a" v-model="checked" name="tongyi">我已阅读并同意<span style="color:#3f9b6a;"
  						@click="goyinsi">《隐私政策》</span></u-checkbox>
  			</u-checkbox-group>
d64cd58f   wesley88   上传验收小程序
44
45
  		</view>
  	</view>
d64cd58f   wesley88   上传验收小程序
46
47
48
49
50
51
  </template>
  
  <script>
  	export default {
  		data() {
  			return {
29cad55a   杨鑫   '验收'
52
53
54
  				checked: null,
  				phone: '',
  				code: '',
d64cd58f   wesley88   上传验收小程序
55
56
57
  				isTrue: false,
  				num: 60,
  				time: null,
29cad55a   杨鑫   '验收'
58
  
d64cd58f   wesley88   上传验收小程序
59
60
  			};
  		},
29cad55a   杨鑫   '验收'
61
62
63
64
65
66
67
68
69
70
71
72
  		watch: {
  			num() {
  				if (this.num == 0) {
  					clearInterval(this.time)
  					this.time = null
  					this.isTrue = false
  					this.num = 60
  				}
  			}
  		},
  		onShow() {
  
d64cd58f   wesley88   上传验收小程序
73
74
  		},
  		methods: {
29cad55a   杨鑫   '验收'
75
76
77
78
79
80
81
82
83
84
  			goyinsi() {
  				uni.navigateTo({
  					url: '/pages/privacy/privacy'
  				});
  			},
  			checkboxGroupChange(val) {
  				this.showTong = val[0]
  				console.log(this.showTong)
  			},
  			register() {
d64cd58f   wesley88   上传验收小程序
85
  				if(this.showTong == 'tongyi'){
29cad55a   杨鑫   '验收'
86
  							
d64cd58f   wesley88   上传验收小程序
87
88
89
90
91
  				}else{
  					uni.showToast({
  						icon: 'none',
  						title: '请阅读并同意隐私政策'
  					})
29cad55a   杨鑫   '验收'
92
  					return
d64cd58f   wesley88   上传验收小程序
93
  				}
29cad55a   杨鑫   '验收'
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
  				if (this.phone == '') {
  					uni.showToast({
  						icon: 'none',
  						title: '请输入手机号'
  					})
  					return
  				}
  				if (this.code == '') {
  					uni.showToast({
  						icon: 'none',
  						title: '请输入验证码'
  					})
  					return
  				}
  
d64cd58f   wesley88   上传验收小程序
109
  				const data = {
29cad55a   杨鑫   '验收'
110
111
  					username:this.phone,
  					 code:this.code
d64cd58f   wesley88   上传验收小程序
112
  				}
29cad55a   杨鑫   '验收'
113
114
  				this.$http.sendRequest('/business/login', 'POST', data, 2).then(res => {
  					if (res.data.code == '') {
d64cd58f   wesley88   上传验收小程序
115
  						uni.setStorageSync('token', res.data.data.token);
29cad55a   杨鑫   '验收'
116
117
  						uni.setStorageSync('user', res.data.data);
  						// uni.setStorageSync('shopId', res.data.data.shopId);
d64cd58f   wesley88   上传验收小程序
118
  						uni.switchTab({
29cad55a   杨鑫   '验收'
119
  							url: '/pages/home/home'
d64cd58f   wesley88   上传验收小程序
120
  						})
29cad55a   杨鑫   '验收'
121
  					} else {
d64cd58f   wesley88   上传验收小程序
122
123
124
125
126
  						uni.showToast({
  							icon: 'none',
  							title: res.data.message
  						})
  					}
29cad55a   杨鑫   '验收'
127
128
129
  
  
  
d64cd58f   wesley88   上传验收小程序
130
131
  				})
  			},
29cad55a   杨鑫   '验收'
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
  			sendCode() {
  				if (!this.phone) {
  					uni.showToast({
  						title: '请填写手机号',
  						icon: 'none'
  					})
  					return
  				}
  				this.$http.sendRequest('/business/verification', 'POST', {
  					phone: this.phone
  				}).then(res => {
  					console.log('获取验证码', res)
  					if (res.data.code == 200) {
  						uni.showToast({
  							icon: 'none',
  							title: '发送成功'
  						})
  						if (this.num > 0) {
  							this.isTrue = true
  							this.time = setInterval(() => {
  								this.num--
  							}, 1000)
  						} else {
  							this.isTrue = false
  							clearInterval(this.time)
  						}
  					} else {
  						uni.showToast({
  							icon: 'none',
  							title: '请稍等再试'
  						})
d64cd58f   wesley88   上传验收小程序
163
  					}
29cad55a   杨鑫   '验收'
164
165
166
  
  				})
  
d64cd58f   wesley88   上传验收小程序
167
  			},
d64cd58f   wesley88   上传验收小程序
168
  		}
d64cd58f   wesley88   上传验收小程序
169
170
171
172
173
  	}
  </script>
  
  <style scoped lang="scss">
  	@import 'login.scss';
29cad55a   杨鑫   '验收'
174
  </style>