Commit c82c1e268c01f6f5968c49fd7525ce1eb4e5290f

Authored by 小川 费
1 parent b9fc064c
Exists in master

1

images/prev.png 100644 → 100755

409 Bytes | W: | H:

409 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
images/sdk_video_001.mp4 100644 → 100755
No preview for this file type
images/sdk_video_002.mp4 100644 → 100755
No preview for this file type
inner/.gitignore 100644 → 100755
inner/README.md 100644 → 100755
inner/SUMMARY.md 100644 → 100755
inner/book.json 100644 → 100755
inner/data.md 100644 → 100755
inner/download.md 100644 → 100755
inner/event.md 100644 → 100755
inner/faq.md 100644 → 100755
inner/install.md 100644 → 100755
inner/intro.md 100644 → 100755
inner/modules.md 100644 → 100755
inner/online.md 100644 → 100755
inner/platform.md 100644 → 100755
inner/share.md 100644 → 100755
inner/stat.md 100644 → 100755
inner/stat_active.md 100644 → 100755
inner/stat_ads.md 100644 → 100755
inner/stat_event.md 100644 → 100755
inner/stat_level.md 100644 → 100755
inner/stat_pay.md 100644 → 100755
inner/styles/website.css 100644 → 100755
outer/.gitignore 100644 → 100755
outer/README.md 100644 → 100755
outer/SUMMARY.md 100644 → 100755
outer/book.json 100644 → 100755
outer/data.md 100644 → 100755
outer/download.md 100644 → 100755
outer/event.md 100644 → 100755
outer/faq.md 100644 → 100755
outer/install.md 100644 → 100755
outer/intro.md 100644 → 100755
outer/modules.md 100644 → 100755
outer/online.md 100644 → 100755
outer/platform.md 100644 → 100755
outer/share.md 100644 → 100755
outer/stat.md 100644 → 100755
outer/stat_active.md 100644 → 100755
outer/stat_ads.md 100644 → 100755
outer/stat_event.md 100644 → 100755
outer/stat_level.md 100644 → 100755
outer/stat_pay.md 100644 → 100755
outer/styles/website.css 100644 → 100755
tools/sdk-share-tools-1.0.0.zip 100644 → 100755
No preview for this file type
tools/sdk-share-tools-1.0.1.zip 100644 → 100755
No preview for this file type
tools/sdk-share-tools-1.0.1/SDKTools.ts 0 → 100755
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  1 +import ShareVideoTools, { ShareVideoKeys, ShareVideoType } from "./ShareVideoTools";
  2 +
  3 +/*
  4 +* SDK工具类库;
  5 +*/
  6 +export default class SDKTools {
  7 + // 判断PCSDK是否支持
  8 + static get isSupported() {
  9 + return typeof PCSDK === 'object';
  10 + }
  11 +
  12 + /**
  13 + * 检测普通不是返回值为Promise的 api接口:在浏览器中或其他不支持的平台不至于报错
  14 + * @param callback 接口 api函数
  15 + * @param defaltVal 返回的默认值
  16 + */
  17 + private static checkNormal<T>(callback: Function, defaltVal?: T): T {
  18 + if (!this.isSupported) return defaltVal;
  19 + return callback();
  20 + }
  21 +
  22 + /**
  23 + * 检测普返回值为Promise的 api接口:在浏览器中或其他不支持的平台不至于报错
  24 + * @param callback 接口 api函数
  25 + * @param defaltVal 返回的默认值
  26 + */
  27 + private static checkPromise(callback: Function, defaultVal: Promise<any> = Promise.resolve()): Promise<any> {
  28 + return this.checkNormal<Promise<any>>(callback, defaultVal);
  29 + }
  30 +
  31 + static getType(shareVideoKey: ShareVideoKeys): ShareVideoType {
  32 + return this.checkNormal(() => ShareVideoTools.getType(shareVideoKey), ShareVideoType.Share);
  33 + }
  34 +
  35 + static share(shareVideoKey: ShareVideoKeys, params?: any, opts?: any): void {
  36 + return this.checkNormal(() => ShareVideoTools.share(shareVideoKey, params, opts), null);
  37 + }
  38 +
  39 + static dispatch(shareVideoKey: ShareVideoKeys, params?: { type?: number, success?: Function, fail?: Function, context?: any }): void {
  40 + if (!this.isSupported)
  41 + return params && params.success && params.success.call(params.context || this);
  42 + else
  43 + return this.checkNormal(() => ShareVideoTools.dispatch(shareVideoKey, params), null);
  44 + }
  45 +
  46 + static dispatchType(shareVideoType: ShareVideoType, shareVideoKey: ShareVideoKeys, opts?: { success?: Function, fail?: Function, context?: any }): void {
  47 + return this.checkNormal(() => ShareVideoTools.dispatchType(shareVideoType, shareVideoKey, opts), null);
  48 + }
  49 +}
0 \ No newline at end of file 50 \ No newline at end of file
tools/sdk-share-tools-1.0.1/ShareVideoTools.ts 0 → 100755
@@ -0,0 +1,160 @@ @@ -0,0 +1,160 @@
  1 +// /*
  2 +// * 分享与视频工具类;
  3 +// */
  4 +// export default class ShareVideoTools {
  5 +// private static isShareIng: boolean = false;
  6 +
  7 +// static getIsShareIng(): boolean {
  8 +// return this.isShareIng;
  9 +// }
  10 +
  11 +// /**
  12 +// * @param key
  13 +// * @param params
  14 +// */
  15 +// static getType(key: ShareVideoKeys): ShareVideoType {
  16 +// return PCSDK.shareVideo.getType(key.toString());
  17 +// }
  18 +
  19 +// /**
  20 +// * 普通分享,不进行处理回调
  21 +// * @param key
  22 +// * @param params 分享参数
  23 +// * @param opts 扩展参数
  24 +// */
  25 +// static share(key: ShareVideoKeys, params: any, opts?: any) {
  26 +// PCSDK.shareVideo.share(key.toString(), params, opts).then(ret => this.handleSuccess(ShareVideoFrom.Share, ret));
  27 +// }
  28 +
  29 +// /**
  30 +// * 验证分享:可处理成功、失败
  31 +// * @param key
  32 +// * @param params
  33 +// */
  34 +// static dispatch(key: ShareVideoKeys, params?: { type?: number, success?: Function, fail?: Function, context?: any }) {
  35 +// PCSDK.shareVideo.shareDispatch(key.toString(), this.buildParams(params));
  36 +// }
  37 +
  38 +// /**
  39 +// * 可自定义类型的验证分享:例如后台配的shareVideoKey是分享,但是这个key临时想要看视频,可传递shareVideoType Video类型强制使用视频
  40 +// * @param shareVideoType
  41 +// * @param key
  42 +// * @param params
  43 +// */
  44 +// static dispatchType(shareType: ShareVideoType, key: ShareVideoKeys, params?: { type?: number, success?: Function, fail?: Function, context?: any }) {
  45 +// PCSDK.shareVideo.dispatchType(shareType, key.toString(), this.buildParams(params));
  46 +// }
  47 +
  48 +// /**
  49 +// * 对参数进行处理
  50 +// * @param params
  51 +// */
  52 +// private static buildParams(params: any = {}) {
  53 +// let { isOveride } = params;
  54 +// let { success, fail, context } = params;
  55 +// // 设置成功处理
  56 +// params = {
  57 +// ...params,
  58 +// success: (from: ShareVideoFrom, ret) => {
  59 +// this.isShareIng = false;
  60 +// this.handleSuccess(from, ret);
  61 +// success && success.call(context, from, ret);
  62 +// }
  63 +// };
  64 +
  65 +// if (isOveride)
  66 +// // 覆盖:失败默认处理
  67 +// return {
  68 +// ...params,
  69 +// fail: (from: ShareVideoFrom, err) => {
  70 +// this.isShareIng = false;
  71 +// fail && fail.call(context, from, err);
  72 +// }
  73 +// };
  74 +
  75 +// else
  76 +// // 不覆盖:失败默认处理
  77 +// return {
  78 +// ...params,
  79 +// fail: (from: ShareVideoFrom, err) => {
  80 +// this.isShareIng = false;
  81 +// this.handleError(from, err);
  82 +// fail && fail.call(context, from, err);
  83 +// }
  84 +// };
  85 +// }
  86 +
  87 +// /**
  88 +// * 成功默认处理:分享和视频统计
  89 +// * @param from 来源
  90 +// * @param ret?
  91 +// */
  92 +// private static handleSuccess(from: ShareVideoFrom, ret: any | null) {
  93 +// switch (from) {
  94 +// case ShareVideoFrom.Share: // 同步分享
  95 +// case ShareVideoFrom.ShareAysnc: // 异步分享
  96 +// break;
  97 +
  98 +// case ShareVideoFrom.Video: // 看视频
  99 +// break;
  100 +// }
  101 +// }
  102 +
  103 +// /**
  104 +// * 失败默认设置(可覆盖)
  105 +// * @param from 来源
  106 +// * @param error: 失败消息对象
  107 +// */
  108 +// private static handleError(from: ShareVideoFrom, error: { code: number, msg: string } | null) {
  109 +// if (!error) return;
  110 +// // 开发者自定义处理 error msg
  111 +// if (error.code) {
  112 +// // wx.showToast({
  113 +// // title: error.msg
  114 +// // });
  115 +// // ViewManager.I.showModal(ComTipFull, error.msg);
  116 +// }
  117 +// }
  118 +// }
  119 +
  120 +// // 分享视频类型(与后台一一对应)
  121 +// export enum ShareVideoType {
  122 +// None = -1, // -1无分享无视频
  123 +// Share = 0, // 0同步分享
  124 +// ShareAysnc = 1, // 1异步分享
  125 +// ShareIntegral = 5, // 5分享积分
  126 +// Video = 2, // 2看视频
  127 +// VideoToShare = 3, // 3无视频则分享
  128 +// VideoAndShare = 4, // 4视频和分享(控制分享和视频两个按钮的显示) ,
  129 +// }
  130 +
  131 +// // 分享或者视频来源
  132 +// export enum ShareVideoFrom {
  133 +// None, // 无分享
  134 +// Share, // 同步分享
  135 +// ShareAysnc, // 异步分享
  136 +// Video // 看视频
  137 +// }
  138 +
  139 +// // 分享视频keysKeys
  140 +// export enum ShareVideoKeys {
  141 +// Forward = <any>'forward', // 右上角三点转发
  142 +// CoinTip = <any>'coin_tip', // 金币不足弹出框
  143 +// DiamondDouble = <any>'diamond_double', // 钻石再来一份
  144 +// SuccessDouble = <any>'success_double', // 成功界面双倍
  145 +// LevelUpDiamond = <any>'levelup_diamond', // 升级活动钻石
  146 +// FailRewardDouble = <any>'fail_reward_double' // 失败获得双倍奖励
  147 +// }
  148 +
  149 +// // 分享和视频错误
  150 +// export enum ShareVideoError {
  151 +// VideoQuit = 1000, // { code: 1000, msg: '要看完视频哦!' },
  152 +// VideoFail = 1001, // { code: 1001, msg: '加载视频广告失败!' },
  153 +// VideoNotOpen = 1002, // { code: 1002, msg: '微信版本过低,暂不支持看视频!' },
  154 +// VideoPlaying = 1003, // { code: 1003, msg: '正在观看视频中...' },
  155 +// VideoInvalid = 999, // { code: 999, msg: '视频UID不存在!' },
  156 +// ShareFail = 1004, // { code: 1004, msg: '失败,发给其他好友试试!' },
  157 +// ShareSame = 1005, // { code: 1005, msg: '别总骚扰这个群,换个群分享吧!' },
  158 +// ShareNotGroup = 1006, // { code: 1006, msg: '请分享到群哦!' }
  159 +// ShareAsyncNotGroup = 1007 // { code: 1007, msg: '分享到群才能领取更多~' }
  160 +// }
0 \ No newline at end of file 161 \ No newline at end of file
word/噗嗤SDK(PCSDK).xmind 100644 → 100755
No preview for this file type