Commit 382fc3c3 authored by mqf_0707's avatar mqf_0707

新增授权及会员优惠券等常用API

parent 9c028b13
...@@ -6,28 +6,39 @@ import { AudioModel } from '../helpers'; ...@@ -6,28 +6,39 @@ import { AudioModel } from '../helpers';
* @param {function} successCb 成功回调 * @param {function} successCb 成功回调
*/ */
export declare const commonToast: (content: string, duration?: number, successCb?: () => any) => void; export declare const commonToast: (content: string, duration?: number, successCb?: () => any) => void;
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
export declare const showToast: (params: {
content: string;
duration?: number;
success?: () => any;
}, Taro?: any) => void;
/** /**
* 简易alert * 简易alert
* @param {string} content toast内容 * @param {string} content toast内容
*/ */
export declare const simpleAlert: (content: string) => void; export declare const simpleAlert: (content: string, Taro?: any) => void;
/** /**
* 通用确认弹窗 * 通用确认弹窗
* @param {string} title 标题 * @param {string} title 标题
* @param {string} content 内容 * @param {string} content 内容
* @param {function} successCb 成功回调 * @param {function} successCb 成功回调
*/ */
export declare const commonConfirm: (title: string, content: string, successCb?: () => any) => Promise<void>; export declare const commonConfirm: (title?: string, content?: string, successCb?: () => any, Taro?: any) => Promise<void>;
/** /**
* 获取系统信息 * 获取系统信息
*/ */
export declare const getSystemInfo: () => Promise<unknown>; export declare const getSystemInfo: (Taro?: any) => Promise<unknown>;
/** /**
* 执行关注店铺 * 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id * @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态 * @returns {boolean} 关注状态
*/ */
export declare const favorShop: (sellerId: number) => Promise<boolean | { export declare const favorShop: (sellerId?: number, Taro?: any) => Promise<boolean | {
error?: number; error?: number;
}>; }>;
/** /**
...@@ -35,34 +46,34 @@ export declare const favorShop: (sellerId: number) => Promise<boolean | { ...@@ -35,34 +46,34 @@ export declare const favorShop: (sellerId: number) => Promise<boolean | {
* @param {number} sellerId 店铺归属的卖家Id * @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态 * @returns {boolean} 关注状态
*/ */
export declare const checkShopFavoredStatus: (sellerId: number) => Promise<boolean | { export declare const checkShopFavoredStatus: (sellerId?: number, Taro?: any) => Promise<boolean | {
isFavor?: boolean; isFavor?: boolean;
}>; }>;
/** /**
* 跳转到外部链接 * 跳转到外部链接
* @param {string} url 跳转链接 * @param {string} url 跳转链接
*/ */
export declare const navigateToOutside: (url: any) => boolean; export declare const navigateToOutside: (url: string, Taro?: any) => boolean;
/** /**
* 跳转到内部链接(新开窗口) * 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接 * @param {string} url 跳转链接
*/ */
export declare const navigateTo: (url: any) => boolean; export declare const navigateTo: (url: string, Taro?: any) => boolean;
/** /**
* 返回页面 * 返回页面
* @param {number} delta * @param {number} delta
*/ */
export declare const navigateBack: (delta?: number) => void; export declare const navigateBack: (delta?: number, Taro?: any) => void;
/** /**
* 跳转到内部链接(不新开窗口) * 跳转到内部链接(不新开窗口)
* @param {string} url * @param {string} url
*/ */
export declare const redirectTo: (url: string) => boolean; export declare const redirectTo: (url: string, Taro?: any) => boolean;
/** /**
* 获取服务器时间 * 获取服务器时间
* @returns {number} 服务器时间戳 * @returns {number} 服务器时间戳
*/ */
export declare const getServerTime: () => Promise<string | { export declare const getServerTime: (Taro?: any) => Promise<string | {
time?: string; time?: string;
}>; }>;
/** /**
...@@ -70,7 +81,7 @@ export declare const getServerTime: () => Promise<string | { ...@@ -70,7 +81,7 @@ export declare const getServerTime: () => Promise<string | {
* @param {number} 商品id * @param {number} 商品id
* @returns {object} 收藏结果 * @returns {object} 收藏结果
*/ */
export declare const collectGoods: (id: number) => Promise<false | { export declare const collectGoods: (id: number, Taro?: any) => Promise<false | {
error?: number; error?: number;
}>; }>;
/** /**
...@@ -78,14 +89,14 @@ export declare const collectGoods: (id: number) => Promise<false | { ...@@ -78,14 +89,14 @@ export declare const collectGoods: (id: number) => Promise<false | {
* @param {number} 商品id * @param {number} 商品id
* @returns {boolean} 商品收场状态 * @returns {boolean} 商品收场状态
*/ */
export declare const checkGoodsCollectedStatus: (id: number) => Promise<boolean | { export declare const checkGoodsCollectedStatus: (id: number, Taro?: any) => Promise<boolean | {
isCollect?: boolean; isCollect?: boolean;
}>; }>;
/** /**
* 跳转到淘宝商品页 * 跳转到淘宝商品页
* @param {string} itemId 商品ID * @param {string} itemId 商品ID
*/ */
export declare const openDetail: (itemId: string) => Promise<unknown>; export declare const openDetail: (itemId: string, Taro?: any) => Promise<unknown>;
/** /**
* 创建音频实例 * 创建音频实例
* @param {object} opts 配置对象 例 { src: '音频链接', autoplay: false } * @param {object} opts 配置对象 例 { src: '音频链接', autoplay: false }
...@@ -93,41 +104,41 @@ export declare const openDetail: (itemId: string) => Promise<unknown>; ...@@ -93,41 +104,41 @@ export declare const openDetail: (itemId: string) => Promise<unknown>;
export declare const createAudio: (opts: { export declare const createAudio: (opts: {
src: string; src: string;
autoplay?: boolean; autoplay?: boolean;
}) => AudioModel; }, Taro?: any) => AudioModel;
/** /**
* 获取图片信息 * 获取图片信息
* @param {string} src 图片地址 * @param {string} src 图片地址
*/ */
export declare const getImageInfo: (src: string) => Promise<unknown>; export declare const getImageInfo: (src: string, Taro?: any) => Promise<unknown>;
/** /**
* 剪切板 * 剪切板
* @param {text: string} * @param {text: string}
*/ */
export declare const setClipboard: (text: string) => Promise<unknown>; export declare const setClipboard: (text: string, Taro?: any) => Promise<unknown>;
/** /**
* 调起分享面板 * 调起分享面板
*/ */
export declare const showSharePanel: () => Promise<void>; export declare const showSharePanel: (Taro?: any) => Promise<void>;
/** /**
* 隐藏分享面板 * 隐藏分享面板
*/ */
export declare const hideShareMenu: () => Promise<void>; export declare const hideShareMenu: (Taro?: any) => Promise<void>;
/** /**
* 获取缓存数据 * 获取缓存数据
* @param key * @param key
*/ */
export declare const getStorage: (key: string) => Promise<string>; export declare const getStorage: (key: string, Taro?: any) => Promise<string>;
/** /**
* 设置缓存数据 * 设置缓存数据
* @param key * @param key
* @param value * @param value
*/ */
export declare const setStorage: (key: string, value: any) => Promise<unknown>; export declare const setStorage: (key: string, value: any, Taro?: any) => Promise<unknown>;
/** /**
* 清除缓存数据 * 清除缓存数据
* @param key * @param key
*/ */
export declare const removeStorage: (key: string) => Promise<unknown>; export declare const removeStorage: (key: string, Taro?: any) => Promise<unknown>;
/** /**
* 自定义分析数据的上报接口 * 自定义分析数据的上报接口
* @param eventType * @param eventType
...@@ -139,20 +150,31 @@ export declare const taobaoReportClick: (eventType: string, logkey: string) => v ...@@ -139,20 +150,31 @@ export declare const taobaoReportClick: (eventType: string, logkey: string) => v
* @param sellerNick * @param sellerNick
* @param itemId * @param itemId
*/ */
export declare const openMessage: (sellerNick: string, itemId: string) => Promise<unknown>; export declare const openMessage: (param: {
sellerNick: string;
itemId: string;
}, Taro?: any) => Promise<unknown>;
/** /**
* 显示指定商品 SKU 选择器 * 显示指定商品 SKU 选择器
* @param itemId * @param itemId
*/ */
export declare const showSkuModal: (itemId: string) => Promise<unknown>; export declare const showSkuModal: (itemId: string, Taro?: any) => Promise<unknown>;
/** /**
* 隐藏正在展示的商品 SKU 选择器 * 隐藏正在展示的商品 SKU 选择器
*/ */
export declare const hideSkuModal: () => Promise<unknown>; export declare const hideSkuModal: (Taro?: any) => Promise<unknown>;
/** /**
* 跳转订单页 * 跳转订单页
* @param itemId * @param itemId
* @param skuId * @param skuId
* @param quantity * @param quantity
*/ */
export declare const confirmCustomOrder: (itemId: number, skuId?: number, quantity?: number) => Promise<unknown>; export declare const confirmCustomOrder: (param: {
itemId: number;
skuId?: number;
quantity?: number;
}, Taro?: any) => Promise<unknown>;
export declare const getSetting: (Taro?: any) => Promise<unknown>;
export declare const openSetting: (Taro?: any) => Promise<unknown>;
export declare const getAuthUserInfo: (Taro?: any) => Promise<unknown>;
export declare const authorize: (scopeInfo: any, Taro?: any) => Promise<unknown>;
This diff is collapsed.
This diff is collapsed.
...@@ -64,13 +64,12 @@ var getUserAddress = function (opts) { ...@@ -64,13 +64,12 @@ var getUserAddress = function (opts) {
joinTag: '' // 分割收货地址符号(淘宝商家有特定发货需求) joinTag: '' // 分割收货地址符号(淘宝商家有特定发货需求)
}; };
_opts = Object.assign({}, defaults, opts); _opts = Object.assign({}, defaults, opts);
return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
return [2 /*return*/, new Promise(function (resolve, reject) {
my.authorize({ my.authorize({
scopes: 'scope.addressList', scopes: 'scope.addressList',
success: function () { success: function () {
var addAddress = _opts.addAddress, searchAddress = _opts.searchAddress, locateAddress = _opts.locateAddress, joinTag = _opts.joinTag; var addAddress = _opts.addAddress, searchAddress = _opts.searchAddress, locateAddress = _opts.locateAddress, joinTag = _opts.joinTag;
// @ts-ignore
if (!my.tb.chooseAddress) { if (!my.tb.chooseAddress) {
reject({ reject({
noSupport: true, noSupport: true,
...@@ -78,7 +77,6 @@ var getUserAddress = function (opts) { ...@@ -78,7 +77,6 @@ var getUserAddress = function (opts) {
}); });
return false; return false;
} }
// @ts-ignore
my.tb.chooseAddress({ my.tb.chooseAddress({
addAddress: addAddress, addAddress: addAddress,
searchAddress: searchAddress, searchAddress: searchAddress,
...@@ -125,8 +123,8 @@ var chooseImage = function (opts) { ...@@ -125,8 +123,8 @@ var chooseImage = function (opts) {
}; };
_opts = Object.assign({}, defaults, opts); _opts = Object.assign({}, defaults, opts);
count = _opts.count, sourceType = _opts.sourceType, compressLevel = _opts.compressLevel; count = _opts.count, sourceType = _opts.sourceType, compressLevel = _opts.compressLevel;
return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
return [2 /*return*/, new Promise(function (resolve, reject) {
if (!my.chooseImage) { if (!my.chooseImage) {
reject({ reject({
noSupport: true, noSupport: true,
...@@ -134,12 +132,10 @@ var chooseImage = function (opts) { ...@@ -134,12 +132,10 @@ var chooseImage = function (opts) {
}); });
return false; return false;
} }
// @ts-ignore
my.chooseImage({ my.chooseImage({
count: count, count: count,
sourceType: sourceType, sourceType: sourceType,
success: function (res) { success: function (res) {
// @ts-ignore
my.compressImage({ my.compressImage({
apFilePaths: res.apFilePaths, apFilePaths: res.apFilePaths,
level: compressLevel, level: compressLevel,
......
This diff is collapsed.
...@@ -4,25 +4,26 @@ ...@@ -4,25 +4,26 @@
* @param params * @param params
* @param name * @param name
*/ */
export declare const promisifyApiSimple: (methodName: string, params: IParamJSAPI, name?: string) => void; export declare const promisifyApiSimple: (methodName?: string, params?: IParamJSAPI, name?: string, Taro?: any) => void;
/** /**
* 通用API封装 * 通用API封装
* @param methodName * @param methodName
* @param params * @param params
*/ */
export declare const promisifyApi: (methodName: string, params?: {}) => Promise<unknown>; export declare const promisifyApi: (methodName?: string, params?: {}, Taro?: any) => Promise<unknown>;
/** /**
* 通用API封装 * 通用API封装
* @param methodName * @param methodName
* @param params * @param params
*/ */
export declare const promisifyApiToTb: (methodName: string, params?: {}) => Promise<unknown>; export declare const promisifyApiToTb: (methodName?: string, params?: {}, Taro?: any) => Promise<unknown>;
/** /**
* 创建音频类 * 创建音频类
*/ */
export declare class AudioModel { export declare class AudioModel {
constructor(opts: { constructor(opts: {
src: string; src: string;
Taro?: any;
}); });
} }
/** /**
......
...@@ -55,14 +55,14 @@ var tb_1 = require("../core/tb"); ...@@ -55,14 +55,14 @@ var tb_1 = require("../core/tb");
* @param params * @param params
* @param name * @param name
*/ */
var promisifyApiSimple = function (methodName, params, name) { var promisifyApiSimple = function (methodName, params, name, Taro) {
if (name) {
// @ts-ignore // @ts-ignore
my[methodName](name, params); var _Taro = Taro || my;
if (name) {
_Taro[methodName](name, params);
return; return;
} }
// @ts-ignore _Taro[methodName](params);
my[methodName](params);
}; };
exports.promisifyApiSimple = promisifyApiSimple; exports.promisifyApiSimple = promisifyApiSimple;
/** /**
...@@ -70,11 +70,12 @@ exports.promisifyApiSimple = promisifyApiSimple; ...@@ -70,11 +70,12 @@ exports.promisifyApiSimple = promisifyApiSimple;
* @param methodName * @param methodName
* @param params * @param params
*/ */
var promisifyApi = function (methodName, params) { var promisifyApi = function (methodName, params, Taro) {
if (params === void 0) { params = {}; } if (params === void 0) { params = {}; }
return new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
my[methodName](__assign(__assign({}, params), { success: function (res) { var _Taro = Taro || my;
return new Promise(function (resolve, reject) {
_Taro[methodName](__assign(__assign({}, params), { success: function (res) {
resolve(res); resolve(res);
}, fail: function (err) { }, fail: function (err) {
reject(err); reject(err);
...@@ -87,11 +88,13 @@ exports.promisifyApi = promisifyApi; ...@@ -87,11 +88,13 @@ exports.promisifyApi = promisifyApi;
* @param methodName * @param methodName
* @param params * @param params
*/ */
var promisifyApiToTb = function (methodName, params) { var promisifyApiToTb = function (methodName, params, Taro) {
if (params === void 0) { params = {}; } if (params === void 0) { params = {}; }
// @ts-ignore
var _Taro = Taro || my;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
my.tb[methodName](__assign(__assign({}, params), { success: function (res) { _Taro.tb[methodName](__assign(__assign({}, params), { success: function (res) {
resolve(res); resolve(res);
}, fail: function (err) { }, fail: function (err) {
reject(err); reject(err);
...@@ -104,14 +107,15 @@ exports.promisifyApiToTb = promisifyApiToTb; ...@@ -104,14 +107,15 @@ exports.promisifyApiToTb = promisifyApiToTb;
*/ */
var AudioModel = /** @class */ (function () { var AudioModel = /** @class */ (function () {
function AudioModel(opts) { function AudioModel(opts) {
var src = opts.src; var Taro = opts.Taro, src = opts.src;
if (!src) { if (!src) {
console.error('请输入音频链接'); console.error('请输入音频链接');
return false; return false;
} }
try { try {
// @ts-ignore // @ts-ignore
var innerAudioContext_1 = my.createInnerAudioContext(); var _Taro = Taro || my;
var innerAudioContext_1 = _Taro.createInnerAudioContext();
Object.keys(opts).forEach(function (item) { Object.keys(opts).forEach(function (item) {
innerAudioContext_1[item] = opts[item]; innerAudioContext_1[item] = opts[item];
}); });
......
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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C,aAAa,CAAC,CAAA;oBACnC,MAAM,EAAE,CAAC;gBACX,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,EAAC;;KACJ,CAAA;AApBY,QAAA,YAAY,gBAoBxB"}
\ No newline at end of file \ No newline at end of file
...@@ -49,45 +49,60 @@ declare const _default: { ...@@ -49,45 +49,60 @@ declare const _default: {
textRiskIdentification: (text: string) => Promise<unknown>; textRiskIdentification: (text: string) => Promise<unknown>;
navigateToTaobaoPage: (shopId: string) => Promise<unknown>; navigateToTaobaoPage: (shopId: string) => Promise<unknown>;
commonToast: (content: string, duration?: number, successCb?: () => any) => void; commonToast: (content: string, duration?: number, successCb?: () => any) => void;
simpleAlert: (content: string) => void; showToast: (params: {
commonConfirm: (title: string, content: string, successCb?: () => any) => Promise<void>; content: string;
getSystemInfo: () => Promise<unknown>; duration?: number;
favorShop: (sellerId: number) => Promise<boolean | { success?: () => any;
}, Taro?: any) => void;
simpleAlert: (content: string, Taro?: any) => void;
commonConfirm: (title?: string, content?: string, successCb?: () => any, Taro?: any) => Promise<void>;
getSystemInfo: (Taro?: any) => Promise<unknown>;
favorShop: (sellerId?: number, Taro?: any) => Promise<boolean | {
error?: number; error?: number;
}>; }>;
checkShopFavoredStatus: (sellerId: number) => Promise<boolean | { checkShopFavoredStatus: (sellerId?: number, Taro?: any) => Promise<boolean | {
isFavor?: boolean; isFavor?: boolean;
}>; }>;
navigateToOutside: (url: any) => boolean; navigateToOutside: (url: string, Taro?: any) => boolean;
navigateTo: (url: any) => boolean; navigateTo: (url: string, Taro?: any) => boolean;
navigateBack: (delta?: number) => void; navigateBack: (delta?: number, Taro?: any) => void;
redirectTo: (url: string) => boolean; redirectTo: (url: string, Taro?: any) => boolean;
getServerTime: () => Promise<string | { getServerTime: (Taro?: any) => Promise<string | {
time?: string; time?: string;
}>; }>;
collectGoods: (id: number) => Promise<false | { collectGoods: (id: number, Taro?: any) => Promise<false | {
error?: number; error?: number;
}>; }>;
checkGoodsCollectedStatus: (id: number) => Promise<boolean | { checkGoodsCollectedStatus: (id: number, Taro?: any) => Promise<boolean | {
isCollect?: boolean; isCollect?: boolean;
}>; }>;
openDetail: (itemId: string) => Promise<unknown>; openDetail: (itemId: string, Taro?: any) => Promise<unknown>;
createAudio: (opts: { createAudio: (opts: {
src: string; src: string;
autoplay?: boolean; autoplay?: boolean;
}) => import("./helpers").AudioModel; }, Taro?: any) => import("./helpers").AudioModel;
getImageInfo: (src: string) => Promise<unknown>; getImageInfo: (src: string, Taro?: any) => Promise<unknown>;
setClipboard: (text: string) => Promise<unknown>; setClipboard: (text: string, Taro?: any) => Promise<unknown>;
showSharePanel: () => Promise<void>; showSharePanel: (Taro?: any) => Promise<void>;
hideShareMenu: () => Promise<void>; hideShareMenu: (Taro?: any) => Promise<void>;
getStorage: (key: string) => Promise<string>; getStorage: (key: string, Taro?: any) => Promise<string>;
setStorage: (key: string, value: any) => Promise<unknown>; setStorage: (key: string, value: any, Taro?: any) => Promise<unknown>;
removeStorage: (key: string) => Promise<unknown>; removeStorage: (key: string, Taro?: any) => Promise<unknown>;
taobaoReportClick: (eventType: string, logkey: string) => void; taobaoReportClick: (eventType: string, logkey: string) => void;
openMessage: (sellerNick: string, itemId: string) => Promise<unknown>; openMessage: (param: {
showSkuModal: (itemId: string) => Promise<unknown>; sellerNick: string;
hideSkuModal: () => Promise<unknown>; itemId: string;
confirmCustomOrder: (itemId: number, skuId?: number, quantity?: number) => Promise<unknown>; }, Taro?: any) => Promise<unknown>;
showSkuModal: (itemId: string, Taro?: any) => Promise<unknown>;
hideSkuModal: (Taro?: any) => Promise<unknown>;
confirmCustomOrder: (param: {
itemId: number;
skuId?: number;
quantity?: number;
}, Taro?: any) => Promise<unknown>;
getSetting: (Taro?: any) => Promise<unknown>;
openSetting: (Taro?: any) => Promise<unknown>;
authorize: (scopeInfo: any, Taro?: any) => Promise<unknown>;
}; };
utils: typeof utils; utils: typeof utils;
request: (header: IRequest) => false | ((handle: any, method: string, params: any, ext?: { request: (header: IRequest) => false | ((handle: any, method: string, params: any, ext?: {
......
{"version":3,"file":"capiFn.js","sourceRoot":"","sources":["../../src/request/capiFn.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAyC;AACzC,qCAA8C;AAC9C,kCAAyC;AAEzC,OAAO;AACP,IAAM,kBAAkB,GAAG;;;;oBACA,qBAAM,qBAAc,EAAE,CAAC,KAAK,CAAC,UAAA,GAAG;oBACrD,gBAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAClC,CAAC,CAAC,EAAA;;gBAFI,WAAW,GAAQ,SAEvB;gBACF,IAAG,CAAC,WAAW;oBAAE,sBAAO,KAAK,EAAA;gBACvB,KAA4F,WAAW,IAAI,EAAE,EAA3G,IAAI,UAAA,EAAE,SAAS,eAAA,EAAE,YAAY,kBAAA,EAAE,QAAQ,cAAA,EAAE,QAAQ,cAAA,EAAE,UAAU,gBAAA,EAAE,UAAU,gBAAA,EAAE,UAAU,gBAAA,CAAuB;gBAC9G,MAAM,GAAG;oBACX,IAAI,MAAA;oBACJ,KAAK,EAAE,SAAS;oBAChB,aAAa,EAAE,UAAU;oBACzB,QAAQ,UAAA;oBACR,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,UAAU;oBAChB,UAAU,YAAA;iBACb,CAAA;gBACD,sBAAO;wBACH,MAAM,QAAA;wBACN,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,OAAO;qBACjD,EAAA;;;KACF,CAAA;AACD,IAAM,cAAc,GAAG,UAAO,OAAO;;QACnC,sBAAO,IAAI,OAAO,CAAC,UAAO,OAAO,EAAC,MAAM;;oBACtC,aAAa;oBACX,EAAE,CAAC,OAAO,CAAC;wBACP,KAAK,EAAE,IAAI;wBACX,OAAO,EAAE,YAAY,GAAG,OAAO;wBAC/B,OAAO,EAAE,UAAC,GAAG;4BACT,IAAG,GAAG,C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BAChB;iCAAK;gCACF,gBAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAA;gCAChC,OAAO,CAAC,KAAK,CAAC,CAAA;6BACjB;;;4BAED,gBAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;4BAC5B,OAAO,CAAC,KAAK,CAAC,CAAA;;;;;iBAErB,CAAC,EAAA;;KACH,CAAA;AArBY,QAAA,kBAAkB,sBAqB9B"}
\ No newline at end of file \ No newline at end of file
...@@ -260,11 +260,11 @@ var validateActivityStatus = function (checkParam) { return __awaiter(void 0, vo ...@@ -260,11 +260,11 @@ var validateActivityStatus = function (checkParam) { return __awaiter(void 0, vo
return [2 /*return*/, false]; return [2 /*return*/, false];
return [2 /*return*/, new Promise(function (resolve, reject) { return [2 /*return*/, new Promise(function (resolve, reject) {
if (nowTime < startTime) { if (nowTime < startTime) {
tb_1.commonToast('活动未开始'); tb_1.showToast({ content: '活动未开始' });
resolve(false); resolve(false);
} }
else if (nowTime > endTime && !noCheck) { else if (nowTime > endTime && !noCheck) {
tb_1.commonToast('活动已结束'); tb_1.showToast({ content: '活动已结束' });
resolve(false); resolve(false);
} }
else { else {
......
This diff is collapsed.
{ {
"name": "tbcc-sdk-ts", "name": "tbcc-sdk-ts",
"version": "1.0.7", "version": "1.0.14",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
......
This diff is collapsed.
...@@ -14,13 +14,12 @@ export const getUserAddress = async (opts = {}) => { ...@@ -14,13 +14,12 @@ export const getUserAddress = async (opts = {}) => {
joinTag: '' // 分割收货地址符号(淘宝商家有特定发货需求) joinTag: '' // 分割收货地址符号(淘宝商家有特定发货需求)
}; };
let _opts = Object.assign({}, defaults, opts); let _opts = Object.assign({}, defaults, opts);
return new Promise((resolve, reject) => {
// @ts-ignore // @ts-ignore
return new Promise((resolve, reject) => {
my.authorize({ my.authorize({
scopes: 'scope.addressList', scopes: 'scope.addressList',
success: () => { success: () => {
const { addAddress, searchAddress, locateAddress, joinTag } = _opts; const { addAddress, searchAddress, locateAddress, joinTag } = _opts;
// @ts-ignore
if (!my.tb.chooseAddress) { if (!my.tb.chooseAddress) {
reject({ reject({
noSupport: true, noSupport: true,
...@@ -28,7 +27,6 @@ export const getUserAddress = async (opts = {}) => { ...@@ -28,7 +27,6 @@ export const getUserAddress = async (opts = {}) => {
}); });
return false; return false;
} }
// @ts-ignore
my.tb.chooseAddress( my.tb.chooseAddress(
{ {
addAddress, addAddress,
...@@ -74,8 +72,8 @@ export const chooseImage = async (opts = {}) => { ...@@ -74,8 +72,8 @@ export const chooseImage = async (opts = {}) => {
}; };
let _opts = Object.assign({}, defaults, opts); let _opts = Object.assign({}, defaults, opts);
const { count, sourceType, compressLevel } = _opts; const { count, sourceType, compressLevel } = _opts;
return new Promise((resolve, reject) => {
// @ts-ignore // @ts-ignore
return new Promise((resolve, reject) => {
if (!my.chooseImage) { if (!my.chooseImage) {
reject({ reject({
noSupport: true, noSupport: true,
...@@ -83,12 +81,10 @@ export const chooseImage = async (opts = {}) => { ...@@ -83,12 +81,10 @@ export const chooseImage = async (opts = {}) => {
}); });
return false; return false;
} }
// @ts-ignore
my.chooseImage({ my.chooseImage({
count, count,
sourceType, sourceType,
success: res => { success: res => {
// @ts-ignore
my.compressImage({ my.compressImage({
apFilePaths: res.apFilePaths, apFilePaths: res.apFilePaths,
level: compressLevel, level: compressLevel,
......
...@@ -5,24 +5,25 @@ import { commonToast } from '../core/tb' ...@@ -5,24 +5,25 @@ import { commonToast } from '../core/tb'
* @param params * @param params
* @param name * @param name
*/ */
export const promisifyApiSimple = (methodName: string, params: IParamJSAPI, name?: string) => { export const promisifyApiSimple = (methodName?: string, params?: IParamJSAPI, name?: string, Taro?: any) => {
if(name) {
// @ts-ignore // @ts-ignore
my[methodName](name,params); const _Taro = Taro || my
if(name) {
_Taro[methodName](name,params);
return; return;
} }
// @ts-ignore _Taro[methodName](params);
my[methodName](params);
} }
/** /**
* 通用API封装 * 通用API封装
* @param methodName * @param methodName
* @param params * @param params
*/ */
export const promisifyApi = (methodName: string, params = {}) => { export const promisifyApi = (methodName?: string, params = {}, Taro?: any) => {
return new Promise((resolve, reject) => {
// @ts-ignore // @ts-ignore
my[methodName]({ const _Taro = Taro || my
return new Promise((resolve, reject) => {
_Taro[methodName]({
...params, ...params,
success: res => { success: res => {
resolve(res) resolve(res)
...@@ -38,10 +39,12 @@ export const promisifyApi = (methodName: string, params = {}) => { ...@@ -38,10 +39,12 @@ export const promisifyApi = (methodName: string, params = {}) => {
* @param methodName * @param methodName
* @param params * @param params
*/ */
export const promisifyApiToTb = (methodName: string, params = {}) => { export const promisifyApiToTb = (methodName?: string, params = {}, Taro?: any) => {
// @ts-ignore
const _Taro = Taro || my
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// @ts-ignore // @ts-ignore
my.tb[methodName]({ _Taro.tb[methodName]({
...params, ...params,
success: res => { success: res => {
resolve(res) resolve(res)
...@@ -56,15 +59,16 @@ export const promisifyApiToTb = (methodName: string, params = {}) => { ...@@ -56,15 +59,16 @@ export const promisifyApiToTb = (methodName: string, params = {}) => {
* 创建音频类 * 创建音频类
*/ */
export class AudioModel { export class AudioModel {
constructor(opts: { src: string }) { constructor(opts: { src: string, Taro?: any }) {
const { src } = opts; const { Taro, src } = opts;
if (!src) { if (!src) {
console.error('请输入音频链接'); console.error('请输入音频链接');
return false; return false;
} }
try { try {
// @ts-ignore // @ts-ignore
const innerAudioContext = my.createInnerAudioContext(); const _Taro = Taro || my
const innerAudioContext = _Taro.createInnerAudioContext();
Object.keys(opts).forEach(item => { Object.keys(opts).forEach(item => {
innerAudioContext[item] = opts[item]; innerAudioContext[item] = opts[item];
}); });
......
...@@ -66,7 +66,7 @@ export const receiveObjectPrize = async (api: any, data: IReceivePrize) => { ...@@ -66,7 +66,7 @@ export const receiveObjectPrize = async (api: any, data: IReceivePrize) => {
commonToast(successMsg) commonToast(successMsg)
resolve(true) resolve(true)
}else { }else {
commonToast(errorMsg || message) commonToast(errorMsg || message )
resolve(false) resolve(false)
} }
}) })
......
import { commonToast, getServerTime } from '../core/tb'; import { showToast, getServerTime } from '../core/tb';
/** /**
* 时间格式化 * 时间格式化
* @param date 接收可以被new Date()方法转换的内容 * @param date 接收可以被new Date()方法转换的内容
...@@ -182,11 +182,11 @@ export const validateActivityStatus = async (checkParam: { startTime: number, en ...@@ -182,11 +182,11 @@ export const validateActivityStatus = async (checkParam: { startTime: number, en
if(!startTime || !endTime) return false if(!startTime || !endTime) return false
return new Promise((resolve,reject) => { return new Promise((resolve,reject) => {
if(nowTime < startTime ) { if(nowTime < startTime ) {
commonToast('活动未开始') showToast({ content: '活动未开始' })
resolve(false) resolve(false)
} }
else if(nowTime > endTime && !noCheck) { else if(nowTime > endTime && !noCheck) {
commonToast('活动已结束') showToast({ content: '活动已结束' })
resolve(false) resolve(false)
} }
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment