Blame view

pages/login/login.vue 4.71 KB
1f3f2378   起风了   我的第一次
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  <template>

  	<view style="background-color: #fff;height: 100vh;">

  		<view style="width: 80%;margin: 0 auto;">

  			<view class="" style="margin-bottom: 150rpx;">

  				<image src="http://antis14.sherkxuan.cn/assets/images/a4.jpg" mode="widthFix"></image>

  			</view>

  			<view>

  				<view class='content'>

  					<view>申请获取以下权限</view>

  					<text>获得你的公开信息(手机号等)</text>

  				</view>

  				<button class='bottom' type='primary' lang="zh_CN" open-type="getPhoneNumber"

  					@getphonenumber="decryptPhoneNumber">

  					一键授权登录

  				</button>

  			</view>

  			<view class="xiey">

  				

  			</view>

  				<!-- <u-checkbox 

  					@change="checkboxChange" 

  					v-model="item.checked" 

  					v-for="(item, index) in list" :key="index" 

  					:name="item.name"

  				></u-checkbox> -->

  				<!-- 我已认证阅读并同意接受 -->

  			<!-- <text style="color: #179b16;">《用户协议》</text></view> -->

  		</view>

  	</view>

  </template>

  

  <script>

  	import service from '@/service/service.js'

  	export default {

  		data() {

  			return {

  				list:[

  					{

  						checked:false,

  						checked:false,

  						name:"xz"

  					}

  				],

  				formss:{

  					account:'admin',

  					password:'e10adc3949ba59abbe56e057f20f883e'

  				},

  				code: '',

  				listdata: {},

  				aesIv: '',

  				encryptedData: '',

  				// 上级绑定下级用户

  				form: {

  					CommissionerUserId: 0,

  					ManagerUserId: 0,

  				},

  				// 类型

  				// Type:0,

  				model: {

  					username: '',

  					picture: ''

  				},

  				// 授权手机登录之后的信息

  				LoginWeCharData: {

  					"aesIv": "",

  					"encryptedData": "",

  					"code": ""

  				},

  				scene: ''

  			}

  		},

  

  		// 打开页面的时候

  		onLoad(data) {

  			this.getCode()

  		},

  		methods: {

  			checkboxChange(e){

  				console.log("xz",e);

  				this.list[0].value = e;

  			},

  			//1,code

  			getCode() {

  				//获取code

  				let that = this

  				uni.login({

  					// provider:'sskxjht',

  					success(res) {

  						that.LoginWeCharData.code = res.code

  						console.log("code",res);

  					}

  				})

  			},

  			goNav(url) {

  				uni.navigateTo({

  					url: url

  				})

  			},

  			gain() {

  				// const token = uni.getStorageSync("token");

  				// if (!token) return

4325c47c   李宇   1
102
  				this.API.getplie1({

1f3f2378   起风了   我的第一次
103
  					pageNum: 1,

4325c47c   李宇   1
104
  					pageSize: 80000

1f3f2378   起风了   我的第一次
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
  				}).then(response => {

  					console.log(response, '界桩')

  					let box1 = []

  					for (let i = 0; i < response.rows.length; i++) {

  						const newlist = response.rows[i];

  						if (i == 0) {

  							let c1 = '四川省眉山市仁寿县' + newlist.boundaryName

  							box1.push(c1)

  						} else {

  							let ontrue = false

  							for (let q = 0; q < box1.length; q++) {

  								if (box1[q] == '四川省眉山市仁寿县' + newlist.boundaryName) {

  									ontrue = true

  									break

  								}

  							}

  							if (ontrue) {

  			

  							} else {

  								let c1 = '四川省眉山市仁寿县' + newlist.boundaryName

  								box1.push(c1)

  							}

  			

  						}

  					}

  					getApp().globalData.list1 = box1

  					console.log('行政', getApp().globalData.list1)

  				})

  			},

  			// 获取手机号

  			decryptPhoneNumber(e) {

  				console.log(e);

  				this.LoginWeCharData.aesIv = e.detail.iv;

  				this.LoginWeCharData.encryptedData = e.detail.encryptedData;

  				console.log('获取手机号信息',JSON.stringify(this.LoginWeCharData))

  				console.log('1111',this.LoginWeCharData,this.list[0].value);

  					console.log(this.LoginWeCharData);

  					this.API.postLogin(this.LoginWeCharData).then(res=>{

  						console.log('res',res);

  						service.saveUser(res.data.user);

  						service.addToken(res.data.token);
  						uni.setStorageSync("userjs", res.data.roles[0]);

  						this.gain()

  						if(res.code == 200){

  							uni.reLaunch({

  								url:"/pages/home/home"

  							})

  						}

  					})

  					if(this.list[0].value){

  				}

  				

  				

  			},

  

  		}

  	}

  </script>

  

  <style lang="scss" scoped>

  	.login{

  		padding: 30rpx;

  		button{

  			background-color: #e85b49;

  			border-radius: 50rpx;

  			margin-top: 60rpx;

  			color:#fff

  		}

  	}

  	.bg{

  		position: fixed;

  		width: 100%;

  		height: 100%;

  		top: 0;

  		left: 0;

  		z-index: -1;

  	}

  	.header {

  		margin-bottom: 20rpx;

  		margin-top: 30rpx;

  		padding: 40rpx;

  		padding-top: 0rpx;

  		width: 100vw;

  		position: relative;

  		image{

  			width: 50vw;

  			height: 10vh;

  			margin-top: 40rpx;

  		}

  		

  	}

  	.content {

  		margin-left: 50rpx;

  		margin-bottom: 90rpx;

  	}

  

  	.content text {

  		display: block;

  		color: #9d9d9d;

  		margin-top: 40rpx;

  	}

  

  	.bottom {

  		border-radius: 80rpx;

  		margin: 70rpx 50rpx;

  		font-size: 35rpx;

  	}

  

  	.xiey {

  		text-align: center;

  		font-weight: 600;

  		font-size: 26rpx;

  		margin-left: 10rpx;

  		line-height: 40rpx;

  	}

  </style>