提交3
This commit is contained in:
parent
2245194a5c
commit
d4220b3577
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
|
@ -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>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
@ -16,7 +16,7 @@
|
|||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
|
||||
<queries package="${applicationId}">
|
||||
<queries package="${applicationId}" >
|
||||
<intent>
|
||||
<action android:name="android.media.action.IMAGE_CAPTURE" />
|
||||
</intent>
|
||||
|
@ -32,7 +32,12 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Xiaoyuankuaidi"
|
||||
android:usesCleartextTraffic="true">
|
||||
android:usesCleartextTraffic="true" >
|
||||
<activity
|
||||
android:name=".yonghushouye"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_yonghushouye"
|
||||
android:theme="@style/Theme.Xiaoyuankuaidi" />
|
||||
<activity
|
||||
android:name=".yonghuxiadanxuzhi"
|
||||
android:exported="false" />
|
||||
|
@ -83,7 +88,7 @@
|
|||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
|
|
@ -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<LoginResult> login(@Body Map<String,String> map);
|
||||
|
||||
|
||||
@GET("system/data/list")
|
||||
Call<qishouqiangdandata> qishouqiangdandata(@Header("Authorization") String token);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<String,String> map = new HashMap<>();
|
||||
map.put("username","admin");
|
||||
map.put("password","admin123");
|
||||
Call<LoginResult> loginResultCall = RetrofitUtils.getRetrofit("http://192.168.43.56:8080/").create(Api.class).login(map);
|
||||
map.put("username", username);
|
||||
map.put("password", password);
|
||||
|
||||
retrofit2.Call<LoginResult> loginResultCall = RetrofitUtils.getRetrofit("http://10.138.77.128:8080/").create(Api.class).login(map);
|
||||
loginResultCall.enqueue(new Callback<LoginResult>() {
|
||||
@Override
|
||||
public void onResponse(Call<LoginResult> call, Response<LoginResult> 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<LoginResult> call, Throwable t) {
|
||||
Toast.makeText(MainActivity.this, "请求失败: " + t.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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<RowsBean> 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;
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -8,14 +8,91 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/button6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="340dp"
|
||||
android:backgroundTint="#9C27B0"
|
||||
android:layout_width="123dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginEnd="178dp"
|
||||
android:layout_marginBottom="200dp"
|
||||
android:backgroundTint="#4CAF50"
|
||||
android:text="登录"
|
||||
android:textSize="23dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextText11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="86dp"
|
||||
android:layout_marginTop="99dp"
|
||||
android:layout_marginBottom="300dp"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextTextPassword"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="44dp"
|
||||
android:ems="10"
|
||||
android:inputType="textPassword"
|
||||
app:layout_constraintEnd_toEndOf="@+id/editTextText11"
|
||||
app:layout_constraintStart_toStartOf="@+id/editTextText11"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextText11" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView64"
|
||||
android:layout_width="94dp"
|
||||
android:layout_height="37dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="用户名"
|
||||
android:gravity="center"
|
||||
android:textSize="21dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/editTextText11"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/editTextText11"
|
||||
app:layout_constraintVertical_bias="1.0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView68"
|
||||
android:layout_width="94dp"
|
||||
android:layout_height="37dp"
|
||||
android:text="密码"
|
||||
android:textSize="21dp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/editTextTextPassword"
|
||||
app:layout_constraintEnd_toStartOf="@+id/editTextTextPassword"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView64"
|
||||
app:layout_constraintTop_toTopOf="@+id/editTextTextPassword" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView15"
|
||||
android:layout_width="846dp"
|
||||
android:layout_height="190dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/yonghutouxiang" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button27"
|
||||
android:layout_width="123dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="178dp"
|
||||
android:backgroundTint="#4CAF50"
|
||||
android:text="注册"
|
||||
android:textSize="23dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/button6"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/button6" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".yonghushouye">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container_view_tag"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -2,4 +2,5 @@
|
|||
<string name="app_name">xiaoyuankuaidi</string>
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="title_activity_yonghushouye">yonghushouye</string>
|
||||
</resources>
|
Loading…
Reference in New Issue