tangxi 3 years ago
parent b0e2420b7f
commit f36087bbdd

@ -142,7 +142,7 @@ public class CatProductController {
file.transferTo(destFile);
}
map.put("flag", true);
map.put("data", "http://10.21.91.105:8081/uploaded/" + fileName);
map.put("data", "http://192.168.1.9:8081/uploaded/" + fileName);
return map;
} catch (Exception e) {
map.put("flag", false);

@ -88,7 +88,7 @@ public class CatShoppingCartController {
file.transferTo(destFile);
}
map.put("flag", true);
map.put("data", "http://10.21.91.105:8081/uploaded/" + fileName);
map.put("data", "http://192.168.1.9:8081/uploaded/" + fileName);
return map;
} catch (Exception e) {
map.put("flag", false);

@ -3,7 +3,7 @@ spring.datasource.url=jdbc:mysql://localhost:3306/orange?useUnicode=true&charact
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.password=tx511520
#开启驼峰自动转换
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.mapper-locations=classpath:mapper/*Mapper.xml

@ -0,0 +1,70 @@
package com.example.catapp.adapter;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.catapp.R;
import com.example.catapp.entity.Product;
import java.util.List;
public class CartAdapter extends BaseAdapter {
private List<Product> cartList;
private LayoutInflater layoutInflater;
public CartAdapter(Context context, List<Product> productList) {
this.cartList = productList;
this.layoutInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return cartList.size();
}
@Override
public Object getItem(int position) {
return cartList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
Log.i("aa", "getView: "+"aa");
convertView = layoutInflater.inflate(R.layout.cart_good, null);
viewHolder = new ViewHolder();
viewHolder.productImage = convertView.findViewById(R.id.category_product_image);
viewHolder.productName = convertView.findViewById(R.id.category_product_name);
viewHolder.productPrice = convertView.findViewById(R.id.category_product_price);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
Product product = cartList.get(position);
Log.i("product", "getView: "+product.toString());
if (product != null) {
viewHolder.productImage.setBackgroundResource(product.getImageUrlId());
viewHolder.productName.setText(product.getProductName());
viewHolder.productPrice.setText(String.valueOf(product.getProductPrice()));
}
return convertView;
}
class ViewHolder {
ImageView productImage;
TextView productName, productPrice;
}
}

@ -20,7 +20,7 @@ import okhttp3.Response;
public class OkHttpClientProduct {
public static String Url="http://10.21.91.105:8081";
public static String Url="http://10.21.93.212:8081";
/**
*
*

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="139dp"
android:background="#ffffff"
android:orientation="horizontal">
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="@+id/category_product_image"
android:layout_width="70dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="5dp"
tools:srcCompat="@tools:sample/avatars" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="6"
android:background="#1EFFFFFF"
android:orientation="vertical">
<TextView
android:id="@+id/category_product_name"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="20dp"
android:text="商品名称"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/category_product_price"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="20dp"
android:text="价格" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
Loading…
Cancel
Save