1
|
<template>
|
1
|
<template>
|
2
|
- <view class="login" :style="vuex_theme">
|
|
|
3
|
- <view class="box">
|
|
|
4
|
- <view v-if="changeLogin == '账号密码登录'" class="form">
|
|
|
5
|
- <u-form :model="form" ref="uForm">
|
|
|
6
|
- <u-form-item prop="mobile"
|
|
|
7
|
- :leftIconStyle="{width:'40rpx',height:'40rpx', position:'relative', right:'8rpx'}"
|
|
|
8
|
- :left-icon="vuex_baseImgUrl && `${vuex_baseImgUrl}login_mobile.png`" borderBottom>
|
|
|
9
|
- <u-input v-model="form.mobile" border="none" maxlength='11' placeholder="请输入手机号"
|
|
|
10
|
- :customStyle="{fontSize:'17px'}" />
|
|
|
11
|
- </u-form-item>
|
|
|
12
|
- <u-form-item prop="verifyCode"
|
|
|
13
|
- :leftIconStyle="{width:'40rpx',height:'40rpx', position:'relative', right:'8rpx'}"
|
|
|
14
|
- :left-icon="vuex_baseImgUrl && `${vuex_baseImgUrl}login_code1.png`" borderBottom>
|
|
|
15
|
- <u-input v-model="form.password" border="none" placeholder="请输入验证码"
|
|
|
16
|
- :customStyle="{fontSize:'17px'}" />
|
|
|
17
|
- <u-button type="default" size="mini" slot="right" :hair-line="false"
|
|
|
18
|
- :custom-style="{color:'var(--primary-color)', border:'none',fontSize:'30rpx'}" @click="getCode">
|
|
|
19
|
- {{codeText}}
|
|
|
20
|
- </u-button>
|
|
|
21
|
- <u-code ref="uCode" @change="codeChange"></u-code>
|
|
|
22
|
- </u-form-item>
|
|
|
23
|
- </u-form>
|
|
|
24
|
- </view>
|
|
|
25
|
- <view v-else class="form">
|
|
|
26
|
- <u-form :model="form" ref="uForm">
|
|
|
27
|
- <u-form-item prop="mobile"
|
|
|
28
|
- :left-icon-style="{width:'40rpx',height:'40rpx', position:'relative', right:'8rpx'}"
|
|
|
29
|
- :left-icon="vuex_baseImgUrl && `${vuex_baseImgUrl}login_mobile.png`" borderBottom>
|
|
|
30
|
- <u-input v-model="form.mobile" border="none" placeholder="请输入账号"
|
|
|
31
|
- :customStyle="{fontSize:'17px'}" />
|
|
|
32
|
- </u-form-item>
|
|
|
33
|
- <u-form-item prop="verifyCode"
|
|
|
34
|
- :left-icon-style="{width:'40rpx',height:'40rpx', position:'relative', right:'8rpx'}"
|
|
|
35
|
- :left-icon="vuex_baseImgUrl && `${vuex_baseImgUrl}login_code2.png`" borderBottom>
|
|
|
36
|
- <u-input v-model="form.password" border="none" type='password' placeholder="请输入密码"
|
|
|
37
|
- :customStyle="{fontSize:'17px'}" />
|
|
|
38
|
- </u-form-item>
|
|
|
39
|
- </u-form>
|
|
|
40
|
- </view>
|
|
|
41
|
-
|
|
|
42
|
- <view class="btn button_warp">
|
|
|
43
|
- <c-button type="confirm" shape="circle"
|
|
|
44
|
- :customStyle="{borderRadius:'48rpx',fontSize:'34rpx',color:'#fff',fontWeight:'400'}" text="登录"
|
|
|
45
|
- :disabled="isDisable" @click="phoneLogin"></c-button>
|
|
|
46
|
- </view>
|
|
|
47
|
-
|
|
|
48
|
- <view class="changeLogin" @click="onchangeLogin">
|
|
|
49
|
- {{changeLogin}}
|
|
|
50
|
- </view>
|
|
|
51
|
-
|
|
|
52
|
- <view class="agreement">
|
|
|
53
|
- <view class="check">
|
|
|
54
|
- <u-checkbox-group @change="checkboxChange" v-model="checked">
|
|
|
55
|
- <u-checkbox size="28" activeColor="var(--primary-color)" shape="circle">
|
|
|
56
|
- </u-checkbox>
|
|
|
57
|
- </u-checkbox-group>
|
|
|
58
|
- </view>
|
|
|
59
|
- <view class="text">
|
|
|
60
|
- <text>您已阅读理解并同意</text>
|
|
|
61
|
- <text class="span" @click="linkService">《优学乐业服务协议》、</text>
|
|
|
62
|
- <text class="span" @click="linkPolicy">《优学乐业隐私政策》</text>
|
|
|
63
|
- </view>
|
|
|
64
|
- </view>
|
|
|
65
|
- </view>
|
|
|
66
|
- <view>
|
|
|
67
|
- <u-toast ref="uToast" />
|
|
|
68
|
- </view>
|
|
|
69
|
- </view>
|
2
|
+ <view class="login" :style="vuex_theme">
|
|
|
3
|
+ <view class="box">
|
|
|
4
|
+ <view v-if="changeLogin == '账号密码登录'" class="form">
|
|
|
5
|
+ <u-form :model="form" ref="uForm">
|
|
|
6
|
+ <u-form-item
|
|
|
7
|
+ prop="mobile"
|
|
|
8
|
+ :leftIconStyle="{
|
|
|
9
|
+ width: '40rpx',
|
|
|
10
|
+ height: '40rpx',
|
|
|
11
|
+ position: 'relative',
|
|
|
12
|
+ right: '8rpx',
|
|
|
13
|
+ }"
|
|
|
14
|
+ :left-icon="vuex_baseImgUrl && `${vuex_baseImgUrl}login_mobile.png`"
|
|
|
15
|
+ borderBottom
|
|
|
16
|
+ >
|
|
|
17
|
+ <u-input
|
|
|
18
|
+ v-model="form.mobile"
|
|
|
19
|
+ border="none"
|
|
|
20
|
+ maxlength="11"
|
|
|
21
|
+ placeholder="请输入手机号"
|
|
|
22
|
+ :customStyle="{ fontSize: '17px' }"
|
|
|
23
|
+ />
|
|
|
24
|
+ </u-form-item>
|
|
|
25
|
+ <u-form-item
|
|
|
26
|
+ prop="verifyCode"
|
|
|
27
|
+ :leftIconStyle="{
|
|
|
28
|
+ width: '40rpx',
|
|
|
29
|
+ height: '40rpx',
|
|
|
30
|
+ position: 'relative',
|
|
|
31
|
+ right: '8rpx',
|
|
|
32
|
+ }"
|
|
|
33
|
+ :left-icon="vuex_baseImgUrl && `${vuex_baseImgUrl}login_code1.png`"
|
|
|
34
|
+ borderBottom
|
|
|
35
|
+ >
|
|
|
36
|
+ <u-input
|
|
|
37
|
+ v-model="form.password"
|
|
|
38
|
+ border="none"
|
|
|
39
|
+ placeholder="请输入验证码"
|
|
|
40
|
+ :customStyle="{ fontSize: '17px' }"
|
|
|
41
|
+ />
|
|
|
42
|
+ <u-button
|
|
|
43
|
+ type="default"
|
|
|
44
|
+ size="mini"
|
|
|
45
|
+ slot="right"
|
|
|
46
|
+ :hair-line="false"
|
|
|
47
|
+ :custom-style="{
|
|
|
48
|
+ color: 'var(--primary-color)',
|
|
|
49
|
+ border: 'none',
|
|
|
50
|
+ fontSize: '30rpx',
|
|
|
51
|
+ }"
|
|
|
52
|
+ @click="getCode"
|
|
|
53
|
+ >
|
|
|
54
|
+ {{ codeText }}
|
|
|
55
|
+ </u-button>
|
|
|
56
|
+ <u-code ref="uCode" @change="codeChange"></u-code>
|
|
|
57
|
+ </u-form-item>
|
|
|
58
|
+ </u-form>
|
|
|
59
|
+ </view>
|
|
|
60
|
+ <view v-else class="form">
|
|
|
61
|
+ <u-form :model="form" ref="uForm">
|
|
|
62
|
+ <u-form-item
|
|
|
63
|
+ prop="mobile"
|
|
|
64
|
+ :left-icon-style="{
|
|
|
65
|
+ width: '40rpx',
|
|
|
66
|
+ height: '40rpx',
|
|
|
67
|
+ position: 'relative',
|
|
|
68
|
+ right: '8rpx',
|
|
|
69
|
+ }"
|
|
|
70
|
+ :left-icon="vuex_baseImgUrl && `${vuex_baseImgUrl}login_mobile.png`"
|
|
|
71
|
+ borderBottom
|
|
|
72
|
+ >
|
|
|
73
|
+ <u-input
|
|
|
74
|
+ v-model="form.mobile"
|
|
|
75
|
+ border="none"
|
|
|
76
|
+ placeholder="请输入账号"
|
|
|
77
|
+ :customStyle="{ fontSize: '17px' }"
|
|
|
78
|
+ />
|
|
|
79
|
+ </u-form-item>
|
|
|
80
|
+ <u-form-item
|
|
|
81
|
+ prop="verifyCode"
|
|
|
82
|
+ :left-icon-style="{
|
|
|
83
|
+ width: '40rpx',
|
|
|
84
|
+ height: '40rpx',
|
|
|
85
|
+ position: 'relative',
|
|
|
86
|
+ right: '8rpx',
|
|
|
87
|
+ }"
|
|
|
88
|
+ :left-icon="vuex_baseImgUrl && `${vuex_baseImgUrl}login_code2.png`"
|
|
|
89
|
+ borderBottom
|
|
|
90
|
+ >
|
|
|
91
|
+ <u-input
|
|
|
92
|
+ v-model="form.password"
|
|
|
93
|
+ border="none"
|
|
|
94
|
+ type="password"
|
|
|
95
|
+ placeholder="请输入密码"
|
|
|
96
|
+ :customStyle="{ fontSize: '17px' }"
|
|
|
97
|
+ />
|
|
|
98
|
+ </u-form-item>
|
|
|
99
|
+ </u-form>
|
|
|
100
|
+ </view>
|
|
|
101
|
+
|
|
|
102
|
+ <view class="btn button_warp">
|
|
|
103
|
+ <c-button
|
|
|
104
|
+ type="confirm"
|
|
|
105
|
+ shape="circle"
|
|
|
106
|
+ :customStyle="{
|
|
|
107
|
+ borderRadius: '48rpx',
|
|
|
108
|
+ fontSize: '34rpx',
|
|
|
109
|
+ color: '#fff',
|
|
|
110
|
+ fontWeight: '400',
|
|
|
111
|
+ }"
|
|
|
112
|
+ text="登录"
|
|
|
113
|
+ :disabled="isDisable"
|
|
|
114
|
+ @click="phoneLogin"
|
|
|
115
|
+ ></c-button>
|
|
|
116
|
+ </view>
|
|
|
117
|
+
|
|
|
118
|
+ <view class="changeLogin" @click="onchangeLogin">
|
|
|
119
|
+ {{ changeLogin }}
|
|
|
120
|
+ </view>
|
|
|
121
|
+
|
|
|
122
|
+ <view class="agreement">
|
|
|
123
|
+ <view class="check">
|
|
|
124
|
+ <u-checkbox-group @change="checkboxChange" v-model="checked">
|
|
|
125
|
+ <u-checkbox
|
|
|
126
|
+ size="28"
|
|
|
127
|
+ activeColor="var(--primary-color)"
|
|
|
128
|
+ shape="circle"
|
|
|
129
|
+ >
|
|
|
130
|
+ </u-checkbox>
|
|
|
131
|
+ </u-checkbox-group>
|
|
|
132
|
+ </view>
|
|
|
133
|
+ <view class="text">
|
|
|
134
|
+ <text>您已阅读理解并同意</text>
|
|
|
135
|
+ <text class="span" @click="linkService">《服务协议》、</text>
|
|
|
136
|
+ <text class="span" @click="linkPolicy">《隐私政策》</text>
|
|
|
137
|
+ </view>
|
|
|
138
|
+ </view>
|
|
|
139
|
+ </view>
|
|
|
140
|
+ <view>
|
|
|
141
|
+ <u-toast ref="uToast" />
|
|
|
142
|
+ </view>
|
|
|
143
|
+ </view>
|
70
|
</template>
|
144
|
</template>
|
71
|
|
145
|
|
72
|
<script>
|
146
|
<script>
|
73
|
- import {
|
|
|
74
|
- mapState,
|
|
|
75
|
- mapActions
|
|
|
76
|
- } from 'vuex'
|
|
|
77
|
- import {
|
|
|
78
|
- getSmsCodeApi,
|
|
|
79
|
- } from '@/config/api.js';
|
|
|
80
|
- import md5 from '@/common/md5';
|
|
|
81
|
-
|
|
|
82
|
- export default {
|
|
|
83
|
- data() {
|
|
|
84
|
- return {
|
|
|
85
|
- errorType: 'toast',
|
|
|
86
|
- isDisable: true,
|
|
|
87
|
- checked: [],
|
|
|
88
|
- service: "https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/agreement/%E3%80%8A%E4%BC%98%E5%AD%A6%E4%B9%90%E4%B8%9A%E7%94%A8%E6%88%B7%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E3%80%8B.htm",
|
|
|
89
|
- policy: "https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/agreement/%E3%80%8A%E4%BC%98%E5%AD%A6%E4%B9%90%E4%B8%9A%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE%E3%80%8B.htm",
|
|
|
90
|
- form: {
|
|
|
91
|
- mobile: '',
|
|
|
92
|
- password: '',
|
|
|
93
|
- },
|
|
|
94
|
- changeLogin: '账号密码登录',
|
|
|
95
|
- codeText: '发送验证码',
|
|
|
96
|
- }
|
|
|
97
|
- },
|
|
|
98
|
-
|
|
|
99
|
- onLoad() {
|
|
|
100
|
- const {
|
|
|
101
|
- dispatch
|
|
|
102
|
- } = this.$store;
|
|
|
103
|
-
|
|
|
104
|
- },
|
|
|
105
|
-
|
|
|
106
|
- onShow() {
|
|
|
107
|
-
|
|
|
108
|
- },
|
|
|
109
|
-
|
|
|
110
|
- watch: {
|
|
|
111
|
- checked: function(newVal, oldVal) {
|
|
|
112
|
- this.isDisable = newVal.length != 0 ? false : true;
|
|
|
113
|
-
|
|
|
114
|
- }
|
|
|
115
|
- },
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
- computed: {
|
|
|
119
|
- ...mapState('user', {
|
|
|
120
|
- // 箭头函数可使代码更简练
|
|
|
121
|
- isReg: 'isReg',
|
|
|
122
|
-
|
|
|
123
|
- }),
|
|
|
124
|
- },
|
|
|
125
|
-
|
|
|
126
|
- methods: {
|
|
|
127
|
-
|
|
|
128
|
- onchangeLogin() {
|
|
|
129
|
- if (this.changeLogin == '验证码登录') {
|
|
|
130
|
- this.changeLogin = '账号密码登录';
|
|
|
131
|
- } else {
|
|
|
132
|
- this.changeLogin = '验证码登录';
|
|
|
133
|
- }
|
|
|
134
|
- },
|
|
|
135
|
-
|
|
|
136
|
- linkService() {
|
|
|
137
|
- console.log(this)
|
|
|
138
|
- this.$u.route({
|
|
|
139
|
- url: `/pages/common/webview/webview?navtitle=服务协议&url=${this.service}`,
|
|
|
140
|
- })
|
|
|
141
|
- },
|
|
|
142
|
-
|
|
|
143
|
- linkPolicy() {
|
|
|
144
|
- this.$u.route({
|
|
|
145
|
- url: `/pages/common/webview/webview?navtitle=隐私政策&url=${this.policy}`,
|
|
|
146
|
- })
|
|
|
147
|
- },
|
|
|
148
|
-
|
|
|
149
|
- checkboxChange(n) {
|
|
|
150
|
- // console.log(n)
|
|
|
151
|
- },
|
|
|
152
|
-
|
|
|
153
|
- getUserProfile() {
|
|
|
154
|
- // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
|
|
|
155
|
- // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
|
|
|
156
|
- wx.getUserProfile({
|
|
|
157
|
- desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
158
|
- success: (res) => {
|
|
|
159
|
- console.log('getUserProfile...', res)
|
|
|
160
|
- // this.$store.commit('setWenxinUserInfo', res);
|
|
|
161
|
- this.$u.vuex('vuex_weixinUserInfo', res.userInfo);
|
|
|
162
|
- }
|
|
|
163
|
- })
|
|
|
164
|
- },
|
|
|
165
|
-
|
|
|
166
|
- codeChange(text) {
|
|
|
167
|
- this.codeText = text;
|
|
|
168
|
- },
|
|
|
169
|
-
|
|
|
170
|
- getCode() {
|
|
|
171
|
- const {
|
|
|
172
|
- mobile = ''
|
|
|
173
|
- } = this.form;
|
|
|
174
|
-
|
|
|
175
|
- if (!(mobile && /^1[0-9]{10}$/.test(mobile))) {
|
|
|
176
|
- this.$refs.uToast.show({
|
|
|
177
|
- message: '请填写正确手机号',
|
|
|
178
|
- type: 'error',
|
|
|
179
|
- duration: 1500,
|
|
|
180
|
- })
|
|
|
181
|
-
|
|
|
182
|
- } else {
|
|
|
183
|
- if (this.$refs.uCode.canGetCode) {
|
|
|
184
|
- // 模拟向后端请求验证码
|
|
|
185
|
- uni.showLoading({
|
|
|
186
|
- title: '正在获取验证码'
|
|
|
187
|
- })
|
|
|
188
|
- setTimeout(() => {
|
|
|
189
|
- uni.hideLoading();
|
|
|
190
|
- // 通知验证码组件内部开始倒计时
|
|
|
191
|
- this.$refs.uCode.start();
|
|
|
192
|
-
|
|
|
193
|
- console.log(mobile)
|
|
|
194
|
-
|
|
|
195
|
- getSmsCodeApi({
|
|
|
196
|
- phone: mobile
|
|
|
197
|
- })
|
|
|
198
|
-
|
|
|
199
|
- }, 1000);
|
|
|
200
|
- } else {
|
|
|
201
|
- this.$u.toast('倒计时结束后再发送');
|
|
|
202
|
- }
|
|
|
203
|
- }
|
|
|
204
|
- },
|
|
|
205
|
-
|
|
|
206
|
- phoneLogin() {
|
|
|
207
|
- if (this.changeLogin == '账号密码登录') {
|
|
|
208
|
- this.$store.dispatch(`user/login`, {
|
|
|
209
|
- way: 'code',
|
|
|
210
|
- type: 'teacher',
|
|
|
211
|
- phone: this.form.mobile,
|
|
|
212
|
- code: this.form.password,
|
|
|
213
|
- })
|
|
|
214
|
- } else {
|
|
|
215
|
- console.log(md5.hex_md5(this.form.password));
|
|
|
216
|
- this.$store.dispatch(`user/login`, {
|
|
|
217
|
- way: 'name',
|
|
|
218
|
- type: 'teacher',
|
|
|
219
|
- username: this.form.mobile,
|
|
|
220
|
- password: md5.hex_md5(this.form.password),
|
|
|
221
|
- })
|
|
|
222
|
- }
|
|
|
223
|
- },
|
|
|
224
|
- }
|
|
|
225
|
-
|
|
|
226
|
- }
|
147
|
+import { mapState, mapActions } from "vuex";
|
|
|
148
|
+import { getSmsCodeApi } from "@/config/api.js";
|
|
|
149
|
+import md5 from "@/common/md5";
|
|
|
150
|
+
|
|
|
151
|
+export default {
|
|
|
152
|
+ data() {
|
|
|
153
|
+ return {
|
|
|
154
|
+ errorType: "toast",
|
|
|
155
|
+ isDisable: true,
|
|
|
156
|
+ checked: [],
|
|
|
157
|
+ service: "https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/agreement/%E3%80%8A%E4%BC%98%E5%AD%A6%E4%B9%90%E4%B8%9A%E7%94%A8%E6%88%B7%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E3%80%8B.htm",
|
|
|
158
|
+ policy: "https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/agreement/%E3%80%8A%E4%BC%98%E5%AD%A6%E4%B9%90%E4%B8%9A%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE%E3%80%8B.htm",
|
|
|
159
|
+ form: {
|
|
|
160
|
+ mobile: "",
|
|
|
161
|
+ password: "",
|
|
|
162
|
+ },
|
|
|
163
|
+ changeLogin: "账号密码登录",
|
|
|
164
|
+ codeText: "发送验证码",
|
|
|
165
|
+ };
|
|
|
166
|
+ },
|
|
|
167
|
+
|
|
|
168
|
+ onLoad() {
|
|
|
169
|
+ if (this.vuex_appId == 'wxac18386e35824192') {
|
|
|
170
|
+ // 新华
|
|
|
171
|
+ this.service = "http://hropublic.oss-cn-beijing.aliyuncs.com/APP/xhsx/1-%20%E6%96%B0%E5%8D%8E%E5%AE%9E%E4%B9%A0%E7%94%A8%E6%88%B7%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE(%E6%B8%85%E6%B4%81%E7%89%88).html"
|
|
|
172
|
+ this.policy = "http://hropublic.oss-cn-beijing.aliyuncs.com/APP/xhsx/1.1-%20%E6%96%B0%E5%8D%8E%E5%AE%9E%E4%B9%A0%E9%9A%90%E7%A7%81%E6%94%BF%E7%AD%96(%E6%B8%85%E6%B4%81%E7%89%88).html"
|
|
|
173
|
+ }
|
|
|
174
|
+ },
|
|
|
175
|
+
|
|
|
176
|
+ onShow() {},
|
|
|
177
|
+
|
|
|
178
|
+ watch: {
|
|
|
179
|
+ checked: function (newVal, oldVal) {
|
|
|
180
|
+ this.isDisable = newVal.length != 0 ? false : true;
|
|
|
181
|
+ },
|
|
|
182
|
+ },
|
|
|
183
|
+
|
|
|
184
|
+ computed: {
|
|
|
185
|
+ ...mapState("user", {
|
|
|
186
|
+ // 箭头函数可使代码更简练
|
|
|
187
|
+ isReg: "isReg",
|
|
|
188
|
+ }),
|
|
|
189
|
+ },
|
|
|
190
|
+
|
|
|
191
|
+ methods: {
|
|
|
192
|
+ onchangeLogin() {
|
|
|
193
|
+ if (this.changeLogin == "验证码登录") {
|
|
|
194
|
+ this.changeLogin = "账号密码登录";
|
|
|
195
|
+ } else {
|
|
|
196
|
+ this.changeLogin = "验证码登录";
|
|
|
197
|
+ }
|
|
|
198
|
+ },
|
|
|
199
|
+
|
|
|
200
|
+ linkService() {
|
|
|
201
|
+ console.log(this);
|
|
|
202
|
+ this.$u.route({
|
|
|
203
|
+ url: `/pages/common/webview/webview?navtitle=服务协议&url=${this.service}`,
|
|
|
204
|
+ });
|
|
|
205
|
+ },
|
|
|
206
|
+
|
|
|
207
|
+ linkPolicy() {
|
|
|
208
|
+ this.$u.route({
|
|
|
209
|
+ url: `/pages/common/webview/webview?navtitle=隐私政策&url=${this.policy}`,
|
|
|
210
|
+ });
|
|
|
211
|
+ },
|
|
|
212
|
+
|
|
|
213
|
+ checkboxChange(n) {
|
|
|
214
|
+ // console.log(n)
|
|
|
215
|
+ },
|
|
|
216
|
+
|
|
|
217
|
+ getUserProfile() {
|
|
|
218
|
+ // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
|
|
|
219
|
+ // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
|
|
|
220
|
+ wx.getUserProfile({
|
|
|
221
|
+ desc: "用于完善会员资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
222
|
+ success: (res) => {
|
|
|
223
|
+ console.log("getUserProfile...", res);
|
|
|
224
|
+ // this.$store.commit('setWenxinUserInfo', res);
|
|
|
225
|
+ this.$u.vuex("vuex_weixinUserInfo", res.userInfo);
|
|
|
226
|
+ },
|
|
|
227
|
+ });
|
|
|
228
|
+ },
|
|
|
229
|
+
|
|
|
230
|
+ codeChange(text) {
|
|
|
231
|
+ this.codeText = text;
|
|
|
232
|
+ },
|
|
|
233
|
+
|
|
|
234
|
+ getCode() {
|
|
|
235
|
+ const { mobile = "" } = this.form;
|
|
|
236
|
+
|
|
|
237
|
+ if (!(mobile && /^1[0-9]{10}$/.test(mobile))) {
|
|
|
238
|
+ this.$refs.uToast.show({
|
|
|
239
|
+ message: "请填写正确手机号",
|
|
|
240
|
+ type: "error",
|
|
|
241
|
+ duration: 1500,
|
|
|
242
|
+ });
|
|
|
243
|
+ } else {
|
|
|
244
|
+ if (this.$refs.uCode.canGetCode) {
|
|
|
245
|
+ // 模拟向后端请求验证码
|
|
|
246
|
+ uni.showLoading({
|
|
|
247
|
+ title: "正在获取验证码",
|
|
|
248
|
+ });
|
|
|
249
|
+ setTimeout(() => {
|
|
|
250
|
+ uni.hideLoading();
|
|
|
251
|
+ // 通知验证码组件内部开始倒计时
|
|
|
252
|
+ this.$refs.uCode.start();
|
|
|
253
|
+
|
|
|
254
|
+ console.log(mobile);
|
|
|
255
|
+
|
|
|
256
|
+ getSmsCodeApi({
|
|
|
257
|
+ phone: mobile,
|
|
|
258
|
+ });
|
|
|
259
|
+ }, 1000);
|
|
|
260
|
+ } else {
|
|
|
261
|
+ this.$u.toast("倒计时结束后再发送");
|
|
|
262
|
+ }
|
|
|
263
|
+ }
|
|
|
264
|
+ },
|
|
|
265
|
+
|
|
|
266
|
+ phoneLogin() {
|
|
|
267
|
+ if (this.changeLogin == "账号密码登录") {
|
|
|
268
|
+ this.$store.dispatch(`user/login`, {
|
|
|
269
|
+ way: "code",
|
|
|
270
|
+ type: "teacher",
|
|
|
271
|
+ phone: this.form.mobile,
|
|
|
272
|
+ code: this.form.password,
|
|
|
273
|
+ });
|
|
|
274
|
+ } else {
|
|
|
275
|
+ console.log(md5.hex_md5(this.form.password));
|
|
|
276
|
+ this.$store.dispatch(`user/login`, {
|
|
|
277
|
+ way: "name",
|
|
|
278
|
+ type: "teacher",
|
|
|
279
|
+ username: this.form.mobile,
|
|
|
280
|
+ password: md5.hex_md5(this.form.password),
|
|
|
281
|
+ });
|
|
|
282
|
+ }
|
|
|
283
|
+ },
|
|
|
284
|
+ },
|
|
|
285
|
+};
|
227
|
</script>
|
286
|
</script>
|
228
|
|
287
|
|
229
|
<style lang="scss" scoped>
|
288
|
<style lang="scss" scoped>
|
230
|
- .login {
|
|
|
231
|
- width: 100%;
|
|
|
232
|
- height: 100%;
|
|
|
233
|
- position: relative;
|
|
|
234
|
-
|
|
|
235
|
- .box {
|
|
|
236
|
- width: 100%;
|
|
|
237
|
- height: 100%;
|
|
|
238
|
- position: absolute;
|
|
|
239
|
- top: 0;
|
|
|
240
|
- left: 0;
|
|
|
241
|
-
|
|
|
242
|
- .logo {
|
|
|
243
|
- padding: 156rpx 0 0 0;
|
|
|
244
|
- width: 120rpx;
|
|
|
245
|
- margin: 0 auto;
|
|
|
246
|
- }
|
|
|
247
|
-
|
|
|
248
|
- .name {
|
|
|
249
|
- margin: 32rpx 0 0 0;
|
|
|
250
|
- text-align: center;
|
|
|
251
|
- font-size: 48rpx;
|
|
|
252
|
- line-height: 66rpx;
|
|
|
253
|
- color: #000000;
|
|
|
254
|
- font-weight: 600;
|
|
|
255
|
- }
|
|
|
256
|
-
|
|
|
257
|
- .changeLogin {
|
|
|
258
|
- width: 100%;
|
|
|
259
|
- text-align: center;
|
|
|
260
|
- margin: 48rpx 0 0 0;
|
|
|
261
|
- font-size: 15px;
|
|
|
262
|
- font-weight: 400;
|
|
|
263
|
- color: var(--primary-color);
|
|
|
264
|
- }
|
|
|
265
|
-
|
|
|
266
|
- .agreement {
|
|
|
267
|
- position: fixed;
|
|
|
268
|
- left: 0;
|
|
|
269
|
- bottom: 34rpx;
|
|
|
270
|
- display: flex;
|
|
|
271
|
- flex-direction: row;
|
|
|
272
|
- justify-content: flex-start;
|
|
|
273
|
- font-size: 24rpx;
|
|
|
274
|
- margin: 30rpx 0 32rpx 0;
|
|
|
275
|
- padding: 0 50rpx;
|
|
|
276
|
-
|
|
|
277
|
- .check {
|
|
|
278
|
- width: 40rpx;
|
|
|
279
|
- padding: 5rpx 0 0 0;
|
|
|
280
|
- // display: inline-block;
|
|
|
281
|
- }
|
|
|
282
|
-
|
|
|
283
|
- .text {
|
|
|
284
|
- // display: inline-block;
|
|
|
285
|
- color: rgba(0, 0, 0, 0.45);
|
|
|
286
|
-
|
|
|
287
|
- .span {
|
|
|
288
|
- color: var(--primary-color);
|
|
|
289
|
- }
|
|
|
290
|
- }
|
|
|
291
|
- }
|
|
|
292
|
-
|
|
|
293
|
- .form {
|
|
|
294
|
- margin: 128rpx 60rpx 0px;
|
|
|
295
|
- }
|
|
|
296
|
-
|
|
|
297
|
- .btn {
|
|
|
298
|
- margin-top: 128rpx;
|
|
|
299
|
- padding: 0 48rpx;
|
|
|
300
|
- }
|
|
|
301
|
-
|
|
|
302
|
- .wxLogin {
|
|
|
303
|
- display: flex;
|
|
|
304
|
- align-items: center;
|
|
|
305
|
- flex-direction: column;
|
|
|
306
|
- margin-top: 180rpx;
|
|
|
307
|
-
|
|
|
308
|
- button {
|
|
|
309
|
- background-color: transparent;
|
|
|
310
|
- }
|
|
|
311
|
-
|
|
|
312
|
- button::after {
|
|
|
313
|
- border: initial
|
|
|
314
|
- }
|
|
|
315
|
-
|
|
|
316
|
- image {
|
|
|
317
|
- width: 96rpx;
|
|
|
318
|
- height: 96rpx;
|
|
|
319
|
- }
|
|
|
320
|
-
|
|
|
321
|
- text {
|
|
|
322
|
- margin-top: 0rpx;
|
|
|
323
|
- }
|
|
|
324
|
- }
|
|
|
325
|
- }
|
|
|
326
|
- }
|
289
|
+.login {
|
|
|
290
|
+ width: 100%;
|
|
|
291
|
+ height: 100%;
|
|
|
292
|
+ position: relative;
|
|
|
293
|
+
|
|
|
294
|
+ .box {
|
|
|
295
|
+ width: 100%;
|
|
|
296
|
+ height: 100%;
|
|
|
297
|
+ position: absolute;
|
|
|
298
|
+ top: 0;
|
|
|
299
|
+ left: 0;
|
|
|
300
|
+
|
|
|
301
|
+ .logo {
|
|
|
302
|
+ padding: 156rpx 0 0 0;
|
|
|
303
|
+ width: 120rpx;
|
|
|
304
|
+ margin: 0 auto;
|
|
|
305
|
+ }
|
|
|
306
|
+
|
|
|
307
|
+ .name {
|
|
|
308
|
+ margin: 32rpx 0 0 0;
|
|
|
309
|
+ text-align: center;
|
|
|
310
|
+ font-size: 48rpx;
|
|
|
311
|
+ line-height: 66rpx;
|
|
|
312
|
+ color: #000000;
|
|
|
313
|
+ font-weight: 600;
|
|
|
314
|
+ }
|
|
|
315
|
+
|
|
|
316
|
+ .changeLogin {
|
|
|
317
|
+ width: 100%;
|
|
|
318
|
+ text-align: center;
|
|
|
319
|
+ margin: 48rpx 0 0 0;
|
|
|
320
|
+ font-size: 15px;
|
|
|
321
|
+ font-weight: 400;
|
|
|
322
|
+ color: var(--primary-color);
|
|
|
323
|
+ }
|
|
|
324
|
+
|
|
|
325
|
+ .agreement {
|
|
|
326
|
+ position: fixed;
|
|
|
327
|
+ left: 0;
|
|
|
328
|
+ bottom: 34rpx;
|
|
|
329
|
+ display: flex;
|
|
|
330
|
+ flex-direction: row;
|
|
|
331
|
+ justify-content: flex-start;
|
|
|
332
|
+ font-size: 24rpx;
|
|
|
333
|
+ margin: 30rpx 0 32rpx 0;
|
|
|
334
|
+ padding: 0 50rpx;
|
|
|
335
|
+
|
|
|
336
|
+ .check {
|
|
|
337
|
+ width: 40rpx;
|
|
|
338
|
+ padding: 5rpx 0 0 0;
|
|
|
339
|
+ // display: inline-block;
|
|
|
340
|
+ }
|
|
|
341
|
+
|
|
|
342
|
+ .text {
|
|
|
343
|
+ // display: inline-block;
|
|
|
344
|
+ color: rgba(0, 0, 0, 0.45);
|
|
|
345
|
+
|
|
|
346
|
+ .span {
|
|
|
347
|
+ color: var(--primary-color);
|
|
|
348
|
+ }
|
|
|
349
|
+ }
|
|
|
350
|
+ }
|
|
|
351
|
+
|
|
|
352
|
+ .form {
|
|
|
353
|
+ margin: 128rpx 60rpx 0px;
|
|
|
354
|
+ }
|
|
|
355
|
+
|
|
|
356
|
+ .btn {
|
|
|
357
|
+ margin-top: 128rpx;
|
|
|
358
|
+ padding: 0 48rpx;
|
|
|
359
|
+ }
|
|
|
360
|
+
|
|
|
361
|
+ .wxLogin {
|
|
|
362
|
+ display: flex;
|
|
|
363
|
+ align-items: center;
|
|
|
364
|
+ flex-direction: column;
|
|
|
365
|
+ margin-top: 180rpx;
|
|
|
366
|
+
|
|
|
367
|
+ button {
|
|
|
368
|
+ background-color: transparent;
|
|
|
369
|
+ }
|
|
|
370
|
+
|
|
|
371
|
+ button::after {
|
|
|
372
|
+ border: initial;
|
|
|
373
|
+ }
|
|
|
374
|
+
|
|
|
375
|
+ image {
|
|
|
376
|
+ width: 96rpx;
|
|
|
377
|
+ height: 96rpx;
|
|
|
378
|
+ }
|
|
|
379
|
+
|
|
|
380
|
+ text {
|
|
|
381
|
+ margin-top: 0rpx;
|
|
|
382
|
+ }
|
|
|
383
|
+ }
|
|
|
384
|
+ }
|
|
|
385
|
+}
|
327
|
</style> |
386
|
</style> |