Przeglądaj źródła

机构增加课程信息

316044749 7 lat temu
rodzic
commit
438fa9d01b

+ 76 - 0
app/src/main/java/com/ynstkz/shitu/android/bean/CourseItemBean.java

@@ -9,4 +9,80 @@ import com.ynstkz.shitu.android.base.BaseBean;
 public class CourseItemBean extends BaseBean{
 
 
+    /**
+     * courseId : 1
+     * title : 疯狂英语21天
+     * detail : 疯狂英语21天
+     * coursePic : http://pic.com
+     * price : 100
+     * marketPrice : 200
+     * memberId : 3
+     * createTime : null
+     * updateTime : null
+     * isDelete : 0
+     */
+
+    private String courseId;
+    private String title;
+    private String detail;
+    private String coursePic;
+    private int price;
+    private int marketPrice;
+    private String memberId;
+
+    public String getCourseId() {
+        return courseId;
+    }
+
+    public void setCourseId(String courseId) {
+        this.courseId = courseId;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getDetail() {
+        return detail;
+    }
+
+    public void setDetail(String detail) {
+        this.detail = detail;
+    }
+
+    public String getCoursePic() {
+        return coursePic;
+    }
+
+    public void setCoursePic(String coursePic) {
+        this.coursePic = coursePic;
+    }
+
+    public int getPrice() {
+        return price;
+    }
+
+    public void setPrice(int price) {
+        this.price = price;
+    }
+
+    public int getMarketPrice() {
+        return marketPrice;
+    }
+
+    public void setMarketPrice(int marketPrice) {
+        this.marketPrice = marketPrice;
+    }
+
+    public String getMemberId() {
+        return memberId;
+    }
+
+    public void setMemberId(String memberId) {
+        this.memberId = memberId;
+    }
 }

+ 23 - 1
app/src/main/java/com/ynstkz/shitu/android/fragment/HomeFragment.java

@@ -36,6 +36,7 @@ import com.ynstkz.shitu.android.activity.OrgListActivity;
 import com.ynstkz.shitu.android.adapter.HomeBannerAdapter;
 import com.ynstkz.shitu.android.adapter.OrgNavigationGridAdapter;
 import com.ynstkz.shitu.android.base.BaseFragment;
+import com.ynstkz.shitu.android.bean.CourseItemBean;
 import com.ynstkz.shitu.android.bean.CourseNavigationBean;
 import com.ynstkz.shitu.android.bean.HomeBannerBean;
 import com.ynstkz.shitu.android.bean.OrgItemBean;
@@ -312,12 +313,33 @@ public class HomeFragment extends BaseFragment implements PullToRefreshBase.OnRe
             TextView tv_memberName = view.findViewById(R.id.tv_memberName);
             MaterialRatingBar rb_score = view.findViewById(R.id.rb_score);
             TextView tv_regaddress = view.findViewById(R.id.tv_regaddress);
-
+            //加载机构数据
             final OrgItemBean orgItemBean = listOrg.get(i);
             Glide.with(getActivity()).load(orgItemBean.getHeadPic()).into(iv_headPic);
             tv_memberName.setText(orgItemBean.getMemberName());
             rb_score.setProgress(orgItemBean.getScore() * 2);
             tv_regaddress.setText(orgItemBean.getAddress());
+
+            //加载课程数据
+            LinearLayout llCourseMain = view.findViewById(R.id.ll_course_main);
+            if(orgItemBean.getCourseList() != null && orgItemBean.getCourseList().size() > 0){
+                llCourseMain.setVisibility(View.VISIBLE);
+                llCourseMain.removeAllViews();
+                for(int j=0; j<orgItemBean.getCourseList().size(); j++){
+                    View courseView = LayoutInflater.from(getActivity()).inflate(R.layout.item_org_course_list, null);
+                    TextView tvCourseTitle = courseView.findViewById(R.id.tv_course_title);
+                    TextView tvCoursePrice = courseView.findViewById(R.id.tv_course_price);
+                    TextView tvCourseMarketprice = courseView.findViewById(R.id.tv_course_marketprice);
+
+                    CourseItemBean courseItemBean = orgItemBean.getCourseList().get(j);
+                    tvCourseTitle.setText(courseItemBean.getTitle());
+                    tvCoursePrice.setText("¥" + courseItemBean.getPrice());
+                    tvCourseMarketprice.setText("市场价:¥" + courseItemBean.getMarketPrice());
+                    llCourseMain.addView(courseView);
+                }
+            } else {
+                llCourseMain.setVisibility(View.GONE);
+            }
             llOrgMain.addView(view);
 
             /**

+ 61 - 0
app/src/main/res/layout/item_org_course_list.xml

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <RelativeLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="@dimen/default_content_margin">
+
+        <TextView
+            android:id="@+id/tv_course_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:layout_toLeftOf="@+id/ll_price_main"
+            android:layout_alignParentLeft="true"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:textColor="@color/color_666"
+            android:textSize="@dimen/company_14sp"
+            android:text="成人英语12课时特惠班-送2课时"/>
+
+        <LinearLayout
+            android:id="@+id/ll_price_main"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            android:layout_alignParentRight="true">
+
+            <TextView
+                android:id="@+id/tv_course_price"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="right"
+                android:textSize="@dimen/company_20sp"
+                android:textColor="#ff695c"
+                android:text="$20"/>
+
+            <TextView
+                android:id="@+id/tv_course_marketprice"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="right"
+                android:layout_marginTop="@dimen/company_10dp"
+                android:textColor="@color/color_999"
+                android:textSize="11sp"
+                android:text="市场价:¥34"/>
+
+
+        </LinearLayout>
+
+    </RelativeLayout>
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/company_1dp"
+        android:background="@color/default_bg"/>
+
+</LinearLayout>

+ 13 - 1
app/src/main/res/layout/item_org_list.xml

@@ -65,11 +65,23 @@
                     android:gravity="right"
                     android:text="未名湖"/>
 
-
             </RelativeLayout>
 
         </RelativeLayout>
 
     </LinearLayout>
 
+    <LinearLayout
+        android:id="@+id/ll_course_main"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+
+    </LinearLayout>
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/company_5dp"
+        android:background="@color/default_bg"/>
+
 </LinearLayout>