diff --git a/.gradle/5.4.1/fileChanges/last-build.bin b/.gradle/5.4.1/fileChanges/last-build.bin deleted file mode 100644 index f76dd23..0000000 Binary files a/.gradle/5.4.1/fileChanges/last-build.bin and /dev/null differ diff --git a/.gradle/5.4.1/fileHashes/fileHashes.lock b/.gradle/5.4.1/fileHashes/fileHashes.lock deleted file mode 100644 index 17827ed..0000000 Binary files a/.gradle/5.4.1/fileHashes/fileHashes.lock and /dev/null differ diff --git a/.gradle/5.4.1/gc.properties b/.gradle/5.4.1/gc.properties deleted file mode 100644 index e69de29..0000000 diff --git a/.gradle/7.0.2/executionHistory/executionHistory.bin b/.gradle/7.0.2/executionHistory/executionHistory.bin index e59bd08..f2314f0 100644 Binary files a/.gradle/7.0.2/executionHistory/executionHistory.bin and b/.gradle/7.0.2/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.0.2/executionHistory/executionHistory.lock b/.gradle/7.0.2/executionHistory/executionHistory.lock index 7e8b4ce..2872016 100644 Binary files a/.gradle/7.0.2/executionHistory/executionHistory.lock and b/.gradle/7.0.2/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.0.2/fileHashes/fileHashes.bin b/.gradle/7.0.2/fileHashes/fileHashes.bin index c5a8115..c2cfe72 100644 Binary files a/.gradle/7.0.2/fileHashes/fileHashes.bin and b/.gradle/7.0.2/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.0.2/fileHashes/fileHashes.lock b/.gradle/7.0.2/fileHashes/fileHashes.lock index 35e7b8b..c48502e 100644 Binary files a/.gradle/7.0.2/fileHashes/fileHashes.lock and b/.gradle/7.0.2/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.0.2/fileHashes/resourceHashesCache.bin b/.gradle/7.0.2/fileHashes/resourceHashesCache.bin index 7266156..240e89f 100644 Binary files a/.gradle/7.0.2/fileHashes/resourceHashesCache.bin and b/.gradle/7.0.2/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/7.0.2/javaCompile/classAnalysis.bin b/.gradle/7.0.2/javaCompile/classAnalysis.bin index 277c5b4..99c4081 100644 Binary files a/.gradle/7.0.2/javaCompile/classAnalysis.bin and b/.gradle/7.0.2/javaCompile/classAnalysis.bin differ diff --git a/.gradle/7.0.2/javaCompile/jarAnalysis.bin b/.gradle/7.0.2/javaCompile/jarAnalysis.bin index 16bd9c2..e49a644 100644 Binary files a/.gradle/7.0.2/javaCompile/jarAnalysis.bin and b/.gradle/7.0.2/javaCompile/jarAnalysis.bin differ diff --git a/.gradle/7.0.2/javaCompile/javaCompile.lock b/.gradle/7.0.2/javaCompile/javaCompile.lock index eb4ec9f..e9a7b01 100644 Binary files a/.gradle/7.0.2/javaCompile/javaCompile.lock and b/.gradle/7.0.2/javaCompile/javaCompile.lock differ diff --git a/.gradle/7.0.2/javaCompile/taskHistory.bin b/.gradle/7.0.2/javaCompile/taskHistory.bin index 2d8fb5f..d7a5bba 100644 Binary files a/.gradle/7.0.2/javaCompile/taskHistory.bin and b/.gradle/7.0.2/javaCompile/taskHistory.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index fbb4337..f429ad1 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/app/build.gradle b/app/build.gradle index 751b94c..d33c0b8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,7 +21,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' manifestPlaceholders = [ - APPID : "320924230000-2-1-32092423SJNB12202505211658160001", + APPID : "320924230000-2-1-32092423SJNB12202507111046530001", // APPID : "320500220500-2-1-32050022SJ97122021091XXXXXXXXXX", REGIONALISMCODE : "\\0320924230000", // REGIONALISMCODE : "\\03205002xxxxxx", @@ -34,7 +34,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' manifestPlaceholders = [ - APPID : "320924230000-2-1-32092423SJNB12202505211658160001", + APPID : "320924230000-2-1-32092423SJNB12202507111046530001", REGIONALISMCODE : "\\0320924230000", NETWORKAREACODE : "\\02", ] diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 10eb1ad..ed93d76 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,26 +13,42 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.jwzs" - tools:replace="android:allowBackup" > + tools:replace="android:allowBackup"> - - - + + + + + android:configChanges="orientation|screenSize|keyboardHidden" + android:exported="true" + android:hardwareAccelerated="true" + android:windowSoftInputMode="adjustResize"> - + + android:name=".MainActivity" + android:configChanges="orientation|screenSize" + android:exported="false" /> + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/pxkj/jwzs/BaseActivity.java b/app/src/main/java/com/pxkj/jwzs/BaseActivity.java index 075716d..be9fb2b 100644 --- a/app/src/main/java/com/pxkj/jwzs/BaseActivity.java +++ b/app/src/main/java/com/pxkj/jwzs/BaseActivity.java @@ -30,12 +30,12 @@ public abstract class BaseActivity extends AppCompatActivity { public static String ACTION_LOGIN = "com.ydjw.ua.ACTION_LOGIN"; public static String ACTION_LOGOUT = "com.ydjw.ua.ACTION_LOGOUT"; - protected static String appId = "320924230000-2-1-32092423SJNB12202505211658160001"; + protected static String appId = "320924230000-2-1-32092423SJNB12202507111046530001"; // protected static String appId = "320500220500-2-1-32050022SJ97122021091XXXXXXXXXX"; protected static String departId = "320924230000"; // protected static String departId = "3205002xxxxxx"; - private final String my_service_id = "320924230000-3-0400-EB013F207C9842D890327B6421C66EB2"; + private final String my_service_id = "320924230000-3-0800-5CDEC9969D674E1CBB7E2F86A697B0D7"; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { diff --git a/app/src/main/java/com/pxkj/jwzs/FirstActivity.java b/app/src/main/java/com/pxkj/jwzs/FirstActivity.java index 7781045..7aa61be 100644 --- a/app/src/main/java/com/pxkj/jwzs/FirstActivity.java +++ b/app/src/main/java/com/pxkj/jwzs/FirstActivity.java @@ -3,6 +3,7 @@ package com.pxkj.jwzs; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; +import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; @@ -20,95 +21,49 @@ import androidx.annotation.Nullable; import java.io.IOException; public class FirstActivity extends BaseActivity { - - private TextView tvApiResult; - + private WebView webView; @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { + protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); // 必须先加载布局,再初始化控件 + setContentView(R.layout.activity_main); - // 初始化TextView(关键!绑定布局中的tv_api_result) -// tvApiResult = findViewById(R.id.tv_api_result); - -// Button btnTestApi = findViewById(R.id.btn_test_api); -// btnTestApi.setOnClickListener(v -> { -// tvApiResult.setText("测试中..."); // 此时tvApiResult已初始化,不会空指针 -// fetchData(); -// }); - - -// WebView webView = findViewById(R.id.webview); -// webView.getSettings().setJavaScriptEnabled(true); // 启用JS -// webView.setWebViewClient(new WebViewClient()); // 防止跳转浏览器 -//// webView.loadUrl("http://218.92.207.242:50022/"); // 加载H5地址 -// webView.loadUrl("http://50.146.63.127:82/app/"); // 加载H5地址 -// webView.getSettings().setDomStorageEnabled(true); -// webView.clearCache(true); // 清除缓存 -// webView.getSettings().setUseWideViewPort(true); -// webView.getSettings().setLoadWithOverviewMode(true); - - - init(); // 调用父类方法 + initWebView(); + init(); // 触发认证流程 } - private void fetchData() { - Retrofit retrofit = new Retrofit.Builder() - .baseUrl("http://50.146.63.127:82/app/api/") -// .baseUrl("http://218.92.207.242:50021/gwgl/") - .addConverterFactory(GsonConverterFactory.create()) - .build(); - ApiService service = retrofit.create(ApiService.class); - Call call = service.getData(); // 假设ApiService中定义的接口是正确的 + private void initWebView() { + webView = findViewById(R.id.webview); + WebSettings settings = webView.getSettings(); + settings.setJavaScriptEnabled(true); + settings.setDomStorageEnabled(true); + settings.setCacheMode(WebSettings.LOAD_DEFAULT); - call.enqueue(new Callback() { + webView.setWebViewClient(new WebViewClient() { @Override - public void onResponse(Call call, Response response) { - // 确保tvApiResult不为null(双重保险) - if (tvApiResult == null) return; - - if (response.isSuccessful()) { - try { - String result = response.body().string(); - tvApiResult.setText("请求成功:\n" + result); - } catch (IOException e) { - tvApiResult.setText("响应解析失败:\n" + e.getMessage()); - } - } else { - tvApiResult.setText("HTTP错误:\n状态码=" + response.code()); - } + public void onPageFinished(WebView view, String url) { + // 页面加载完成处理 } - - @Override - public void onFailure(Call call, Throwable t) { - // 确保tvApiResult不为null(双重保险) - if (tvApiResult == null) return; - - // 显示具体错误原因(如网络不可达、超时等) - String errorMsg = "请求失败:\n"; - if (t.getMessage() != null) { - errorMsg += t.getMessage(); - } else { - errorMsg += "未知错误"; - } - tvApiResult.setText(errorMsg); + }); + } + @Override + protected void refresh() { + runOnUiThread(() -> { + String url = SpUtils.getString(this, "TARGET_URL", ""); + if (!TextUtils.isEmpty(url)) { + webView.loadUrl(url); } + // 移除跳转到MainActivity的代码 }); } @Override - protected void refresh() { - - String targetUrl = SpUtils.getString(this, "TARGET_URL", ""); - if (!TextUtils.isEmpty(targetUrl)) { - WebView webView = findViewById(R.id.webview); - webView.loadUrl(targetUrl); // 加载绑定服务ID的网址 - } else { - Toast.makeText(this, "未获取到有效网址", Toast.LENGTH_SHORT).show(); + protected void onDestroy() { + if (webView != null) { + webView.destroy(); + webView = null; } - // 寻址成功后,在这跳转下个页面 - startActivity(new Intent(this, MainActivity.class)); + super.onDestroy(); } } diff --git a/app/src/main/java/com/pxkj/jwzs/MainActivity.java b/app/src/main/java/com/pxkj/jwzs/MainActivity.java index 4471706..8e153c7 100644 --- a/app/src/main/java/com/pxkj/jwzs/MainActivity.java +++ b/app/src/main/java/com/pxkj/jwzs/MainActivity.java @@ -7,9 +7,8 @@ public class MainActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - // 所有其它页面均继承BaseActivity - + // 不自动跳转,仅作为备用入口 + finish(); } @Override