This commit is contained in:
haomingming
2026-11-03 11:10:38 +08:00
parent 4ae19c6045
commit a12e39b781
6 changed files with 105 additions and 27 deletions
@@ -407,6 +407,7 @@ public class CourseUrlDetailActivity extends BaseActivity implements
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else // AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
int id = v.getId(); int id = v.getId();
if (id == R.id.ll_yuan_download) { if (id == R.id.ll_yuan_download) {
if (!UIUtils.checkLoginAndJump(this)) return;
if (freeRecord > 0 || welfareNum>0) { if (freeRecord > 0 || welfareNum>0) {
showDialoag(freeRecord+welfareNum); showDialoag(freeRecord+welfareNum);
} else { } else {
@@ -421,9 +422,11 @@ public class CourseUrlDetailActivity extends BaseActivity implements
openWordFile(mPath); openWordFile(mPath);
} }
} else if (id == R.id.ll_again_download) { } else if (id == R.id.ll_again_download) {
if (!UIUtils.checkLoginAndJump(this)) return;
getSystemTime(); getSystemTime();
needreportPays("order_gdfile_download",0+"","元",1+"",title,tags,"肝胆课件"); needreportPays("order_gdfile_download",0+"","元",1+"",title,tags,"肝胆课件");
} else if (id == R.id.ll_free_download) { } else if (id == R.id.ll_free_download) {
if (!UIUtils.checkLoginAndJump(this)) return;
order_id = "FREE"; order_id = "FREE";
int visibility = mLl_ctn_download.getVisibility(); int visibility = mLl_ctn_download.getVisibility();
if (visibility!=0) { if (visibility!=0) {
@@ -436,6 +439,7 @@ public class CourseUrlDetailActivity extends BaseActivity implements
} }
needreportPays("order_gdfile_download",0+"","元",1+"",title,tags,"肝胆课件"); needreportPays("order_gdfile_download",0+"","元",1+"",title,tags,"肝胆课件");
} else if (id == R.id.top_right) { } else if (id == R.id.top_right) {
if (!UIUtils.checkLoginAndJump(this)) return;
if (IsColloction) { if (IsColloction) {
CollectListDis(); CollectListDis();
} else { } else {
@@ -1156,6 +1156,7 @@ public class NewsDetailActivity extends BaseActivity implements
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else // AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
int id = v.getId(); int id = v.getId();
if (id == R.id.top_right_text) { if (id == R.id.top_right_text) {
if (!UIUtils.checkLoginAndJump(this)) return;
//分享功能换成分享到容联 //分享功能换成分享到容联
delVisit(); delVisit();
// case R.id.inside_share: // case R.id.inside_share:
@@ -1188,6 +1189,7 @@ public class NewsDetailActivity extends BaseActivity implements
} }
} else if (id == R.id.ll_collect) { } else if (id == R.id.ll_collect) {
if (!UIUtils.checkLoginAndJump(this)) return;
// 调用收藏 // 调用收藏
if (isCollection != null) { if (isCollection != null) {
if (flag==3||flag==4){//新闻 if (flag==3||flag==4){//新闻
@@ -1223,6 +1225,7 @@ public class NewsDetailActivity extends BaseActivity implements
} }
} }
} else if (id == R.id.ll_agree) { } else if (id == R.id.ll_agree) {
if (!UIUtils.checkLoginAndJump(this)) return;
if (isAgree != null) { if (isAgree != null) {
LogUtil.i("isAgree = "+isAgree); LogUtil.i("isAgree = "+isAgree);
if (!isAgree.equals("1")) { if (!isAgree.equals("1")) {
@@ -518,11 +518,17 @@ public class BaseApplication extends Application {
currentActivity.startActivity(intentv); currentActivity.startActivity(intentv);
} }
} else if(event.equals("buyPointPage")) { } else if(event.equals("buyPointPage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
// 我的积分页:不再依赖 currentActivity,直接使用 Application 作为 Context 启动页面 // 我的积分页:不再依赖 currentActivity,直接使用 Application 作为 Context 启动页面
Intent intentv = new Intent(BaseApplication.this, cn.shangyu.gdxzExpert.pointsmall.BuyIntegerActivty.class); Intent intentv = new Intent(BaseApplication.this, cn.shangyu.gdxzExpert.pointsmall.BuyIntegerActivty.class);
intentv.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intentv.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentv); startActivity(intentv);
} else if(event.equals("payPptPage")) { } else if(event.equals("payPptPage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
if (currentActivity != null) { if (currentActivity != null) {
LogUtil.i("payPptPage", msgValue); LogUtil.i("payPptPage", msgValue);
JSONObject jsonObject = new JSONObject(msgValue); JSONObject jsonObject = new JSONObject(msgValue);
@@ -538,6 +544,9 @@ public class BaseApplication extends Application {
currentActivity.startActivity(intent); currentActivity.startActivity(intent);
} }
}else if(event.equals("payPonitPage")) { }else if(event.equals("payPonitPage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
// 支付积分页:不再依赖 currentActivity,直接使用 Application 作为 Context 启动页面 // 支付积分页:不再依赖 currentActivity,直接使用 Application 作为 Context 启动页面
LogUtil.i("payPointPage", msgValue); LogUtil.i("payPointPage", msgValue);
JSONObject jsonObject = new JSONObject(msgValue); JSONObject jsonObject = new JSONObject(msgValue);
@@ -559,6 +568,9 @@ public class BaseApplication extends Application {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent); startActivity(intent);
}else if(event.equals("goPatientMsg")) { }else if(event.equals("goPatientMsg")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
Intent intent = null; Intent intent = null;
if (currentActivity != null) { if (currentActivity != null) {
intent = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.MyPatientActivity.class); intent = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.MyPatientActivity.class);
@@ -573,6 +585,9 @@ public class BaseApplication extends Application {
startActivity(intent); startActivity(intent);
} }
}else if(event.equals("goSendMsg")) { }else if(event.equals("goSendMsg")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
if (currentActivity != null) { if (currentActivity != null) {
String patientUuid = msgValue; String patientUuid = msgValue;
try { try {
@@ -615,6 +630,9 @@ public class BaseApplication extends Application {
startActivity(intent); startActivity(intent);
} }
}else if(event.equals("goGroupMessagePage")) { }else if(event.equals("goGroupMessagePage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
Intent intent = null; Intent intent = null;
if (currentActivity != null) { if (currentActivity != null) {
intent = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.SendGroupMsgListActivity.class); intent = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.SendGroupMsgListActivity.class);
@@ -293,6 +293,9 @@ public abstract class BaseActivity extends AppCompatActivity implements
LogUtil.i("首页切换逻辑执行完成"); LogUtil.i("首页切换逻辑执行完成");
}else if(msg.equals("patientClass")){ }else if(msg.equals("patientClass")){
if (!UIUtils.checkLoginAndJump(finalMainActivity)) {
return;
}
LogUtil.i("准备切换到患教页"); LogUtil.i("准备切换到患教页");
if (main_radiogroup == null) { if (main_radiogroup == null) {
LogUtil.e("main_radiogroup is null!"); LogUtil.e("main_radiogroup is null!");
@@ -323,6 +326,9 @@ public abstract class BaseActivity extends AppCompatActivity implements
LogUtil.i("患教页切换逻辑执行完成"); LogUtil.i("患教页切换逻辑执行完成");
}else if(msg.equals("education")){ }else if(msg.equals("education")){
if (!UIUtils.checkLoginAndJump(finalMainActivity)) {
return;
}
LogUtil.i("准备切换到继续教育页"); LogUtil.i("准备切换到继续教育页");
if (main_radiogroup == null) { if (main_radiogroup == null) {
LogUtil.e("main_radiogroup is null!"); LogUtil.e("main_radiogroup is null!");
@@ -450,6 +456,9 @@ public abstract class BaseActivity extends AppCompatActivity implements
* 处理 Token 检查 * 处理 Token 检查
*/ */
public void handleCheckToken(DCUniMPJSCallback callback) { public void handleCheckToken(DCUniMPJSCallback callback) {
if (!UIUtils.isLogined()) {
return;
}
try { try {
Map<String, String> param = new HashMap<>(); Map<String, String> param = new HashMap<>();
sendJsonPostParamtoNetSignMD5(getAccessToken, param, ACCESS_TOKEN, new OnCallBackFromNet() { sendJsonPostParamtoNetSignMD5(getAccessToken, param, ACCESS_TOKEN, new OnCallBackFromNet() {
@@ -474,8 +474,12 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
initIntent(); initIntent();
getCommentList(); getCommentList();
if (UIUtils.isLogined()) {
addVideoWatchRecord(); addVideoWatchRecord();
}
if (UIUtils.isLogined()) {
isVideoDownloadRecord(); isVideoDownloadRecord();
}
needreportDetail(getIntent().getStringExtra("pagetype"), videoTeachDetailBean.getVideo().getTags(),title); needreportDetail(getIntent().getStringExtra("pagetype"), videoTeachDetailBean.getVideo().getTags(),title);
break; break;
case 0: case 0:
@@ -606,8 +610,12 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
case 404://第一次请求失败 case 404://第一次请求失败
LogUtil.e("提交失败,重新请求 "); LogUtil.e("提交失败,重新请求 ");
videoDetail(); videoDetail();
if (UIUtils.isLogined()) {
isVideoDownloadRecord(); isVideoDownloadRecord();
}
if (UIUtils.isLogined()) {
addVideoWatchRecord(); addVideoWatchRecord();
}
break; break;
} }
@@ -1672,6 +1680,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()){ switch (v.getId()){
case R.id.bt_inside_share: case R.id.bt_inside_share:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
delVisit(); delVisit();
break; break;
case R.id.top_back: case R.id.top_back:
@@ -1685,6 +1694,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
this.finish(); this.finish();
break; break;
case R.id.top_right: case R.id.top_right:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if (isCollt) { if (isCollt) {
showProgressDialog("正在取消收藏"); showProgressDialog("正在取消收藏");
DisCollection(); DisCollection();
@@ -1709,6 +1719,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
break; break;
case R.id.bt_add_pinglun: case R.id.bt_add_pinglun:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if (StringUtil.isEmpty(mEt_add.getText().toString().trim())) { if (StringUtil.isEmpty(mEt_add.getText().toString().trim())) {
ToastUtil.showMessage("输入内容"); ToastUtil.showMessage("输入内容");
return; return;
@@ -1717,6 +1728,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
hideSoftInputFromWindow(); hideSoftInputFromWindow();
break; break;
case R.id.et_add_pinglun: case R.id.et_add_pinglun:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if(CommonUtil.BigModule()) if(CommonUtil.BigModule())
{ {
@@ -1728,6 +1740,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
break; break;
case R.id.tv_delete://删除 case R.id.tv_delete://删除
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if ( downloadInfo!=null&&!downloadSQLiteHelper.isAdd(downloadInfo)){ if ( downloadInfo!=null&&!downloadSQLiteHelper.isAdd(downloadInfo)){
return; return;
@@ -1774,6 +1787,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
break; break;
case R.id.tv_video_long: case R.id.tv_video_long:
case R.id.iv_video_Long://继续/停止 case R.id.iv_video_Long://继续/停止
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
final PolyvDownloader downloader1 = PolyvDownloaderManager.getPolyvDownloader(vid, bitrate); final PolyvDownloader downloader1 = PolyvDownloaderManager.getPolyvDownloader(vid, bitrate);
if ("停止".equals(tv_video_long.getText().toString())){ if ("停止".equals(tv_video_long.getText().toString())){
downloader1.stop(); downloader1.stop();
@@ -1787,10 +1801,12 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
break; break;
case R.id.tv_exchange1: case R.id.tv_exchange1:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
startActivityForResult(new Intent(VideoDetailPolyvPlayerActivity.this, PolyvDownloadActivity.class),101); startActivityForResult(new Intent(VideoDetailPolyvPlayerActivity.this, PolyvDownloadActivity.class),101);
break; break;
case R.id.rl_huancun: case R.id.rl_huancun:
case R.id.tv_exchange: case R.id.tv_exchange:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
String netWorkTypeName = getNetWorkTypeName(VideoDetailPolyvPlayerActivity.this); String netWorkTypeName = getNetWorkTypeName(VideoDetailPolyvPlayerActivity.this);
if ("NETWORK_WIFI".equals(netWorkTypeName)){ if ("NETWORK_WIFI".equals(netWorkTypeName)){
if ("点击下载".equals(tv_exchange.getText().toString())){ if ("点击下载".equals(tv_exchange.getText().toString())){
@@ -67,6 +67,28 @@ import io.dcloud.feature.unimp.config.UniMPReleaseConfiguration;
public class UniappUtil { public class UniappUtil {
private static String lastUniMPToken = "";
/**
* 判断目标路径是否允许游客模式(未登录)访问
* 覆盖:肝胆视频、肝胆新闻(肝胆时讯)、肝胆课件及其详情页
*/
public static boolean isGuestAllowedPath(String targetPath) {
if (StringUtil.isEmpty(targetPath)) {
return false;
}
return targetPath.startsWith("/pages_app/video/video")
|| targetPath.startsWith("/pages_app/videoDetail/videoDetail")
|| targetPath.startsWith("/pages_app/liveReplay/liveReplay")
|| targetPath.startsWith("/pages_app/replayList/replayList")
|| targetPath.startsWith("/pages_app/newsList/newsList")
|| targetPath.startsWith("/pages_app/news/news")
|| targetPath.startsWith("/pages_app/webview/webviewClass")
|| targetPath.startsWith("/pages_app/webview/webview")
|| targetPath.startsWith("/pages_app/ppt/ppt")
|| targetPath.startsWith("/pages_app/pptDetail/pptDetail");
}
/** /**
* 展示uniapp mp - 公共方法 * 展示uniapp mp - 公共方法
* @param context 上下文 * @param context 上下文
@@ -75,7 +97,7 @@ public class UniappUtil {
public static void showUniMp(Context context, String targetPath, com.alibaba.fastjson.JSONObject pageParams) { public static void showUniMp(Context context, String targetPath, com.alibaba.fastjson.JSONObject pageParams) {
try { try {
if (!UIUtils.checkLoginAndJump(context)) { if (!isGuestAllowedPath(targetPath) && !UIUtils.checkLoginAndJump(context)) {
return; return;
} }
checkWgt(context, targetPath, pageParams); checkWgt(context, targetPath, pageParams);
@@ -109,14 +131,14 @@ public class UniappUtil {
private static void showInternal(Context context, String targetPath, com.alibaba.fastjson.JSONObject pageParams) { private static void showInternal(Context context, String targetPath, com.alibaba.fastjson.JSONObject pageParams) {
try { try {
if (!UIUtils.checkLoginAndJump(context)) { if (!isGuestAllowedPath(targetPath) && !UIUtils.checkLoginAndJump(context)) {
return; return;
} }
String uuid = SharePrefUtil.getString(context, Constant.uuid, ""); String uuid = SharePrefUtil.getString(context, Constant.uuid, "");
if(StringUtil.isEmpty(uuid)){ if(!isGuestAllowedPath(targetPath) && StringUtil.isEmpty(uuid)){
return; return;
} }
String access_token = SharePrefUtil.getString(context, "access_token", ""); String access_token = UIUtils.isLogined() ? SharePrefUtil.getString(context, "access_token", "") : "";
String QueryString = StringUtil.toQueryString(pageParams); String QueryString = StringUtil.toQueryString(pageParams);
JSONObject userInfo = new JSONObject(); JSONObject userInfo = new JSONObject();
userInfo.put("uuid", SharePrefUtil.getString(context, Constant.uuid, "")); userInfo.put("uuid", SharePrefUtil.getString(context, Constant.uuid, ""));
@@ -154,7 +176,12 @@ public class UniappUtil {
Log.d("UniappUtil","uniapp_MP_cash.isRunning()="+uniapp_MP_cash.isRunning()); Log.d("UniappUtil","uniapp_MP_cash.isRunning()="+uniapp_MP_cash.isRunning());
} }
//存在但是不在运行 //存在但是不在运行
if(uniapp_MP_cash != null && !uniapp_MP_cash.isRunning()){ if(uniapp_MP_cash != null && (!uniapp_MP_cash.isRunning() || !StringUtil.equals(lastUniMPToken, access_token))){
BaseApplication.getUniMPCaches().remove(uniapp_mp_appid);
uniapp_MP_cash.closeUniMP();
uniapp_MP_cash = null;
}
if(false && uniapp_MP_cash != null && !uniapp_MP_cash.isRunning()){
BaseApplication.getUniMPCaches().remove(uniapp_mp_appid); BaseApplication.getUniMPCaches().remove(uniapp_mp_appid);
uniapp_MP_cash.closeUniMP(); uniapp_MP_cash.closeUniMP();
} }
@@ -179,6 +206,7 @@ public class UniappUtil {
} }
} }
IUniMP uniapp_MP = DCUniMPSDK.getInstance().openUniMP(openContext, uniapp_mp_appid, uniMPOpenConfiguration); IUniMP uniapp_MP = DCUniMPSDK.getInstance().openUniMP(openContext, uniapp_mp_appid, uniMPOpenConfiguration);
lastUniMPToken = access_token != null ? access_token : "";
BaseApplication.getUniMPCaches().put(uniapp_MP.getAppid(), uniapp_MP); BaseApplication.getUniMPCaches().put(uniapp_MP.getAppid(), uniapp_MP);
} }
} catch (Exception e) { } catch (Exception e) {