zhenghy

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool

# Conflicts:
#	sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
Showing 51 changed files with 334 additions and 1606 deletions
1 -@mpaas:registry=https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/meta  
@@ -38,4 +38,7 @@ export class SpConstants{ @@ -38,4 +38,7 @@ export class SpConstants{
38 //启动页数据存储key 38 //启动页数据存储key
39 static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model' 39 static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model'
40 40
  41 + //频道信息流页面左右挂角
  42 + static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_'
  43 +
41 } 44 }
1 -import { expect } from '@ohos/hypium';  
2 -  
3 export { Logger } from './src/main/ets/utils/Logger' 1 export { Logger } from './src/main/ets/utils/Logger'
4 2
5 export { ResourcesUtils } from './src/main/ets/utils/ResourcesUtils' 3 export { ResourcesUtils } from './src/main/ets/utils/ResourcesUtils'
@@ -51,7 +49,3 @@ export { NetworkUtil } from './src/main/ets/utils/NetworkUtil' @@ -51,7 +49,3 @@ export { NetworkUtil } from './src/main/ets/utils/NetworkUtil'
51 export { NetworkManager } from './src/main/ets/network/NetworkManager' 49 export { NetworkManager } from './src/main/ets/network/NetworkManager'
52 50
53 export { NetworkType } from './src/main/ets/network/NetworkType' 51 export { NetworkType } from './src/main/ets/network/NetworkType'
54 -  
55 -export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils'  
56 -  
57 -export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck'  
@@ -6,6 +6,5 @@ @@ -6,6 +6,5 @@
6 "description": "Please describe the basic information.", 6 "description": "Please describe the basic information.",
7 "main": "Index.ets", 7 "main": "Index.ets",
8 "version": "1.0.0", 8 "version": "1.0.0",
9 - "dependencies": {  
10 - } 9 + "dependencies": {}
11 } 10 }
1 -import { MPUpgradeService } from '@mpaas/upgrade'  
2 -import { upgradeRes } from '@mpaas/upgrade/src/main/ets/t4/a'  
3 -import { AppUtils } from '../utils/AppUtils'  
4 -import { SPHelper } from '../utils/SPHelper'  
5 -  
6 -export interface UpgradeTipContent {  
7 -  
8 - content: string  
9 - newVersion: string  
10 - downloadUrl: string  
11 - forceUpgrade: boolean  
12 -}  
13 -  
14 -export class MpaasUpgradeCheck {  
15 -  
16 - /// 默认提示框  
17 - checkNewVersionAndShow() {  
18 - try {  
19 - MPUpgradeService.checkNewVersionAndShow()  
20 - } catch (error) {  
21 - console.log("mpaas upgrade fail", JSON.stringify(error))  
22 - }  
23 - }  
24 -  
25 - checkNewVersion(): Promise<UpgradeTipContent | null> {  
26 -  
27 - return new Promise((resolve, fail) => {  
28 - MPUpgradeService.checkNewVersion().then((response)=>{  
29 - let str = JSON.stringify(response)  
30 - console.log("mpaas upgrade check", str)  
31 -  
32 - /*  
33 - {  
34 - "android64FileSize": 0,  
35 - "downloadURL": "https://appgallery.huawei.com/#/app",  
36 - "fileSize": 0,  
37 - "fullMd5": "no md5",  
38 - "guideMemo": "欢迎使用新版本",  
39 - "isWifi": 0,  
40 - "netType": "ALL",  
41 - "newestVersion": "1.0.1",  
42 - "resultStatus": 204,  
43 - "silentType": 0,  
44 - "upgradeVersion": "1.0.1"  
45 - }*/  
46 -  
47 - let res = response as upgradeRes  
48 -  
49 - // AliUpgradeNewVersion = 201, /*当前使用的已是最新版本*/  
50 - // AliUpgradeOneTime = 202, /*客户端已有新版本,单次提醒*/  
51 - // AliUpgradeForceUpdate = 203, /*客户端已有新版本,强制升级(已废弃)*/  
52 - // AliUpgradeEveryTime = 204, /*客户端已有新版本,多次提醒*/  
53 - // AliUpgradeRejectLogin = 205, /*限制登录(已废弃)*/  
54 - // AliUpgradeForceUpdateWithLogin = 206 /*客户端已有新版本,强制升级*/  
55 -  
56 - const currentAppVersoin = AppUtils.getAppVersionName()  
57 -  
58 - if (res.resultStatus == 201) {  
59 - resolve(null)  
60 - return  
61 - }  
62 -  
63 - // 单次升级控制  
64 - if (res.resultStatus == 202) {  
65 - const oldOnceValue = SPHelper.default.getSync("upgradeOnceKey", false) as boolean  
66 - if (true == oldOnceValue) {  
67 - resolve(null)  
68 - return  
69 - }  
70 - SPHelper.default.save("upgradeOnceKey", true)  
71 - } else {  
72 - SPHelper.default.save("upgradeOnceKey", false)  
73 - }  
74 -  
75 - if (res.resultStatus == 202 || res.resultStatus == 204 || res.resultStatus == 206) {  
76 - let content: UpgradeTipContent = {  
77 - content: res.guideMemo,  
78 - newVersion: res.upgradeVersion,  
79 - downloadUrl: res.downloadURL,  
80 - forceUpgrade: res.resultStatus == 206  
81 - }  
82 - resolve(content)  
83 - return  
84 - }  
85 -  
86 - resolve(null)  
87 - }).catch((error: Error) => {  
88 - console.log("mpaas upgrade fail", `name: ${error.name}, message: ${error.message}, \nstack: ${error.stack}`)  
89 - fail("检测升级失败")  
90 - })  
91 - })  
92 - }  
93 -}  
1 -import { MPFramework } from '@mpaas/framework'  
2 -import { common } from '@kit.AbilityKit';  
3 -  
4 -/*  
5 -对接mpaas注意:  
6 -* 1、后台创建mpaas.config,需要包名。放到rawfile目录  
7 -* 2、网关加密hs_1222.png图片,放到rawfile目录  
8 -* 3. 配置和加密图片,需要包名和签名对应,否则无法使用  
9 - * */  
10 -  
11 -export class MpaasUtils {  
12 -  
13 - // 启动时onCreate()方法调用  
14 - static initApp(context: common.UIAbilityContext) {  
15 - MPFramework.create(context);  
16 - }  
17 -  
18 - // 获取mPaaS utdid  
19 - static async mpaasUtdid() {  
20 - let utdid = await MPFramework.instance.udid  
21 - return utdid  
22 - }  
23 -  
24 - // 登录和退出登录调用,用来管理白名单用  
25 - static setupUserId(userId?: string) {  
26 - MPFramework.instance.userId = userId  
27 - }  
28 -}  
@@ -53,16 +53,5 @@ export class AppUtils { @@ -53,16 +53,5 @@ export class AppUtils {
53 } 53 }
54 return ''; 54 return '';
55 } 55 }
56 -  
57 - static getFingerprint(): string {  
58 - try {  
59 - let bundleInfo =  
60 - bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO);  
61 - let finger = bundleInfo.signatureInfo.fingerprint;  
62 - } catch (e) {  
63 - Logger.warn(TAG, 'get app signatureinfo error:' + e?.message);  
64 - }  
65 - return '';  
66 - }  
67 } 56 }
68 57
1 export { ResponseDTO } from "./src/main/ets/bean/ResponseDTO" 1 export { ResponseDTO } from "./src/main/ets/bean/ResponseDTO"
2 2
  3 +export { ResposeError } from "./src/main/ets/bean/ResposeError"
  4 +
3 export { HttpRequest as WDHttp } from "./src/main/ets/http/HttpRequest" 5 export { HttpRequest as WDHttp } from "./src/main/ets/http/HttpRequest"
4 6
5 export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils" 7 export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils"
  1 +/**
  2 + * 接口返回错误数据封装
  3 + */
  4 +export class ResposeError {
  5 + code: number = -1;
  6 + message: string = '';
  7 +
  8 + static buildError(message: string, code?: number): ResposeError {
  9 + let error = new ResposeError()
  10 + error.message = message
  11 + if (code) {
  12 + error.code = code
  13 + }
  14 + return error;
  15 + }
  16 +}
@@ -6,6 +6,7 @@ import axios, { @@ -6,6 +6,7 @@ import axios, {
6 InternalAxiosRequestConfig 6 InternalAxiosRequestConfig
7 } from '@ohos/axios'; 7 } from '@ohos/axios';
8 import { Logger } from 'wdKit/Index'; 8 import { Logger } from 'wdKit/Index';
  9 +import { ResposeError } from '../bean/ResposeError';
9 10
10 // import type ResponseDTO from '../models/ResponseDTO'; 11 // import type ResponseDTO from '../models/ResponseDTO';
11 12
@@ -99,17 +100,16 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r @@ -99,17 +100,16 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r
99 }, 100 },
100 (error: AxiosError) => { 101 (error: AxiosError) => {
101 // 异常响应 102 // 异常响应
102 - // console.log('全局响应失败拦截')  
103 - // console.log(error.request)  
104 - // console.log(error.response) 103 + // 429-流量超标;403-临时token;406-token过期,强制下线
105 // 这里用来处理http常见错误,进行全局提示 104 // 这里用来处理http常见错误,进行全局提示
  105 + let errorBean = new ResposeError()
106 if (error != null && error.response != null) { 106 if (error != null && error.response != null) {
107 let message = buildErrorMsg(error.response.status); 107 let message = buildErrorMsg(error.response.status);
108 // 错误消息可以使用全局弹框展示出来 108 // 错误消息可以使用全局弹框展示出来
109 console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`) 109 console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`)
  110 + errorBean = buildError(error.response.status)
110 } 111 }
111 -  
112 - return Promise.reject(error); 112 + return Promise.reject(errorBean);
113 } 113 }
114 ); 114 );
115 115
@@ -161,3 +161,9 @@ function buildErrorMsg(httpStatus: number): string { @@ -161,3 +161,9 @@ function buildErrorMsg(httpStatus: number): string {
161 } 161 }
162 return message; 162 return message;
163 } 163 }
  164 +
  165 +function buildError(httpStatus: number): ResposeError {
  166 + let message = buildErrorMsg(httpStatus);
  167 + let error: ResposeError = ResposeError.buildError(message, httpStatus)
  168 + return error;
  169 +}
@@ -4,6 +4,7 @@ import HashMap from '@ohos.util.HashMap'; @@ -4,6 +4,7 @@ import HashMap from '@ohos.util.HashMap';
4 import { ResponseDTO } from '../bean/ResponseDTO'; 4 import { ResponseDTO } from '../bean/ResponseDTO';
5 import { HttpUrlUtils, WDHttp } from '../../../../Index'; 5 import { HttpUrlUtils, WDHttp } from '../../../../Index';
6 import { RefreshTokenRes } from '../bean/RefreshTokenRes'; 6 import { RefreshTokenRes } from '../bean/RefreshTokenRes';
  7 +import { ResposeError } from '../bean/ResposeError';
7 8
8 const TAG: string = 'HttpBizUtil' 9 const TAG: string = 'HttpBizUtil'
9 10
@@ -20,14 +21,12 @@ export class HttpBizUtil { @@ -20,14 +21,12 @@ export class HttpBizUtil {
20 * @returns 返回值 21 * @returns 返回值
21 */ 22 */
22 static get<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> { 23 static get<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> {
23 - return new Promise<T>((success, debug) => { 24 + return new Promise<T>((success, error) => {
24 WDHttp.get<T>(url, headers).then((originalRes: T) => { 25 WDHttp.get<T>(url, headers).then((originalRes: T) => {
25 - try {  
26 - let resDTO = originalRes as ResponseDTO  
27 - Logger.debug(TAG, 'get: ' + resDTO.code)  
28 - Logger.debug(TAG, 'get: ' + resDTO.message) 26 + success(originalRes)
  27 + }).catch((res: ResposeError) => {
29 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面 28 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
30 - if (resDTO.code == 403 || resDTO.code == 406) { 29 + if (res.code == 403 || res.code == 406) {
31 HttpBizUtil.refreshToken().then((token: string) => { 30 HttpBizUtil.refreshToken().then((token: string) => {
32 if (headers) { 31 if (headers) {
33 headers.replace('RMRB-X-TOKEN', token) 32 headers.replace('RMRB-X-TOKEN', token)
@@ -39,18 +38,14 @@ export class HttpBizUtil { @@ -39,18 +38,14 @@ export class HttpBizUtil {
39 Logger.debug(TAG, 'get again: ' + againResDTO) 38 Logger.debug(TAG, 'get again: ' + againResDTO)
40 success(againResDTO) 39 success(againResDTO)
41 }).catch((res: object) => { 40 }).catch((res: object) => {
42 - debug(res) 41 + error(ResposeError.buildError(JSON.stringify(res)))
43 }) 42 })
44 }); 43 });
45 } else { 44 } else {
46 - success(originalRes)  
47 - }  
48 - } catch (e) {  
49 - debug(originalRes) 45 + // 非403、406,直接抛出去
  46 + Logger.debug(TAG, 'get else: ' + JSON.stringify(res))
  47 + error(res)
50 } 48 }
51 -  
52 - }).catch((res: object) => {  
53 - debug(res)  
54 }) 49 })
55 }) 50 })
56 } 51 }
@@ -63,34 +58,31 @@ export class HttpBizUtil { @@ -63,34 +58,31 @@ export class HttpBizUtil {
63 * @returns 返回值 58 * @returns 返回值
64 */ 59 */
65 static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { 60 static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
66 - return new Promise<T>((success, debug) => { 61 + return new Promise<T>((success, error) => {
67 WDHttp.post<T>(url, data, headers).then((originalRes: T) => { 62 WDHttp.post<T>(url, data, headers).then((originalRes: T) => {
68 - try {  
69 - let resDTO = originalRes as ResponseDTO  
70 - Logger.debug(TAG, 'post: ' + resDTO.code)  
71 - Logger.debug(TAG, 'post: ' + resDTO.message) 63 + success(originalRes)
  64 + }).catch((res: ResposeError) => {
72 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面 65 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
73 - if (resDTO.code == 403 || resDTO.code == 406) { 66 + Logger.debug(TAG, 'post catch error: ' + JSON.stringify(res))
  67 + if (res.code == 403 || res.code == 406) {
74 HttpBizUtil.refreshToken().then((token: string) => { 68 HttpBizUtil.refreshToken().then((token: string) => {
75 if (headers) { 69 if (headers) {
76 headers.replace('RMRB-X-TOKEN', token) 70 headers.replace('RMRB-X-TOKEN', token)
77 headers.replace('cookie', 'RMRB-X-TOKEN=' + token) 71 headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
78 } 72 }
  73 + Logger.debug(TAG, 'post again send: ' + token)
79 // refreshToken为空场景不处理,直接请求接口。 74 // refreshToken为空场景不处理,直接请求接口。
80 - WDHttp.post<T>(url, headers).then((againResDTO: T) => { 75 + WDHttp.post<T>(url, data, headers).then((againResDTO: T) => {
  76 + Logger.debug(TAG, 'post again success: ' + JSON.stringify(againResDTO))
81 success(againResDTO) 77 success(againResDTO)
82 }).catch((res: object) => { 78 }).catch((res: object) => {
83 - debug(res) 79 + error(ResposeError.buildError(JSON.stringify(res)))
84 }) 80 })
85 }); 81 });
86 } else { 82 } else {
87 - success(originalRes) 83 + // 非403、406,直接抛出去
  84 + error(res)
88 } 85 }
89 - } catch (e) {  
90 - success(originalRes)  
91 - }  
92 - }).catch((res: object) => {  
93 - debug(res)  
94 }) 86 })
95 }) 87 })
96 } 88 }
@@ -104,9 +96,9 @@ export class HttpBizUtil { @@ -104,9 +96,9 @@ export class HttpBizUtil {
104 params.set('refreshToken', HttpUrlUtils.getRefreshToken()) 96 params.set('refreshToken', HttpUrlUtils.getRefreshToken())
105 params.set('deviceId', HttpUrlUtils.getDeviceId()) 97 params.set('deviceId', HttpUrlUtils.getDeviceId())
106 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 98 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
107 - Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken())  
108 - // // 请求刷新token接口  
109 - return new Promise<string>((success, debug) => { 99 + // Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken())
  100 + // 请求刷新token接口
  101 + return new Promise<string>((success, error) => {
110 WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params, headers).then((resDTO: ResponseDTO<RefreshTokenRes>) => { 102 WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params, headers).then((resDTO: ResponseDTO<RefreshTokenRes>) => {
111 let newToken = '' 103 let newToken = ''
112 if (resDTO) { 104 if (resDTO) {
@@ -126,6 +118,7 @@ export class HttpBizUtil { @@ -126,6 +118,7 @@ export class HttpBizUtil {
126 Logger.debug(TAG, 'refreshToken refreshToken: ' + resDTO.data.refreshToken) 118 Logger.debug(TAG, 'refreshToken refreshToken: ' + resDTO.data.refreshToken)
127 } 119 }
128 } 120 }
  121 + Logger.debug(TAG, 'refreshToken last jwtToken: ' + newToken)
129 success(newToken) 122 success(newToken)
130 }); 123 });
131 }) 124 })
@@ -2,7 +2,7 @@ import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean'; @@ -2,7 +2,7 @@ import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean';
2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; 2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
3 import { Logger } from 'wdKit'; 3 import { Logger } from 'wdKit';
4 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; 4 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
5 -import { WDRouterRule } from '../router/WDRouterRule'; 5 +import { WDRouterRule, WDRouterPage } from '../../../../Index';
6 import { ContentConstants } from 'wdConstant'; 6 import { ContentConstants } from 'wdConstant';
7 import { common, Want } from '@kit.AbilityKit'; 7 import { common, Want } from '@kit.AbilityKit';
8 import { BusinessError } from '@kit.BasicServicesKit'; 8 import { BusinessError } from '@kit.BasicServicesKit';
@@ -398,4 +398,14 @@ export class ProcessUtils { @@ -398,4 +398,14 @@ export class ProcessUtils {
398 public static jumpChannelTab(channelId: string, pageId: string) { 398 public static jumpChannelTab(channelId: string, pageId: string) {
399 HomeChannelUtils.jumpChannelTab(channelId, pageId) 399 HomeChannelUtils.jumpChannelTab(channelId, pageId)
400 } 400 }
  401 +
  402 + /**
  403 + * 跳转人民号主页
  404 + *@params creatorId 创作者id
  405 + */
  406 + public static gotoPeopleShipHomePage(creatorId: string) {
  407 + let params = {'creatorId': creatorId} as Record<string, string>;
  408 + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
  409 + }
  410 +
401 } 411 }
@@ -145,6 +145,10 @@ function handleJsCallAppInnerLinkMethod(data: Message) { @@ -145,6 +145,10 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
145 content.objectType = ContentConstants.TYPE_FOURTEEN 145 content.objectType = ContentConstants.TYPE_FOURTEEN
146 ProcessUtils.processPage(content) 146 ProcessUtils.processPage(content)
147 break; 147 break;
  148 + case 'owner_page':
  149 + let creatorId = urlParams.get('creatorId') || ''
  150 + ProcessUtils.gotoPeopleShipHomePage(creatorId)
  151 + break;
148 default: 152 default:
149 break; 153 break;
150 } 154 }
@@ -68,14 +68,9 @@ export interface CompAdvBean { @@ -68,14 +68,9 @@ export interface CompAdvBean {
68 displayPriority: number; 68 displayPriority: number;
69 69
70 /** 70 /**
71 - * 展示的次数  
72 - */  
73 - showCount: number;  
74 -  
75 - /**  
76 * 页面id 71 * 页面id
77 */ 72 */
78 - pageId: String ; 73 + pageId: String;
79 74
80 /** 75 /**
81 * 开屏广告-显示时长 76 * 开屏广告-显示时长
@@ -97,6 +92,4 @@ export interface CompAdvBean { @@ -97,6 +92,4 @@ export interface CompAdvBean {
97 displayRound: number; 92 displayRound: number;
98 93
99 94
100 -  
101 -  
102 } 95 }
1 -import { AccountManagerUtils, Logger, DateTimeUtils } from 'wdKit'; 1 +import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper } from 'wdKit';
2 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 2 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
3 -import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams, 3 +import { ContentDetailDTO,postBatchAttentionStatusParams,
4 PhotoListBean, 4 PhotoListBean,
5 ContentDTO, 5 ContentDTO,
6 RmhInfoDTO, } from 'wdBean'; 6 RmhInfoDTO, } from 'wdBean';
7 import media from '@ohos.multimedia.media'; 7 import media from '@ohos.multimedia.media';
8 import { OperRowListView } from './view/OperRowListView'; 8 import { OperRowListView } from './view/OperRowListView';
9 import { WDPlayerController } from 'wdPlayer/Index'; 9 import { WDPlayerController } from 'wdPlayer/Index';
  10 +import {
  11 + batchLikeAndCollectParams,
  12 + batchLikeAndCollectResult,
  13 + ContentDetailRequest,
  14 + contentListParams,
  15 + postExecuteCollectRecordParams,
  16 + postExecuteLikeParams,
  17 + postInteractAccentionOperateParams
  18 +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
10 import { ContentConstants } from '../constants/ContentConstants'; 19 import { ContentConstants } from '../constants/ContentConstants';
11 -import { ProcessUtils } from 'wdRouter'; 20 +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
12 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; 21 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
13 import display from '@ohos.display'; 22 import display from '@ohos.display';
14 import { BusinessError } from '@ohos.base'; 23 import { BusinessError } from '@ohos.base';
15 -import { CommonConstants } from 'wdConstant/Index'; 24 +import { CommonConstants, SpConstants } from 'wdConstant/Index';
16 import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' 25 import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo'
17 import router from '@ohos.router'; 26 import router from '@ohos.router';
18 const TAG = 'DynamicDetailComponent' 27 const TAG = 'DynamicDetailComponent'
@@ -24,20 +33,13 @@ export struct DynamicDetailComponent { @@ -24,20 +33,13 @@ export struct DynamicDetailComponent {
24 private contentId: string = '' 33 private contentId: string = ''
25 private relType: string = '' 34 private relType: string = ''
26 //出参 fixme 模拟数据用json转换 35 //出参 fixme 模拟数据用json转换
27 - @State contentDetailData: ContentDetailDTO = {  
28 - publishTime: "2023年03月14日 08:16",  
29 - rmhInfo:{rmhHeadUrl:"",rmhName:"人民号名称",rmhDesc:"人民号描述单行展示"},  
30 - newsContent:"优先展示这个内容",  
31 - newsSummary:"其次展示这个内容",  
32 - newsTitle:"上面两个都没有再展示这个内容",  
33 - newsType:15  
34 - } as ContentDetailDTO 36 + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
35 //变量 37 //变量
36 scroller: Scroller = new Scroller(); 38 scroller: Scroller = new Scroller();
37 /** 39 /**
38 * 默认未关注 点击去关注 40 * 默认未关注 点击去关注
39 */ 41 */
40 - private followStatus: String = '0'; 42 + @State followStatus: String = '0';
41 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 43 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
42 44
43 //跳转 45 //跳转
@@ -130,7 +132,7 @@ export struct DynamicDetailComponent { @@ -130,7 +132,7 @@ export struct DynamicDetailComponent {
130 .backgroundColor($r('app.color.color_ED2800')) 132 .backgroundColor($r('app.color.color_ED2800'))
131 .fontColor($r('app.color.color_fff')) 133 .fontColor($r('app.color.color_fff'))
132 .onClick(() => { 134 .onClick(() => {
133 - // this.handleAccention(this.item, 1) 135 + this.handleAccention()
134 }) 136 })
135 } else { 137 } else {
136 Text('已关注') 138 Text('已关注')
@@ -143,7 +145,7 @@ export struct DynamicDetailComponent { @@ -143,7 +145,7 @@ export struct DynamicDetailComponent {
143 .borderColor($r('app.color.color_CCCCCC')) 145 .borderColor($r('app.color.color_CCCCCC'))
144 .fontColor($r('app.color.color_CCCCCC')) 146 .fontColor($r('app.color.color_CCCCCC'))
145 .onClick(() => { 147 .onClick(() => {
146 - // this.handleAccention(this.item, 0) 148 + this.handleAccention()
147 }) 149 })
148 } 150 }
149 } 151 }
@@ -224,6 +226,9 @@ export struct DynamicDetailComponent { @@ -224,6 +226,9 @@ export struct DynamicDetailComponent {
224 item.height = callback?.height || 0; 226 item.height = callback?.height || 0;
225 }) 227 })
226 } 228 }
  229 + .onClick((event: ClickEvent) => {
  230 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
  231 + })
227 } 232 }
228 } else if (this.contentDetailData.photoList.length === 4) { 233 } else if (this.contentDetailData.photoList.length === 4) {
229 GridCol({ 234 GridCol({
@@ -233,6 +238,9 @@ export struct DynamicDetailComponent { @@ -233,6 +238,9 @@ export struct DynamicDetailComponent {
233 .aspectRatio(1) 238 .aspectRatio(1)
234 .borderRadius(this.caclImageRadius(index)) 239 .borderRadius(this.caclImageRadius(index))
235 } 240 }
  241 + .onClick((event: ClickEvent) => {
  242 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
  243 + })
236 } else { 244 } else {
237 GridCol({ 245 GridCol({
238 span: { sm: 4, lg: 3 } 246 span: { sm: 4, lg: 3 }
@@ -241,6 +249,9 @@ export struct DynamicDetailComponent { @@ -241,6 +249,9 @@ export struct DynamicDetailComponent {
241 .aspectRatio(1) 249 .aspectRatio(1)
242 .borderRadius(this.caclImageRadius(index)) 250 .borderRadius(this.caclImageRadius(index))
243 } 251 }
  252 + .onClick((event: ClickEvent) => {
  253 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
  254 + })
244 } 255 }
245 }) 256 })
246 } 257 }
@@ -414,7 +425,7 @@ export struct DynamicDetailComponent { @@ -414,7 +425,7 @@ export struct DynamicDetailComponent {
414 console.error(TAG, JSON.stringify(this.contentDetailData)) 425 console.error(TAG, JSON.stringify(this.contentDetailData))
415 let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) 426 let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
416 console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) 427 console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
417 - this.newsStatusOfUser = data[0]; 428 + // this.newsStatusOfUser = data[0];
418 Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) 429 Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
419 } catch (exception) { 430 } catch (exception) {
420 console.error(TAG, JSON.stringify(exception)) 431 console.error(TAG, JSON.stringify(exception))
@@ -486,6 +497,33 @@ export struct DynamicDetailComponent { @@ -486,6 +497,33 @@ export struct DynamicDetailComponent {
486 return 3; //普通图 497 return 3; //普通图
487 } 498 }
488 } 499 }
  500 +
  501 + /**
  502 + * 关注号主
  503 + */
  504 + async handleAccention() {
  505 + // 未登录,跳转登录
  506 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  507 + if (!user_id) {
  508 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  509 + return
  510 + }
  511 +
  512 + const params2: postInteractAccentionOperateParams = {
  513 + attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
  514 + attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id
  515 + attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id
  516 + status: this.followStatus == '0'? 1:0,
  517 + }
  518 + ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
  519 + console.log('关注号主==', JSON.stringify(res.data))
  520 + if (this.followStatus == '1') {
  521 + this.followStatus = '0'
  522 + } else {
  523 + this.followStatus = '1'
  524 + }
  525 + })
  526 + }
489 } 527 }
490 528
491 interface radiusType { 529 interface radiusType {
@@ -12,6 +12,7 @@ import { @@ -12,6 +12,7 @@ import {
12 } from 'wdBean'; 12 } from 'wdBean';
13 import DetailViewModel from '../viewmodel/DetailViewModel'; 13 import DetailViewModel from '../viewmodel/DetailViewModel';
14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; 14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
  15 +import { OperRowListView } from './view/OperRowListView';
15 import router from '@ohos.router'; 16 import router from '@ohos.router';
16 import { RecommendList } from '../components/view/RecommendList' 17 import { RecommendList } from '../components/view/RecommendList'
17 import { CommonConstants } from 'wdConstant'; 18 import { CommonConstants } from 'wdConstant';
@@ -91,7 +92,8 @@ export struct ImageAndTextPageComponent { @@ -91,7 +92,8 @@ export struct ImageAndTextPageComponent {
91 } 92 }
92 93
93 //底部交互区 94 //底部交互区
94 - Row() { 95 + OperRowListView({contentDetailData: this.contentDetailData[0]})
  96 + /* Row() {
95 Image($r('app.media.icon_arrow_left')) 97 Image($r('app.media.icon_arrow_left'))
96 .width(24) 98 .width(24)
97 .height(24) 99 .height(24)
@@ -126,7 +128,7 @@ export struct ImageAndTextPageComponent { @@ -126,7 +128,7 @@ export struct ImageAndTextPageComponent {
126 .height(56) 128 .height(56)
127 .padding({ left: 15, right: 15, bottom: 50, top: 20 }) 129 .padding({ left: 15, right: 15, bottom: 50, top: 20 })
128 .justifyContent(FlexAlign.SpaceBetween) 130 .justifyContent(FlexAlign.SpaceBetween)
129 - .backgroundColor(Color.White) 131 + .backgroundColor(Color.White)*/
130 } 132 }
131 133
132 } 134 }
@@ -6,7 +6,8 @@ import { @@ -6,7 +6,8 @@ import {
6 H5ReceiveDetailBean, 6 H5ReceiveDetailBean,
7 ResponseBean 7 ResponseBean
8 } from 'wdBean'; 8 } from 'wdBean';
9 -import { Logger } from 'wdKit'; 9 +import { Logger, SPHelper } from 'wdKit';
  10 +import { SpConstants } from 'wdConstant';
10 import { WdWebLocalComponent } from 'wdWebComponent'; 11 import { WdWebLocalComponent } from 'wdWebComponent';
11 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; 12 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
12 import { BridgeWebViewControl } from 'wdJsBridge/Index'; 13 import { BridgeWebViewControl } from 'wdJsBridge/Index';
@@ -22,7 +23,7 @@ export struct ImageAndTextWebComponent { @@ -22,7 +23,7 @@ export struct ImageAndTextWebComponent {
22 private webPrepared = false; 23 private webPrepared = false;
23 private dataPrepared = false; 24 private dataPrepared = false;
24 25
25 - onDetailDataUpdated() { 26 + async onDetailDataUpdated() {
26 if (this.action) { 27 if (this.action) {
27 let contentId: string = '' 28 let contentId: string = ''
28 let contentType: string = '' 29 let contentType: string = ''
@@ -30,6 +31,8 @@ export struct ImageAndTextWebComponent { @@ -30,6 +31,8 @@ export struct ImageAndTextWebComponent {
30 let channelId: string = '' 31 let channelId: string = ''
31 let compId: string = '' 32 let compId: string = ''
32 let sourcePage: string = '5' 33 let sourcePage: string = '5'
  34 + let creatorId = await SPHelper.default.get(SpConstants.USER_CREATOR_ID, '') || ''
  35 + let isLogin = await SPHelper.default.get(SpConstants.USER_STATUS, '') || '0'
33 if (this.action.params) { 36 if (this.action.params) {
34 if (this.action.params.contentID) { 37 if (this.action.params.contentID) {
35 contentId = this.action.params?.contentID 38 contentId = this.action.params?.contentID
@@ -56,8 +59,8 @@ export struct ImageAndTextWebComponent { @@ -56,8 +59,8 @@ export struct ImageAndTextWebComponent {
56 59
57 // TODO 对接user信息、登录情况 60 // TODO 对接user信息、登录情况
58 let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { 61 let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
59 - creatorId: '',  
60 - isLogin: '0', 62 + creatorId: creatorId,
  63 + isLogin: isLogin,
61 networkStatus: 1, 64 networkStatus: 1,
62 loadImageOnlyWifiSwitch: '2', 65 loadImageOnlyWifiSwitch: '2',
63 66
@@ -44,7 +44,8 @@ export struct CommentText { @@ -44,7 +44,8 @@ export struct CommentText {
44 textContent: this.longMessage, 44 textContent: this.longMessage,
45 fontSize: this.fontSize, 45 fontSize: this.fontSize,
46 fontWeight: this.fontWeight, 46 fontWeight: this.fontWeight,
47 - constraintWidth: (this.screenWidth - padding) 47 + constraintWidth: (this.screenWidth - padding),
  48 + wordBreak:WordBreak.BREAK_ALL
48 }) 49 })
49 50
50 console.log(`文本宽度为:${this.textWidth}`) 51 console.log(`文本宽度为:${this.textWidth}`)
@@ -71,7 +72,8 @@ export struct CommentText { @@ -71,7 +72,8 @@ export struct CommentText {
71 textContent: string, 72 textContent: string,
72 fontSize: this.fontSize, 73 fontSize: this.fontSize,
73 fontWeight: this.fontWeight, 74 fontWeight: this.fontWeight,
74 - constraintWidth: (this.screenWidth - padding) 75 + constraintWidth: (this.screenWidth - padding),
  76 + wordBreak:WordBreak.BREAK_ALL
75 }) 77 })
76 78
77 //计算有误差20 79 //计算有误差20
@@ -130,6 +132,7 @@ export struct CommentText { @@ -130,6 +132,7 @@ export struct CommentText {
130 .fontWeight(this.fontWeight) 132 .fontWeight(this.fontWeight)
131 .fontColor(this.fontColor) 133 .fontColor(this.fontColor)
132 .maxLines(this.lines) 134 .maxLines(this.lines)
  135 + .wordBreak(WordBreak.BREAK_ALL)
133 136
134 // .backgroundColor(Color.Red) 137 // .backgroundColor(Color.Red)
135 138
@@ -15,6 +15,7 @@ export struct ChildCommentComponent { @@ -15,6 +15,7 @@ export struct ChildCommentComponent {
15 @State isExpandParent: boolean = false; 15 @State isExpandParent: boolean = false;
16 @State isOverLines: boolean = false 16 @State isOverLines: boolean = false
17 @State isOverLinesParent: boolean = false 17 @State isOverLinesParent: boolean = false
  18 + testText:string = "1,因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸"
18 19
19 build() { 20 build() {
20 Column() { 21 Column() {
@@ -71,7 +72,7 @@ export struct ChildCommentComponent { @@ -71,7 +72,7 @@ export struct ChildCommentComponent {
71 }) 72 })
72 } 73 }
73 } 74 }
74 - .margin({ bottom: '10lpx' }) 75 + .margin({ bottom: '5lpx' })
75 .width('100%') 76 .width('100%')
76 .height('108lpx') 77 .height('108lpx')
77 .padding({ left: '31lpx', right: '31lpx' }) 78 .padding({ left: '31lpx', right: '31lpx' })
@@ -93,6 +94,7 @@ export struct ChildCommentComponent { @@ -93,6 +94,7 @@ export struct ChildCommentComponent {
93 }) 94 })
94 } 95 }
95 }.maxLines(5) 96 }.maxLines(5)
  97 + .wordBreak(WordBreak.BREAK_ALL)
96 .textStyle() 98 .textStyle()
97 } 99 }
98 }.padding({ left: '31lpx', right: '31lpx' }) 100 }.padding({ left: '31lpx', right: '31lpx' })
@@ -138,6 +140,7 @@ export struct ChildCommentComponent { @@ -138,6 +140,7 @@ export struct ChildCommentComponent {
138 }) 140 })
139 } 141 }
140 }.maxLines(5) 142 }.maxLines(5)
  143 + .wordBreak(WordBreak.BREAK_ALL)
141 .textAlign(TextAlign.Start) 144 .textAlign(TextAlign.Start)
142 .width('100%') 145 .width('100%')
143 } 146 }
@@ -243,11 +246,13 @@ export struct ChildCommentComponent { @@ -243,11 +246,13 @@ export struct ChildCommentComponent {
243 let measureTruncateWidth: number = measure.measureText({ 246 let measureTruncateWidth: number = measure.measureText({
244 textContent: truncateContent, 247 textContent: truncateContent,
245 fontSize: px2fp(fontSize), 248 fontSize: px2fp(fontSize),
  249 + wordBreak:WordBreak.BREAK_ALL
246 }) 250 })
247 if(type === 1){ 251 if(type === 1){
248 measureTruncateWidth = measureTruncateWidth + measure.measureText({ 252 measureTruncateWidth = measureTruncateWidth + measure.measureText({
249 textContent: `@${this.data.parentCommentUserName}:`, 253 textContent: `@${this.data.parentCommentUserName}:`,
250 fontSize: px2fp(fontSize), 254 fontSize: px2fp(fontSize),
  255 + wordBreak:WordBreak.BREAK_ALL
251 }) 256 })
252 } 257 }
253 let clipStr: string = '' 258 let clipStr: string = ''
@@ -255,6 +260,7 @@ export struct ChildCommentComponent { @@ -255,6 +260,7 @@ export struct ChildCommentComponent {
255 if (measure.measureText({ 260 if (measure.measureText({
256 textContent: clipStr, 261 textContent: clipStr,
257 fontSize: px2fp(fontSize), 262 fontSize: px2fp(fontSize),
  263 + wordBreak:WordBreak.BREAK_ALL
258 }) >= textWidth * maxLines - measureTruncateWidth) { 264 }) >= textWidth * maxLines - measureTruncateWidth) {
259 if (type === 0) { 265 if (type === 0) {
260 this.isOverLines = true 266 this.isOverLines = true
@@ -2,8 +2,7 @@ import { Action, ContentDTO, Params } from 'wdBean'; @@ -2,8 +2,7 @@ import { Action, ContentDTO, Params } from 'wdBean';
2 import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; 2 import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
3 import { Logger } from 'wdKit'; 3 import { Logger } from 'wdKit';
4 import { CompUtils } from '../../utils/CompUtils'; 4 import { CompUtils } from '../../utils/CompUtils';
5 -import { WDRouterRule } from 'wdRouter';  
6 -import { ProcessUtils } from 'wdRouter'; 5 +import { ProcessUtils, WDRouterRule } from 'wdRouter';
7 6
8 const TAG: string = 'CardView'; 7 const TAG: string = 'CardView';
9 8
@@ -24,8 +23,7 @@ export struct CarouselLayout01CardView { @@ -24,8 +23,7 @@ export struct CarouselLayout01CardView {
24 Image(this.item.coverUrl) 23 Image(this.item.coverUrl)
25 .width(CommonConstants.FULL_PARENT) 24 .width(CommonConstants.FULL_PARENT)
26 .height(CommonConstants.FULL_PARENT) 25 .height(CommonConstants.FULL_PARENT)
27 - .objectFit(ImageFit.Cover)  
28 - // .borderRadius($r("app.float.border_radius_6")) 26 + .objectFit(ImageFit.Cover)// .borderRadius($r("app.float.border_radius_6"))
29 .alignRules({ 27 .alignRules({
30 top: { anchor: '__container__', align: VerticalAlign.Top }, 28 top: { anchor: '__container__', align: VerticalAlign.Top },
31 left: { anchor: '__container__', align: HorizontalAlign.Start } 29 left: { anchor: '__container__', align: HorizontalAlign.Start }
@@ -435,11 +433,10 @@ export struct PaperSingleColumn999CardView { @@ -435,11 +433,10 @@ export struct PaperSingleColumn999CardView {
435 .fontSize(12) 433 .fontSize(12)
436 .fontColor(Color.Gray) 434 .fontColor(Color.Gray)
437 .margin({ left: 22 }) 435 .margin({ left: 22 })
438 - Image($r('app.media.icon_share')) 436 + Image($r('app.media.icon_forward'))
439 .width(16) 437 .width(16)
440 .height(16) 438 .height(16)
441 .margin({ left: 10, right: 22, top: 10, bottom: 10 }) 439 .margin({ left: 10, right: 22, top: 10, bottom: 10 })
442 - .backgroundColor(Color.Brown)  
443 }.width(CommonConstants.FULL_PARENT) 440 }.width(CommonConstants.FULL_PARENT)
444 .justifyContent(FlexAlign.SpaceBetween) 441 .justifyContent(FlexAlign.SpaceBetween)
445 } 442 }
@@ -447,7 +444,7 @@ export struct PaperSingleColumn999CardView { @@ -447,7 +444,7 @@ export struct PaperSingleColumn999CardView {
447 .backgroundColor(Color.White) 444 .backgroundColor(Color.White)
448 .margin({ bottom: 5, left: 12, right: 12 }) 445 .margin({ bottom: 5, left: 12, right: 12 })
449 .borderRadius(4) 446 .borderRadius(4)
450 - .onClick(()=>{ 447 + .onClick(() => {
451 ProcessUtils.processPage(this.item) 448 ProcessUtils.processPage(this.item)
452 }) 449 })
453 } 450 }
1 import { CommonConstants, ViewType } from 'wdConstant'; 1 import { CommonConstants, ViewType } from 'wdConstant';
2 import { Logger } from 'wdKit'; 2 import { Logger } from 'wdKit';
3 import PageViewModel from '../../viewmodel/PageViewModel'; 3 import PageViewModel from '../../viewmodel/PageViewModel';
4 -import { EmptyComponent } from '../view/EmptyComponent'; 4 +import { EmptyComponent, WDViewDefaultType } from '../view/EmptyComponent';
5 import { ErrorComponent } from '../view/ErrorComponent'; 5 import { ErrorComponent } from '../view/ErrorComponent';
6 import PageModel from '../../viewmodel/PageModel'; 6 import PageModel from '../../viewmodel/PageModel';
7 import { listTouchEvent } from '../../utils/PullDownRefresh'; 7 import { listTouchEvent } from '../../utils/PullDownRefresh';
@@ -31,14 +31,18 @@ export struct PageComponent { @@ -31,14 +31,18 @@ export struct PageComponent {
31 build() { 31 build() {
32 Column() { 32 Column() {
33 if (this.pageModel.viewType == ViewType.LOADING) { 33 if (this.pageModel.viewType == ViewType.LOADING) {
34 - // LoadingComponent()  
35 this.LoadingLayout() 34 this.LoadingLayout()
36 - } else if (this.pageModel.viewType == ViewType.ERROR) {  
37 - ErrorComponent()  
38 - } else if (this.pageModel.viewType == ViewType.EMPTY) {  
39 - EmptyComponent()  
40 - } else { 35 + } else if (this.pageModel.viewType == ViewType.LOADED) {
41 this.ListLayout() 36 this.ListLayout()
  37 + } else if (this.pageModel.viewType == ViewType.EMPTY) {
  38 + //缺省页
  39 + EmptyComponent({
  40 + emptyType: this.pageModel.emptyType,
  41 + emptyButton: true,
  42 + retry: () => {
  43 + this.getData()
  44 + }
  45 + })
42 } 46 }
43 } 47 }
44 .width(CommonConstants.FULL_PARENT) 48 .width(CommonConstants.FULL_PARENT)
@@ -65,7 +69,6 @@ export struct PageComponent { @@ -65,7 +69,6 @@ export struct PageComponent {
65 this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) 69 this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
66 }) 70 })
67 } 71 }
68 -  
69 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { 72 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
70 ListItem() { 73 ListItem() {
71 Column() { 74 Column() {
@@ -124,9 +127,10 @@ export struct PageComponent { @@ -124,9 +127,10 @@ export struct PageComponent {
124 127
125 if (this.pageAdvModel.isShowAds) { 128 if (this.pageAdvModel.isShowAds) {
126 if (this.pageAdvModel.pageCornerAdv.matInfo != null) { 129 if (this.pageAdvModel.pageCornerAdv.matInfo != null) {
127 - // 页面右边挂角 130 + // 广告中心的挂角广告
128 this.drawPageCornerAdvView(1, 1 == this.pageAdvModel.isRightAdv) 131 this.drawPageCornerAdvView(1, 1 == this.pageAdvModel.isRightAdv)
129 } else if (this.pageAdvModel.pageCornerContentInfo.advert != null) { 132 } else if (this.pageAdvModel.pageCornerContentInfo.advert != null) {
  133 + // 展现中心的挂角广告业务
130 this.drawPageCornerAdvView(2, 1 == this.pageAdvModel.isRightAdv) 134 this.drawPageCornerAdvView(2, 1 == this.pageAdvModel.isRightAdv)
131 } 135 }
132 } 136 }
@@ -6,7 +6,6 @@ import { StringUtils } from 'wdKit/Index' @@ -6,7 +6,6 @@ import { StringUtils } from 'wdKit/Index'
6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
7 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' 7 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
8 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' 8 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
9 -import { LiveModel } from '../../viewmodel/LiveModel'  
10 9
11 @Component 10 @Component
12 export struct LiveHorizontalReservationComponent { 11 export struct LiveHorizontalReservationComponent {
@@ -20,7 +19,7 @@ export struct LiveHorizontalReservationComponent { @@ -20,7 +19,7 @@ export struct LiveHorizontalReservationComponent {
20 .width(3) 19 .width(3)
21 .height(16) 20 .height(16)
22 .margin({ right: 4 }) 21 .margin({ right: 4 })
23 - Text(StringUtils.isNotEmpty(this?.compDTO?.objectTitle) ? this?.compDTO?.objectTitle : "直播预") 22 + Text(StringUtils.isNotEmpty(this?.compDTO?.objectTitle) ? this?.compDTO?.objectTitle : "直播预")
24 .fontSize($r("app.float.font_size_17")) 23 .fontSize($r("app.float.font_size_17"))
25 .fontColor($r("app.color.color_222222")) 24 .fontColor($r("app.color.color_222222"))
26 .fontWeight(600) 25 .fontWeight(600)
@@ -82,6 +81,7 @@ export struct LiveHorizontalReservationComponent { @@ -82,6 +81,7 @@ export struct LiveHorizontalReservationComponent {
82 }) 81 })
83 }) 82 })
84 }.listDirection(Axis.Horizontal) 83 }.listDirection(Axis.Horizontal)
  84 + .scrollBar(BarState.Off)
85 .width(CommonConstants.FULL_WIDTH) 85 .width(CommonConstants.FULL_WIDTH)
86 .height(this.compDTO.operDataList.length == 2 ? 180 : 136) 86 .height(this.compDTO.operDataList.length == 2 ? 180 : 136)
87 } else if (this.compDTO.operDataList.length) { 87 } else if (this.compDTO.operDataList.length) {
@@ -12,6 +12,7 @@ import { @@ -12,6 +12,7 @@ import {
12 import router from '@ohos.router'; 12 import router from '@ohos.router';
13 import inputMethod from '@ohos.inputMethod'; 13 import inputMethod from '@ohos.inputMethod';
14 import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; 14 import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
  15 +import { LikeComponent } from './LikeComponent';
15 import { HttpUrlUtils } from 'wdNetwork/Index'; 16 import { HttpUrlUtils } from 'wdNetwork/Index';
16 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 17 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
17 import { PageRepository } from '../../repository/PageRepository'; 18 import { PageRepository } from '../../repository/PageRepository';
@@ -29,9 +30,11 @@ const TAG = 'OperRowListView'; @@ -29,9 +30,11 @@ const TAG = 'OperRowListView';
29 @Preview 30 @Preview
30 @Component 31 @Component
31 export struct OperRowListView { 32 export struct OperRowListView {
32 - private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 33 + // private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
  34 + @Prop contentDetailData: ContentDetailDTO
33 @State interactData: InteractDataDTO = {} as InteractDataDTO 35 @State interactData: InteractDataDTO = {} as InteractDataDTO
34 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 36 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
  37 + @State likeBean: Record<string, string> = {}
35 38
36 @State operationList: OperationItem[] = [ 39 @State operationList: OperationItem[] = [
37 { 40 {
@@ -60,6 +63,20 @@ export struct OperRowListView { @@ -60,6 +63,20 @@ export struct OperRowListView {
60 this.getInteractDataStatus() 63 this.getInteractDataStatus()
61 } 64 }
62 this.queryContentInteractCount() 65 this.queryContentInteractCount()
  66 + // 点赞需要数据
  67 + // this.data['userName'] = '人民日报网友2kD2xW'
  68 + // this.data['contentType'] = '8' //必须
  69 + // this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学'
  70 + // this.data['userHeaderUrl'] = ""
  71 + // this.data['channelId'] = "2059" //必须
  72 + // this.data['status'] = "1" //必须
  73 + this.likeBean['contentId'] = this.contentDetailData.newsId + ''
  74 + this.likeBean['userName'] = this.contentDetailData.editorName + ''
  75 + this.likeBean['contentType'] = this.contentDetailData.newsType + ''
  76 + this.likeBean['title'] = this.contentDetailData.newsTitle + ''
  77 + this.likeBean['userHeaderUrl'] = ''
  78 + this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
  79 + this.likeBean['status'] = ''
63 } 80 }
64 81
65 build() { 82 build() {
@@ -83,7 +100,7 @@ export struct OperRowListView { @@ -83,7 +100,7 @@ export struct OperRowListView {
83 .onClick(() => { 100 .onClick(() => {
84 router.back(); 101 router.back();
85 }) 102 })
86 - TextInput({placeholder:'说两句...'}) 103 + TextInput({placeholder:'说两句11...'})
87 .placeholderColor('#999999') 104 .placeholderColor('#999999')
88 .placeholderFont( 105 .placeholderFont(
89 { 106 {
@@ -112,10 +129,9 @@ export struct OperRowListView { @@ -112,10 +129,9 @@ export struct OperRowListView {
112 .width('54.5%') 129 .width('54.5%')
113 } 130 }
114 .width('100%') 131 .width('100%')
115 - .height(56) 132 + .height(126)
116 .backgroundColor(Color.Black) 133 .backgroundColor(Color.Black)
117 } 134 }
118 -  
119 /** 135 /**
120 * 组件项 136 * 组件项
121 * 137 *
@@ -125,7 +141,11 @@ export struct OperRowListView { @@ -125,7 +141,11 @@ export struct OperRowListView {
125 buildOperationItem(item: OperationItem, index: number) { 141 buildOperationItem(item: OperationItem, index: number) {
126 Column() { 142 Column() {
127 if (item.text === '点赞') { 143 if (item.text === '点赞') {
128 - RelativeContainer() { 144 + LikeComponent({
  145 + data: this.likeBean
  146 + })
  147 +
  148 + /* RelativeContainer() {
129 Row() { 149 Row() {
130 Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon) 150 Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon)
131 .width(24) 151 .width(24)
@@ -134,6 +154,7 @@ export struct OperRowListView { @@ -134,6 +154,7 @@ export struct OperRowListView {
134 .interpolation(ImageInterpolation.High) 154 .interpolation(ImageInterpolation.High)
135 .onClick(() => { 155 .onClick(() => {
136 this.toggleLikeStatus() 156 this.toggleLikeStatus()
  157 + console.log('点赞_111', JSON.stringify(this.contentDetailData))
137 }) 158 })
138 } 159 }
139 .alignRules({ 160 .alignRules({
@@ -168,7 +189,7 @@ export struct OperRowListView { @@ -168,7 +189,7 @@ export struct OperRowListView {
168 .id(`e_row3_${index}`) 189 .id(`e_row3_${index}`)
169 } 190 }
170 } 191 }
171 - .id(`e_icon_${index}`) 192 + .id(`e_icon_${index}`)*/
172 } else if (item.text === '收藏') { 193 } else if (item.text === '收藏') {
173 RelativeContainer() { 194 RelativeContainer() {
174 Row() { 195 Row() {
1 import { PageInfoDTO } from 'wdBean/Index'; 1 import { PageInfoDTO } from 'wdBean/Index';
2 import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; 2 import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
  3 +import { DateTimeUtils, SPHelper } from 'wdKit/Index';
  4 +import { ArrayList } from '@kit.ArkTS';
  5 +import { SpConstants } from 'wdConstant/Index';
3 6
4 /** 7 /**
5 * @Description: 处理页面的广告业务 8 * @Description: 处理页面的广告业务
@@ -18,16 +21,11 @@ export default class PageAdModel { @@ -18,16 +21,11 @@ export default class PageAdModel {
18 // 1:右边;2:左边 -> 默认右边 21 // 1:右边;2:左边 -> 默认右边
19 pageCornerContentInfo: AdvRuleBean = {} as AdvRuleBean 22 pageCornerContentInfo: AdvRuleBean = {} as AdvRuleBean
20 23
21 - // 展现中心业务信息  
22 -  
23 -  
24 -  
25 -  
26 /** 24 /**
27 * 解析广告资源 25 * 解析广告资源
28 * @param pageInfo 26 * @param pageInfo
29 */ 27 */
30 - analysisAdvSource(pageInfo: PageInfoDTO): void { 28 + async analysisAdvSource(pageInfo: PageInfoDTO) {
31 29
32 if (pageInfo.hasAdInfo === 1 && pageInfo.cornersAdv != null) { 30 if (pageInfo.hasAdInfo === 1 && pageInfo.cornersAdv != null) {
33 // 优先展示展现中心广告 31 // 优先展示展现中心广告
@@ -55,12 +53,26 @@ export default class PageAdModel { @@ -55,12 +53,26 @@ export default class PageAdModel {
55 } else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) { 53 } else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) {
56 // 广告中心-挂角广告信息 54 // 广告中心-挂角广告信息
57 let cornersAdv2 = pageInfo.cornersAdv2 55 let cornersAdv2 = pageInfo.cornersAdv2
58 - // 获取  
59 - let showCompAdvBean = cornersAdv2[0] 56 +
  57 + if (cornersAdv2.length == 0) {
  58 + return
  59 + }
  60 + // 加工处理广告中心的广告数据
  61 + let pageCoreAdvArray = this.treatPageInfoAdsData(cornersAdv2);
  62 +
  63 + let advLength = pageCoreAdvArray.length;
  64 + let pageId = pageInfo.id.toString();
  65 + let a = 0;
  66 + if (advLength > 1) {
  67 + a = await this.calPageAdvIndex(pageId,advLength)
  68 + }
  69 + // 获取投放
  70 + let showCompAdvBean = pageCoreAdvArray.convertToArray()[a]
60 71
61 if (showCompAdvBean.matInfo == null) { 72 if (showCompAdvBean.matInfo == null) {
62 return 73 return
63 } 74 }
  75 + this.saveReleaseAdvIndex(pageId, a)
64 // 76 //
65 let slotInfo = showCompAdvBean.slotInfo; 77 let slotInfo = showCompAdvBean.slotInfo;
66 let postion = slotInfo.position 78 let postion = slotInfo.position
@@ -76,4 +88,84 @@ export default class PageAdModel { @@ -76,4 +88,84 @@ export default class PageAdModel {
76 } 88 }
77 89
78 } 90 }
  91 + /**
  92 + * 计算投放广告的序列号
  93 + * @param pageId
  94 + * @param advLength
  95 + * @returns
  96 + */
  97 + private async calPageAdvIndex(pageId: string , advLength: number): Promise<number>{
  98 +
  99 + let index = await this.obtainReleaseAdvIndex(pageId);
  100 + let a = await index + 1;
  101 + if (a >= advLength) {
  102 + a = 0;
  103 + }
  104 + return a;
  105 + }
  106 +
  107 + /**
  108 + * 获取已投放挂角广告的编号
  109 + * @param pageId
  110 + * @returns
  111 + */
  112 + private async obtainReleaseAdvIndex(pageId: string): Promise<number> {
  113 +
  114 + let index: number = await SPHelper.default.get(SpConstants.APP_PAGE_CORNER_ADV + pageId, -1) as number;
  115 +
  116 + return index;
  117 + }
  118 +
  119 + /**
  120 + * 存储已经投放广告的编号
  121 + * @param pageId
  122 + * @param index
  123 + */
  124 + private async saveReleaseAdvIndex(pageId: string, index: number) {
  125 + await SPHelper.default.save(SpConstants.APP_PAGE_CORNER_ADV + pageId, index)
  126 + }
  127 +
  128 + /**
  129 + * 删除数据
  130 + * @param pageId
  131 + */
  132 + private async clearHistoryAdvIndex(pageId: string){
  133 +
  134 + SPHelper.default.deleteSync(SpConstants.APP_PAGE_CORNER_ADV + pageId)
  135 +
  136 + }
  137 +
  138 + private checkPageCornerAdv(pageId: string): Promise<boolean> {
  139 + let haveData = SPHelper.default.has(SpConstants.APP_PAGE_CORNER_ADV + pageId)
  140 + return haveData
  141 + }
  142 +
  143 + /**
  144 + * 对广告中心的广告 数据按不同维度加工 筛选出符合的数据
  145 + * @param cornersAdv2 页面的广告数据
  146 + * @param pageId 所在页面pageid
  147 + */
  148 + private treatPageInfoAdsData(cornersAdv2: CompAdvBean[]): ArrayList<CompAdvBean> {
  149 +
  150 + // 按时间维度过滤出广告数据
  151 + let compAdsArray: ArrayList<CompAdvBean> = new ArrayList();
  152 + let serverTimeLong: number = DateTimeUtils.getTimeStamp();
  153 + for (let advBean of cornersAdv2) {
  154 + let startLong = advBean.startTime;
  155 + let endLong = advBean.endTime;
  156 +
  157 + if (serverTimeLong >= startLong && serverTimeLong <= endLong) {
  158 + //符合开始时间和结束时间要求
  159 + compAdsArray.add(advBean)
  160 + }
  161 + }
  162 +
  163 + //按展现优先级维度 数值越小,等级越高
  164 + if (compAdsArray.length > 1) {
  165 + //B、按展现优先级维度 数值越小,等级越高
  166 + compAdsArray.sort((a: CompAdvBean, b: CompAdvBean) => a.displayPriority - b.displayPriority)
  167 + }
  168 +
  169 + return compAdsArray;
  170 + }
79 } 171 }
1 import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean'; 1 import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean';
2 import { CompStyle, ViewType } from 'wdConstant/Index'; 2 import { CompStyle, ViewType } from 'wdConstant/Index';
3 -import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit'; 3 +import { CollectionUtils, DateTimeUtils, Logger, NetworkUtil } from 'wdKit';
4 import { closeRefresh } from '../utils/PullDownRefresh'; 4 import { closeRefresh } from '../utils/PullDownRefresh';
5 import PageModel from './PageModel'; 5 import PageModel from './PageModel';
6 import PageViewModel from './PageViewModel'; 6 import PageViewModel from './PageViewModel';
7 import { promptAction } from '@kit.ArkUI'; 7 import { promptAction } from '@kit.ArkUI';
8 import { AdvRuleBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; 8 import { AdvRuleBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
9 import PageAdModel from './PageAdvModel'; 9 import PageAdModel from './PageAdvModel';
  10 +import { WDViewDefaultType } from '../components/view/EmptyComponent';
10 11
11 const TAG = 'PageHelper'; 12 const TAG = 'PageHelper';
12 13
@@ -14,14 +15,12 @@ const TAG = 'PageHelper'; @@ -14,14 +15,12 @@ const TAG = 'PageHelper';
14 * 处理返回后的数据 15 * 处理返回后的数据
15 */ 16 */
16 export class PageHelper { 17 export class PageHelper {
17 -  
18 -  
19 /** 18 /**
20 * 刷新数据 19 * 刷新数据
21 */ 20 */
22 - async refreshUI(pageModel: PageModel,pageAdvModel:PageAdModel) { 21 + async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) {
23 pageModel.loadStrategy = 2 22 pageModel.loadStrategy = 2
24 - this.getPageInfo(pageModel,pageAdvModel) 23 + this.getPageInfo(pageModel, pageAdvModel)
25 } 24 }
26 25
27 /** 26 /**
@@ -36,28 +35,36 @@ export class PageHelper { @@ -36,28 +35,36 @@ export class PageHelper {
36 /** 35 /**
37 * 进页面请求数据 36 * 进页面请求数据
38 */ 37 */
39 - async getInitData(pageModel: PageModel,pageAdvModel:PageAdModel) { 38 + async getInitData(pageModel: PageModel, pageAdvModel: PageAdModel) {
40 pageModel.loadStrategy = 1 39 pageModel.loadStrategy = 1
41 - this.getPageInfo(pageModel,pageAdvModel) 40 + let netStatus = NetworkUtil.isNetConnected()
  41 + if (netStatus) {
  42 + this.getPageInfo(pageModel, pageAdvModel)
  43 + } else {
  44 + pageModel.viewType = ViewType.EMPTY;
  45 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork;
  46 + }
42 } 47 }
43 48
44 - async getPageInfo(pageModel: PageModel,pageAdvModel:PageAdModel) { 49 + getPageInfo(pageModel: PageModel, pageAdvModel: PageAdModel) {
45 pageModel.currentPage = 1; 50 pageModel.currentPage = 1;
46 - let pageInfo = await PageViewModel.getPageInfo(pageModel.pageId); 51 + PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => {
47 if (pageInfo == null) { 52 if (pageInfo == null) {
48 pageModel.viewType = ViewType.EMPTY; 53 pageModel.viewType = ViewType.EMPTY;
  54 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent;
49 return; 55 return;
50 } 56 }
51 pageModel.pageInfo = pageInfo; 57 pageModel.pageInfo = pageInfo;
52 //解析广告资源 58 //解析广告资源
53 - pageAdvModel.analysisAdvSource(pageInfo)  
54 - 59 + pageAdvModel.analysisAdvSource(pageInfo);
55 this.parseGroup(pageModel) 60 this.parseGroup(pageModel)
56 - 61 + }).catch(() => {
  62 + pageModel.viewType = ViewType.EMPTY;
  63 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed;
  64 + })
57 } 65 }
58 66
59 67
60 -  
61 async parseGroup(pageModel: PageModel) { 68 async parseGroup(pageModel: PageModel) {
62 let pageInfo: PageInfoDTO = pageModel.pageInfo 69 let pageInfo: PageInfoDTO = pageModel.pageInfo
63 pageModel.groupList = [] 70 pageModel.groupList = []
@@ -84,6 +91,8 @@ export class PageHelper { @@ -84,6 +91,8 @@ export class PageHelper {
84 // 没数据,展示空页面 91 // 没数据,展示空页面
85 Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.'); 92 Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.');
86 pageModel.viewType = ViewType.EMPTY; 93 pageModel.viewType = ViewType.EMPTY;
  94 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent;
  95 +
87 } 96 }
88 } 97 }
89 98
@@ -5,6 +5,7 @@ import { RefreshConstants as Const } from '../utils/RefreshConstants'; @@ -5,6 +5,7 @@ import { RefreshConstants as Const } from '../utils/RefreshConstants';
5 import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; 5 import { PageUIReqBean } from '../components/page/bean/PageUIReqBean';
6 import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; 6 import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
7 import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; 7 import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
  8 +import { WDViewDefaultType } from '../components/view/EmptyComponent';
8 9
9 /** 10 /**
10 * 页面下拉刷新、上拉加载数据bean。 11 * 页面下拉刷新、上拉加载数据bean。
@@ -38,6 +39,7 @@ export default class PageModel { @@ -38,6 +39,7 @@ export default class PageModel {
38 isVisiblePullUpLoad: boolean = false; 39 isVisiblePullUpLoad: boolean = false;
39 offsetY: number = 0; 40 offsetY: number = 0;
40 viewType: number = ViewType.LOADING; 41 viewType: number = ViewType.LOADING;
  42 + emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default
41 hasMore: boolean = true; 43 hasMore: boolean = true;
42 startIndex = 0; 44 startIndex = 0;
43 endIndex = 0; 45 endIndex = 0;
@@ -51,12 +53,6 @@ export default class PageModel { @@ -51,12 +53,6 @@ export default class PageModel {
51 // keyGenerator相关字符串,用于刷新list布局 53 // keyGenerator相关字符串,用于刷新list布局
52 timestamp: String = '1'; 54 timestamp: String = '1';
53 55
54 - // //左右挂角广告对象  
55 - // pageCornerAdv:CompAdvBean = {} as CompAdvBean // 挂角广告  
56 - // isShowAds : boolean = false;  
57 - // isRightAdv : number = 1;// 1:右边;2:左边 -> 默认右边  
58 - // pageCornerContentInfo:AdvRuleBean = {} as AdvRuleBean // 展现中心业务信息  
59 -  
60 56
61 /** 57 /**
62 * 简单复制业务数据 58 * 简单复制业务数据
@@ -26,7 +26,7 @@ export struct TabChatComponent { @@ -26,7 +26,7 @@ export struct TabChatComponent {
26 } else if (this.pageModel.viewType == ViewType.ERROR) { 26 } else if (this.pageModel.viewType == ViewType.ERROR) {
27 ErrorComponent() 27 ErrorComponent()
28 } else if (this.pageModel.viewType == ViewType.EMPTY) { 28 } else if (this.pageModel.viewType == ViewType.EMPTY) {
29 - EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoContent1 }) 29 + EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoComment1 })
30 } else { 30 } else {
31 this.ListLayout() 31 this.ListLayout()
32 } 32 }
@@ -107,7 +107,6 @@ export struct TabLiveItemComponent { @@ -107,7 +107,6 @@ export struct TabLiveItemComponent {
107 .listDirection(Axis.Horizontal) 107 .listDirection(Axis.Horizontal)
108 .margin({ 108 .margin({
109 top: 8, 109 top: 8,
110 - right: 16  
111 }) 110 })
112 } 111 }
113 //音频 112 //音频
@@ -147,14 +146,12 @@ export struct TabLiveItemComponent { @@ -147,14 +146,12 @@ export struct TabLiveItemComponent {
147 } 146 }
148 .margin({ 147 .margin({
149 top: 8, 148 top: 8,
150 - right: 16  
151 }) 149 })
152 .aspectRatio(Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[0]) / Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[1])) 150 .aspectRatio(Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[0]) / Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[1]))
153 .onClick(() => { 151 .onClick(() => {
154 this.gotoVideoPlayPage() 152 this.gotoVideoPlayPage()
155 }) 153 })
156 } 154 }
157 -  
158 } 155 }
159 .margin({ 156 .margin({
160 left: 8, 157 left: 8,
@@ -75,7 +75,7 @@ export struct PlayUIComponent { @@ -75,7 +75,7 @@ export struct PlayUIComponent {
75 if (this.liveDetailsBean.liveInfo?.liveState != 'wait') { 75 if (this.liveDetailsBean.liveInfo?.liveState != 'wait') {
76 Text(this.liveDetailsBean.newsTitle) 76 Text(this.liveDetailsBean.newsTitle)
77 .maxLines(1) 77 .maxLines(1)
78 - .textOverflow({ overflow: TextOverflow.Ellipsis }) 78 + .textOverflow({ overflow: TextOverflow.MARQUEE })
79 .fontSize('16fp') 79 .fontSize('16fp')
80 .fontWeight(500) 80 .fontWeight(500)
81 .fontColor(Color.White) 81 .fontColor(Color.White)
@@ -269,8 +269,7 @@ export struct PlayUIComponent { @@ -269,8 +269,7 @@ export struct PlayUIComponent {
269 .blockSize({ 269 .blockSize({
270 width: 18, 270 width: 18,
271 height: 12 271 height: 12
272 - })  
273 - // .blockStyle({ 272 + })// .blockStyle({
274 // type: SliderBlockType.IMAGE, 273 // type: SliderBlockType.IMAGE,
275 // image: $r('app.media.ic_player_block') 274 // image: $r('app.media.ic_player_block')
276 // }) 275 // })
@@ -14,7 +14,7 @@ import { SpConstants } from 'wdConstant/Index' @@ -14,7 +14,7 @@ import { SpConstants } from 'wdConstant/Index'
14 14
15 15
16 const TAG = 'PlayerRightView'; 16 const TAG = 'PlayerRightView';
17 - 17 +//视频点播页右侧操作栏:点赞/收藏/评论/分享 竖着排列
18 @Component 18 @Component
19 export struct PlayerRightView { 19 export struct PlayerRightView {
20 private playerController?: WDPlayerController; 20 private playerController?: WDPlayerController;
@@ -11,7 +11,3 @@ export { PlayerConstants } from "./src/main/ets/constants/PlayerConstants" @@ -11,7 +11,3 @@ export { PlayerConstants } from "./src/main/ets/constants/PlayerConstants"
11 export { SpeedBean } from "./src/main/ets/bean/SpeedBean" 11 export { SpeedBean } from "./src/main/ets/bean/SpeedBean"
12 12
13 export { DateFormatUtil } from "./src/main/ets/utils/DateFormatUtil" 13 export { DateFormatUtil } from "./src/main/ets/utils/DateFormatUtil"
14 -  
15 -export { WDAliPlayerController } from "./src/main/ets/controller/WDAliPlayerController"  
16 -  
17 -export { WDListPlayerData, WDAliListPlayerController } from "./src/main/ets/controller/WDAliListPlayerController"  
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 "main": "Index.ets", 7 "main": "Index.ets",
8 "version": "1.0.0", 8 "version": "1.0.0",
9 "dependencies": { 9 "dependencies": {
10 - "wdKit": "file:../../commons/wdKit",  
11 - "premierlibrary": "file:./libs/premierlibrary.har" 10 + "wdKit": "file:../../commons/wdKit"
12 } 11 }
13 } 12 }
@@ -5,8 +5,6 @@ export class PlayerConstants { @@ -5,8 +5,6 @@ export class PlayerConstants {
5 static readonly STATUS_START: number = 1; 5 static readonly STATUS_START: number = 1;
6 static readonly STATUS_PAUSE: number = 2; 6 static readonly STATUS_PAUSE: number = 2;
7 static readonly STATUS_STOP: number = 3; 7 static readonly STATUS_STOP: number = 3;
8 - static readonly STATUS_ERROR: number = 4;  
9 - static readonly STATUS_COMPLETION: number = 5;  
10 8
11 static readonly OPERATE_STATE: Array<string> = ['prepared','playing', 'paused', 'completed']; 9 static readonly OPERATE_STATE: Array<string> = ['prepared','playing', 'paused', 'completed'];
12 10
1 -import { AliPlayerFactory, AliPlayer, InfoBean, UrlSource, ErrorInfo, InfoCode } from 'premierlibrary';  
2 -import {  
3 - idle,  
4 - initalized,  
5 - prepared,  
6 - started,  
7 - paused,  
8 - stopped,  
9 - completion,  
10 - error} from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer';  
11 -import { AliListPlayer } from 'premierlibrary/src/main/ets/com/aliyun/player/AliListPlayer'  
12 -  
13 -import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting';  
14 -import prompt from '@ohos.promptAction';  
15 -import { Logger } from '../utils/Logger';  
16 -import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants';  
17 -  
18 -export interface WDListPlayerData {  
19 - uid: string  
20 - url: string  
21 - surfaceId?: string  
22 -}  
23 -  
24 -/*  
25 -  
26 - * 此播放器为阿里播放器鸿蒙版本封装,可播放单个视频、列表多个视频  
27 - * 列表上下滑场景用:WDAliListPlayerController  
28 - *  
29 - * 阿里文档链接:https://help.aliyun.com/zh/apsara-video-sdk/developer-reference/integrated-hongmeng-harmonyos-next-framework-player-sdk  
30 - */  
31 -@Observed  
32 -export class WDAliListPlayerController {  
33 - private initPromise: Promise<void>;  
34 - private avPlayer?: AliListPlayer;  
35 -  
36 - // 内部播放器状态  
37 - private avPlayerStatus: number = idle  
38 - private duration: number = 0;  
39 - private status: number = PlayerConstants.STATUS_IDLE;  
40 - private loop: boolean = false;  
41 - private url: string = '';  
42 - private surfaceId: string = '';  
43 - private playSpeed: number = 1;  
44 - private seekTime: number = 0;  
45 - private positionY: number = 0;  
46 - private startTime: number = 0  
47 -  
48 - public errorCode?: number  
49 - public errorMesage?: string  
50 -  
51 - public onVideoSizeChange?: (width: number, height: number) => void;  
52 - public onBufferUpdate?: (buffered: number, duration: number) => void;  
53 - public onTimeUpdate?: (position: number, duration: number) => void;  
54 - public onVolumeUpdate?: (volume: number) => void;  
55 -  
56 - // 播放完成,决定是否继续播放回调  
57 - public continue?: () => void;  
58 -  
59 - // 准备完成,决定是否播放回调。如果不实现,则自动播放  
60 - public onCanplay?: () => void;  
61 - public onStatusChange?: (status: number) => void;  
62 - public onFirstFrameDisplay?: () => void  
63 -  
64 - //// ------------ 以下为列表播放器属性  
65 - private playSources: WDListPlayerData[] = []  
66 - private currentPlayRecord?: WDListPlayerData  
67 -  
68 - constructor() {  
69 - Logger.info("初始化")  
70 - initGlobalPlayerSettings()  
71 - this.initPromise = this.createAVPlayer();  
72 - }  
73 -  
74 - /**  
75 - * 创建 videoPlayer对象  
76 - */  
77 - private createAVPlayer(): Promise<void> {  
78 - return new Promise((resolve, reject) => {  
79 - Logger.debug("开始创建")  
80 - let traceId = ''  
81 - this.avPlayer = AliPlayerFactory.createAliListPlayer(getContext(), traceId)  
82 - if (this.avPlayer) {  
83 - Logger.debug("创建完成1")  
84 - setupPlayerConfig(this.avPlayer!)  
85 - this.bindState();  
86 - resolve();  
87 - } else {  
88 - Logger.error("创建完成0")  
89 - Logger.error('[WDPlayerController] createAvPlayer fail!');  
90 - reject();  
91 - }  
92 - });  
93 - }  
94 -  
95 - public destory() {  
96 - Logger.debug("播放器销毁")  
97 - this.avPlayer?.stop()  
98 - this.avPlayer?.release()  
99 - this.playSources = []  
100 - this.currentPlayRecord = undefined  
101 - }  
102 -  
103 - /**  
104 - * AliPlayer 绑定事件.  
105 - */  
106 - private bindState() {  
107 - this.avPlayer?.setOnPreparedListener({  
108 - // 当调用play()方法后,会调用  
109 - onPrepared: () => {  
110 - this.duration = this.avPlayer?.getDuration();  
111 - Logger.debug("已准备好", `${this.duration}`)  
112 - }  
113 - }  
114 - );  
115 - this.avPlayer?.setOnRenderingStartListener({  
116 - onRenderingStart: () => {  
117 - Logger.debug("首帧开始显示")  
118 - if (this.onFirstFrameDisplay) {  
119 - this.onFirstFrameDisplay()  
120 - }  
121 - }  
122 - });  
123 - this.avPlayer?.setOnCompletionListener({  
124 - onCompletion: () => {  
125 - Logger.debug("播放完成")  
126 - }  
127 - });  
128 - this.avPlayer?.setOnInfoListener({  
129 - onInfo: (bean: InfoBean) => {  
130 -  
131 - if (bean.getCode() === InfoCode.CurrentPosition) {  
132 - let position : number = bean.getExtraValue()  
133 - Logger.debug(`播放进度条:${position}/ ${this.duration}`)  
134 - this.initProgress(position);  
135 -  
136 - } else if (bean.getCode() === InfoCode.BufferedPosition) {  
137 - let buffer : number = bean.getExtraValue()  
138 - if (this.onBufferUpdate) {  
139 - this.onBufferUpdate(buffer, this.duration)  
140 - }  
141 -  
142 - } else if (bean.getCode() === InfoCode.SwitchToSoftwareVideoDecoder) {  
143 - Logger.debug(`DOWNGRADE TO SOFTWARE DECODE`)  
144 - // this.mSwitchedToSoftListener?.onSwitched();  
145 - }  
146 - }  
147 - });  
148 - this.avPlayer?.setOnStateChangedListener({  
149 - onStateChanged: (status: number) => {  
150 - this.avPlayerStatus = status  
151 - Logger.debug("status update:" + `${this.getStatusStringWith(status)}`)  
152 -  
153 - switch (status) {  
154 - case initalized: {  
155 - //this.avPlayer?.prepare();  
156 - } break  
157 - case prepared: {  
158 - if (this.startTime) {  
159 - this.setSeekTime(this.startTime, SliderChangeMode.Begin);  
160 - }  
161 - this.duration = this.avPlayer?.getDuration();  
162 - if (this.onVideoSizeChange) {  
163 - this.onVideoSizeChange(this.avPlayer?.getVideoWidth(), this.avPlayer?.getVideoHeight());  
164 - }  
165 - if (this.onCanplay) {  
166 - this.onCanplay()  
167 - } else {  
168 - this.play()  
169 - }  
170 - } break  
171 - case started: {  
172 - this.setBright();  
173 - this.status = PlayerConstants.STATUS_START;  
174 - this.watchStatus();  
175 - } break  
176 - case paused: {  
177 - this.status = PlayerConstants.STATUS_PAUSE;  
178 - this.watchStatus();  
179 - } break  
180 - case stopped: {  
181 - this.status = PlayerConstants.STATUS_STOP;  
182 - this.watchStatus();  
183 - } break  
184 - case completion: {  
185 - this.status = PlayerConstants.STATUS_COMPLETION;  
186 - this.watchStatus();  
187 - if (this.continue) {  
188 - this.continue();  
189 - } else {  
190 - //TODO:  
191 - //this.duration = 0;  
192 - //this.url = this.avPlayer.url || '';  
193 - //this.avPlayer.reset();  
194 - }  
195 - } break  
196 - case error: {  
197 - // 这里拿不到错误信息  
198 - // this.status = PlayerConstants.STATUS_ERROR;  
199 - // this.watchStatus();  
200 - }  
201 - }  
202 - }  
203 - });  
204 - this.avPlayer?.setOnErrorListener({  
205 - onError:(errorInfo) => {  
206 - Logger.error("播放错误", JSON.stringify(errorInfo))  
207 - this.errorCode = errorInfo.getCode()  
208 - this.errorMesage = errorInfo.getMsg()  
209 - this.status = PlayerConstants.STATUS_ERROR;  
210 - this.watchStatus();  
211 - }  
212 - });  
213 - this.avPlayer?.setOnLoadingStatusListener({  
214 - onLoadingBegin: () => {  
215 - // Logger.error("开始加载。。。")  
216 - },  
217 - onLoadingProgress: (percent: number, netSpeed: number) => {  
218 - // this.loadingProgress = percent;  
219 - // this.loadingSpeed = netSpeed;  
220 - },  
221 - onLoadingEnd: () => {  
222 - // Logger.error("结束加载")  
223 - // this.showLoadingScene = false;  
224 - // this.loadingProgress = 0;  
225 - // this.loadingSpeed = 0;  
226 - }  
227 - });  
228 - this.avPlayer?.setOnSeekCompleteListener({  
229 - onSeekComplete: () => {  
230 - this.initProgress(this.avPlayer?.getCurrentPosition());  
231 - }  
232 - })  
233 - }  
234 -  
235 - private getStatusStringWith(status: number) : string {  
236 - switch (status) {  
237 - case idle: return 'idle'  
238 - case initalized: return 'initalized'  
239 - case prepared: return 'prepared'  
240 - case started: return 'started'  
241 - case paused: return 'paused'  
242 - case stopped: return 'stopped'  
243 - case completion: return 'completion'  
244 - case error: return 'error'  
245 - }  
246 - return 'unknow'  
247 - }  
248 -  
249 - public setXComponentController(controller: XComponentController) {  
250 - this.setSurfaceId(controller.getXComponentSurfaceId())  
251 - }  
252 -  
253 - public setSurfaceId(surfaceId: string) {  
254 - this.surfaceId = surfaceId  
255 - }  
256 -  
257 - public async addSources(sources: WDListPlayerData[]) {  
258 - if (this.avPlayer == null) {  
259 - Logger.info("等待播放器初始化")  
260 - await this.initPromise;  
261 - }  
262 - if (this.avPlayer == null) {  
263 - return  
264 - }  
265 -  
266 - /// 追加数据源  
267 - this.playSources.splice(this.playSources.length, 0, ...sources)  
268 - sources.map(data => {  
269 - this.avPlayer?.addUrl(data.url, data.uid)  
270 - })  
271 - }  
272 -  
273 - public moveTo(uid: string, surfaceId: string) {  
274 - let uidDatas = this.playSources.filter(data => data.uid === uid)  
275 - if (uidDatas.length == 0) {  
276 - Logger.info("请先addSources()添加数据源url" + uid)  
277 - return  
278 - }  
279 - this.currentPlayRecord = uidDatas[0]  
280 - this.avPlayer?.setSurfaceId(surfaceId)  
281 -  
282 - // this.setAliPlayerURL(this.currentPlayRecord.url)  
283 -  
284 - let result = this.avPlayer?.moveTo(uid)  
285 - Logger.info("moveTo" + uid + ` result:${result}`)  
286 - this.avPlayer?.prepare()  
287 - }  
288 -  
289 - private setAliPlayerURL(url: string) {  
290 - let urlSource : UrlSource = new UrlSource()  
291 - urlSource.setUri(url)  
292 - this.avPlayer?.setUrlDataSource(urlSource)  
293 - }  
294 -  
295 - private release() {  
296 - if (this.avPlayer == null) {  
297 - return  
298 - }  
299 - this.avPlayer.release()  
300 - this.avPlayer = undefined  
301 - }  
302 -  
303 - public pause() {  
304 - Logger.debug("暂停", this.url)  
305 - this.avPlayer?.pause();  
306 - }  
307 -  
308 - public play() {  
309 - Logger.debug("播放", this.url)  
310 - this.avPlayer?.start();  
311 - }  
312 -  
313 - public stop() {  
314 - Logger.debug("停止", this.url)  
315 - this.avPlayer?.stop();  
316 - }  
317 -  
318 - public setLoop(loop: boolean) {  
319 - this.loop = loop;  
320 - this.avPlayer?.setLoop(loop);  
321 - }  
322 -  
323 - public setMute(mute: boolean) {  
324 - this.avPlayer?.setMute(mute)  
325 - }  
326 -  
327 - public setSpeed(playSpeed: number) {  
328 - this.playSpeed = playSpeed;  
329 - this.avPlayer?.setSpeed(this.playSpeed);  
330 - }  
331 -  
332 - public switchPlayOrPause() {  
333 - if (this.avPlayerStatus == started) {  
334 - this.avPlayer?.pause();  
335 - } else if (this.avPlayerStatus == completion) {  
336 - this.avPlayer?.seekTo(0, 0)  
337 - this.avPlayer?.start()  
338 - } else {  
339 - this.avPlayer?.start();  
340 - }  
341 - }  
342 -  
343 - public setSeekTime(value: number, mode: SliderChangeMode) {  
344 - // if (this.avPlayer == null) {  
345 - // await this.initPromise;  
346 - // }  
347 - // if (this.avPlayer == null) {  
348 - // return  
349 - // }  
350 - // if (mode == SliderChangeMode.Begin) {  
351 - // this.seekTime = value * 1000;  
352 - // this.avPlayer?.seek(this.seekTime, media.SeekMode.SEEK_PREV_SYNC);  
353 - // }  
354 - if (mode === SliderChangeMode.Moving) {  
355 - // this.progressThis.progressVal = value;  
356 - // this.progressThis.currentTime = DateFormatUtil.secondToTime(Math.floor(value * this.duration /  
357 - // 100 / 1000));  
358 - }  
359 - if (mode === SliderChangeMode.End) {  
360 - this.seekTime = Math.floor(value * this.duration / 100);  
361 - this.avPlayer?.seekTo(this.seekTime, 0);  
362 - }  
363 - }  
364 -  
365 - public setBright() {  
366 - // globalThis.windowClass.setWindowBrightness(this.playerThis.bright)  
367 - }  
368 -  
369 - public getStatus() {  
370 - return this.status;  
371 - }  
372 -  
373 - public getPlayer() {  
374 - return this.avPlayer != undefined  
375 - }  
376 -  
377 - initProgress(time: number) {  
378 - if (this.onTimeUpdate) {  
379 - this.onTimeUpdate(time, this.duration);  
380 - }  
381 - }  
382 -  
383 - resetProgress() {  
384 - this.seekTime = 0;  
385 - this.duration = 0;  
386 - }  
387 -  
388 - onVolumeActionStart(event: GestureEvent) {  
389 - this.positionY = event.offsetY;  
390 - }  
391 -  
392 - onBrightActionStart(event: GestureEvent) {  
393 - this.positionY = event.offsetY;  
394 - }  
395 -  
396 - volume: number = 1  
397 -  
398 - onVolumeActionUpdate(event: GestureEvent) {  
399 - if (!this.avPlayer) {  
400 - return  
401 - }  
402 - if (this.avPlayerStatus != prepared &&  
403 - this.avPlayerStatus != started &&  
404 - this.avPlayerStatus != paused &&  
405 - this.avPlayerStatus != completion) {  
406 - return;  
407 - }  
408 - let changeVolume = (event.offsetY - this.positionY) / 300;  
409 - let currentVolume = this.volume - changeVolume;  
410 - if (currentVolume > 1) {  
411 - currentVolume = 1;  
412 - }  
413 - if (currentVolume <= 0) {  
414 - currentVolume = 0;  
415 - }  
416 - this.volume = currentVolume;  
417 - this.avPlayer?.setVolume(this.volume);  
418 - this.positionY = event.offsetY;  
419 - if (this.onVolumeUpdate) {  
420 - this.onVolumeUpdate(this.volume);  
421 - }  
422 - console.log("volume : " + this.volume)  
423 - }  
424 -  
425 - onBrightActionUpdate(event: GestureEvent) {  
426 - // if (!this.playerThis.volumeShow) {  
427 - // this.playerThis.brightShow = true;  
428 - // let changeBright = (this.positionY - event.offsetY) / globalThis.screenHeight;  
429 - // let currentBright = this.playerThis.bright + changeBright;  
430 - // let brightMinFlag = currentBright <= 0;  
431 - // let brightMaxFlag = currentBright > 1;  
432 - // this.playerThis.bright = brightMinFlag ? 0 :  
433 - // (brightMaxFlag ? 1 : currentBright);  
434 - // this.setBright();  
435 - // this.positionY = event.offsetY;  
436 - // }  
437 - }  
438 -  
439 - onActionEnd() {  
440 - setTimeout(() => {  
441 - this.positionY = 0;  
442 - }, 200);  
443 - }  
444 -  
445 - watchStatus() {  
446 - console.log('watchStatus', this.status)  
447 - if (this.onStatusChange) {  
448 - this.onStatusChange(this.status)  
449 - }  
450 - // if (this.status === PlayConstants.STATUS_START) {  
451 - // globalThis.windowClass.setWindowKeepScreenOn(true);  
452 - // } else {  
453 - // globalThis.windowClass.setWindowKeepScreenOn(false);  
454 - // }  
455 - }  
456 -  
457 - playError(msg?: string) {  
458 - prompt.showToast({  
459 - duration: 3000,  
460 - message: msg ? msg : "请检查地址输入正确且网络正常"  
461 - });  
462 - }  
463 -  
464 - setStartTime(time?: number) {  
465 - this.startTime = time ?? 0;  
466 - }  
467 -}  
1 -import { AliPlayerFactory, AliPlayer, InfoBean, UrlSource, ErrorInfo, InfoCode } from 'premierlibrary';  
2 -import {  
3 - idle,  
4 - initalized,  
5 - prepared,  
6 - started,  
7 - paused,  
8 - stopped,  
9 - completion,  
10 - error} from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer';  
11 -  
12 -import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting';  
13 -import prompt from '@ohos.promptAction';  
14 -import { Logger } from '../utils/Logger';  
15 -import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants';  
16 -  
17 -/*  
18 - * 此播放器为阿里播放器鸿蒙版本封装,可播放单个视频、或直播  
19 - * 列表上下滑场景用:WDListPlayerController  
20 - *  
21 - * 阿里文档链接:https://help.aliyun.com/zh/apsara-video-sdk/developer-reference/integrated-hongmeng-harmonyos-next-framework-player-sdk  
22 - */  
23 -@Observed  
24 -export class WDAliPlayerController {  
25 - private initPromise: Promise<void>;  
26 - private avPlayer?: AliPlayer;  
27 -  
28 - // 内部播放器状态  
29 - private avPlayerStatus: number = idle  
30 - private duration: number = 0;  
31 - private status: number = PlayerConstants.STATUS_IDLE;  
32 - private loop: boolean = false;  
33 - private url: string = '';  
34 - private surfaceId: string = '';  
35 - private playSpeed: number = 1;  
36 - private seekTime: number = 0;  
37 - private positionY: number = 0;  
38 - private startTime: number = 0  
39 -  
40 - public errorCode?: number  
41 - public errorMesage?: string  
42 -  
43 - public onVideoSizeChange?: (width: number, height: number) => void;  
44 - public onBufferUpdate?: (buffered: number, duration: number) => void;  
45 - public onTimeUpdate?: (position: number, duration: number) => void;  
46 - public onVolumeUpdate?: (volume: number) => void;  
47 -  
48 - // 播放完成,决定是否继续播放回调  
49 - public continue?: () => void;  
50 -  
51 - // 准备完成,决定是否播放回调。如果不实现,则自动播放  
52 - public onCanplay?: () => void;  
53 - public onStatusChange?: (status: number) => void;  
54 - public onFirstFrameDisplay?: () => void  
55 -  
56 - constructor() {  
57 - Logger.info("初始化")  
58 - initGlobalPlayerSettings()  
59 - this.initPromise = this.createAVPlayer();  
60 - }  
61 -  
62 - /**  
63 - * 创建 videoPlayer对象  
64 - */  
65 - private createAVPlayer(): Promise<void> {  
66 - return new Promise((resolve, reject) => {  
67 - Logger.debug("开始创建")  
68 - let traceId = ''  
69 - this.avPlayer = AliPlayerFactory.createAliPlayer(getContext(), traceId)  
70 - if (this.avPlayer) {  
71 - Logger.debug("创建完成1")  
72 - setupPlayerConfig(this.avPlayer!)  
73 - this.bindState();  
74 - resolve();  
75 - } else {  
76 - Logger.error("创建完成0")  
77 - Logger.error('[WDPlayerController] createAvPlayer fail!');  
78 - reject();  
79 - }  
80 - });  
81 - }  
82 -  
83 - public destory() {  
84 - Logger.debug("播放器销毁")  
85 - this.avPlayer?.stop()  
86 - this.avPlayer?.release()  
87 - }  
88 -  
89 - /**  
90 - * AliPlayer 绑定事件.  
91 - */  
92 - private bindState() {  
93 - this.avPlayer?.setOnPreparedListener({  
94 - // 当调用play()方法后,会调用  
95 - onPrepared: () => {  
96 - this.duration = this.avPlayer?.getDuration();  
97 - Logger.debug("已准备好", `${this.duration}`)  
98 - }  
99 - }  
100 - );  
101 - this.avPlayer?.setOnRenderingStartListener({  
102 - onRenderingStart: () => {  
103 - Logger.debug("首帧开始显示")  
104 - if (this.onFirstFrameDisplay) {  
105 - this.onFirstFrameDisplay()  
106 - }  
107 - }  
108 - });  
109 - this.avPlayer?.setOnCompletionListener({  
110 - onCompletion: () => {  
111 - Logger.debug("播放完成")  
112 - }  
113 - });  
114 - this.avPlayer?.setOnInfoListener({  
115 - onInfo: (bean: InfoBean) => {  
116 -  
117 - if (bean.getCode() === InfoCode.CurrentPosition) {  
118 - let position : number = bean.getExtraValue()  
119 - Logger.debug(`播放进度条:${position}/ ${this.duration}`)  
120 - this.initProgress(position);  
121 -  
122 - } else if (bean.getCode() === InfoCode.BufferedPosition) {  
123 - let buffer : number = bean.getExtraValue()  
124 - if (this.onBufferUpdate) {  
125 - this.onBufferUpdate(buffer, this.duration)  
126 - }  
127 -  
128 - } else if (bean.getCode() === InfoCode.SwitchToSoftwareVideoDecoder) {  
129 - Logger.debug(`DOWNGRADE TO SOFTWARE DECODE`)  
130 - // this.mSwitchedToSoftListener?.onSwitched();  
131 - }  
132 - }  
133 - });  
134 - this.avPlayer?.setOnStateChangedListener({  
135 - onStateChanged: (status: number) => {  
136 - this.avPlayerStatus = status  
137 - Logger.debug("status update:" + `${this.getStatusStringWith(status)}`)  
138 -  
139 - switch (status) {  
140 - case initalized: {  
141 - //this.avPlayer?.prepare();  
142 - } break  
143 - case prepared: {  
144 - if (this.startTime) {  
145 - this.setSeekTime(this.startTime, SliderChangeMode.Begin);  
146 - }  
147 - this.duration = this.avPlayer?.getDuration();  
148 - if (this.onVideoSizeChange) {  
149 - this.onVideoSizeChange(this.avPlayer?.getVideoWidth(), this.avPlayer?.getVideoHeight());  
150 - }  
151 - if (this.onCanplay) {  
152 - this.onCanplay()  
153 - } else {  
154 - this.play()  
155 - }  
156 - } break  
157 - case started: {  
158 - this.setBright();  
159 - this.status = PlayerConstants.STATUS_START;  
160 - this.watchStatus();  
161 - } break  
162 - case paused: {  
163 - this.status = PlayerConstants.STATUS_PAUSE;  
164 - this.watchStatus();  
165 - } break  
166 - case stopped: {  
167 - this.status = PlayerConstants.STATUS_STOP;  
168 - this.watchStatus();  
169 - } break  
170 - case completion: {  
171 - this.status = PlayerConstants.STATUS_COMPLETION;  
172 - this.watchStatus();  
173 - if (this.continue) {  
174 - this.continue();  
175 - } else {  
176 - //TODO:  
177 - //this.duration = 0;  
178 - //this.url = this.avPlayer.url || '';  
179 - //this.avPlayer.reset();  
180 - }  
181 - } break  
182 - case error: {  
183 - // 这里拿不到错误信息  
184 - // this.status = PlayerConstants.STATUS_ERROR;  
185 - // this.watchStatus();  
186 - }  
187 - }  
188 - }  
189 - });  
190 - this.avPlayer?.setOnErrorListener({  
191 - onError:(errorInfo) => {  
192 - Logger.error("播放错误", JSON.stringify(errorInfo))  
193 - this.errorCode = errorInfo.getCode()  
194 - this.errorMesage = errorInfo.getMsg()  
195 - this.status = PlayerConstants.STATUS_ERROR;  
196 - this.watchStatus();  
197 - }  
198 - });  
199 - this.avPlayer?.setOnLoadingStatusListener({  
200 - onLoadingBegin: () => {  
201 - // Logger.error("开始加载。。。")  
202 - },  
203 - onLoadingProgress: (percent: number, netSpeed: number) => {  
204 - // this.loadingProgress = percent;  
205 - // this.loadingSpeed = netSpeed;  
206 - },  
207 - onLoadingEnd: () => {  
208 - // Logger.error("结束加载")  
209 - // this.showLoadingScene = false;  
210 - // this.loadingProgress = 0;  
211 - // this.loadingSpeed = 0;  
212 - }  
213 - });  
214 - this.avPlayer?.setOnSeekCompleteListener({  
215 - onSeekComplete: () => {  
216 - this.initProgress(this.avPlayer?.getCurrentPosition());  
217 - }  
218 - })  
219 - }  
220 -  
221 - private setAliPlayerURL(url: string) {  
222 - let urlSource : UrlSource = new UrlSource()  
223 - urlSource.setUri(url)  
224 - this.avPlayer?.setUrlDataSource(urlSource)  
225 - }  
226 -  
227 - private getStatusStringWith(status: number) : string {  
228 - switch (status) {  
229 - case idle: return 'idle'  
230 - case initalized: return 'initalized'  
231 - case prepared: return 'prepared'  
232 - case started: return 'started'  
233 - case paused: return 'paused'  
234 - case stopped: return 'stopped'  
235 - case completion: return 'completion'  
236 - case error: return 'error'  
237 - }  
238 - return 'unknow'  
239 - }  
240 -  
241 - setXComponentController(controller: XComponentController) {  
242 - this.setSurfaceId(controller.getXComponentSurfaceId())  
243 - }  
244 -  
245 - setSurfaceId(surfaceId: string) {  
246 - this.surfaceId = surfaceId  
247 - }  
248 -  
249 - async firstPlay(url: string) {  
250 - this.url = url;  
251 - if (this.avPlayer == null) {  
252 - Logger.info("等待播放器初始化")  
253 - await this.initPromise;  
254 - } else {  
255 - if (this.avPlayerStatus != idle) {  
256 - this.destory()  
257 - this.initPromise = this.createAVPlayer();  
258 - await this.initPromise;  
259 - }  
260 - }  
261 - if (this.avPlayer == null) {  
262 - return  
263 - }  
264 - this.duration = 0  
265 - this.errorCode = undefined  
266 - this.errorMesage = undefined  
267 - this.avPlayerStatus = idle  
268 - this.status = PlayerConstants.STATUS_IDLE  
269 -  
270 - this.avPlayer?.setAutoPlay(false)  
271 -  
272 - Logger.debug("开始播放", this.url)  
273 - this.setAliPlayerURL(this.url);  
274 -  
275 - Logger.info("设置SurfaceId" + this.surfaceId)  
276 - this.avPlayer?.setSurfaceId(this.surfaceId)  
277 -  
278 - this.avPlayer?.prepare()  
279 - }  
280 -  
281 - release() {  
282 - if (this.avPlayer == null) {  
283 - return  
284 - }  
285 - this.avPlayer.release()  
286 - this.avPlayer = undefined  
287 - }  
288 -  
289 - pause() {  
290 - Logger.debug("暂停", this.url)  
291 - this.avPlayer?.pause();  
292 - }  
293 -  
294 - play() {  
295 - Logger.debug("播放", this.url)  
296 - this.avPlayer?.start();  
297 - }  
298 -  
299 - stop() {  
300 - Logger.debug("停止", this.url)  
301 - this.avPlayer?.stop();  
302 - }  
303 -  
304 - setLoop(loop: boolean) {  
305 - this.loop = loop;  
306 - this.avPlayer?.setLoop(loop);  
307 - }  
308 -  
309 - setMute(mute: boolean) {  
310 - this.avPlayer?.setMute(mute)  
311 - }  
312 -  
313 - setSpeed(playSpeed: number) {  
314 - this.playSpeed = playSpeed;  
315 - this.avPlayer?.setSpeed(this.playSpeed);  
316 - }  
317 -  
318 - switchPlayOrPause() {  
319 - if (this.avPlayerStatus == started) {  
320 - this.avPlayer?.pause();  
321 - } else if (this.avPlayerStatus == completion) {  
322 - this.avPlayer?.seekTo(0, 0)  
323 - this.avPlayer?.start()  
324 - } else {  
325 - this.avPlayer?.start();  
326 - }  
327 - }  
328 -  
329 - setSeekTime(value: number, mode: SliderChangeMode) {  
330 - // if (this.avPlayer == null) {  
331 - // await this.initPromise;  
332 - // }  
333 - // if (this.avPlayer == null) {  
334 - // return  
335 - // }  
336 - // if (mode == SliderChangeMode.Begin) {  
337 - // this.seekTime = value * 1000;  
338 - // this.avPlayer?.seek(this.seekTime, media.SeekMode.SEEK_PREV_SYNC);  
339 - // }  
340 - if (mode === SliderChangeMode.Moving) {  
341 - // this.progressThis.progressVal = value;  
342 - // this.progressThis.currentTime = DateFormatUtil.secondToTime(Math.floor(value * this.duration /  
343 - // 100 / 1000));  
344 - }  
345 - if (mode === SliderChangeMode.End) {  
346 - this.seekTime = Math.floor(value * this.duration / 100);  
347 - this.avPlayer?.seekTo(this.seekTime, 0);  
348 - }  
349 - }  
350 -  
351 - setBright() {  
352 - // globalThis.windowClass.setWindowBrightness(this.playerThis.bright)  
353 - }  
354 -  
355 - getStatus() {  
356 - return this.status;  
357 - }  
358 -  
359 - getPlayer() {  
360 - return this.avPlayer != undefined  
361 - }  
362 -  
363 - initProgress(time: number) {  
364 - if (this.onTimeUpdate) {  
365 - this.onTimeUpdate(time, this.duration);  
366 - }  
367 - }  
368 -  
369 - resetProgress() {  
370 - this.seekTime = 0;  
371 - this.duration = 0;  
372 - }  
373 -  
374 - onVolumeActionStart(event: GestureEvent) {  
375 - this.positionY = event.offsetY;  
376 - }  
377 -  
378 - onBrightActionStart(event: GestureEvent) {  
379 - this.positionY = event.offsetY;  
380 - }  
381 -  
382 - volume: number = 1  
383 -  
384 - onVolumeActionUpdate(event: GestureEvent) {  
385 - if (!this.avPlayer) {  
386 - return  
387 - }  
388 - if (this.avPlayerStatus != prepared &&  
389 - this.avPlayerStatus != started &&  
390 - this.avPlayerStatus != paused &&  
391 - this.avPlayerStatus != completion) {  
392 - return;  
393 - }  
394 - let changeVolume = (event.offsetY - this.positionY) / 300;  
395 - let currentVolume = this.volume - changeVolume;  
396 - if (currentVolume > 1) {  
397 - currentVolume = 1;  
398 - }  
399 - if (currentVolume <= 0) {  
400 - currentVolume = 0;  
401 - }  
402 - this.volume = currentVolume;  
403 - this.avPlayer?.setVolume(this.volume);  
404 - this.positionY = event.offsetY;  
405 - if (this.onVolumeUpdate) {  
406 - this.onVolumeUpdate(this.volume);  
407 - }  
408 - console.log("volume : " + this.volume)  
409 - }  
410 -  
411 - onBrightActionUpdate(event: GestureEvent) {  
412 - // if (!this.playerThis.volumeShow) {  
413 - // this.playerThis.brightShow = true;  
414 - // let changeBright = (this.positionY - event.offsetY) / globalThis.screenHeight;  
415 - // let currentBright = this.playerThis.bright + changeBright;  
416 - // let brightMinFlag = currentBright <= 0;  
417 - // let brightMaxFlag = currentBright > 1;  
418 - // this.playerThis.bright = brightMinFlag ? 0 :  
419 - // (brightMaxFlag ? 1 : currentBright);  
420 - // this.setBright();  
421 - // this.positionY = event.offsetY;  
422 - // }  
423 - }  
424 -  
425 - onActionEnd() {  
426 - setTimeout(() => {  
427 - this.positionY = 0;  
428 - }, 200);  
429 - }  
430 -  
431 - watchStatus() {  
432 - console.log('watchStatus', this.status)  
433 - if (this.onStatusChange) {  
434 - this.onStatusChange(this.status)  
435 - }  
436 - // if (this.status === PlayConstants.STATUS_START) {  
437 - // globalThis.windowClass.setWindowKeepScreenOn(true);  
438 - // } else {  
439 - // globalThis.windowClass.setWindowKeepScreenOn(false);  
440 - // }  
441 - }  
442 -  
443 - playError(msg?: string) {  
444 - prompt.showToast({  
445 - duration: 3000,  
446 - message: msg ? msg : "请检查地址输入正确且网络正常"  
447 - });  
448 - }  
449 -  
450 - setStartTime(time?: number) {  
451 - this.startTime = time ?? 0;  
452 - }  
453 -}  
@@ -134,10 +134,6 @@ export class WDPlayerController { @@ -134,10 +134,6 @@ export class WDPlayerController {
134 this.surfaceId = controller.getXComponentSurfaceId() 134 this.surfaceId = controller.getXComponentSurfaceId()
135 } 135 }
136 136
137 - setSurfaceId(surfaceId: string) {  
138 - this.surfaceId = surfaceId  
139 - }  
140 -  
141 async firstPlay(url: string) { 137 async firstPlay(url: string) {
142 this.url = url; 138 this.url = url;
143 if (this.avPlayer == null) { 139 if (this.avPlayer == null) {
@@ -2,7 +2,6 @@ import componentUtils from '@ohos.arkui.componentUtils'; @@ -2,7 +2,6 @@ import componentUtils from '@ohos.arkui.componentUtils';
2 import { WDPlayerController } from '../controller/WDPlayerController' 2 import { WDPlayerController } from '../controller/WDPlayerController'
3 import { WindowModel } from 'wdKit'; 3 import { WindowModel } from 'wdKit';
4 import { Logger } from '../utils/Logger'; 4 import { Logger } from '../utils/Logger';
5 -import { enableAliPlayer } from '../utils/GlobalSetting';  
6 5
7 class Size { 6 class Size {
8 width: Length = "100%"; 7 width: Length = "100%";
@@ -75,9 +74,8 @@ export struct WDPlayerRenderLiveView { @@ -75,9 +74,8 @@ export struct WDPlayerRenderLiveView {
75 Row() { 74 Row() {
76 // 设置为“surface“类型时XComponent组件可以和其他组件一起进行布局和渲染。 75 // 设置为“surface“类型时XComponent组件可以和其他组件一起进行布局和渲染。
77 XComponent({ 76 XComponent({
78 - id: enableAliPlayer ? this.insId : 'xComponentId',  
79 - type: XComponentType.SURFACE,  
80 - libraryname: enableAliPlayer ? "premierlibrary" : undefined, 77 + id: 'xComponentId',
  78 + type: 'surface',
81 controller: this.xComponentController 79 controller: this.xComponentController
82 }) 80 })
83 .onLoad(async (event) => { 81 .onLoad(async (event) => {
@@ -89,11 +87,7 @@ export struct WDPlayerRenderLiveView { @@ -89,11 +87,7 @@ export struct WDPlayerRenderLiveView {
89 surfaceWidth: 1920, 87 surfaceWidth: 1920,
90 surfaceHeight: 720 88 surfaceHeight: 720
91 }); 89 });
92 - if (enableAliPlayer) {  
93 - this.playerController?.setSurfaceId(this.insId)  
94 - } else {  
95 this.playerController?.setXComponentController(this.xComponentController) 90 this.playerController?.setXComponentController(this.xComponentController)
96 - }  
97 if (this.onLoad) { 91 if (this.onLoad) {
98 this.onLoad(event) 92 this.onLoad(event)
99 } 93 }
@@ -2,7 +2,6 @@ import componentUtils from '@ohos.arkui.componentUtils'; @@ -2,7 +2,6 @@ import componentUtils from '@ohos.arkui.componentUtils';
2 import { WDPlayerController } from '../controller/WDPlayerController' 2 import { WDPlayerController } from '../controller/WDPlayerController'
3 import { WindowModel } from 'wdKit'; 3 import { WindowModel } from 'wdKit';
4 import { Logger } from '../utils/Logger'; 4 import { Logger } from '../utils/Logger';
5 -import { enableAliPlayer } from '../utils/GlobalSetting';  
6 5
7 class Size { 6 class Size {
8 width: Length = "100%"; 7 width: Length = "100%";
@@ -74,9 +73,8 @@ export struct WDPlayerRenderVLiveView { @@ -74,9 +73,8 @@ export struct WDPlayerRenderVLiveView {
74 Row() { 73 Row() {
75 // 设置为“surface“类型时XComponent组件可以和其他组件一起进行布局和渲染。 74 // 设置为“surface“类型时XComponent组件可以和其他组件一起进行布局和渲染。
76 XComponent({ 75 XComponent({
77 - id: enableAliPlayer ? this.insId : 'xComponentId',  
78 - type: XComponentType.SURFACE,  
79 - libraryname: enableAliPlayer ? "premierlibrary" : undefined, 76 + id: 'xComponentId',
  77 + type: 'surface',
80 controller: this.xComponentController 78 controller: this.xComponentController
81 }) 79 })
82 .onLoad(async (event) => { 80 .onLoad(async (event) => {
@@ -86,11 +84,7 @@ export struct WDPlayerRenderVLiveView { @@ -86,11 +84,7 @@ export struct WDPlayerRenderVLiveView {
86 surfaceWidth: 1920, 84 surfaceWidth: 1920,
87 surfaceHeight: 1080 85 surfaceHeight: 1080
88 }); 86 });
89 - if (enableAliPlayer) {  
90 - this.playerController?.setSurfaceId(this.insId)  
91 - } else {  
92 this.playerController?.setXComponentController(this.xComponentController) 87 this.playerController?.setXComponentController(this.xComponentController)
93 - }  
94 if (this.onLoad) { 88 if (this.onLoad) {
95 this.onLoad(event) 89 this.onLoad(event)
96 } 90 }
@@ -2,7 +2,6 @@ import componentUtils from '@ohos.arkui.componentUtils'; @@ -2,7 +2,6 @@ import componentUtils from '@ohos.arkui.componentUtils';
2 import { WDPlayerController } from '../controller/WDPlayerController' 2 import { WDPlayerController } from '../controller/WDPlayerController'
3 import { WindowModel } from 'wdKit'; 3 import { WindowModel } from 'wdKit';
4 import { Logger } from '../utils/Logger'; 4 import { Logger } from '../utils/Logger';
5 -import { enableAliPlayer } from '../utils/GlobalSetting';  
6 5
7 class Size { 6 class Size {
8 width: Length = "100%"; 7 width: Length = "100%";
@@ -76,7 +75,6 @@ export struct WDPlayerRenderView { @@ -76,7 +75,6 @@ export struct WDPlayerRenderView {
76 XComponent({ 75 XComponent({
77 id: this.insId, 76 id: this.insId,
78 type: XComponentType.SURFACE, 77 type: XComponentType.SURFACE,
79 - libraryname: enableAliPlayer ? "premierlibrary" : undefined,  
80 controller: this.xComponentController 78 controller: this.xComponentController
81 }) 79 })
82 .onLoad(async (event) => { 80 .onLoad(async (event) => {
@@ -85,11 +83,7 @@ export struct WDPlayerRenderView { @@ -85,11 +83,7 @@ export struct WDPlayerRenderView {
85 surfaceWidth: 1920, 83 surfaceWidth: 1920,
86 surfaceHeight: 1080 84 surfaceHeight: 1080
87 }); 85 });
88 - if (enableAliPlayer) {  
89 - this.playerController?.setSurfaceId(this.insId)  
90 - } else {  
91 this.playerController?.setXComponentController(this.xComponentController) 86 this.playerController?.setXComponentController(this.xComponentController)
92 - }  
93 if (this.onLoad) { 87 if (this.onLoad) {
94 this.onLoad(event) 88 this.onLoad(event)
95 } 89 }
1 -import { AliPlayerGlobalSettings, AliPlayer } from 'premierlibrary';  
2 -  
3 -import fs from '@ohos.file.fs';  
4 -import common from '@ohos.app.ability.common';  
5 -import { error } from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer';  
6 -import { BusinessError } from '@kit.BasicServicesKit';  
7 -  
8 -let currentContext = getContext() as common.UIAbilityContext  
9 -  
10 -export function initGlobalPlayerSettings(context?: common.UIAbilityContext) {  
11 -  
12 - AliPlayerGlobalSettings.setUseHttp2(true);  
13 -  
14 - let filesDir = (context != undefined ? context : currentContext).filesDir;  
15 - let cachePath = filesDir + "/player-cache"  
16 -  
17 - fs.stat(cachePath).catch((error: BusinessError) => {  
18 - if (error.code = 13900002) {  
19 - fs.mkdirSync(cachePath)  
20 - }  
21 - })  
22 -  
23 - AliPlayerGlobalSettings.enableLocalCache(true,1 * 1024, cachePath)  
24 -  
25 - AliPlayerGlobalSettings.setCacheFileClearConfig(3 * 24 * 6, 1024, 300)  
26 -}  
27 -  
28 -export function setupPlayerConfig(player: AliPlayer) {  
29 - let config = player.getConfig()  
30 - if (config) {  
31 - config.mMaxDelayTime = 500  
32 - config.mMaxBufferDuration = 50000  
33 - config.mHighBufferDuration = 3000  
34 - config.mStartBufferDuration = 50  
35 - player.setConfig(config)  
36 - }  
37 -}  
38 -  
39 -/*  
40 - * 开启前注意:  
41 - * 1、配置好包名对应的license文件  
42 - * 2、页面组件播放器控制器使用WDAliPlayerController  
43 - * 3、WDAliListPlayerController 暂时由于SDK问题,不能使用  
44 - * 4、  
45 - * */  
46 -export const enableAliPlayer = false  
@@ -9,23 +9,6 @@ @@ -9,23 +9,6 @@
9 "2in1" 9 "2in1"
10 ], 10 ],
11 "deliveryWithInstall": true, 11 "deliveryWithInstall": true,
12 - "pages": "$profile:main_pages",  
13 -  
14 - "metadata": [  
15 - {  
16 - "name": "com.aliyun.alivc_license.licensekey",  
17 - // "value": "MoCTfuQ391Z01mNqG8f8786e23c8a457a8ff8d5faedc1040c"  
18 - "value": "KoETnmCmxJ1e1ZXDj0eb2ddb6c81c4cb7b9912df65e6d8eb2"  
19 - },  
20 - {  
21 - "name": "com.aliyun.alivc_license.licensefile",  
22 - // "value": "license.crt"  
23 - "value": "pre-license.crt"  
24 - },  
25 - {  
26 - "name": "com.aliyun.alivc_license.service_env",  
27 - "value": "PreRelease"  
28 - }  
29 - ] 12 + "pages": "$profile:main_pages"
30 } 13 }
31 } 14 }
@@ -5,161 +5,10 @@ @@ -5,161 +5,10 @@
5 "lockfileVersion": 3, 5 "lockfileVersion": 3,
6 "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", 6 "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
7 "specifiers": { 7 "specifiers": {
8 - "@mpaas/compress@^1.0.0": "@mpaas/compress@1.0.0",  
9 - "@mpaas/fake-island@^1.0.0": "@mpaas/fake-island@1.0.0",  
10 - "@mpaas/framework@0.0.2": "@mpaas/framework@0.0.2",  
11 - "@mpaas/framework@^0.0.2": "@mpaas/framework@0.0.2",  
12 - "@mpaas/fs-ext@^1.0.0": "@mpaas/fs-ext@1.0.0",  
13 - "@mpaas/lang@^1.0.0": "@mpaas/lang@1.0.0",  
14 - "@mpaas/path@^1.0.0": "@mpaas/path@1.0.0",  
15 - "@mpaas/rpc@^0.0.2": "@mpaas/rpc@0.0.2",  
16 - "@mpaas/shuckle@^1.0.0": "@mpaas/shuckle@1.0.0",  
17 - "@mpaas/trace-log@^0.0.2": "@mpaas/trace-log@0.0.2",  
18 - "@mpaas/transport_build@^0.0.2": "@mpaas/transport_build@0.0.2",  
19 - "@mpaas/udid@0.0.2": "@mpaas/udid@0.0.2",  
20 - "@mpaas/upgrade@0.0.2": "@mpaas/upgrade@0.0.2",  
21 - "@ohos/crypto-js@^2.0.2": "@ohos/crypto-js@2.0.3",  
22 "@ohos/hypium@1.0.16": "@ohos/hypium@1.0.16", 8 "@ohos/hypium@1.0.16": "@ohos/hypium@1.0.16",
23 - "@ohos/pulltorefresh@^2.0.5": "@ohos/pulltorefresh@2.0.5",  
24 - "dayjs@^1.11.7": "dayjs@1.11.7",  
25 - "libcompress.so@oh_modules/.ohpm/@mpaas+compress@1.0.0/oh_modules/@mpaas/compress/src/main/cpp/types/libcompress": "libcompress.so@oh_modules/.ohpm/@mpaas+compress@1.0.0/oh_modules/@mpaas/compress/src/main/cpp/types/libcompress",  
26 - "libframework_api.so@oh_modules/.ohpm/@mpaas+framework@0.0.2/oh_modules/@mpaas/framework/src/main/cpp/types/libframework_api": "libframework_api.so@oh_modules/.ohpm/@mpaas+framework@0.0.2/oh_modules/@mpaas/framework/src/main/cpp/types/libframework_api",  
27 - "libgwcli.so@oh_modules/.ohpm/@mpaas+fake-island@1.0.0/oh_modules/@mpaas/fake-island/types": "libgwcli.so@oh_modules/.ohpm/@mpaas+fake-island@1.0.0/oh_modules/@mpaas/fake-island/types",  
28 - "liblang.so@oh_modules/.ohpm/@mpaas+lang@1.0.0/oh_modules/@mpaas/lang/types": "liblang.so@oh_modules/.ohpm/@mpaas+lang@1.0.0/oh_modules/@mpaas/lang/types",  
29 - "libmplog.so@oh_modules/.ohpm/@mpaas+trace-log@0.0.2/oh_modules/@mpaas/trace-log/types": "libmplog.so@oh_modules/.ohpm/@mpaas+trace-log@0.0.2/oh_modules/@mpaas/trace-log/types",  
30 - "libshuckle.so@oh_modules/.ohpm/@mpaas+shuckle@1.0.0/oh_modules/@mpaas/shuckle/src/main/cpp/types/libshuckle": "libshuckle.so@oh_modules/.ohpm/@mpaas+shuckle@1.0.0/oh_modules/@mpaas/shuckle/src/main/cpp/types/libshuckle",  
31 - "long@^5.2.1": "long@5.2.1",  
32 - "pako@^2.1.0": "pako@2.1.0" 9 + "@ohos/pulltorefresh@^2.0.5": "@ohos/pulltorefresh@2.0.5"
33 }, 10 },
34 "packages": { 11 "packages": {
35 - "@mpaas/compress@1.0.0": {  
36 - "name": "@mpaas/compress",  
37 - "integrity": "sha512-x/aUK/zKjoUnd4kYGNAI1JMcEY2n4N6Rn+F+zcIYs8WLgobY6kFXTphLJ/NlSgjJklc2009U8zeStvtjon1zaQ==",  
38 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/compress/compress-1.0.0.har",  
39 - "registryType": "ohpm",  
40 - "dependencies": {  
41 - "libcompress.so": "file:./src/main/cpp/types/libcompress"  
42 - }  
43 - },  
44 - "@mpaas/fake-island@1.0.0": {  
45 - "name": "@mpaas/fake-island",  
46 - "integrity": "sha512-cEt0Zsie0rwfvnYmqA+6pa93L6NLkJKwiqJCoE9Z2hFjhk9s4RSz7F0AUuj4WobrpdElXuipoCNFPXWLb4ZBlA==",  
47 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/fake-island/fake-island-1.0.0.har",  
48 - "registryType": "ohpm",  
49 - "dependencies": {  
50 - "libgwcli.so": "file:./types"  
51 - }  
52 - },  
53 - "@mpaas/framework@0.0.2": {  
54 - "name": "@mpaas/framework",  
55 - "integrity": "sha512-nNpCI44zvg4fN9GNM5m31LdqfLrej9mMo/+BMny8QK+/Jvc3m/itE45bWZZ7unfflq40H2t4YOgtNAIW3m8MaA==",  
56 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/framework/framework-0.0.2.har",  
57 - "registryType": "ohpm",  
58 - "dependencies": {  
59 - "libframework_api.so": "file:./src/main/cpp/types/libframework_api",  
60 - "@mpaas/udid": "0.0.2"  
61 - }  
62 - },  
63 - "@mpaas/fs-ext@1.0.0": {  
64 - "name": "@mpaas/fs-ext",  
65 - "integrity": "sha512-4TGUdrkmVSFktp1NcRdcs4uLYH6GvN1aTkMD2z8TJLztz5Hq5fMrvuznsmwTsSaRxGfGuyHPER8enMQo8wcfKA==",  
66 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/fs-ext/fs-ext-1.0.0.har",  
67 - "registryType": "ohpm",  
68 - "dependencies": {  
69 - "@mpaas/path": "^1.0.0"  
70 - }  
71 - },  
72 - "@mpaas/lang@1.0.0": {  
73 - "name": "@mpaas/lang",  
74 - "integrity": "sha512-dcQ2QPrvwZgBhoGUjAbSFfkReDkwqEPMTzy/Xk05dhIB9VVznpLPahlQLVi0Am1FPATCT8J7DDrko9aJLOba+w==",  
75 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/lang/lang-1.0.0.har",  
76 - "registryType": "ohpm",  
77 - "dependencies": {  
78 - "liblang.so": "file:./types"  
79 - }  
80 - },  
81 - "@mpaas/path@1.0.0": {  
82 - "name": "@mpaas/path",  
83 - "integrity": "sha512-TNjPaVOiq4DTiNFexSeI9isxeJ1H4q9Vieh3Bnv66o0U/e7rwV1qjEUtMvihX3MlsX0VKVkT0Xyf/wm18l4XYw==",  
84 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/path/path-1.0.0.har",  
85 - "registryType": "ohpm"  
86 - },  
87 - "@mpaas/rpc@0.0.2": {  
88 - "name": "@mpaas/rpc",  
89 - "integrity": "sha512-BeiXDHW77CpZF5x4nuQc+3A7MfhFfU3+Wc73gac/ZRhIPuAAzfLmlzm5alqdm6oiWAw17ERQydUSG4SQSCHQ4g==",  
90 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/rpc/rpc-0.0.2.har",  
91 - "registryType": "ohpm",  
92 - "dependencies": {  
93 - "@mpaas/transport_build": "^0.0.2",  
94 - "@mpaas/lang": "^1.0.0",  
95 - "@mpaas/framework": "^0.0.2"  
96 - }  
97 - },  
98 - "@mpaas/shuckle@1.0.0": {  
99 - "name": "@mpaas/shuckle",  
100 - "integrity": "sha512-B0MhrNzwG9pIoPxYVBldyenQWtWfTv5twd/0Ur1LbMpbp09AQ5wrZjKgDoeUtsIls9gzL9T8ngDZU6mRn8SYgQ==",  
101 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/shuckle/shuckle-1.0.0.har",  
102 - "registryType": "ohpm",  
103 - "dependencies": {  
104 - "libshuckle.so": "file:./src/main/cpp/types/libshuckle",  
105 - "@mpaas/framework": "^0.0.2"  
106 - }  
107 - },  
108 - "@mpaas/trace-log@0.0.2": {  
109 - "name": "@mpaas/trace-log",  
110 - "integrity": "sha512-Llsdnx3L2tJJDg9vwJY01YsK4IOSmCo4SmAIW9yFHTzylrzFSWdFefRhJbNlkQQilXdYygEkBByXVvT1wFSmAg==",  
111 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/trace-log/trace-log-0.0.2.har",  
112 - "registryType": "ohpm",  
113 - "dependencies": {  
114 - "@mpaas/lang": "^1.0.0",  
115 - "@mpaas/fs-ext": "^1.0.0",  
116 - "@mpaas/path": "^1.0.0",  
117 - "@mpaas/framework": "0.0.2",  
118 - "libmplog.so": "file:types",  
119 - "dayjs": "^1.11.7"  
120 - }  
121 - },  
122 - "@mpaas/transport_build@0.0.2": {  
123 - "name": "@mpaas/transport_build",  
124 - "integrity": "sha512-utz9C/cKIWbYrNiTBjk1gUhPH4/M73G64hWlrYKDpkfJHJmdYcQmmYV3v7Jit1z7Qg7hhu0aOaZzShqdQdC7rg==",  
125 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/transport_build/transport_build-0.0.2.har",  
126 - "registryType": "ohpm",  
127 - "dependencies": {  
128 - "@ohos/crypto-js": "^2.0.2",  
129 - "dayjs": "^1.11.7",  
130 - "pako": "^2.1.0",  
131 - "@mpaas/fake-island": "^1.0.0",  
132 - "long": "^5.2.1",  
133 - "@mpaas/framework": "^0.0.2",  
134 - "@mpaas/shuckle": "^1.0.0",  
135 - "@mpaas/compress": "^1.0.0"  
136 - }  
137 - },  
138 - "@mpaas/udid@0.0.2": {  
139 - "name": "@mpaas/udid",  
140 - "integrity": "sha512-YFLSgBOrIjjmcFm4Cn2BB1tspHKHdB4qipVl4MUhHHDfiUYbLIVuv7x5xB9xPuPf0gKO8rx0yqUuzkaNDoNsAw==",  
141 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/udid/udid-0.0.2.har",  
142 - "registryType": "ohpm"  
143 - },  
144 - "@mpaas/upgrade@0.0.2": {  
145 - "name": "@mpaas/upgrade",  
146 - "integrity": "sha512-VWamULIoJPA6nxUADwwNXd3uOspZeYAsRh05pApVilIdum5ktIMXIFl71jAKsChs3jtrhs9y5EShoZD4MZrGsA==",  
147 - "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/upgrade/upgrade-0.0.2.har",  
148 - "registryType": "ohpm",  
149 - "dependencies": {  
150 - "@mpaas/framework": "^0.0.2",  
151 - "@mpaas/rpc": "^0.0.2",  
152 - "@mpaas/lang": "^1.0.0",  
153 - "@mpaas/transport_build": "^0.0.2",  
154 - "@mpaas/trace-log": "^0.0.2"  
155 - }  
156 - },  
157 - "@ohos/crypto-js@2.0.3": {  
158 - "name": "@ohos/crypto-js",  
159 - "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==",  
160 - "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har",  
161 - "registryType": "ohpm"  
162 - },  
163 "@ohos/hypium@1.0.16": { 12 "@ohos/hypium@1.0.16": {
164 "name": "@ohos/hypium", 13 "name": "@ohos/hypium",
165 "integrity": "sha512-PC3jpwKERg68V+4dmKU+SLjNps9i5JcQH57rQriaTsh62NBgVZs4SceMmNOtrIOyldbEJ5mXSwoZwiG/nkRmTw==", 14 "integrity": "sha512-PC3jpwKERg68V+4dmKU+SLjNps9i5JcQH57rQriaTsh62NBgVZs4SceMmNOtrIOyldbEJ5mXSwoZwiG/nkRmTw==",
@@ -171,60 +20,6 @@ @@ -171,60 +20,6 @@
171 "integrity": "sha512-mgBvJ6Ga70LmAoPKTOEPLFJluHUEAaBt2+7wF7R6223Vw6UEbZrof1MyvVOLEHk8Uc64ASIMW/TNQ8AHraTV5A==", 20 "integrity": "sha512-mgBvJ6Ga70LmAoPKTOEPLFJluHUEAaBt2+7wF7R6223Vw6UEbZrof1MyvVOLEHk8Uc64ASIMW/TNQ8AHraTV5A==",
172 "resolved": "https://repo.harmonyos.com/ohpm/@ohos/pulltorefresh/-/pulltorefresh-2.0.5.har", 21 "resolved": "https://repo.harmonyos.com/ohpm/@ohos/pulltorefresh/-/pulltorefresh-2.0.5.har",
173 "registryType": "ohpm" 22 "registryType": "ohpm"
174 - },  
175 - "dayjs@1.11.7": {  
176 - "name": "dayjs",  
177 - "integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==",  
178 - "resolved": "https://ohpm.openharmony.cn/ohpm/dayjs/-/dayjs-1.11.7.tgz",  
179 - "shasum": "4b296922642f70999544d1144a2c25730fce63e2",  
180 - "registryType": "ohpm"  
181 - },  
182 - "libcompress.so@oh_modules/.ohpm/@mpaas+compress@1.0.0/oh_modules/@mpaas/compress/src/main/cpp/types/libcompress": {  
183 - "name": "libcompress.so",  
184 - "resolved": "oh_modules/.ohpm/@mpaas+compress@1.0.0/oh_modules/@mpaas/compress/src/main/cpp/types/libcompress",  
185 - "registryType": "local"  
186 - },  
187 - "libframework_api.so@oh_modules/.ohpm/@mpaas+framework@0.0.2/oh_modules/@mpaas/framework/src/main/cpp/types/libframework_api": {  
188 - "name": "libframework_api.so",  
189 - "resolved": "oh_modules/.ohpm/@mpaas+framework@0.0.2/oh_modules/@mpaas/framework/src/main/cpp/types/libframework_api",  
190 - "registryType": "local"  
191 - },  
192 - "libgwcli.so@oh_modules/.ohpm/@mpaas+fake-island@1.0.0/oh_modules/@mpaas/fake-island/types": {  
193 - "name": "libgwcli.so",  
194 - "resolved": "oh_modules/.ohpm/@mpaas+fake-island@1.0.0/oh_modules/@mpaas/fake-island/types",  
195 - "registryType": "local"  
196 - },  
197 - "liblang.so@oh_modules/.ohpm/@mpaas+lang@1.0.0/oh_modules/@mpaas/lang/types": {  
198 - "name": "liblang.so",  
199 - "resolved": "oh_modules/.ohpm/@mpaas+lang@1.0.0/oh_modules/@mpaas/lang/types",  
200 - "registryType": "local"  
201 - },  
202 - "libmplog.so@oh_modules/.ohpm/@mpaas+trace-log@0.0.2/oh_modules/@mpaas/trace-log/types": {  
203 - "name": "libmplog.so",  
204 - "resolved": "oh_modules/.ohpm/@mpaas+trace-log@0.0.2/oh_modules/@mpaas/trace-log/types",  
205 - "registryType": "local"  
206 - },  
207 - "libshuckle.so@oh_modules/.ohpm/@mpaas+shuckle@1.0.0/oh_modules/@mpaas/shuckle/src/main/cpp/types/libshuckle": {  
208 - "name": "lishuckle.so",  
209 - "resolved": "oh_modules/.ohpm/@mpaas+shuckle@1.0.0/oh_modules/@mpaas/shuckle/src/main/cpp/types/libshuckle",  
210 - "registryType": "local",  
211 - "dependencies": {  
212 - "@mpaas/framework": "^0.0.2"  
213 - }  
214 - },  
215 - "long@5.2.1": {  
216 - "name": "long",  
217 - "integrity": "sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A==",  
218 - "resolved": "https://ohpm.openharmony.cn/ohpm/long/-/long-5.2.1.tgz",  
219 - "shasum": "e27595d0083d103d2fa2c20c7699f8e0c92b897f",  
220 - "registryType": "ohpm"  
221 - },  
222 - "pako@2.1.0": {  
223 - "name": "pako",  
224 - "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==",  
225 - "resolved": "https://ohpm.openharmony.cn/ohpm/pako/-/pako-2.1.0.tgz",  
226 - "shasum": "266cc37f98c7d883545d11335c00fbd4062c9a86",  
227 - "registryType": "ohpm"  
228 } 23 }
229 } 24 }
230 } 25 }
@@ -9,10 +9,7 @@ @@ -9,10 +9,7 @@
9 "main": "", 9 "main": "",
10 "version": "1.0.0", 10 "version": "1.0.0",
11 "dependencies": { 11 "dependencies": {
12 - "@ohos/pulltorefresh": "^2.0.5",  
13 - "@mpaas/udid": "0.0.2",  
14 - "@mpaas/upgrade": "0.0.2",  
15 - "@mpaas/framework": "0.0.2" 12 + "@ohos/pulltorefresh": "^2.0.5"
16 }, 13 },
17 "dynamicDependencies": {} 14 "dynamicDependencies": {}
18 } 15 }
1 -@mpaas:registry=https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/meta  
@@ -8,7 +8,6 @@ import { @@ -8,7 +8,6 @@ import {
8 EmitterEventId, 8 EmitterEventId,
9 EmitterUtils, 9 EmitterUtils,
10 Logger, 10 Logger,
11 - MpaasUtils,  
12 NetworkManager, 11 NetworkManager,
13 NetworkType, 12 NetworkType,
14 SPHelper, 13 SPHelper,
@@ -21,10 +20,6 @@ export default class EntryAbility extends UIAbility { @@ -21,10 +20,6 @@ export default class EntryAbility extends UIAbility {
21 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { 20 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
22 SPHelper.init(this.context); 21 SPHelper.init(this.context);
23 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); 22 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
24 -  
25 - // mPaaS 初始化  
26 - MpaasUtils.initApp(this.context)  
27 -  
28 registerRouter(); 23 registerRouter();
29 NetworkManager.getInstance().init() 24 NetworkManager.getInstance().init()
30 WDHttp.initHttpHeader() 25 WDHttp.initHttpHeader()
1 import { BottomNavigationComponent, LogoutViewModel } from 'wdComponent'; 1 import { BottomNavigationComponent, LogoutViewModel } from 'wdComponent';
2 import { BreakpointConstants } from 'wdConstant'; 2 import { BreakpointConstants } from 'wdConstant';
3 3
4 -import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger, MpaasUpgradeCheck } from 'wdKit'; 4 +import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger } from 'wdKit';
5 import router from '@ohos.router'; 5 import router from '@ohos.router';
6 import { promptAction } from '@kit.ArkUI'; 6 import { promptAction } from '@kit.ArkUI';
7 import { HWLocationUtils } from 'wdHwAbility/Index'; 7 import { HWLocationUtils } from 'wdHwAbility/Index';
8 -import { UpgradeTipDialog } from "./upgradePage/UpgradeTipDialog" 8 +
9 9
10 const TAG = 'MainPage'; 10 const TAG = 'MainPage';
11 11
@@ -16,7 +16,6 @@ struct MainPage { @@ -16,7 +16,6 @@ struct MainPage {
16 @Provide pageHide: number = -1 16 @Provide pageHide: number = -1
17 private breakpointSystem: BreakpointSystem = new BreakpointSystem() 17 private breakpointSystem: BreakpointSystem = new BreakpointSystem()
18 @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; 18 @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
19 - upgradeDialogController?: CustomDialogController  
20 19
21 watchCurrentBreakpoint() { 20 watchCurrentBreakpoint() {
22 Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`); 21 Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
@@ -44,26 +43,6 @@ struct MainPage { @@ -44,26 +43,6 @@ struct MainPage {
44 onPageShow() { 43 onPageShow() {
45 Logger.info(TAG, 'onPageShow'); 44 Logger.info(TAG, 'onPageShow');
46 this.pageShow = Math.random() 45 this.pageShow = Math.random()
47 -  
48 - // TODO: 升级检查,暂时不开放  
49 - // this.upgradeCheck()  
50 - }  
51 -  
52 - upgradeCheck() {  
53 - const mpaas = new MpaasUpgradeCheck()  
54 - mpaas.checkNewVersion().then((data) => {  
55 - if (data != null) {  
56 -  
57 - this.upgradeDialogController = new CustomDialogController({  
58 - builder: UpgradeTipDialog({  
59 - tipContent:data  
60 - })  
61 - })  
62 - this.upgradeDialogController?.open()  
63 - }  
64 - }).catch(() => {  
65 -  
66 - })  
67 } 46 }
68 47
69 onBackPress() { 48 onBackPress() {
1 -import { UpgradeTipContent } from 'wdKit/Index'  
2 -  
3 -@Preview  
4 -@CustomDialog  
5 -export struct UpgradeTipDialog {  
6 - private tipContent: UpgradeTipContent = {} as UpgradeTipContent  
7 - cancel?: () => void  
8 - confirm?: () => void  
9 - controller: CustomDialogController  
10 -  
11 - build() {  
12 - Column() {  
13 - Text(this.tipContent.content).fontSize(20).margin({ top: 10, bottom: 10 })  
14 - Flex({ justifyContent: FlexAlign.SpaceAround }) {  
15 - Button('cancel')  
16 - .onClick(() => {  
17 - this.controller.close()  
18 - if (this.cancel) {  
19 - this.cancel()  
20 - }  
21 - }).backgroundColor(0xffffff).fontColor(Color.Black)  
22 - Button('立即升级')  
23 - .onClick(() => {  
24 - this.controller.close()  
25 - if (this.confirm) {  
26 - this.confirm()  
27 - }  
28 - }).backgroundColor(0xffffff).fontColor(Color.Red)  
29 - }.margin({ bottom: 10 })  
30 - }  
31 - }  
32 -  
33 -  
34 -}  
1 -{  
2 - "absBase64Code":"",  
3 - "appId":"PRI2B87143171150",  
4 - "appKey":"PRI2B87143171150_HARMONY",  
5 - "base64Code":"",  
6 - "v6Base64Code":"",  
7 - "workspaceId":"default",  
8 - "rpcGW":"http://123.56.249.180/mgw.htm",  
9 - "mpaasapi":"http://123.56.249.180/mgw.htm",  
10 - "pushPort":"",  
11 - "pushGW":"",  
12 - "logGW":"",  
13 - "mvetAppWS":"10.250.12.199"  
14 -}  
1 ------BEGIN ALI VIDEO CERT-----  
2 -LmlsQS5jaUwAAWU1MGY1NWU1Y2U1MzIxMDc5MjQ4ZjUzNGQ2ZjVmZmQ2ZmY1MTFmM  
3 -WMzZTlmZDU4NjUxNmU4YmI0NmMxNzM0MTU1OTBjYzQyY2Y4NGY4Y2U2MGZmYjMzMG  
4 -Q5NTQ1NjFmMGMxNzBjMmUyZGQ5MjYwNjY2YjVlN2Y2YTlhMjZhMzc0YjNhNjExN2N  
5 -lYzRlNGYzMGIxODViMmRlOTVhNzU1Nzg2YzY4MzhkYTY1YWI5NTUzMjQyNjRkN2Q0  
6 -OGE0OTExZjFkYzM5MzllZGQ2YjE2OThkNjJjMGI3ZmUwNDRkOGMwYTI0ZTgzZTRiM  
7 -jUwMTk2MDgwNWFkYzBmMGMwNDU3MDE5ZGI0NDNjYzRiNjc3MjRhMTg5YjAyYmU1YT  
8 -E4NDg1ZWQ4NWRmZDQxYzVkZTUzOTUyNmZiOWNiODNjNTE5MWZhMWE4N2E3YjE3M2I  
9 -xY2I4NzI2YTFiZDFjZjBkZTNlNzM2ZmU3NmFmMjQyOWRlY2FjNTUzYjdhZmFjNDM1  
10 -NTRhNDYwY2RkNWE2NGFmZDg5N2ZmYmVjMWQ3NTc0MDdlOGM2ODBkYzMyYjM1YzU0Z  
11 -Dk1N2MyMTk2YjlmYzEwNjA0YTVmZGQ1Yzg0OTE1N2VkZDNiYjk4OTc4YjZjMGY1OD  
12 -Q4MDY5MjQzMTQzZmMyZDA1ZGJiNTJjMjVhZjMwMWFjYTNkAAAB1u6ksgCgo8C07iY  
13 -q52y6BA6nGYLr+YxZCDTYa0zPm21WZhNlUYE8xR1KKPxoOfhgADCG7FubFonJ5pyD  
14 -2+O7g21xWr3CbYQ1S1D/qWE9pYtIoIUl3USIr8pfRQz2/Lk4TUPO/VzgAWeQrbclC  
15 -wgz50pvVzVAwGjBQfofHlCMO6iIbgSazoopOZSeDfOULs7dPkIOfjeSm1ZMCpytgh  
16 -SKCsd0GwaV+yWn+Uk2DOLafFk2logpRGmQzxcZ/K+vJuedUPHzMSRV8VfXc86wix9  
17 -Tx1sokTb9Xt3wqYgbO/5jn2RhOdBYruFUOrFt3LIp1rKj8XngtwI7Cjr7oBAlEXMf  
18 -Uk2A1s/+AAABZB0FG6sG6bbq5JZuwpbmlC7QuD/rUW5iJavqQwZbylmgDuHTZKe22  
19 -mpbwLrw+3w0j9WAsytGn1C07nnmdjzJGe7oujnqOEgUSId9kkBN898rVMjfMy0ckt  
20 -QgBLtxy6nHvgXLbxUzG4rXHccWAwyTGnEfwNl3FRSuB8jGPewQvrV/HyRKMY7MASv  
21 -EA2uo6NGxLfkz+YrqKjFywqsBmTACkE7kJzL2MoNJ6hfJkKl92Z1+HvpwJEV7EdwN  
22 -Qd7MoB+Jd2gF9YLbnk0h+h+d+aI9tIoM8CksdkHsCLLAONvi7LwwN/RcoytfKts8i  
23 -YQ+b5do3+z/ybD/XZVSPswWmuW1BqEAAAGNchb17gAAAFMAAAAgZ2E3ODYwZGNhMT  
24 -g1NDQ0MTlhNTMzNzBhYTQ4ZGIzZDEAAAABAAAAJwAAAAAAAABAAAAAG2NvbS5hbGl  
25 -5dW4ucGxheWVyLm9ob3NfZGVtbwAAAAEAAAEFAAAAAgAAAAAAAABAAAAj8QAAAZiU  
26 -tdAAAQAAAOgAAAABAAAACAAAABgAAE4hAAABjXIW8ngAAAGYlLXQAAAAAAAAAAAYA  
27 -ABOIgAAAY1yFvJ4AAABmJS10AAAAAAAAAAAGAAATiMAAAGNchbyeAAAAZiUtdAAAA  
28 -AAAAAAABgAAE4kAAABjXIW8ngAAAGYlLXQAAAAAAAAAAAYAABOJQAAAY1yFvJ4AAA  
29 -BmJS10AAAAAAAAAAAGAAATiYAAAGNchbyeAAAAZiUtdAAAAAAAAAAABgAAE4nAAAB  
30 -jXIW8ngAAAGYlLXQAAAAAAAAAAAYAABOhQAAAY1yFvJ4AAABmJS10AAAAAAA  
31 ------END ALI VIDEO CERT-----