feat: add request.js utility, service page, and fix hospital image URLs

- Add request.js for unified API calls with loading/error handling
- Add service page (service type listing)
- Fix hospital list to load from API with proper image URL construction
- Add service types dynamic loading on index page
- Various mini program improvements (order, care, wallet pages)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
renjianbo
2026-06-07 10:13:26 +08:00
parent d0d69387fb
commit 1d0a0b9b04
79 changed files with 3152 additions and 1539 deletions

View File

@@ -14,14 +14,6 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true //突破应用方法数65535的一个限制
}
signingConfigs {
release {
storeFile file('july.jks')
storePassword "july"
keyAlias "123456"
keyPassword "123456"
}
}
signingConfigs {
release {
storeFile file('ruilaizi.jks')
@@ -39,7 +31,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
// 生产环境 —— 连接公网服务器
// 生产环境 —— 通过域名访问
buildConfigField "String", "API_BASE_URL", '"http://101.43.95.130:8039"'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

View File

@@ -35,6 +35,7 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<application
android:name=".BaseApplication"
@@ -45,6 +46,13 @@
android:roundIcon="@mipmap/fw_logo"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!-- 微信支付回调Activity -->
<activity
android:name=".wxapi.WXPayEntryActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity android:name=".main.my.activity.ShimingActivity"
android:windowSoftInputMode="adjustPan"
>

View File

@@ -116,14 +116,14 @@ public class BaseApplication extends Application {
//https相关设置,以下几种方案根据需要自己设置
//方法一:信任所有证书,不安全有风险
HttpsUtils.SSLParams sslParams1 = HttpsUtils.getSslSocketFactory();
//HttpsUtils.SSLParams sslParams1 = HttpsUtils.getSslSocketFactory();
//方法二:自定义信任规则,校验服务端证书
HttpsUtils.SSLParams sslParams2 = HttpsUtils.getSslSocketFactory(new SafeTrustManager());
//方法三:使用预埋证书,校验服务端证书(自签名证书)
//HttpsUtils.SSLParams sslParams3 = HttpsUtils.getSslSocketFactory(getAssets().open("srca.cer"));
//方法四:使用bks证书和密码管理客户端证书(双向认证),使用预埋证书,校验服务端证书(自签名证书)
//HttpsUtils.SSLParams sslParams4 = HttpsUtils.getSslSocketFactory(getAssets().open("xxx.bks"), "123456", getAssets().open("yyy.cer"));
builder.sslSocketFactory(sslParams1.sSLSocketFactory, sslParams1.trustManager);
builder.sslSocketFactory(sslParams2.sSLSocketFactory, sslParams2.trustManager);
//配置https的域名匹配规则,详细看demo的初始化介绍,不需要就不要加入,使用不当会导致https握手失败
builder.hostnameVerifier(new SafeHostnameVerifier());

View File

@@ -9,6 +9,7 @@ import android.view.WindowManager;
import com.ruilaizi.service.base.BaseActivity;
import com.ruilaizi.service.utils.ToastUtils;
import com.ruilaizi.service.utils.checkVersionsUtils.ProfileSpUtils;
import java.lang.ref.WeakReference;
import java.util.List;
@@ -69,13 +70,11 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
private void startActivity() {
startActivity(MainActivity.class);
//此类逻辑有是否登录,没有登录则跳验证码登录
// if (ProfileSpUtils.getInstance().isLogin()) {
// startActivity(MainActivity.class);
// } else {
// startActivity(LoginPasswordActivity.class);
// }
if (ProfileSpUtils.getInstance().isLogin()) {
startActivity(MainActivity.class);
} else {
startActivity(LoginPasswordActivity.class);
}
finish();
}
@@ -88,9 +87,13 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
@AfterPermissionGranted(RC_CAMERA_AND_LOCATION)
private void methodRequiresTwoPermission() {
String[] perms = {Manifest.permission.WRITE_EXTERNAL_STORAGE
, Manifest.permission.CAMERA
};
String[] perms;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) {
// Android 13+: WRITE_EXTERNAL_STORAGE 已废弃
perms = new String[]{Manifest.permission.CAMERA, Manifest.permission.READ_MEDIA_IMAGES};
} else {
perms = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA};
}
if (EasyPermissions.hasPermissions(this, perms)) {
handler.sendEmptyMessageDelayed(0, 2000);

View File

@@ -3,6 +3,7 @@ package com.ruilaizi.service.main.activity.mvp.presenterImpl;
import android.text.TextUtils;
import android.util.Log;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
import com.ruilaizi.service.main.activity.MainActivity;
@@ -77,9 +78,14 @@ public class LoginPasswordPresenterImpl extends MvpBasePresenter<LoginPasswordCo
}
getView().showProgressDialog("登录中...");
// 清除旧的全局 Authorization header,否则 Spring Security 会拒绝登录请求
com.lzy.okgo.model.HttpHeaders commonHeaders = OkGo.getInstance().getCommonHeaders();
if (commonHeaders != null) {
commonHeaders.remove("Authorization");
}
final HttpParams paramsPost = new HttpParams();
paramsPost.put("username", "admin");
paramsPost.put("password", "123456");
paramsPost.put("username", mobile);
paramsPost.put("password", passWord);
new NetApi().getPostData(paramsPost, HttpConstants.URi_appLogin).subscribe(new Observer<Response>() {
@Override
public void onNext(Response response) {

View File

@@ -13,6 +13,7 @@ public class kehuListBean extends BaseModel {
private int code;
private String msg;
private List<KehuinfoBean> data;
private List<KehuinfoBean> rows;
public int getTotal() {
return total;
@@ -39,13 +40,21 @@ public class kehuListBean extends BaseModel {
}
public List<KehuinfoBean> getData() {
return data;
return rows != null ? rows : data;
}
public void setData(List<KehuinfoBean> data) {
this.data = data;
}
public List<KehuinfoBean> getRows() {
return rows;
}
public void setRows(List<KehuinfoBean> rows) {
this.rows = rows;
}
// public static class DataBean extends BaseObservable implements Serializable {
// private Object searchValue;
// private Object createBy;

View File

@@ -231,7 +231,7 @@ public class CanFragment extends MobanFragment {
public void onNext(Response response) {
String body = (String) response.body();
kehuListBean data = JsonUtils.fromJson(body, kehuListBean.class);
if (data.getCode() == 200) {
if (data.getCode() == 200 || data.getCode() == 0) {
List<KehuinfoBean> data1 = data.getData();
mSwl.setRefreshing(false);

View File

@@ -232,7 +232,7 @@ public class ComFragment extends MobanFragment {
public void onNext(Response response) {
String body = (String) response.body();
kehuListBean data = JsonUtils.fromJson(body, kehuListBean.class);
if (data.getCode() == 200) {
if (data.getCode() == 200 || data.getCode() == 0) {
List<KehuinfoBean> data1 = data.getData();
mSwl.setRefreshing(false);

View File

@@ -231,7 +231,7 @@ public class CustomerFragment extends MobanFragment {
public void onNext(Response response) {
String body = (String) response.body();
kehuListBean data = JsonUtils.fromJson(body, kehuListBean.class);
if (data.getCode() == 200) {
if (data.getCode() == 200 || data.getCode() == 0) {
List<KehuinfoBean> data1 = data.getData();
mSwl.setRefreshing(false);

View File

@@ -232,7 +232,7 @@ public class SerFragment extends MobanFragment {
public void onNext(Response response) {
String body = (String) response.body();
kehuListBean data = JsonUtils.fromJson(body, kehuListBean.class);
if (data.getCode() == 200) {
if (data.getCode() == 200 || data.getCode() == 0) {
List<KehuinfoBean> data1 = data.getData();
mSwl.setRefreshing(false);

View File

@@ -244,7 +244,7 @@ public class TobeSerFragment extends MobanFragment {
public void onNext(Response response) {
String body = (String) response.body();
kehuListBean data = JsonUtils.fromJson(body, kehuListBean.class);
if (data.getCode() == 200) {
if (data.getCode() == 200 || data.getCode() == 0) {
List<KehuinfoBean> data1 = data.getData();
mSwl.setRefreshing(false);

View File

@@ -37,6 +37,10 @@ import com.zhihu.matisse.MimeType;
import com.zhihu.matisse.engine.impl.PicassoEngine;
import com.zhihu.matisse.internal.entity.CaptureStrategy;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -123,7 +127,7 @@ public class ShimingActivity extends BaseActivity {
toast("请输入姓名");
return;
}
if("".equals(recFollowBean.getRealName())){
if("".equals(recFollowBean.getIdentityNo())){
toast("请输入身份证号");
return;
}
@@ -197,10 +201,43 @@ public class ShimingActivity extends BaseActivity {
}
/**
* 将图片文件压缩后转为 base64,限制最大宽度并控制 JPEG 质量
*/
private String compressAndToBase64(File file, int maxWidth) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
int sampleSize = 1;
int width = options.outWidth;
if (width > 0) {
while (width / sampleSize > maxWidth) {
sampleSize *= 2;
}
}
options.inJustDecodeBounds = false;
options.inSampleSize = sampleSize;
Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath(), options);
if (bitmap == null) {
return "";
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 50, baos);
bitmap.recycle();
return "data:image/jpg;base64," + android.util.Base64.encodeToString(baos.toByteArray(), android.util.Base64.NO_WRAP);
}
private void getPermissions() {
RxPermissions rxPermissions = new RxPermissions(this);
rxPermissions.request(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA)
String[] permissions;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) {
// Android 13+: WRITE_EXTERNAL_STORAGE 已废弃,需用 READ_MEDIA_IMAGES
permissions = new String[]{Manifest.permission.CAMERA, Manifest.permission.READ_MEDIA_IMAGES};
} else {
permissions = new String[]{Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE};
}
rxPermissions.request(permissions)
.subscribe(new io.reactivex.Observer<Boolean>() {
@Override
public void onSubscribe(Disposable d) {
@@ -287,10 +324,9 @@ public class ShimingActivity extends BaseActivity {
@Override
public void onSuccess(File file) {
//转换成功后的文件
String resultt = AbImageUtil.bitmapToBase64(ImageUtils.getBitmap(file));
uploadPic(resultt,0);
showProgressDialog("上传中...", ShimingActivity.this);
String resultt = compressAndToBase64(file, 600);
uploadPic(resultt, 0);
}
@Override
@@ -327,10 +363,9 @@ public class ShimingActivity extends BaseActivity {
@Override
public void onSuccess(File file) {
//转换成功后的文件
String resultt = AbImageUtil.bitmapToBase64(ImageUtils.getBitmap(file));
uploadPic(resultt,1);
showProgressDialog("上传中...", ShimingActivity.this);
String resultt = compressAndToBase64(file, 1200);
uploadPic(resultt, 1);
}
@Override
@@ -367,9 +402,9 @@ public class ShimingActivity extends BaseActivity {
@Override
public void onSuccess(File file) {
//转换成功后的文件
String resultt = AbImageUtil.bitmapToBase64(ImageUtils.getBitmap(file));
uploadPic(resultt,2);
showProgressDialog("上传中...", ShimingActivity.this);
String resultt = compressAndToBase64(file, 1200);
uploadPic(resultt, 2);
}
@Override

View File

@@ -105,6 +105,8 @@ public class loginBean implements Serializable {
private String leijijine;
private String yue;
private String token;
private String monthIncome;
private String monthOrderCount;
public String getUserId() {
return userId;
@@ -169,5 +171,21 @@ public class loginBean implements Serializable {
public void setToken(String token) {
this.token = token;
}
public String getMonthIncome() {
return monthIncome;
}
public void setMonthIncome(String monthIncome) {
this.monthIncome = monthIncome;
}
public String getMonthOrderCount() {
return monthOrderCount;
}
public void setMonthOrderCount(String monthOrderCount) {
this.monthOrderCount = monthOrderCount;
}
}
}

View File

@@ -27,8 +27,8 @@ public class ViewHolderOne extends AbstractViewTypeHolder {
@Override
public void bindHolder(robCustomerInfoBean dataBean, int position, Context mContext, MarKQuestionItemviewOnClickListener mviewListener) {
super.bindHolder(dataBean, position, mContext, mviewListener);
WidgetTools.setTextsev(my_shouru, "", ProfileSpUtils.getInstance().getUserProfie().getData().getYue());
WidgetTools.setTextsev(my_dingdan_num, "", ProfileSpUtils.getInstance().getUserProfie().getData().getYue());
WidgetTools.setTextsev(my_shouru, "", ProfileSpUtils.getInstance().getUserProfie().getData().getMonthIncome());
WidgetTools.setTextsev(my_dingdan_num, "", ProfileSpUtils.getInstance().getUserProfie().getData().getMonthOrderCount());
}
}

View File

@@ -10,6 +10,7 @@ import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import androidx.annotation.Nullable;
@@ -57,12 +58,11 @@ public class WXPayEntryActivity extends BaseActivity implements IWXAPIEventHandl
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initData();
}
private void initData() {
// api = WXAPIFactory.createWXAPI(this, PayUtils.APP_ID);
api = WXAPIFactory.createWXAPI(this, WXEntryActivity.WEIXIN_APP_ID, true);
api.handleIntent(getIntent(), this);
}
}
}