// /* // * 分享与视频工具类; // */ // export default class ShareVideoTools { // private static isShareIng: boolean = false; // static getIsShareIng(): boolean { // return this.isShareIng; // } // /** // * @param key // * @param params // */ // static getType(key: ShareVideoKeys): ShareVideoType { // return PCSDK.shareVideo.getType(key.toString()); // } // /** // * 普通分享,不进行处理回调 // * @param key // * @param params 分享参数 // * @param opts 扩展参数 // */ // static share(key: ShareVideoKeys, params: any, opts?: any) { // PCSDK.shareVideo.share(key.toString(), params, opts).then(ret => this.handleSuccess(ShareVideoFrom.Share, ret)); // } // /** // * 验证分享:可处理成功、失败 // * @param key // * @param params // */ // static dispatch(key: ShareVideoKeys, params?: { type?: number, success?: Function, fail?: Function, context?: any }) { // PCSDK.shareVideo.shareDispatch(key.toString(), this.buildParams(params)); // } // /** // * 可自定义类型的验证分享:例如后台配的shareVideoKey是分享,但是这个key临时想要看视频,可传递shareVideoType Video类型强制使用视频 // * @param shareVideoType // * @param key // * @param params // */ // static dispatchType(shareType: ShareVideoType, key: ShareVideoKeys, params?: { type?: number, success?: Function, fail?: Function, context?: any }) { // PCSDK.shareVideo.dispatchType(shareType, key.toString(), this.buildParams(params)); // } // /** // * 对参数进行处理 // * @param params // */ // private static buildParams(params: any = {}) { // let { isOveride } = params; // let { success, fail, context } = params; // // 设置成功处理 // params = { // ...params, // success: (from: ShareVideoFrom, ret) => { // this.isShareIng = false; // this.handleSuccess(from, ret); // success && success.call(context, from, ret); // } // }; // if (isOveride) // // 覆盖:失败默认处理 // return { // ...params, // fail: (from: ShareVideoFrom, err) => { // this.isShareIng = false; // fail && fail.call(context, from, err); // } // }; // else // // 不覆盖:失败默认处理 // return { // ...params, // fail: (from: ShareVideoFrom, err) => { // this.isShareIng = false; // this.handleError(from, err); // fail && fail.call(context, from, err); // } // }; // } // /** // * 成功默认处理:分享和视频统计 // * @param from 来源 // * @param ret? // */ // private static handleSuccess(from: ShareVideoFrom, ret: any | null) { // switch (from) { // case ShareVideoFrom.Share: // 同步分享 // case ShareVideoFrom.ShareAysnc: // 异步分享 // break; // case ShareVideoFrom.Video: // 看视频 // break; // } // } // /** // * 失败默认设置(可覆盖) // * @param from 来源 // * @param error: 失败消息对象 // */ // private static handleError(from: ShareVideoFrom, error: { code: number, msg: string } | null) { // if (!error) return; // // 开发者自定义处理 error msg // if (error.code) { // // wx.showToast({ // // title: error.msg // // }); // // ViewManager.I.showModal(ComTipFull, error.msg); // } // } // } // // 分享视频类型(与后台一一对应) // export enum ShareVideoType { // None = -1, // -1无分享无视频 // Share = 0, // 0同步分享 // ShareAysnc = 1, // 1异步分享 // ShareIntegral = 5, // 5分享积分 // Video = 2, // 2看视频 // VideoToShare = 3, // 3无视频则分享 // VideoAndShare = 4, // 4视频和分享(控制分享和视频两个按钮的显示) , // } // // 分享或者视频来源 // export enum ShareVideoFrom { // None, // 无分享 // Share, // 同步分享 // ShareAysnc, // 异步分享 // Video // 看视频 // } // // 分享视频keysKeys // export enum ShareVideoKeys { // Forward = 'forward', // 右上角三点转发 // CoinTip = 'coin_tip', // 金币不足弹出框 // DiamondDouble = 'diamond_double', // 钻石再来一份 // SuccessDouble = 'success_double', // 成功界面双倍 // LevelUpDiamond = 'levelup_diamond', // 升级活动钻石 // FailRewardDouble = 'fail_reward_double' // 失败获得双倍奖励 // } // // 分享和视频错误 // export enum ShareVideoError { // VideoQuit = 1000, // { code: 1000, msg: '要看完视频哦!' }, // VideoFail = 1001, // { code: 1001, msg: '加载视频广告失败!' }, // VideoNotOpen = 1002, // { code: 1002, msg: '微信版本过低,暂不支持看视频!' }, // VideoPlaying = 1003, // { code: 1003, msg: '正在观看视频中...' }, // VideoInvalid = 999, // { code: 999, msg: '视频UID不存在!' }, // ShareFail = 1004, // { code: 1004, msg: '失败,发给其他好友试试!' }, // ShareSame = 1005, // { code: 1005, msg: '别总骚扰这个群,换个群分享吧!' }, // ShareNotGroup = 1006, // { code: 1006, msg: '请分享到群哦!' } // ShareAsyncNotGroup = 1007 // { code: 1007, msg: '分享到群才能领取更多~' } // }