Commit 0471108b6ad5a6516cc9e0edfe54f563ab9e410b

Authored by shixianjie
1 parent 68453f091e
Exists in master

去掉添加学生功能

... ... @@ -17,5 +17,6 @@
17 17 <option name="resolveExternalAnnotations" value="false" />
18 18 </GradleProjectSettings>
19 19 </option>
  20 + <option name="offlineMode" value="true" />
20 21 </component>
21 22 </project>
22 23 \ No newline at end of file
... ...
app/src/main/java/com/hjx/parent/ChooseActivity.java
... ... @@ -128,9 +128,6 @@ public class ChooseActivity extends BaseActivity {
128 128 }
129 129  
130 130 public void loadList() {
131   - StudentBean sb = new StudentBean();
132   - sb.setNickName("添加学生");
133   - alist.add(sb);
134 131 String student = (String) SharedPreferencesUtil.getData("student", "");
135 132 try {
136 133 StudentBean studentBean = new Gson().fromJson(student, StudentBean.class);
... ... @@ -154,13 +151,7 @@ public class ChooseActivity extends BaseActivity {
154 151 StudentBean studentBean = alist.get(item.getAdapterPosition());
155 152 item.setText(R.id.tv_name, studentBean.getNickName());
156 153 if (TextUtils.isEmpty(studentBean.getStuId())) {
157   - item.setVisible(R.id.rl_add, true);
158   - item.getConvertView().setOnClickListener(new View.OnClickListener() {
159   - @Override
160   - public void onClick(View view) {
161   - startActivity(new Intent(ChooseActivity.this, AddStudentActivity.class));
162   - }
163   - });
  154 + // do nothing
164 155 } else {
165 156 item.setBackgroundRes(R.id.rl_child, select == item.getAdapterPosition() ? R.drawable.bg_solid_white_10_or : R.drawable.bg_solid_white_10);
166 157 item.setImageResource(R.id.iv_select, select == item.getAdapterPosition() ? R.mipmap.gx : R.mipmap.wsyq);
... ...
app/src/main/java/com/hjx/parent/SmsLoginActivity.java
... ... @@ -10,11 +10,13 @@ import android.widget.Toast;
10 10  
11 11 import com.hjx.parent.databinding.ActivitySmsLoginBinding;
12 12 import com.hjx.parent.rx.BaseRxActivity;
  13 +import com.prws.common.bean.Student;
13 14 import com.prws.common.net.NetWorks;
14 15 import com.prws.common.utils.LogUtil;
15 16 import com.prws.common.utils.SharedPreferencesUtil;
16 17  
17 18 import java.util.HashMap;
  19 +import java.util.List;
18 20 import java.util.Map;
19 21 import java.util.concurrent.TimeUnit;
20 22  
... ... @@ -90,6 +92,11 @@ public class SmsLoginActivity extends BaseRxActivity&lt;ActivitySmsLoginBinding&gt; {
90 92 .subscribe((response, th) -> {
91 93 binding.btnLogin.setEnabled(true);
92 94 if (handleResponseData(response, th)) {
  95 + List<Student> list = response.getData().parentInfoList;
  96 + if (list == null || list.isEmpty()) {
  97 + showToast("未注册学生, 无法登录");
  98 + return;
  99 + }
93 100 SharedPreferencesUtil.putData("phone", phone);
94 101 SharedPreferencesUtil.putData("role", "parent");
95 102 SharedPreferencesUtil.putData("userId", response.getData().id);
... ...
app/src/main/java/com/hjx/parent/fragment/MeFragment.java
... ... @@ -145,9 +145,6 @@ public class MeFragment extends BaseFragment {
145 145 // }
146 146  
147 147 public void loadList() {
148   - StudentBean sb = new StudentBean();
149   - sb.setNickName("添加学生");
150   - alist.add(0, sb);
151 148 BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_child, alist) {
152 149 @Override
153 150 public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
... ... @@ -159,14 +156,7 @@ public class MeFragment extends BaseFragment {
159 156 StudentBean studentBean = alist.get(item.getAdapterPosition());
160 157 item.setText(R.id.tv_name, studentBean.getNickName());
161 158 if (TextUtils.isEmpty(studentBean.getStuId())) {
162   - item.setImageResource(R.id.iv_avatar, R.mipmap.tjxss);
163   - item.setVisible(R.id.iv_vip, false);
164   - item.getConvertView().setOnClickListener(new View.OnClickListener() {
165   - @Override
166   - public void onClick(View view) {
167   - startActivity(new Intent(getActivity(), AddStudentActivity.class));
168   - }
169   - });
  159 + // do nothing
170 160 } else {
171 161 if (TextUtils.isEmpty(studentBean.getPhoto())) {
172 162 item.setImageResource(R.id.iv_avatar, "男".equals(studentBean.getGender()) ? R.mipmap.ic_avatar_male : R.mipmap.ic_avatar_female);
... ...
libs/common/src/main/java/com/prws/common/bean/User.java
1 1 package com.prws.common.bean;
2 2  
  3 +import java.util.ArrayList;
  4 +
3 5 public class User {
4 6  
5 7 public String id;
... ... @@ -11,5 +13,6 @@ public class User {
11 13 public String identityName; //用户身份(普通用户、管理员、内部员工)
12 14 public String gender; //性别
13 15 public String registration; //注册方式(用户创建、员工创建)
  16 + public ArrayList<Student> parentInfoList;
14 17 public String token;
15 18 }
... ...
libs/common/src/main/java/com/prws/common/net/NetWorks.java
... ... @@ -58,7 +58,7 @@ import retrofit2.http.Url;
58 58 */
59 59 public class NetWorks extends RetrofitUtils {
60 60 //服务器路径
61   - public static final NetService service_url = getMachineRetrofit(BuildConfig.SERVER_URL).create(NetService.class);
  61 + public static final NetService service_url = getMachineRetrofit("https://mgr.hjx.com").create(NetService.class);
62 62  
63 63 //设缓存有效期为1天
64 64 protected static final long CACHE_STALE_SEC = 60 * 60 * 24 * 1;
... ...