Pārlūkot izejas kodu

修改学生信息-家庭信息

316044749 7 gadi atpakaļ
vecāks
revīzija
c6152ec40a

+ 16 - 7
app/src/main/java/com/ynstkz/shitu/android/activity/StudentInfoActivity.java

@@ -24,6 +24,7 @@ import com.ynstkz.shitu.android.bean.LocalCityBean;
 import com.ynstkz.shitu.android.bean.StudentFamilyInfoBean;
 import com.ynstkz.shitu.android.bean.StudentInfoAddBean;
 import com.ynstkz.shitu.android.data.RequestGroup;
+import com.ynstkz.shitu.android.data.SharedPreferencesUtils;
 import com.ynstkz.shitu.android.view.ScrollViewWithGridView;
 
 import java.text.DateFormat;
@@ -234,6 +235,7 @@ public class StudentInfoActivity extends TitleBarActivity {
         btnSave.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
+                saveApplyFamilyInfo();
                 String studentName = editUsername.getText().toString().trim();
                 if(TextUtils.isEmpty(studentName)){
                     showToast("用户名不能为空");
@@ -413,14 +415,21 @@ public class StudentInfoActivity extends TitleBarActivity {
     private void saveApplyFamilyInfo(){
         if(llMemberFamily.getChildCount() > 0) {
             for (int i=0; i<llMemberFamily.getChildCount(); i++) {
+                LinearLayout viewMemberFamilyItem = (LinearLayout) llMemberFamily.getChildAt(i);
+
+                String tv_familyName = ((EditText)viewMemberFamilyItem.findViewById(R.id.tv_familyName)).getText().toString().trim();
+                String familyPhone = ((EditText)viewMemberFamilyItem.findViewById(R.id.edit_familyPhone)).getText().toString().trim();
+                String job = ((EditText)viewMemberFamilyItem.findViewById(R.id.edit_job)).getText().toString().trim();
+                String remark = ((EditText)viewMemberFamilyItem.findViewById(R.id.edit_remark)).getText().toString().trim();
+
                 StudentFamilyInfoBean studentFamilyInfoBean = new StudentFamilyInfoBean();
-                studentFamilyInfoBean.setFamilyName("");
+                studentFamilyInfoBean.setFamilyName(tv_familyName);
                 studentFamilyInfoBean.setFamilyId("");
-                studentFamilyInfoBean.setFamilyPhone("");
-                studentFamilyInfoBean.setJob("");
-                studentFamilyInfoBean.setRemark("");
+                studentFamilyInfoBean.setFamilyPhone(familyPhone);
+                studentFamilyInfoBean.setJob(job);
+                studentFamilyInfoBean.setRemark(remark);
                 studentFamilyInfoBean.setStudentInfoId("");
-                studentFamilyInfoBean.setUserId("");
+                studentFamilyInfoBean.setUserId(SharedPreferencesUtils.getUserId());
                 listStudentFamilyInfo.add(studentFamilyInfoBean);
             }
         }
@@ -440,8 +449,8 @@ public class StudentInfoActivity extends TitleBarActivity {
             public void onResponse(Object response, int id) {
                 StudentInfoAddBean studentInfoAddBean = (StudentInfoAddBean)response;
                 if(studentInfoAddBean != null) {
-                    if("200".equals(studentInfoAddBean.getCode())){
-                        saveApplyFamilyInfo();
+                    if("200".equals(studentInfoAddBean.getCode())){ //提交家庭信息成功
+
                     } else {
                         showToast(studentInfoAddBean.getMsg());
                     }

+ 2 - 1
app/src/main/java/com/ynstkz/shitu/android/data/RequestGroup.java

@@ -503,6 +503,7 @@ public class RequestGroup {
      * 报名-家庭成员信息
      */
     public static void applyFamilyInfo(List<StudentFamilyInfoBean> listStudentFamily, Callback callback){
-        OkHttpUtils.postString().url(UrlCat.URL_APPLY_FAMILY).content(new Gson().toJson(listStudentFamily)).build().execute(callback);
+        OkHttpUtils.postString().url(UrlCat.URL_APPLY_FAMILY).addHeader(KEY_TOKEN,
+                SharedPreferencesUtils.getToken()).content(new Gson().toJson(listStudentFamily)).build().execute(callback);
     }
 }

+ 5 - 1
app/src/main/res/layout/item_student_family.xml

@@ -75,7 +75,7 @@
             android:textSize="@dimen/company_16sp" />
 
         <EditText
-            android:id="@+id/tv_parentName"
+            android:id="@+id/tv_familyName"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_centerVertical="true"
@@ -105,6 +105,7 @@
             android:textSize="@dimen/company_16sp" />
 
         <EditText
+            android:id="@+id/edit_job"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_centerVertical="true"
@@ -163,12 +164,14 @@
             android:textSize="@dimen/company_16sp" />
 
         <EditText
+            android:id="@+id/edit_familyPhone"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_centerVertical="true"
             android:layout_marginLeft="@dimen/student_info_leftpadding"
             android:background="@null"
             android:hint="请输入"
+            android:inputType="phone"
             android:textColor="@color/color_999"
             android:textSize="@dimen/company_16sp" />
 
@@ -192,6 +195,7 @@
             android:textSize="@dimen/company_16sp" />
 
         <EditText
+            android:id="@+id/edit_remark"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_centerVertical="true"