This commit is contained in:
Lixin 2024-12-20 23:35:38 +08:00
parent e873d14534
commit b97dee2ccc
10 changed files with 556 additions and 0 deletions

View File

@ -50,4 +50,5 @@ dependencies {
}

View File

@ -1,9 +1,11 @@
package com.example.myapplication;
import com.example.myapplication.dao.GoodsinformationResult;
import com.example.myapplication.dao.LoginResult;
import com.example.myapplication.dao.ShouyeshuiguoResult;
import com.example.myapplication.dao.UserInformationResult;
import com.example.myapplication.dao.UserInformationResult2;
import com.example.myapplication.dao.TwodimensionResult;
import java.util.Map;
@ -25,4 +27,10 @@ public interface Api {
@GET("system/user/profile")
Call<UserInformationResult2> getUserInformation2(@Header("Authorization") String token);
@GET("system/twodimension/list")
Call<TwodimensionResult> getTwodimension(@Header("Authorization") String token);
@GET("system/goodsinformation/list")
Call<GoodsinformationResult> getGoodsinformation(@Header("Authorization") String token);
}

View File

@ -0,0 +1,57 @@
package com.example.myapplication.dao;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
@NoArgsConstructor
@Data
public class GoodsinformationResult {
@SerializedName("total")
public Integer total;
@SerializedName("rows")
public List<RowsBean> rows;
@SerializedName("code")
public Integer code;
@SerializedName("msg")
public String msg;
@NoArgsConstructor
@Data
public static class RowsBean {
@SerializedName("createBy")
public Object createBy;
@SerializedName("createTime")
public Object createTime;
@SerializedName("updateBy")
public Object updateBy;
@SerializedName("updateTime")
public Object updateTime;
@SerializedName("remark")
public Object remark;
@SerializedName("goodsinformationid")
public Integer goodsinformationid;
@SerializedName("supplier")
public String supplier;
@SerializedName("standard")
public String standard;
@SerializedName("locality")
public String locality;
@SerializedName("qualityguaranteeperiod")
public String qualityguaranteeperiod;
@SerializedName("particular")
public String particular;
@SerializedName("picture1")
public String picture1;
@SerializedName("picture2")
public String picture2;
@SerializedName("picture3")
public String picture3;
@SerializedName("goodsid")
public Integer goodsid;
}
}

View File

@ -0,0 +1,52 @@
package com.example.myapplication.dao;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
@lombok.NoArgsConstructor
@lombok.Data
public class TwodimensionResult {
@SerializedName("total")
public Integer total;
@SerializedName("rows")
public List<RowsBean> rows;
@SerializedName("code")
public Integer code;
@SerializedName("msg")
public String msg;
@lombok.NoArgsConstructor
@lombok.Data
public static class RowsBean {
@SerializedName("createBy")
public Object createBy;
@SerializedName("createTime")
public Object createTime;
@SerializedName("updateBy")
public Object updateBy;
@SerializedName("updateTime")
public Object updateTime;
@SerializedName("remark")
public Object remark;
@SerializedName("id")
public Integer id;
@SerializedName("twodimension1")
public String twodimension1;
@SerializedName("twodimension2")
public String twodimension2;
@SerializedName("twodimension3")
public String twodimension3;
@SerializedName("customerid")
public Integer customerid;
public String getTwodimension1() {
return twodimension1;
}
}
}

View File

@ -1,13 +1,26 @@
package com.example.myapplication;
import static android.app.PendingIntent.getActivity;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.example.myapplication.Utils.RetrofitUtils;
import com.example.myapplication.dao.TwodimensionResult;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class tihuomaActivity extends AppCompatActivity {
@Override
@ -33,5 +46,49 @@ public class tihuomaActivity extends AppCompatActivity {
textView78.setText(phoneNumber);
}
ImageView imageView = findViewById(R.id.imageView6);
SharedPreferences sharedPreferences = getSharedPreferences("data", MODE_PRIVATE);
String token = sharedPreferences.getString("token", "");
Call<TwodimensionResult> twodimensionResultCall =
RetrofitUtils.getRetrofit("http://192.168.56.115:8080/").create(Api.class).getTwodimension("Bearer " + token);
twodimensionResultCall.enqueue(new Callback<TwodimensionResult>() {
@Override
public void onResponse(Call<TwodimensionResult> call, Response<TwodimensionResult> response) {
TwodimensionResult twodimensionResult = response.body();
if (twodimensionResult!= null) {
if (twodimensionResult.code == 200) {
// 清空原有数据
// 使用 Glide 加载二维码图片
if (twodimensionResult.rows != null && !twodimensionResult.rows.isEmpty()) {
String qrCodeUrl = twodimensionResult.rows.get(0).getTwodimension1();
if (qrCodeUrl != null && !qrCodeUrl.isEmpty()) {
Glide.with(tihuomaActivity.this)
.load(qrCodeUrl)
.into(imageView);
}
}
} else if (twodimensionResult.code == 401) {
// 处理未授权的情况例如提示用户重新登录
Log.e("MineFragment", "Unauthorized access");
} else {
// 处理其他错误情况
Log.e("MineFragment", "Error code: " + twodimensionResult.code);
}
} else {
// 处理响应为空的情况
Log.e("MineFragment", "Response body is null");
}
}
@Override
public void onFailure(Call<TwodimensionResult> call, Throwable t) {
// 处理网络错误或其他异常
t.printStackTrace();
Log.e("HomeFragment", "Network error: " + t.getMessage());
}
});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -15,6 +15,7 @@
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout23"
android:layout_width="407dp"
android:layout_height="60dp"
android:background="#FFFFFF"
@ -47,5 +48,385 @@
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/fanhui" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout25"
android:layout_width="407dp"
android:layout_height="70dp"
android:background="#F5F5F5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" >
<ImageButton
android:id="@+id/imageButton36"
android:layout_width="60dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/shouye3" />
<ImageButton
android:id="@+id/imageButton37"
android:layout_width="91dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageButton36"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/zixunkefu2" />
<ImageButton
android:id="@+id/imageButton38"
android:layout_width="60dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageButton37"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/fenxiang" />
<ImageButton
android:id="@+id/imageButton40"
android:layout_width="195dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageButton38"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/jiarugouwuche" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="0dp"
android:layout_height="0dp"
android:fillViewport="true"
app:layout_constraintBottom_toTopOf="@+id/constraintLayout25"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout23">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="405dp"
android:layout_height="1300dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/textView79"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/imageView7"
android:layout_width="430dp"
android:layout_height="390dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_launcher_background" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout26"
android:layout_width="410dp"
android:layout_height="70dp"
android:background="#FF0000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView7">
<TextView
android:id="@+id/textView81"
android:layout_width="110dp"
android:layout_height="45dp"
android:layout_marginStart="32dp"
android:gravity="center"
android:text="81"
android:textColor="#FFFFFF"
android:textSize="29dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView82"
android:layout_width="210dp"
android:layout_height="25dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="32dp"
android:gravity="center"
android:text="距离本商品结束还剩:"
android:textColor="#FFFFFF"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView83"
android:layout_width="67dp"
android:layout_height="36dp"
android:gravity="center"
android:text="1天"
android:textColor="#FFFFFF"
android:textSize="26dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/textView82"
app:layout_constraintStart_toStartOf="@+id/textView82"
app:layout_constraintTop_toBottomOf="@+id/textView82" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/textView84"
android:layout_width="150dp"
android:layout_height="39dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="84"
android:textColor="#000000"
android:textSize="26dp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout26" />
<TextView
android:id="@+id/textView85"
android:layout_width="150dp"
android:layout_height="39dp"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="预售时间:"
android:textColor="#FFA500"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@+id/textView84"
app:layout_constraintStart_toStartOf="@+id/textView84"
app:layout_constraintTop_toBottomOf="@+id/textView84" />
<TextView
android:id="@+id/textView86"
android:layout_width="150dp"
android:layout_height="39dp"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="提货时间:"
android:textColor="#FFA500"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@+id/textView85"
app:layout_constraintStart_toStartOf="@+id/textView85"
app:layout_constraintTop_toBottomOf="@+id/textView85" />
<TextView
android:id="@+id/textView87"
android:layout_width="150dp"
android:layout_height="39dp"
android:layout_marginEnd="32dp"
android:gravity="center"
android:text="限量600份"
android:textColor="#FFA500"
android:textSize="23dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/textView84"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView84" />
<TextView
android:id="@+id/textView88"
android:layout_width="150dp"
android:layout_height="39dp"
android:gravity="center"
android:text="88"
android:textColor="#FFA500"
android:textSize="23dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/textView85"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView86"
app:layout_constraintTop_toTopOf="@+id/textView85" />
<TextView
android:id="@+id/textView89"
android:layout_width="150dp"
android:layout_height="39dp"
android:gravity="center"
android:text="89"
android:textColor="#FFA500"
android:textSize="23dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/textView86"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView86"
app:layout_constraintTop_toBottomOf="@+id/textView85" />
<TextView
android:id="@+id/textView90"
android:layout_width="123dp"
android:layout_height="34dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="商品信息"
android:textColor="#000000"
android:textSize="23dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView86" />
<TextView
android:id="@+id/textView91"
android:layout_width="111dp"
android:layout_height="31dp"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="供应商:"
android:textColor="#000000"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView90" />
<TextView
android:id="@+id/textView92"
android:layout_width="111dp"
android:layout_height="31dp"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="规格:"
android:textColor="#000000"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@+id/textView91"
app:layout_constraintStart_toStartOf="@+id/textView91"
app:layout_constraintTop_toBottomOf="@+id/textView91" />
<TextView
android:id="@+id/textView93"
android:layout_width="111dp"
android:layout_height="31dp"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="产地:"
android:textColor="#000000"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@+id/textView92"
app:layout_constraintStart_toStartOf="@+id/textView92"
app:layout_constraintTop_toBottomOf="@+id/textView92" />
<TextView
android:id="@+id/textView94"
android:layout_width="111dp"
android:layout_height="31dp"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="保质期限:"
android:textColor="#000000"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@+id/textView93"
app:layout_constraintStart_toStartOf="@+id/textView93"
app:layout_constraintTop_toBottomOf="@+id/textView93" />
<TextView
android:id="@+id/textView95"
android:layout_width="180dp"
android:layout_height="31dp"
android:layout_marginEnd="32dp"
android:gravity="center"
android:text="95"
android:textColor="#000000"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/textView91"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView91" />
<TextView
android:id="@+id/textView96"
android:layout_width="180dp"
android:layout_height="31dp"
android:gravity="center"
android:text="96"
android:textColor="#000000"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/textView92"
app:layout_constraintEnd_toEndOf="@+id/textView95"
app:layout_constraintStart_toStartOf="@+id/textView95"
app:layout_constraintTop_toTopOf="@+id/textView92" />
<TextView
android:id="@+id/textView97"
android:layout_width="180dp"
android:layout_height="31dp"
android:gravity="center"
android:text="97"
android:textColor="#000000"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/textView93"
app:layout_constraintEnd_toEndOf="@+id/textView96"
app:layout_constraintStart_toStartOf="@+id/textView96"
app:layout_constraintTop_toTopOf="@+id/textView93" />
<TextView
android:id="@+id/textView98"
android:layout_width="180dp"
android:layout_height="31dp"
android:gravity="center"
android:text="98"
android:textColor="#000000"
android:textSize="19dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/textView94"
app:layout_constraintEnd_toEndOf="@+id/textView97"
app:layout_constraintStart_toStartOf="@+id/textView97"
app:layout_constraintTop_toTopOf="@+id/textView94" />
<TextView
android:id="@+id/textView99"
android:layout_width="123dp"
android:layout_height="34dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="图文详情"
android:textColor="#000000"
android:textSize="23dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@+id/textView90"
app:layout_constraintStart_toStartOf="@+id/textView90"
app:layout_constraintTop_toBottomOf="@+id/textView94" />
<TextView
android:id="@+id/textView100"
android:layout_width="387dp"
android:layout_height="140dp"
android:layout_marginTop="8dp"
android:text="100"
android:textStyle="bold"
android:textColor="#000000"
android:textSize="18dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView99" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>