diff --git a/xiaoyuankuaidi/.idea/.gitignore b/xiaoyuankuaidi/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/xiaoyuankuaidi/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/xiaoyuankuaidi/.idea/gradle.xml b/xiaoyuankuaidi/.idea/gradle.xml
new file mode 100644
index 0000000..4019936
--- /dev/null
+++ b/xiaoyuankuaidi/.idea/gradle.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xiaoyuankuaidi/.idea/migrations.xml b/xiaoyuankuaidi/.idea/migrations.xml
new file mode 100644
index 0000000..f8051a6
--- /dev/null
+++ b/xiaoyuankuaidi/.idea/migrations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xiaoyuankuaidi/.idea/misc.xml b/xiaoyuankuaidi/.idea/misc.xml
new file mode 100644
index 0000000..8bb1dd1
--- /dev/null
+++ b/xiaoyuankuaidi/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xiaoyuankuaidi/.idea/vcs.xml b/xiaoyuankuaidi/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/xiaoyuankuaidi/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xiaoyuankuaidi/src/main/AndroidManifest.xml b/xiaoyuankuaidi/src/main/AndroidManifest.xml
index d92bc52..5295554 100644
--- a/xiaoyuankuaidi/src/main/AndroidManifest.xml
+++ b/xiaoyuankuaidi/src/main/AndroidManifest.xml
@@ -1,5 +1,5 @@
-
+
@@ -16,7 +16,7 @@
-
+
@@ -32,7 +32,12 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Xiaoyuankuaidi"
- android:usesCleartextTraffic="true">
+ android:usesCleartextTraffic="true" >
+
@@ -83,7 +88,7 @@
android:exported="false" />
+ android:exported="true" >
diff --git a/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/Api.java b/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/Api.java
index 51d7d4f..abda5e2 100644
--- a/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/Api.java
+++ b/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/Api.java
@@ -1,13 +1,21 @@
package com.example.lixing.lixing.lixin.xiaoyuankuaidi;
-import android.telecom.Call;
-
import java.util.Map;
+import retrofit2.Call;
import retrofit2.http.Body;
+import retrofit2.http.GET;
+import retrofit2.http.Header;
import retrofit2.http.POST;
+
+
public interface Api {
@POST("login")
Call login(@Body Map map);
+
+
+ @GET("system/data/list")
+ Call qishouqiangdandata(@Header("Authorization") String token);
+
}
diff --git a/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/MainActivity.java b/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/MainActivity.java
index 2bfd1c2..c5f149f 100644
--- a/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/MainActivity.java
+++ b/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/MainActivity.java
@@ -5,34 +5,78 @@ import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
-import android.telecom.Call;
import android.view.View;
import android.widget.Button;
+import android.widget.EditText;
import android.widget.Toast;
import java.util.HashMap;
import java.util.Map;
-import retrofit2.Call; // 更改为正确的导入
+import retrofit2.Call;
import retrofit2.Callback; // 更改为正确的导入
import retrofit2.Response; // 添加这一行
public class MainActivity extends AppCompatActivity {
+
+
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+ // 获取用户名
+// EditText editText =findViewById(R.id.editTextText11);
+// String username = editText.getText().toString();
+// editText.setText(username);
+ //获取密码
+// EditText editText1 =findViewById(R.id.editTextTextPassword);
+// String password = editText1.getText().toString();
+// editText1.setText(password);
+ // 初始化 EditText
+ EditText editText = findViewById(R.id.editTextText11);
+ EditText editText1 = findViewById(R.id.editTextTextPassword);
+
Button button = findViewById(R.id.button6);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ String username = editText.getText().toString().trim();
+ String password = editText1.getText().toString().trim();
+
+ if (username.isEmpty() || password.isEmpty()) {
+ Toast.makeText(MainActivity.this, "用户名与密码不能为空!", Toast.LENGTH_SHORT).show();
+ return;
+ }
Map map = new HashMap<>();
- map.put("username","admin");
- map.put("password","admin123");
- Call loginResultCall = RetrofitUtils.getRetrofit("http://192.168.43.56:8080/").create(Api.class).login(map);
+ map.put("username", username);
+ map.put("password", password);
+
+ retrofit2.Call loginResultCall = RetrofitUtils.getRetrofit("http://10.138.77.128:8080/").create(Api.class).login(map);
loginResultCall.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ LoginResult loginResult = response.body();
+ if(loginResult != null && loginResult.code == 200)
+ {
+ SharedPreferences.Editor editor = getSharedPreferences("data",MODE_PRIVATE).edit();
+ editor.putString("token",loginResult.token);
+ editor.apply();
+ Intent intent = new Intent(MainActivity.this, yonghuyindao.class);
+ intent.putExtra("token",loginResult.token);
+ startActivity(intent);
+ }else{
+ Toast.makeText(MainActivity.this,loginResult.msg,Toast.LENGTH_SHORT).show();
+ }
+
+ }
+
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ Toast.makeText(MainActivity.this, "请求失败: " + t.getMessage(), Toast.LENGTH_SHORT).show();
+ }
});
}
});
diff --git a/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/qishouqiangdandata.java b/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/qishouqiangdandata.java
new file mode 100644
index 0000000..ee23d11
--- /dev/null
+++ b/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/qishouqiangdandata.java
@@ -0,0 +1,43 @@
+package com.example.lixing.lixing.lixin.xiaoyuankuaidi;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+
+public class qishouqiangdandata {
+
+ @SerializedName("total")
+ public Integer total;
+ @SerializedName("rows")
+ public List rows;
+ @SerializedName("code")
+ public Integer code;
+ @SerializedName("msg")
+ public String msg;
+
+ 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("price")
+ public Integer price;
+ @SerializedName("time")
+ public String time;
+ @SerializedName("qujian")
+ public String qujian;
+ @SerializedName("shoujian")
+ public String shoujian;
+ @SerializedName("tip")
+ public String tip;
+ }
+}
diff --git a/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/yonghushouye.java b/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/yonghushouye.java
new file mode 100644
index 0000000..2979164
--- /dev/null
+++ b/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/yonghushouye.java
@@ -0,0 +1,22 @@
+package com.example.lixing.lixing.lixin.xiaoyuankuaidi;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.os.Bundle;
+
+public class yonghushouye extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_yonghushouye);
+
+ // 获取传递的 token
+ String token = getIntent().getStringExtra("token");
+
+ // 使用 FragmentTransaction 添加或替换 Fragment
+ getSupportFragmentManager().beginTransaction()
+ .replace(androidx.fragment.R.id.fragment_container_view_tag, new yonghushouyeFragment())
+ .commit();
+ }
+}
\ No newline at end of file
diff --git a/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/yonghushouyeFragment.java b/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/yonghushouyeFragment.java
index a1780fc..6ac137e 100644
--- a/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/yonghushouyeFragment.java
+++ b/xiaoyuankuaidi/src/main/java/com/example/lixing/lixing/lixin/xiaoyuankuaidi/yonghushouyeFragment.java
@@ -9,11 +9,9 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
-import android.widget.ImageButton;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
-import com.bumptech.glide.request.RequestOptions;
import org.json.JSONException;
import org.json.JSONObject;
diff --git a/xiaoyuankuaidi/src/main/res/layout/activity_main.xml b/xiaoyuankuaidi/src/main/res/layout/activity_main.xml
index 34f9cef..3957024 100644
--- a/xiaoyuankuaidi/src/main/res/layout/activity_main.xml
+++ b/xiaoyuankuaidi/src/main/res/layout/activity_main.xml
@@ -8,14 +8,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xiaoyuankuaidi/src/main/res/layout/activity_yonghushouye.xml b/xiaoyuankuaidi/src/main/res/layout/activity_yonghushouye.xml
new file mode 100644
index 0000000..15d32b5
--- /dev/null
+++ b/xiaoyuankuaidi/src/main/res/layout/activity_yonghushouye.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xiaoyuankuaidi/src/main/res/values/strings.xml b/xiaoyuankuaidi/src/main/res/values/strings.xml
index 243443f..374895f 100644
--- a/xiaoyuankuaidi/src/main/res/values/strings.xml
+++ b/xiaoyuankuaidi/src/main/res/values/strings.xml
@@ -2,4 +2,5 @@
xiaoyuankuaidi
Hello blank fragment
+ yonghushouye
\ No newline at end of file