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
@@ -406,7 +406,8 @@ public class CourseUrlDetailActivity extends BaseActivity implements
// TODO Auto-generated method stub
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
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) {
showDialoag(freeRecord+welfareNum);
} else {
@@ -420,10 +421,12 @@ public class CourseUrlDetailActivity extends BaseActivity implements
} else if (type != null && type.trim().contains("doc")) {
openWordFile(mPath);
}
} else if (id == R.id.ll_again_download) {
} else if (id == R.id.ll_again_download) {
if (!UIUtils.checkLoginAndJump(this)) return;
getSystemTime();
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";
int visibility = mLl_ctn_download.getVisibility();
if (visibility!=0) {
@@ -435,7 +438,8 @@ public class CourseUrlDetailActivity extends BaseActivity implements
getSystemTime();
}
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) {
CollectListDis();
} else {
@@ -1155,7 +1155,8 @@ public class NewsDetailActivity extends BaseActivity implements
protected void processClick(View v) {
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
int id = v.getId();
if (id == R.id.top_right_text) {
if (id == R.id.top_right_text) {
if (!UIUtils.checkLoginAndJump(this)) return;
//分享功能换成分享到容联
delVisit();
// case R.id.inside_share:
@@ -1187,7 +1188,8 @@ 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 (flag==3||flag==4){//新闻
@@ -1222,7 +1224,8 @@ public class NewsDetailActivity extends BaseActivity implements
CollectListDis(3);
}
}
} else if (id == R.id.ll_agree) {
} else if (id == R.id.ll_agree) {
if (!UIUtils.checkLoginAndJump(this)) return;
if (isAgree != null) {
LogUtil.i("isAgree = "+isAgree);
if (!isAgree.equals("1")) {
@@ -518,11 +518,17 @@ public class BaseApplication extends Application {
currentActivity.startActivity(intentv);
}
} else if(event.equals("buyPointPage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
// 我的积分页:不再依赖 currentActivity,直接使用 Application 作为 Context 启动页面
Intent intentv = new Intent(BaseApplication.this, cn.shangyu.gdxzExpert.pointsmall.BuyIntegerActivty.class);
intentv.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentv);
} else if(event.equals("payPptPage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
if (currentActivity != null) {
LogUtil.i("payPptPage", msgValue);
JSONObject jsonObject = new JSONObject(msgValue);
@@ -538,6 +544,9 @@ public class BaseApplication extends Application {
currentActivity.startActivity(intent);
}
}else if(event.equals("payPonitPage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
// 支付积分页:不再依赖 currentActivity,直接使用 Application 作为 Context 启动页面
LogUtil.i("payPointPage", msgValue);
JSONObject jsonObject = new JSONObject(msgValue);
@@ -559,6 +568,9 @@ public class BaseApplication extends Application {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}else if(event.equals("goPatientMsg")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
Intent intent = null;
if (currentActivity != null) {
intent = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.MyPatientActivity.class);
@@ -573,6 +585,9 @@ public class BaseApplication extends Application {
startActivity(intent);
}
}else if(event.equals("goSendMsg")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
if (currentActivity != null) {
String patientUuid = msgValue;
try {
@@ -615,6 +630,9 @@ public class BaseApplication extends Application {
startActivity(intent);
}
}else if(event.equals("goGroupMessagePage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
Intent intent = null;
if (currentActivity != null) {
intent = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.SendGroupMsgListActivity.class);
@@ -292,7 +292,10 @@ public abstract class BaseActivity extends AppCompatActivity implements
changeHomeMethod.invoke(finalMainActivity);
LogUtil.i("首页切换逻辑执行完成");
}else if(msg.equals("patientClass")){
}else if(msg.equals("patientClass")){
if (!UIUtils.checkLoginAndJump(finalMainActivity)) {
return;
}
LogUtil.i("准备切换到患教页");
if (main_radiogroup == null) {
LogUtil.e("main_radiogroup is null!");
@@ -322,7 +325,10 @@ public abstract class BaseActivity extends AppCompatActivity implements
changePatientZhongxinMethod.invoke(finalMainActivity);
LogUtil.i("患教页切换逻辑执行完成");
}else if(msg.equals("education")){
}else if(msg.equals("education")){
if (!UIUtils.checkLoginAndJump(finalMainActivity)) {
return;
}
LogUtil.i("准备切换到继续教育页");
if (main_radiogroup == null) {
LogUtil.e("main_radiogroup is null!");
@@ -449,7 +455,10 @@ public abstract class BaseActivity extends AppCompatActivity implements
/**
* 处理 Token 检查
*/
public void handleCheckToken(DCUniMPJSCallback callback) {
public void handleCheckToken(DCUniMPJSCallback callback) {
if (!UIUtils.isLogined()) {
return;
}
try {
Map<String, String> param = new HashMap<>();
sendJsonPostParamtoNetSignMD5(getAccessToken, param, ACCESS_TOKEN, new OnCallBackFromNet() {
@@ -474,8 +474,12 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
initIntent();
getCommentList();
addVideoWatchRecord();
isVideoDownloadRecord();
if (UIUtils.isLogined()) {
addVideoWatchRecord();
}
if (UIUtils.isLogined()) {
isVideoDownloadRecord();
}
needreportDetail(getIntent().getStringExtra("pagetype"), videoTeachDetailBean.getVideo().getTags(),title);
break;
case 0:
@@ -606,8 +610,12 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
case 404://第一次请求失败
LogUtil.e("提交失败,重新请求 ");
videoDetail();
isVideoDownloadRecord();
addVideoWatchRecord();
if (UIUtils.isLogined()) {
isVideoDownloadRecord();
}
if (UIUtils.isLogined()) {
addVideoWatchRecord();
}
break;
}
@@ -1671,7 +1679,8 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.bt_inside_share:
case R.id.bt_inside_share:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
delVisit();
break;
case R.id.top_back:
@@ -1684,7 +1693,8 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
hideSoftInputFromWindow();
this.finish();
break;
case R.id.top_right:
case R.id.top_right:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if (isCollt) {
showProgressDialog("正在取消收藏");
DisCollection();
@@ -1708,7 +1718,8 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
needreportSome("share","","");
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())) {
ToastUtil.showMessage("输入内容");
return;
@@ -1716,7 +1727,8 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
getAddComment();
hideSoftInputFromWindow();
break;
case R.id.et_add_pinglun:
case R.id.et_add_pinglun:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if(CommonUtil.BigModule())
{
@@ -1727,7 +1739,8 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
}
break;
case R.id.tv_delete://删除
case R.id.tv_delete://删除
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if ( downloadInfo!=null&&!downloadSQLiteHelper.isAdd(downloadInfo)){
return;
@@ -1773,7 +1786,8 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
break;
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);
if ("停止".equals(tv_video_long.getText().toString())){
downloader1.stop();
@@ -1786,11 +1800,13 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
}
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);
break;
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);
if ("NETWORK_WIFI".equals(netWorkTypeName)){
if ("点击下载".equals(tv_exchange.getText().toString())){
@@ -67,6 +67,28 @@ import io.dcloud.feature.unimp.config.UniMPReleaseConfiguration;
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 - 公共方法
* @param context 上下文
@@ -75,7 +97,7 @@ public class UniappUtil {
public static void showUniMp(Context context, String targetPath, com.alibaba.fastjson.JSONObject pageParams) {
try {
if (!UIUtils.checkLoginAndJump(context)) {
if (!isGuestAllowedPath(targetPath) && !UIUtils.checkLoginAndJump(context)) {
return;
}
checkWgt(context, targetPath, pageParams);
@@ -109,14 +131,14 @@ public class UniappUtil {
private static void showInternal(Context context, String targetPath, com.alibaba.fastjson.JSONObject pageParams) {
try {
if (!UIUtils.checkLoginAndJump(context)) {
if (!isGuestAllowedPath(targetPath) && !UIUtils.checkLoginAndJump(context)) {
return;
}
String uuid = SharePrefUtil.getString(context, Constant.uuid, "");
if(StringUtil.isEmpty(uuid)){
if(!isGuestAllowedPath(targetPath) && StringUtil.isEmpty(uuid)){
return;
}
String access_token = SharePrefUtil.getString(context, "access_token", "");
String access_token = UIUtils.isLogined() ? SharePrefUtil.getString(context, "access_token", "") : "";
String QueryString = StringUtil.toQueryString(pageParams);
JSONObject userInfo = new JSONObject();
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());
}
//存在但是不在运行
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);
uniapp_MP_cash.closeUniMP();
}
@@ -179,6 +206,7 @@ public class UniappUtil {
}
}
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);
}
} catch (Exception e) {