增加前端登录注册接口,后端数据处理
This commit is contained in:
parent
db95cdb811
commit
764892f357
|
@ -7,6 +7,6 @@ import retrofit2.http.POST;
|
|||
|
||||
public interface Class2Api {
|
||||
@FormUrlEncoded
|
||||
@POST("Class2/getClass2List")
|
||||
@POST("class2/getClass2List")
|
||||
Call<Class2_home> class2 (@Field("id") Integer id);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,6 @@ import retrofit2.http.POST;
|
|||
|
||||
public interface ClassApi {
|
||||
@FormUrlEncoded
|
||||
@POST("Class/getClassList")
|
||||
@POST("class/getClassList")
|
||||
Call<Class_home> class1 (@Field("id") Integer id);
|
||||
}
|
||||
|
|
|
@ -1,29 +1,9 @@
|
|||
|
||||
package com.example.liyueling_final;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.content.ContentValues; import android.content.Intent; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast;
|
||||
import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response;
|
||||
public class EnrollActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
EditText phone;
|
||||
EditText password;
|
||||
EditText repassword;
|
||||
|
@ -76,7 +56,8 @@ public class EnrollActivity extends AppCompatActivity {
|
|||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put("phone",phoneNumber);
|
||||
contentValues.put("password",userPassword);
|
||||
contentValues.put("img", "");
|
||||
contentValues.put("user_img", "");
|
||||
contentValues.put("username","");
|
||||
sqLiteDatabase.insert("users",null,contentValues);
|
||||
|
||||
Intent intent = new Intent(EnrollActivity.this, LoginMainActivity.class);
|
||||
|
|
|
@ -24,5 +24,46 @@ public class LoginUser {
|
|||
public String phone;
|
||||
@SerializedName("userImg")
|
||||
public String userImg;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getUserImg() {
|
||||
return userImg;
|
||||
}
|
||||
|
||||
public void setUserImg(String userImg) {
|
||||
this.userImg = userImg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.example.liyueling_final;
|
||||
|
||||
import kotlin.Result;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.Field;
|
||||
|
@ -10,4 +11,7 @@ public interface LoginUserApi {
|
|||
@FormUrlEncoded
|
||||
@POST("login")
|
||||
Call<LoginUser> login(@Field("id") Integer id);
|
||||
|
||||
@POST("regist/register")
|
||||
Call<Result> register(@Body LoginUser loginUser);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public class MainhomeFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onFailure(Call<Class_home> call, Throwable t) {
|
||||
|
||||
Log.i("data", "Request failed: " + t.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.example.liyueling_final;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MyAdapter extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private List<PersionInfo> listinfos;
|
||||
|
||||
public MyAdapter(Context context, List<PersionInfo> listinfos){
|
||||
this.context =context;
|
||||
this.listinfos = listinfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return listinfos.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return listinfos.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
convertView = LayoutInflater.from(context).inflate(R.layout.list_item, null);
|
||||
TextView tv = (TextView) convertView.findViewById(R.id.tv);
|
||||
PersionInfo persionInfo = listinfos.get(position);
|
||||
tv.setText(persionInfo.getNameString());
|
||||
if (persionInfo.isChick()) {
|
||||
convertView.setBackgroundResource(R.drawable.tongcheng_all_bg01);
|
||||
} else {
|
||||
convertView.setBackgroundColor(Color.parseColor("#f4f4f4"));
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.example.liyueling_final;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class PersionInfo implements Serializable {
|
||||
|
||||
private String nameString;
|
||||
private boolean chick; //标识
|
||||
|
||||
public PersionInfo(String nameString) {
|
||||
this.nameString = nameString;
|
||||
}
|
||||
|
||||
public String getNameString() {
|
||||
return nameString;
|
||||
}
|
||||
|
||||
public void setNameString(String nameString) {
|
||||
this.nameString = nameString;
|
||||
}
|
||||
|
||||
public boolean isChick() {
|
||||
return chick;
|
||||
}
|
||||
|
||||
public void setChick(boolean chick) {
|
||||
this.chick = chick;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?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:minHeight="60dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue