Commit aee2ca753c4969a260521fa0b1310137e128965e
1 parent
7243a5da59
Exists in
master
家长与教师分开登录
Showing
9 changed files
with
456 additions
and
133 deletions
Show diff stats
app/src/main/AndroidManifest.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | 3 | xmlns:tools="http://schemas.android.com/tools" |
4 | - package="com.hjx.parent"> | |
4 | + package="com.hjx.parent" | |
5 | + tools:ignore="LockedOrientationActivity"> | |
5 | 6 | |
6 | 7 | |
8 | + <uses-feature | |
9 | + android:name="android.hardware.camera" | |
10 | + android:required="false" /> | |
11 | + | |
7 | 12 | <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> |
8 | 13 | <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 允许程序改变网络链接状态 --> |
9 | 14 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许程序访问访问WIFI网络状态信息 --> |
... | ... | @@ -44,10 +49,6 @@ |
44 | 49 | android:exported="true" |
45 | 50 | android:screenOrientation="portrait" |
46 | 51 | android:theme="@style/ThemeSplash"> |
47 | - <intent-filter> | |
48 | - <action android:name="android.intent.action.MAIN" /> | |
49 | - <category android:name="android.intent.category.LAUNCHER" /> | |
50 | - </intent-filter> | |
51 | 52 | </activity> |
52 | 53 | <activity |
53 | 54 | android:name=".MainActivity" |
... | ... | @@ -134,6 +135,15 @@ |
134 | 135 | <activity android:name=".HomeworkTopicActivity" /> |
135 | 136 | <activity android:name=".HomeworkShareActivity" /> |
136 | 137 | <activity android:name=".HuyouDetailActivity" /> |
138 | + <activity android:name=".SmsLoginActivity" | |
139 | + android:exported="true" | |
140 | + android:screenOrientation="portrait" | |
141 | + android:theme="@style/ThemeSplash"> | |
142 | + <intent-filter> | |
143 | + <action android:name="android.intent.action.MAIN" /> | |
144 | + <category android:name="android.intent.category.LAUNCHER" /> | |
145 | + </intent-filter> | |
146 | + </activity> | |
137 | 147 | |
138 | 148 | <provider |
139 | 149 | android:name="androidx.core.content.FileProvider" | ... | ... |
app/src/main/java/com/hjx/parent/AccountActivity.java
... | ... | @@ -362,7 +362,7 @@ public class AccountActivity extends BaseActivity { |
362 | 362 | |
363 | 363 | private void restartApp() { |
364 | 364 | //重启app,这一步一定要加上,如果不重启app,可能打开新的页面显示的语言会不正确 |
365 | - Intent intent = new Intent(this, LoginActivity.class); | |
365 | + Intent intent = new Intent(this, SmsLoginActivity.class); | |
366 | 366 | intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK); |
367 | 367 | startActivity(intent); |
368 | 368 | android.os.Process.killProcess(android.os.Process.myPid()); | ... | ... |
app/src/main/java/com/hjx/parent/LoginActivity.java
... | ... | @@ -43,10 +43,6 @@ public class LoginActivity extends BaseActivity { |
43 | 43 | ImageView iv_show; |
44 | 44 | ImageView iv_delete; |
45 | 45 | Button btn_login; |
46 | - TextView tv_reg; | |
47 | - CheckBox cb_1; | |
48 | - TextView tv_user; | |
49 | - TextView tv_ys; | |
50 | 46 | |
51 | 47 | |
52 | 48 | @Override |
... | ... | @@ -72,11 +68,6 @@ public class LoginActivity extends BaseActivity { |
72 | 68 | iv_show = findViewById(R.id.iv_4); |
73 | 69 | iv_delete = findViewById(R.id.iv_2); |
74 | 70 | btn_login = findViewById(R.id.btn_1); |
75 | - tv_reg = findViewById(R.id.tv_2); | |
76 | - cb_1 = findViewById(R.id.cb_1); | |
77 | - tv_user = findViewById(R.id.tv_4); | |
78 | - tv_ys = findViewById(R.id.tv_6); | |
79 | - | |
80 | 71 | |
81 | 72 | String student = (String) SharedPreferencesUtil.getData("student", ""); |
82 | 73 | |
... | ... | @@ -96,6 +87,10 @@ public class LoginActivity extends BaseActivity { |
96 | 87 | LogUtil.e(TAG, "role 是空----"); |
97 | 88 | } |
98 | 89 | |
90 | + findViewById(R.id.tvBack).setOnClickListener(v -> { | |
91 | + startActivity(new Intent(this, SmsLoginActivity.class)); | |
92 | + finish(); | |
93 | + }); | |
99 | 94 | |
100 | 95 | } |
101 | 96 | |
... | ... | @@ -131,26 +126,21 @@ public class LoginActivity extends BaseActivity { |
131 | 126 | return; |
132 | 127 | } |
133 | 128 | |
134 | - if (!cb_1.isChecked()) { | |
135 | - Toast.makeText(this, "请勾选协议", Toast.LENGTH_SHORT).show(); | |
136 | - return; | |
137 | - } | |
129 | +// if (!cb_1.isChecked()) { | |
130 | +// Toast.makeText(this, "请勾选协议", Toast.LENGTH_SHORT).show(); | |
131 | +// return; | |
132 | +// } | |
138 | 133 | |
139 | 134 | login(phone, pwd); |
140 | 135 | |
141 | 136 | }); |
142 | 137 | |
143 | - tv_reg.setOnClickListener(view -> { | |
144 | - startActivity(RegisterActivity.class); | |
145 | - finish(); | |
146 | - }); | |
147 | - | |
148 | - tv_ys.setOnClickListener(view -> { | |
149 | - startActivity(YinsiActivity.class); | |
150 | - }); | |
151 | - tv_user.setOnClickListener(view -> { | |
152 | - startActivity(UserAgreementActivity.class); | |
153 | - }); | |
138 | +// tv_ys.setOnClickListener(view -> { | |
139 | +// startActivity(YinsiActivity.class); | |
140 | +// }); | |
141 | +// tv_user.setOnClickListener(view -> { | |
142 | +// startActivity(UserAgreementActivity.class); | |
143 | +// }); | |
154 | 144 | } |
155 | 145 | |
156 | 146 | public void login(final String phone, String pwd) { |
... | ... | @@ -176,18 +166,7 @@ public class LoginActivity extends BaseActivity { |
176 | 166 | if (isSucceed) { |
177 | 167 | JSONObject jo2 = jo.getJSONObject("data"); |
178 | 168 | String role = jo2.getString("role"); |
179 | - if ("parent".equals(role)) { | |
180 | - SharedPreferencesUtil.putData("phone", phone); | |
181 | - SharedPreferencesUtil.putData("role", role); | |
182 | - SharedPreferencesUtil.putData("userId", jo2.getString("id")); | |
183 | - SharedPreferencesUtil.putData("token", jo2.getString("token")); | |
184 | - if (jo2.has("photo") && !jo2.getString("photo").equals("null")) { | |
185 | - SharedPreferencesUtil.putData("photo", jo2.getString("photo")); | |
186 | - } | |
187 | - SharedPreferencesUtil.putData("name", jo2.getString("username")); | |
188 | - startActivity(ChooseActivity.class); | |
189 | - finish(); | |
190 | - } else if ("member_advisor".equals(role) || "teaching_supervision".equals(role)) { | |
169 | + if ("member_advisor".equals(role) || "teaching_supervision".equals(role)) { | |
191 | 170 | SharedPreferencesUtil.putData("phone", phone); |
192 | 171 | SharedPreferencesUtil.putData("role", role); |
193 | 172 | SharedPreferencesUtil.putData("userId", jo2.getString("id")); | ... | ... |
app/src/main/java/com/hjx/parent/SmsLoginActivity.java
... | ... | @@ -0,0 +1,151 @@ |
1 | +package com.hjx.parent; | |
2 | + | |
3 | +import android.annotation.SuppressLint; | |
4 | +import android.content.Intent; | |
5 | +import android.os.Bundle; | |
6 | +import android.telephony.PhoneNumberUtils; | |
7 | +import android.text.TextUtils; | |
8 | +import android.view.View; | |
9 | +import android.widget.Toast; | |
10 | + | |
11 | +import com.hjx.parent.databinding.ActivitySmsLoginBinding; | |
12 | +import com.hjx.parent.rx.BaseRxActivity; | |
13 | +import com.prws.common.net.NetWorks; | |
14 | +import com.prws.common.utils.LogUtil; | |
15 | +import com.prws.common.utils.SharedPreferencesUtil; | |
16 | + | |
17 | +import java.util.HashMap; | |
18 | +import java.util.Map; | |
19 | +import java.util.concurrent.TimeUnit; | |
20 | + | |
21 | +import io.reactivex.Observable; | |
22 | +import io.reactivex.android.schedulers.AndroidSchedulers; | |
23 | +import io.reactivex.disposables.Disposable; | |
24 | + | |
25 | +public class SmsLoginActivity extends BaseRxActivity<ActivitySmsLoginBinding> { | |
26 | + private final NetWorks.NetService api = NetWorks.service_url; | |
27 | + @Override | |
28 | + public void initView(Bundle savedInstanceState) { | |
29 | + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE); | |
30 | + | |
31 | + String student = (String) SharedPreferencesUtil.getData("student", ""); | |
32 | + | |
33 | + if (!TextUtils.isEmpty(student)) { | |
34 | + if ((SharedPreferencesUtil.getData("role", "")).equals("parent")) { | |
35 | + Intent intent = new Intent(this, MainActivity.class); | |
36 | + startActivity(intent); | |
37 | + finish(); | |
38 | + } else { | |
39 | + Intent intent = new Intent(this, TeacherMainActivity.class); | |
40 | + startActivity(intent); | |
41 | + finish(); | |
42 | + } | |
43 | + return; | |
44 | + } | |
45 | + | |
46 | + binding.tvEntrance.setOnClickListener(v -> { | |
47 | + startActivity(new Intent(this, LoginActivity.class)); | |
48 | + finish(); | |
49 | + }); | |
50 | + binding.btnGetCode.setOnClickListener(v -> { | |
51 | + String phone = binding.etPhone.getText().toString().trim(); | |
52 | + if (phone.isEmpty()) { | |
53 | + showToast("请输入手机号"); | |
54 | + return; | |
55 | + } | |
56 | + sendCode(phone); | |
57 | + }); | |
58 | + binding.btnLogin.setOnClickListener(v -> { | |
59 | + | |
60 | + String phone = binding.etPhone.getText().toString().trim(); | |
61 | + String code = binding.etCode.getText().toString().trim(); | |
62 | + if (phone.isEmpty() || code.isEmpty()) { | |
63 | + Toast.makeText(this, "手机号以及验证码不能为空", Toast.LENGTH_SHORT).show(); | |
64 | + return; | |
65 | + } | |
66 | + | |
67 | + if (!binding.chkPermission.isChecked()) { | |
68 | + Toast.makeText(this, "请勾选协议", Toast.LENGTH_SHORT).show(); | |
69 | + return; | |
70 | + } | |
71 | + login(phone, code); | |
72 | + }); | |
73 | + | |
74 | + binding.tv6.setOnClickListener(view -> { | |
75 | + startActivity(new Intent(this, YinsiActivity.class)); | |
76 | + }); | |
77 | + binding.tv4.setOnClickListener(view -> { | |
78 | + startActivity(new Intent(this, UserAgreementActivity.class)); | |
79 | + }); | |
80 | + } | |
81 | + | |
82 | + @SuppressLint("CheckResult") | |
83 | + private void login(String phone, String code) { | |
84 | + binding.btnLogin.setEnabled(false); | |
85 | + Map<String, String> body = new HashMap<>(); | |
86 | + body.put("phone", phone); | |
87 | + body.put("code", code); | |
88 | + api.smsLogin(body) | |
89 | + .compose(transformSingle()) | |
90 | + .subscribe((response, th) -> { | |
91 | + binding.btnLogin.setEnabled(true); | |
92 | + if (handleResponseData(response, th)) { | |
93 | + SharedPreferencesUtil.putData("phone", phone); | |
94 | + SharedPreferencesUtil.putData("role", "parent"); | |
95 | + SharedPreferencesUtil.putData("userId", response.getData().id); | |
96 | + SharedPreferencesUtil.putData("token", response.getData().token); | |
97 | + SharedPreferencesUtil.putData("name", response.getData().username); | |
98 | + startActivity(new Intent(this, ChooseActivity.class)); | |
99 | + finish(); | |
100 | + } | |
101 | + }); | |
102 | + } | |
103 | + | |
104 | + @SuppressLint({"SetTextI18n", "CheckResult"}) | |
105 | + private void sendCode(String phone) { | |
106 | + binding.btnGetCode.setEnabled(false); | |
107 | + api.smsCode(phone) | |
108 | + .compose(transformSingle()) | |
109 | + .subscribe((response, th) -> { | |
110 | + if (handleResponse(response, th)) { | |
111 | + showToast("验证码已发送"); | |
112 | + timeDown(); | |
113 | + } else { | |
114 | + if (disposable != null) disposable.dispose(); | |
115 | + binding.btnGetCode.setText("获取验证码"); | |
116 | + binding.btnGetCode.setEnabled(true); | |
117 | + } | |
118 | + }); | |
119 | + } | |
120 | + | |
121 | + private int timeDown = 0; | |
122 | + private Disposable disposable; | |
123 | + @SuppressLint("SetTextI18n") | |
124 | + private void timeDown() { | |
125 | + timeDown = 60; | |
126 | + disposable = Observable | |
127 | + .interval(0, 1, TimeUnit.SECONDS) | |
128 | + .observeOn(AndroidSchedulers.mainThread()) | |
129 | + .subscribe(l -> { | |
130 | + if (--timeDown <= 0) { | |
131 | + if (disposable != null) disposable.dispose(); | |
132 | + binding.btnGetCode.setText("获取验证码"); | |
133 | + binding.btnGetCode.setEnabled(true); | |
134 | + } else { | |
135 | + binding.btnGetCode.setText("获取验证码(" + timeDown + "s)"); | |
136 | + binding.btnGetCode.setEnabled(false); | |
137 | + } | |
138 | + }, Throwable::printStackTrace); | |
139 | + } | |
140 | + | |
141 | + @Override | |
142 | + protected void onDestroy() { | |
143 | + super.onDestroy(); | |
144 | + if (disposable != null) disposable.dispose(); | |
145 | + } | |
146 | + | |
147 | + @Override | |
148 | + protected ActivitySmsLoginBinding getViewBinding() { | |
149 | + return ActivitySmsLoginBinding.inflate(getLayoutInflater()); | |
150 | + } | |
151 | +} | ... | ... |
app/src/main/java/com/hjx/parent/rx/BaseRxActivity.java
... | ... | @@ -6,6 +6,7 @@ import androidx.annotation.Nullable; |
6 | 6 | import androidx.viewbinding.ViewBinding; |
7 | 7 | |
8 | 8 | import com.hjx.parent.BaseActivity; |
9 | +import com.prws.common.bean.ResponseResult; | |
9 | 10 | import com.trello.rxlifecycle2.android.ActivityEvent; |
10 | 11 | |
11 | 12 | import io.reactivex.subjects.BehaviorSubject; |
... | ... | @@ -54,4 +55,26 @@ public abstract class BaseRxActivity<VB extends ViewBinding> extends BaseActivit |
54 | 55 | rxLifecycle.onNext(ActivityEvent.DESTROY); |
55 | 56 | } |
56 | 57 | |
58 | + public <T> boolean handleResponse(ResponseResult<T> response, Throwable t) { | |
59 | + if (t != null) { | |
60 | + t.printStackTrace(); | |
61 | + showToast(t.getMessage()); | |
62 | + } | |
63 | + if (response == null) return false; | |
64 | + if (response.getSuccess() != null && response.getSuccess()) { | |
65 | + return true; | |
66 | + } else { | |
67 | + if (response.getMsg() != null && !response.getMsg().isEmpty()) { | |
68 | + showToast(response.getMsg()); | |
69 | + } | |
70 | + return false; | |
71 | + } | |
72 | + } | |
73 | + | |
74 | + public <T> boolean handleResponseData(ResponseResult<T> response, Throwable t) { | |
75 | + if (handleResponse(response, t)) { | |
76 | + return response.getData() != null; | |
77 | + } | |
78 | + return false; | |
79 | + } | |
57 | 80 | } | ... | ... |
app/src/main/res/layout/activity_login.xml
... | ... | @@ -7,11 +7,23 @@ |
7 | 7 | |
8 | 8 | |
9 | 9 | <TextView |
10 | + android:id="@+id/tvBack" | |
11 | + android:text="家长登录" | |
12 | + android:textSize="13sp" | |
13 | + android:textColor="#666" | |
14 | + android:layout_width="wrap_content" | |
15 | + android:layout_height="wrap_content" | |
16 | + android:layout_marginTop="72dp" | |
17 | + android:layout_marginEnd="30dp" | |
18 | + app:layout_constraintTop_toTopOf="parent" | |
19 | + app:layout_constraintEnd_toEndOf="parent"/> | |
20 | + | |
21 | + <TextView | |
10 | 22 | android:layout_width="wrap_content" |
11 | 23 | android:layout_height="wrap_content" |
12 | 24 | android:layout_marginLeft="30dp" |
13 | 25 | android:layout_marginTop="64dp" |
14 | - android:text="登录" | |
26 | + android:text="教师登录" | |
15 | 27 | android:textColor="#333333" |
16 | 28 | android:textSize="25dp" |
17 | 29 | android:textStyle="bold" |
... | ... | @@ -127,95 +139,5 @@ |
127 | 139 | app:layout_constraintRight_toRightOf="parent" |
128 | 140 | app:layout_constraintTop_toTopOf="parent" /> |
129 | 141 | |
130 | - <TextView | |
131 | - android:id="@+id/tv_1" | |
132 | - android:layout_width="wrap_content" | |
133 | - android:layout_height="wrap_content" | |
134 | - android:layout_marginLeft="85dp" | |
135 | - android:layout_marginTop="15dp" | |
136 | - android:text="没有账号,立即" | |
137 | - android:textColor="#666666" | |
138 | - android:textSize="17dp" | |
139 | - app:layout_constraintLeft_toLeftOf="@id/btn_1" | |
140 | - app:layout_constraintTop_toBottomOf="@id/btn_1" /> | |
141 | - | |
142 | - <TextView | |
143 | - android:id="@+id/tv_2" | |
144 | - android:layout_width="wrap_content" | |
145 | - android:layout_height="wrap_content" | |
146 | - android:layout_marginTop="15dp" | |
147 | - android:text="注册" | |
148 | - android:textColor="#FE5E09" | |
149 | - android:textSize="17dp" | |
150 | - app:layout_constraintLeft_toRightOf="@id/tv_1" | |
151 | - app:layout_constraintTop_toBottomOf="@id/btn_1" /> | |
152 | - | |
153 | - | |
154 | - <CheckBox | |
155 | - android:id="@+id/cb_1" | |
156 | - android:layout_width="wrap_content" | |
157 | - android:layout_height="wrap_content" | |
158 | - android:layout_marginLeft="67dp" | |
159 | - android:layout_marginBottom="50dp" | |
160 | - android:background="@android:color/transparent" | |
161 | - app:layout_constraintBottom_toBottomOf="parent" | |
162 | - app:layout_constraintLeft_toLeftOf="parent" /> | |
163 | - | |
164 | - <TextView | |
165 | - android:id="@+id/tv_3" | |
166 | - android:layout_width="wrap_content" | |
167 | - android:layout_height="wrap_content" | |
168 | - android:layout_marginLeft="5dp" | |
169 | - android:text="已阅读并同意《" | |
170 | - android:textColor="#999999" | |
171 | - android:textSize="12dp" | |
172 | - app:layout_constraintBottom_toBottomOf="@id/cb_1" | |
173 | - app:layout_constraintLeft_toRightOf="@id/cb_1" | |
174 | - app:layout_constraintTop_toTopOf="@id/cb_1" /> | |
175 | - | |
176 | - <TextView | |
177 | - android:id="@+id/tv_4" | |
178 | - android:layout_width="wrap_content" | |
179 | - android:layout_height="wrap_content" | |
180 | - android:text="用户协议" | |
181 | - android:textColor="#FE5E09" | |
182 | - android:textSize="12dp" | |
183 | - app:layout_constraintBottom_toBottomOf="@id/cb_1" | |
184 | - app:layout_constraintLeft_toRightOf="@id/tv_3" | |
185 | - app:layout_constraintTop_toTopOf="@id/cb_1" /> | |
186 | - | |
187 | - <TextView | |
188 | - android:id="@+id/tv_5" | |
189 | - android:layout_width="wrap_content" | |
190 | - android:layout_height="wrap_content" | |
191 | - android:text="》和《" | |
192 | - android:textColor="#999999" | |
193 | - android:textSize="12dp" | |
194 | - app:layout_constraintBottom_toBottomOf="@id/cb_1" | |
195 | - app:layout_constraintLeft_toRightOf="@id/tv_4" | |
196 | - app:layout_constraintTop_toTopOf="@id/cb_1" /> | |
197 | - | |
198 | - <TextView | |
199 | - android:id="@+id/tv_6" | |
200 | - android:layout_width="wrap_content" | |
201 | - android:layout_height="wrap_content" | |
202 | - android:text="隐私政策" | |
203 | - android:textColor="#FE5E09" | |
204 | - android:textSize="12dp" | |
205 | - app:layout_constraintBottom_toBottomOf="@id/cb_1" | |
206 | - app:layout_constraintLeft_toRightOf="@id/tv_5" | |
207 | - app:layout_constraintTop_toTopOf="@id/cb_1" /> | |
208 | - | |
209 | - <TextView | |
210 | - android:id="@+id/tv_7" | |
211 | - android:layout_width="wrap_content" | |
212 | - android:layout_height="wrap_content" | |
213 | - android:text="》" | |
214 | - android:textColor="#999999" | |
215 | - android:textSize="12dp" | |
216 | - app:layout_constraintBottom_toBottomOf="@id/cb_1" | |
217 | - app:layout_constraintLeft_toRightOf="@id/tv_6" | |
218 | - app:layout_constraintTop_toTopOf="@id/cb_1" /> | |
219 | - | |
220 | 142 | |
221 | 143 | </androidx.constraintlayout.widget.ConstraintLayout> |
222 | 144 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/activity_sms_login.xml
... | ... | @@ -0,0 +1,216 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
4 | + xmlns:tools="http://schemas.android.com/tools" | |
5 | + android:layout_width="match_parent" | |
6 | + android:layout_height="match_parent" | |
7 | + android:background="@mipmap/bg" | |
8 | + tools:ignore="HardcodedText,SpUsage,ContentDescription,Autofill"> | |
9 | + | |
10 | + | |
11 | + <TextView | |
12 | + android:layout_width="wrap_content" | |
13 | + android:layout_height="wrap_content" | |
14 | + android:layout_marginStart="30dp" | |
15 | + android:layout_marginTop="64dp" | |
16 | + android:text="登录" | |
17 | + android:textColor="#333333" | |
18 | + android:textSize="25dp" | |
19 | + android:textStyle="bold" | |
20 | + app:layout_constraintLeft_toLeftOf="parent" | |
21 | + app:layout_constraintTop_toTopOf="parent" /> | |
22 | + | |
23 | + <TextView | |
24 | + android:id="@+id/tvEntrance" | |
25 | + android:text="教师入口" | |
26 | + android:textSize="13sp" | |
27 | + android:textColor="#666" | |
28 | + android:layout_width="wrap_content" | |
29 | + android:layout_height="wrap_content" | |
30 | + android:layout_marginTop="72dp" | |
31 | + android:layout_marginEnd="30dp" | |
32 | + app:layout_constraintTop_toTopOf="parent" | |
33 | + app:layout_constraintEnd_toEndOf="parent"/> | |
34 | + | |
35 | + <View | |
36 | + android:id="@+id/view_1" | |
37 | + android:layout_width="315dp" | |
38 | + android:layout_height="50dp" | |
39 | + android:layout_marginTop="166dp" | |
40 | + android:background="@drawable/bg_solid_white" | |
41 | + app:layout_constraintLeft_toLeftOf="parent" | |
42 | + app:layout_constraintRight_toRightOf="parent" | |
43 | + app:layout_constraintTop_toTopOf="parent" /> | |
44 | + | |
45 | + <ImageView | |
46 | + android:id="@+id/iv_1" | |
47 | + android:layout_width="16dp" | |
48 | + android:layout_height="18dp" | |
49 | + android:layout_marginStart="20dp" | |
50 | + android:background="@mipmap/sjh" | |
51 | + app:layout_constraintBottom_toBottomOf="@id/view_1" | |
52 | + app:layout_constraintLeft_toLeftOf="@id/view_1" | |
53 | + app:layout_constraintTop_toTopOf="@id/view_1" /> | |
54 | + | |
55 | + <ImageView | |
56 | + android:id="@+id/iv_2" | |
57 | + android:layout_width="13dp" | |
58 | + android:layout_height="13dp" | |
59 | + android:layout_marginEnd="20dp" | |
60 | + android:background="@mipmap/sc" | |
61 | + app:layout_constraintBottom_toBottomOf="@id/view_1" | |
62 | + app:layout_constraintRight_toRightOf="@id/view_1" | |
63 | + app:layout_constraintTop_toTopOf="@id/view_1" /> | |
64 | + | |
65 | + <EditText | |
66 | + android:id="@+id/etPhone" | |
67 | + android:layout_width="0dp" | |
68 | + android:layout_height="0dp" | |
69 | + android:layout_marginStart="46dp" | |
70 | + android:background="@android:color/transparent" | |
71 | + android:gravity="start|center_vertical" | |
72 | + android:hint="请输入手机号" | |
73 | + android:inputType="number" | |
74 | + android:maxLength="11" | |
75 | + android:textColorHint="#999999" | |
76 | + android:textSize="16dp" | |
77 | + app:layout_constraintBottom_toBottomOf="@id/view_1" | |
78 | + app:layout_constraintLeft_toLeftOf="@id/view_1" | |
79 | + app:layout_constraintRight_toLeftOf="@id/iv_2" | |
80 | + app:layout_constraintTop_toTopOf="@id/view_1" | |
81 | + tools:ignore="TextFields" /> | |
82 | + | |
83 | + | |
84 | + <View | |
85 | + android:id="@+id/view_2" | |
86 | + android:layout_width="315dp" | |
87 | + android:layout_height="50dp" | |
88 | + android:layout_marginTop="241dp" | |
89 | + android:background="@drawable/bg_solid_white" | |
90 | + app:layout_constraintLeft_toLeftOf="parent" | |
91 | + app:layout_constraintRight_toRightOf="parent" | |
92 | + app:layout_constraintTop_toTopOf="parent" /> | |
93 | + | |
94 | + <ImageView | |
95 | + android:id="@+id/iv_3" | |
96 | + android:layout_width="16dp" | |
97 | + android:layout_height="18dp" | |
98 | + android:layout_marginStart="20dp" | |
99 | + android:background="@mipmap/mm" | |
100 | + app:layout_constraintBottom_toBottomOf="@id/view_2" | |
101 | + app:layout_constraintLeft_toLeftOf="@id/view_2" | |
102 | + app:layout_constraintTop_toTopOf="@id/view_2" /> | |
103 | + | |
104 | + <TextView | |
105 | + android:id="@+id/btnGetCode" | |
106 | + android:text="获取验证码" | |
107 | + android:textSize="13dp" | |
108 | + android:textColor="#999" | |
109 | + android:layout_width="wrap_content" | |
110 | + android:layout_height="wrap_content" | |
111 | + android:layout_marginEnd="20dp" | |
112 | + app:layout_constraintBottom_toBottomOf="@id/view_2" | |
113 | + app:layout_constraintRight_toRightOf="@id/view_2" | |
114 | + app:layout_constraintTop_toTopOf="@id/view_2" /> | |
115 | + | |
116 | + <EditText | |
117 | + android:id="@+id/etCode" | |
118 | + android:maxLength="6" | |
119 | + android:layout_width="0dp" | |
120 | + android:layout_height="0dp" | |
121 | + android:layout_marginStart="46dp" | |
122 | + android:layout_marginEnd="20dp" | |
123 | + android:background="@android:color/transparent" | |
124 | + android:gravity="start|center_vertical" | |
125 | + android:hint="请输入验证码" | |
126 | + android:inputType="number" | |
127 | + android:textColorHint="#999999" | |
128 | + android:textSize="16dp" | |
129 | + app:layout_constraintBottom_toBottomOf="@id/view_2" | |
130 | + app:layout_constraintLeft_toLeftOf="@id/view_2" | |
131 | + app:layout_constraintRight_toLeftOf="@id/btnGetCode" | |
132 | + app:layout_constraintTop_toTopOf="@id/view_2" /> | |
133 | + | |
134 | + | |
135 | + <Button | |
136 | + android:id="@+id/btnLogin" | |
137 | + android:layout_width="315dp" | |
138 | + android:layout_height="50dp" | |
139 | + android:layout_marginTop="331dp" | |
140 | + android:background="@drawable/bg_solid_btn" | |
141 | + android:text="登录" | |
142 | + android:textColor="@color/white" | |
143 | + android:textSize="18dp" | |
144 | + app:layout_constraintLeft_toLeftOf="parent" | |
145 | + app:layout_constraintRight_toRightOf="parent" | |
146 | + app:layout_constraintTop_toTopOf="parent" /> | |
147 | + | |
148 | + | |
149 | + <CheckBox | |
150 | + android:id="@+id/chkPermission" | |
151 | + android:layout_width="wrap_content" | |
152 | + android:layout_height="wrap_content" | |
153 | + android:layout_marginStart="67dp" | |
154 | + android:layout_marginBottom="50dp" | |
155 | + android:background="@android:color/transparent" | |
156 | + app:layout_constraintBottom_toBottomOf="parent" | |
157 | + app:layout_constraintLeft_toLeftOf="parent" /> | |
158 | + | |
159 | + <TextView | |
160 | + android:id="@+id/tv_3" | |
161 | + android:layout_width="wrap_content" | |
162 | + android:layout_height="wrap_content" | |
163 | + android:layout_marginStart="5dp" | |
164 | + android:text="已阅读并同意《" | |
165 | + android:textColor="#999999" | |
166 | + android:textSize="12dp" | |
167 | + app:layout_constraintBottom_toBottomOf="@id/chkPermission" | |
168 | + app:layout_constraintLeft_toRightOf="@id/chkPermission" | |
169 | + app:layout_constraintTop_toTopOf="@id/chkPermission" /> | |
170 | + | |
171 | + <TextView | |
172 | + android:id="@+id/tv_4" | |
173 | + android:layout_width="wrap_content" | |
174 | + android:layout_height="wrap_content" | |
175 | + android:text="用户协议" | |
176 | + android:textColor="#FE5E09" | |
177 | + android:textSize="12dp" | |
178 | + app:layout_constraintBottom_toBottomOf="@id/chkPermission" | |
179 | + app:layout_constraintLeft_toRightOf="@id/tv_3" | |
180 | + app:layout_constraintTop_toTopOf="@id/chkPermission" /> | |
181 | + | |
182 | + <TextView | |
183 | + android:id="@+id/tv_5" | |
184 | + android:layout_width="wrap_content" | |
185 | + android:layout_height="wrap_content" | |
186 | + android:text="》和《" | |
187 | + android:textColor="#999999" | |
188 | + android:textSize="12dp" | |
189 | + app:layout_constraintBottom_toBottomOf="@id/chkPermission" | |
190 | + app:layout_constraintLeft_toRightOf="@id/tv_4" | |
191 | + app:layout_constraintTop_toTopOf="@id/chkPermission" /> | |
192 | + | |
193 | + <TextView | |
194 | + android:id="@+id/tv_6" | |
195 | + android:layout_width="wrap_content" | |
196 | + android:layout_height="wrap_content" | |
197 | + android:text="隐私政策" | |
198 | + android:textColor="#FE5E09" | |
199 | + android:textSize="12dp" | |
200 | + app:layout_constraintBottom_toBottomOf="@id/chkPermission" | |
201 | + app:layout_constraintLeft_toRightOf="@id/tv_5" | |
202 | + app:layout_constraintTop_toTopOf="@id/chkPermission" /> | |
203 | + | |
204 | + <TextView | |
205 | + android:id="@+id/tv_7" | |
206 | + android:layout_width="wrap_content" | |
207 | + android:layout_height="wrap_content" | |
208 | + android:text="》" | |
209 | + android:textColor="#999999" | |
210 | + android:textSize="12dp" | |
211 | + app:layout_constraintBottom_toBottomOf="@id/chkPermission" | |
212 | + app:layout_constraintLeft_toRightOf="@id/tv_6" | |
213 | + app:layout_constraintTop_toTopOf="@id/chkPermission" /> | |
214 | + | |
215 | + | |
216 | +</androidx.constraintlayout.widget.ConstraintLayout> | |
0 | 217 | \ No newline at end of file | ... | ... |
libs/common/src/main/java/com/prws/common/bean/User.java
... | ... | @@ -0,0 +1,15 @@ |
1 | +package com.prws.common.bean; | |
2 | + | |
3 | +public class User { | |
4 | + | |
5 | + public String id; | |
6 | + public String phone; | |
7 | + public String account; | |
8 | + public String password; | |
9 | + public String username; | |
10 | + public String identity; //用户身份(NORMAL,ADMIN,EMPLOYEE) | |
11 | + public String identityName; //用户身份(普通用户、管理员、内部员工) | |
12 | + public String gender; //性别 | |
13 | + public String registration; //注册方式(用户创建、员工创建) | |
14 | + public String token; | |
15 | +} | ... | ... |
libs/common/src/main/java/com/prws/common/net/NetWorks.java
... | ... | @@ -13,6 +13,7 @@ import com.prws.common.bean.Student; |
13 | 13 | import com.prws.common.bean.Teacher; |
14 | 14 | import com.prws.common.bean.TopicBean; |
15 | 15 | import com.prws.common.bean.UpdateBean; |
16 | +import com.prws.common.bean.User; | |
16 | 17 | import com.prws.common.bean.baidu.BaiduInput; |
17 | 18 | import com.prws.common.bean.homework.HomeWork; |
18 | 19 | import com.prws.common.bean.homework.HomeworkDetail; |
... | ... | @@ -250,6 +251,12 @@ public class NetWorks extends RetrofitUtils { |
250 | 251 | @Query("homeworkStatisticsId") String homeworkId |
251 | 252 | ); |
252 | 253 | |
254 | + @GET("api/v1/login/smsCode") | |
255 | + Single<ResponseResult<String>> smsCode(@Query("mobile") String mobile); | |
256 | + | |
257 | + @POST("api/v1/login/smsLogin") | |
258 | + Single<ResponseResult<User>> smsLogin(@Body Object body); | |
259 | + | |
253 | 260 | } |
254 | 261 | |
255 | 262 | public static String getUserId() { | ... | ... |