Commit a270cb14 authored by mqf_0707's avatar mqf_0707

wnf

parents 6fa6821f b1d3f18f
No preview for this file type
/server /server
node_modules/
...@@ -49,7 +49,8 @@ ...@@ -49,7 +49,8 @@
"lodash": "4.17.15", "lodash": "4.17.15",
"react": "^16.10.0", "react": "^16.10.0",
"react-dom": "^16.10.0", "react-dom": "^16.10.0",
"taro-ui": "^3.0.0-alpha.3" "taro-ui": "^3.0.0-alpha.3",
"tbcc-sdk-ts": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.0", "@babel/core": "^7.8.0",
......
import cloud from '@tbmp/mp-cloud-sdk' import cloud from '@tbmp/mp-cloud-sdk'
import tbccTs from '@/tbcc-sdk-ts' import tbccTs from 'tbcc-sdk-ts'
import conifg from './config' import conifg from './config'
const { utils: { generateAPI }, request: tbccRequest, capi, capiFn } = tbccTs const { utils: { generateAPI }, request: tbccRequest, capi, capiFn } = tbccTs
......
...@@ -12,22 +12,13 @@ const { env } = config ...@@ -12,22 +12,13 @@ const { env } = config
cloud.init({ env }) cloud.init({ env })
class App extends Component { class App extends Component {
componentDidMount() {}
onLaunch(options) { onLaunch(options) {
console.log('options :>> ', options); console.log('options :>> ', options)
const { activityId } = options.query || {} const { activityId } = options.query || {}
const app = getApp() const app = getApp()
app.activityId = activityId || config.defaultActivityId app.activityId = activityId || config.defaultActivityId
} }
componentDidShow() {}
componentDidHide() {}
componentDidCatchError() { }
// this.props.children 是将要会渲染的页面 // this.props.children 是将要会渲染的页面
render() { render() {
return this.props.children return this.props.children
......
import { View } from '@tarojs/components' import { View } from '@tarojs/components'
import React, { useState } from 'react' import React, { useState } from 'react'
import { useThrottle } from '@/hooks/useThrottle' import { useThrottle } from '@/hooks/useThrottle'
import classnames from 'classnames'
import Modal from '@/components/_base/Modal/Modal' import Modal from '@/components/_base/Modal/Modal'
import styles from './DoHelpModal.module.less' import styles from './DoHelpModal.module.less'
import API from '@/api' import API from '@/api'
import { checkIsMember, commonToast } from '@/utils/tb'
import { showToast } from '@tarojs/taro' import { showToast } from '@tarojs/taro'
import { useLoginInfoModel } from '@/store' import { useLoginInfoModel } from '@/store'
import { checkIsMember } from 'tbcc-sdk-ts/lib/utils'
import { commonToast } from 'tbcc-sdk-ts/lib/core/tb'
export default function RuleModal(props) { export default function RuleModal(props) {
const { bg = '', width = 300, height = 300, onClose = () => {}, closePostion, top = '40%', newVip = false } = props const { bg = '', width = 300, height = 300, onClose = () => {}, closePostion, top = '40%', newVip = false } = props
......
import { View, ScrollView, Image } from '@tarojs/components' import { View, ScrollView, Image } from '@tarojs/components'
import classnames from 'classnames' import React from 'react'
import React, { useEffect, useState } from 'react' import tbccTs from 'tbcc-sdk-ts'
import tbccTs from '@/tbcc-sdk-ts'
const { openDetail, collectGoods, checkGoodsCollectedStatus, commonToast } = tbccTs.tb const { openDetail, collectGoods, checkGoodsCollectedStatus, commonToast } = tbccTs.tb
import './GoodsPage.less' import './GoodsPage.less'
......
import { View, ScrollView, Text } from '@tarojs/components' import { View, ScrollView, Text } from '@tarojs/components'
import React from 'react' import React from 'react'
import classnames from 'classnames'
import Modal from '@/components/_base/Modal/Modal' import Modal from '@/components/_base/Modal/Modal'
import styles from './RuleModal.module.less' import styles from './RuleModal.module.less'
......
...@@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react' ...@@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react'
import Popup from '@/components/_base/Popup/Popup' import Popup from '@/components/_base/Popup/Popup'
import { noopFn } from '@/utils/util' import { noopFn } from '@/utils/util'
import { useTasks } from '@/hooks/useTasks' import { useTasks } from '@/hooks/useTasks'
import tbccTs from '@/tbcc-sdk-ts' import tbccTs from 'tbcc-sdk-ts'
import API from '@/api' import API from '@/api'
import config from '@/config' import config from '@/config'
import { useThrottle } from '@/hooks/useThrottle' import { useThrottle } from '@/hooks/useThrottle'
......
export default { export default {
env: 'test', // 云函数环境 test 测试环境 online 线上环境 env: 'test', // 云函数环境 test 测试环境 online 线上环境
<<<<<<< HEAD
requestType: 'cloud', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口 requestType: 'cloud', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口
cloudName: 'hlnBox', // 主云函数项目名 CommonToC cloudName: 'hlnBox', // 主云函数项目名 CommonToC
=======
requestType: 'yapi', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口
cloudName: 'CommonToC', // 主云函数项目名 CommonToC
>>>>>>> b1d3f18f88e4491f5057494d2eab352d8727c37a
sellerId: '2207644377875', sellerId: '2207644377875',
tornadoAPI: 'https://tornado.duibadev.com.cn/tbServer/api?db=xxx&proxyIp=xxx', // 新增:当requestType: 'tornadoAPI'时,找服务端提供地址 tornadoAPI: 'https://tornado.duibadev.com.cn/tbServer/api?db=xxx&proxyIp=xxx', // 新增:当requestType: 'tornadoAPI'时,找服务端提供地址
defaultActivityId: '5ff7e0a3e5c0d7dafd30dce5' // 默认活动id defaultActivityId: '5ff7e0a3e5c0d7dafd30dce5' // 默认活动id
......
import { getAuthUserInfo } from 'tbcc-sdk-ts/lib/core/tbFn'
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { getAuthUserInfo } from '../utils/tb'
// 授权 // 授权
export function useAuth() { export function useAuth() {
......
...@@ -2,10 +2,10 @@ import { useEffect, useState } from 'react' ...@@ -2,10 +2,10 @@ import { useEffect, useState } from 'react'
import { useRouter } from '@tarojs/taro' import { useRouter } from '@tarojs/taro'
import { useLoginInfoModel } from '../store/loginInfo' import { useLoginInfoModel } from '../store/loginInfo'
import API from '../api' import API from '../api'
import { checkShopFavoredStatus } from '../utils/tb'
import config from '../config' import config from '../config'
import { useAuth } from './useAuth' import { useAuth } from './useAuth'
import { noopFn } from '@/utils/util' import { noopFn } from '@/utils/util'
import { checkShopFavoredStatus } from 'tbcc-sdk-ts/lib/core/tb'
const { login } = API const { login } = API
......
...@@ -14,7 +14,7 @@ import { useState, useEffect } from 'react' ...@@ -14,7 +14,7 @@ import { useState, useEffect } from 'react'
} }
* @return {*} * @return {*}
*/ */
export function useRequest(api, params = {}, config = { manual: false }) { export function useRequest(api, defaultParams = {}, config = { manual: false }) {
const [ data, setData ] = useState({}) const [ data, setData ] = useState({})
const [ code, setCode ] = useState('') const [ code, setCode ] = useState('')
const [ success, setSuccess ] = useState(false) const [ success, setSuccess ] = useState(false)
...@@ -22,7 +22,7 @@ export function useRequest(api, params = {}, config = { manual: false }) { ...@@ -22,7 +22,7 @@ export function useRequest(api, params = {}, config = { manual: false }) {
const [ loading, setLoading ] = useState(false) const [ loading, setLoading ] = useState(false)
const [ error, setError ] = useState(null) const [ error, setError ] = useState(null)
const request = async() => { const request = async(params = defaultParams) => {
setLoading(true) setLoading(true)
try { try {
const { data: resData, success: resSuccess, message: resMsg, code: resCode } = await api(params, config) const { data: resData, success: resSuccess, message: resMsg, code: resCode } = await api(params, config)
......
...@@ -5,84 +5,6 @@ import { useRequest } from './useRequest' ...@@ -5,84 +5,6 @@ import { useRequest } from './useRequest'
export function useTasks() { export function useTasks() {
const { data, run: fetchTaskList } = useRequest(API.getTaskList, {}, { manual: false }) const { data, run: fetchTaskList } = useRequest(API.getTaskList, {}, { manual: false })
// const mockTaskList = [
// {
// taskType: 'follow',
// title: '关注店铺',
// taskRateType: 1,
// times: 1,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'member',
// title: '加入会员',
// taskRateType: 1,
// times: 1,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'invites',
// title: '邀请好友入会',
// taskRateType: 1,
// times: 3,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'jumpLink',
// title: '浏览店铺15s',
// taskRateType: 2,
// times: 1,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'browseGoods',
// itemIds: '617724147979,617724563528,617300295119',
// title: '浏览商品',
// taskRateType: 2,
// times: 1,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'orderGoods',
// itemIds: '617724147979,617724563528,617300295119',
// title: '下单任务',
// taskRateType: 2,
// times: 1,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'collectGoods',
// title: '收藏商品',
// itemIds: '617724147979,617724563528,617300295119',
// taskRateType: 2,
// times: 1,
// todayCompleteTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'sign',
// title: '每日签到',
// taskRateType: 2,
// times: 1,
// todayCompleteTimes: 0,
// status: 1,
// rewards: 1
// }
// ]
return { return {
taskList: data?.list || [], taskList: data?.list || [],
fetchTaskList fetchTaskList
......
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { View } from '@tarojs/components' import { View } from '@tarojs/components'
import GoodsPage from '@/components/GoodsPage/GoodsPage' import GoodsPage from '@/components/GoodsPage/GoodsPage'
import tbccTs from '@/tbcc-sdk-ts'
import { useDidShow, useRouter } from '@tarojs/taro' import { useDidShow, useRouter } from '@tarojs/taro'
import API from '@/api' import API from '@/api'
import { TASK_CONFIG } from '@/const' import { TASK_CONFIG } from '@/const'
import { useRequest } from '@/hooks/useRequest' import { useRequest } from '@/hooks/useRequest'
import { commonToast } from 'tbcc-sdk-ts/lib/core/tb'
const { commonToast } = tbccTs.tb
const browseConfig = { const browseConfig = {
taskType: 'browseGoods', taskType: 'browseGoods',
......
...@@ -3,7 +3,7 @@ import { View } from '@tarojs/components' ...@@ -3,7 +3,7 @@ import { View } from '@tarojs/components'
import GoodsPage from '@/components/GoodsPage/GoodsPage' import GoodsPage from '@/components/GoodsPage/GoodsPage'
import { useRequest } from '@/hooks/useRequest' import { useRequest } from '@/hooks/useRequest'
import { useRouter } from '@tarojs/taro' import { useRouter } from '@tarojs/taro'
import tbccTs from '@/tbcc-sdk-ts' import tbccTs from 'tbcc-sdk-ts'
import API from '@/api' import API from '@/api'
import { useThrottle } from '@/hooks/useThrottle' import { useThrottle } from '@/hooks/useThrottle'
......
...@@ -8,7 +8,6 @@ import API from '@/api' ...@@ -8,7 +8,6 @@ import API from '@/api'
import RuleModal from '@/components/RuleModal/RuleModal' import RuleModal from '@/components/RuleModal/RuleModal'
import DoHelpModal from '@/components/DoHelpModal/DoHelpModal' import DoHelpModal from '@/components/DoHelpModal/DoHelpModal'
import TasksModal from '@/components/TasksModal/TasksModal' import TasksModal from '@/components/TasksModal/TasksModal'
import styles from './index.module.less' import styles from './index.module.less'
const INDEX_CONFIG = { const INDEX_CONFIG = {
...@@ -20,7 +19,6 @@ const INDEX_CONFIG = { ...@@ -20,7 +19,6 @@ const INDEX_CONFIG = {
} }
function Index() { function Index() {
const app = getApp()
const { activityInfo, setActivityInfoAndStatus } = useActivityInfoModel() const { activityInfo, setActivityInfoAndStatus } = useActivityInfoModel()
const { loginInfo } = useLoginInfoModel() const { loginInfo } = useLoginInfoModel()
...@@ -32,11 +30,8 @@ function Index() { ...@@ -32,11 +30,8 @@ function Index() {
const [ taskFlag, setTaskFlag ] = useState(0) const [ taskFlag, setTaskFlag ] = useState(0)
const fetchActivityInfo = async() => { const fetchActivityInfo = async() => {
const res = await API.getActivityBaseInfoById() const { success, data } = await API.getActivityBaseInfoById()
const { data } = res success && setActivityInfoAndStatus(data)
if (res?.success) {
setActivityInfoAndStatus(data)
}
} }
// 授权登录完成 // 授权登录完成
useLogin(() => { useLogin(() => {
...@@ -75,11 +70,11 @@ function Index() { ...@@ -75,11 +70,11 @@ function Index() {
const onGoMyPrizePage = () => Taro.navigateTo({ url: '/pages/myPrize/myPrize' }) const onGoMyPrizePage = () => Taro.navigateTo({ url: '/pages/myPrize/myPrize' })
return ( return (
<View className={styles.container} style={{ backgroundImage: `${INDEX_CONFIG.bg}` }}> <View className={styles.container} style={{ backgroundImage: `url(${INDEX_CONFIG.bg})` }}>
<View className={styles.rule} style={{ backgroundImage: `${INDEX_CONFIG.ruleButton}` }} onTap={() => setRuleModalVisible(true)}>活动规则</View> <View className={styles.rule} style={{ backgroundImage: `url(${INDEX_CONFIG.ruleButton})` }} onTap={() => setRuleModalVisible(true)}>活动规则</View>
<View className={styles.my_prize} style={{ backgroundImage: `${INDEX_CONFIG.myPrizeButton}` }} onTap={onGoMyPrizePage}>我的奖品</View> <View className={styles.my_prize} style={{ backgroundImage: `url(${INDEX_CONFIG.myPrizeButton})` }} onTap={onGoMyPrizePage}>我的奖品</View>
<View className={styles.share} style={{ backgroundImage: `${INDEX_CONFIG.shareButton}` }} onTap={onShare}>分享</View> <View className={styles.share} style={{ backgroundImage: `url(${INDEX_CONFIG.shareButton})` }} onTap={onShare}>分享</View>
<View className={styles.tasks} style={{ backgroundImage: `${INDEX_CONFIG.taskButton}` }} onTap={() => setTasksModalVisible(true)}>任务</View> <View className={styles.tasks} style={{ backgroundImage: `url(${INDEX_CONFIG.taskButton})` }} onTap={() => setTasksModalVisible(true)}>任务</View>
<View className={styles.bemember} onTap={() => setMemberVisible(true)}>入会</View> <View className={styles.bemember} onTap={() => setMemberVisible(true)}>入会</View>
{ {
......
import React, { useEffect, useState } from 'react' import React, { useState } from 'react'
import { Image, ScrollView, View } from '@tarojs/components' import { Image, ScrollView, View } from '@tarojs/components'
import API from '@/api' import API from '@/api'
import { DRAW_STATUS, PRIZE_TYPE } from '@/const' import { DRAW_STATUS, PRIZE_TYPE } from '@/const'
import DeliveryModal from '@/components/DeliveryModal/DeliveryModal' import DeliveryModal from '@/components/DeliveryModal/DeliveryModal'
import tbccTs from '@/tbcc-sdk-ts' import tbccTs from 'tbcc-sdk-ts'
import { useThrottle } from '@/hooks/useThrottle' import { useThrottle } from '@/hooks/useThrottle'
import { checkIsMember } from 'tbcc-sdk-ts/lib/utils'
import { useDidShow } from '@tarojs/taro' import { useDidShow } from '@tarojs/taro'
import { dateFormatter } from '@/utils/date'
import './myPrize.less' import './myPrize.less'
const { throttleHandle, checkIsMember, dateFormatter } = tbccTs.utils
const { commonToast, getUserAddress, navigateToOutside, setClipboard } = tbccTs.tb const { commonToast, getUserAddress, navigateToOutside, setClipboard } = tbccTs.tb
const { getMyPrizeList, receiveEnamePrize, receiveObjectPrize } = API const { getMyPrizeList, receiveEnamePrize, receiveObjectPrize } = API
......
const fns = require('./lib/index')
module.exports = fns.default
export declare const DRAW_STATUS: {
WAITAWARD: number;
PROCESSING: number;
SUCCESS: number;
FAIL: number;
EXPIRED: number;
RETRY: number;
};
export declare const PRIZE_TYPE: {
ENAME: number;
CREDITS: number;
OBJECT: number;
THANKS: number;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PRIZE_TYPE = exports.DRAW_STATUS = void 0;
// 领取奖品状态
exports.DRAW_STATUS = {
// 待领取
WAITAWARD: 1,
// 处理中
PROCESSING: 2,
// 领取成功
SUCCESS: 3,
// 领取失败
FAIL: 4,
// 已过期
EXPIRED: 5,
// 重新领取
RETRY: 6
};
// 奖品类型
exports.PRIZE_TYPE = {
ENAME: 1,
CREDITS: 2,
OBJECT: 3,
THANKS: 5
};
//# sourceMappingURL=constants.js.map
\ No newline at end of file
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,SAAS;AACI,QAAA,WAAW,GAAG;IACzB,MAAM;IACN,SAAS,EAAE,CAAC;IACZ,MAAM;IACN,UAAU,EAAE,CAAC;IACb,OAAO;IACP,OAAO,EAAE,CAAC;IACV,OAAO;IACP,IAAI,EAAE,CAAC;IACP,MAAM;IACN,OAAO,EAAE,CAAC;IACV,OAAO;IACP,KAAK,EAAE,CAAC;CACT,CAAA;AAED,OAAO;AACM,QAAA,UAAU,GAAG;IACxB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACV,CAAC"}
\ No newline at end of file
import { AudioModel } from '../helpers';
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
export declare const commonToast: (content: string, duration?: number, successCb?: () => any) => void;
/**
* 简易alert
* @param {string} content toast内容
*/
export declare const simpleAlert: (content: string) => void;
/**
* 通用确认弹窗
* @param {string} title 标题
* @param {string} content 内容
* @param {function} successCb 成功回调
*/
export declare const commonConfirm: (title: string, content: string, successCb?: () => any) => Promise<void>;
/**
* 获取系统信息
*/
export declare const getSystemInfo: () => Promise<unknown>;
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export declare const favorShop: (sellerId: number) => Promise<false | {
error?: number;
}>;
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export declare const checkShopFavoredStatus: (sellerId: number) => Promise<boolean | {
isFavor?: boolean;
}>;
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
export declare const navigateToOutside: (url: any) => boolean;
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export declare const navigateTo: (url: any) => boolean;
/**
* 返回页面
* @param {number} delta
*/
export declare const navigateBack: (delta?: number) => void;
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url
*/
export declare const redirectTo: (url: string) => boolean;
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
export declare const getServerTime: () => Promise<string | {
time?: string;
}>;
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
export declare const collectGoods: (id: number) => Promise<false | {
error?: number;
}>;
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
export declare const checkGoodsCollectedStatus: (id: number) => Promise<boolean | {
isCollect?: boolean;
}>;
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
export declare const openDetail: (itemId: string) => Promise<unknown>;
/**
* 创建音频实例
* @param {object} opts 配置对象 例 { src: '音频链接', autoplay: false }
*/
export declare const createAudio: (opts: {
src: string;
autoplay?: boolean;
}) => AudioModel;
/**
* 获取图片信息
* @param {string} src 图片地址
*/
export declare const getImageInfo: (src: string) => Promise<unknown>;
/**
* 剪切板
* @param {text: string}
*/
export declare const setClipboard: (text: string) => Promise<unknown>;
/**
* 调起分享面板
*/
export declare const showSharePanel: () => Promise<void>;
/**
* 获取缓存数据
* @param key
*/
export declare const getStorage: (key: string) => Promise<string | {
data?: string;
}>;
/**
* 设置缓存数据
* @param key
* @param value
*/
export declare const setStorage: (key: string, value: any) => Promise<unknown>;
/**
* 清除缓存数据
* @param key
*/
export declare const removeStorage: (key: string) => Promise<unknown>;
/**
* 自定义分析数据的上报接口
* @param eventType
* @param logkey
*/
export declare const taobaoReportClick: (eventType: string, logkey: string) => void;
/**
* 打开BC客服聊天
* @param sellerNick
* @param itemId
*/
export declare const openMessage: (sellerNick: string, itemId: string) => Promise<unknown>;
/**
* 显示指定商品 SKU 选择器
* @param itemId
*/
export declare const showSkuModal: (itemId: string) => Promise<unknown>;
/**
* 隐藏正在展示的商品 SKU 选择器
*/
export declare const hideSkuModal: () => Promise<unknown>;
/**
* 跳转订单页
* @param itemId
* @param skuId
* @param quantity
*/
export declare const confirmCustomOrder: (itemId: number, skuId?: number, quantity?: number) => Promise<unknown>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.confirmCustomOrder = exports.hideSkuModal = exports.showSkuModal = exports.openMessage = exports.taobaoReportClick = exports.removeStorage = exports.setStorage = exports.getStorage = exports.showSharePanel = exports.setClipboard = exports.getImageInfo = exports.createAudio = exports.openDetail = exports.checkGoodsCollectedStatus = exports.collectGoods = exports.getServerTime = exports.redirectTo = exports.navigateBack = exports.navigateTo = exports.navigateToOutside = exports.checkShopFavoredStatus = exports.favorShop = exports.getSystemInfo = exports.commonConfirm = exports.simpleAlert = exports.commonToast = void 0;
var helpers_1 = require("../helpers");
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
var commonToast = function (content, duration, successCb) {
helpers_1.promisifyApiSimple('showToast', {
content: content || '换个姿势再试一次~',
duration: duration || 3000,
success: successCb
});
};
exports.commonToast = commonToast;
/**
* 简易alert
* @param {string} content toast内容
*/
var simpleAlert = function (content) {
helpers_1.promisifyApiSimple('alert', {
content: content
});
};
exports.simpleAlert = simpleAlert;
/**
* 通用确认弹窗
* @param {string} title 标题
* @param {string} content 内容
* @param {function} successCb 成功回调
*/
var commonConfirm = function (title, content, successCb) {
if (title === void 0) { title = '提示'; }
return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
helpers_1.promisifyApiSimple('confirm', {
title: title,
content: content,
confirmButtonText: '确定',
cancelButtonText: '取消',
success: function (result) {
var confirm = result.confirm;
if (confirm) {
successCb && successCb();
}
}
});
return [2 /*return*/];
});
});
};
exports.commonConfirm = commonConfirm;
/**
* 获取系统信息
*/
var getSystemInfo = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('getSystemInfo', {})];
case 1: return [2 /*return*/, _a.sent()];
}
});
}); };
exports.getSystemInfo = getSystemInfo;
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
var favorShop = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!sellerId) {
return [2 /*return*/, false];
}
return [4 /*yield*/, helpers_1.promisifyApiToTb('favorShop', { id: +sellerId })];
case 1:
result = _a.sent();
if ((result === null || result === void 0 ? void 0 : result.error) === 11)
return [2 /*return*/, false];
return [2 /*return*/, result];
}
});
}); };
exports.favorShop = favorShop;
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
var checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!sellerId) {
return [2 /*return*/, false];
}
return [4 /*yield*/, helpers_1.promisifyApiToTb('checkShopFavoredStatus', { id: +sellerId })];
case 1:
result = _a.sent();
if (result === null || result === void 0 ? void 0 : result.isFavor)
return [2 /*return*/, result.isFavor];
return [2 /*return*/, result];
}
});
}); };
exports.checkShopFavoredStatus = checkShopFavoredStatus;
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
var navigateToOutside = function (url) {
if (!url) {
console.error('navigateToOutside: 请传入url');
return false;
}
helpers_1.promisifyApiSimple('call', {
url: url
}, 'navigateToOutside');
};
exports.navigateToOutside = navigateToOutside;
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
var navigateTo = function (url) {
if (!url) {
console.error('navigateTo: 请传入url');
return false;
}
helpers_1.promisifyApiSimple('navigateTo', {
url: url
});
};
exports.navigateTo = navigateTo;
/**
* 返回页面
* @param {number} delta
*/
var navigateBack = function (delta) {
helpers_1.promisifyApiSimple('navigateBack', {
delta: delta
});
};
exports.navigateBack = navigateBack;
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url
*/
var redirectTo = function (url) {
if (!url) {
console.error('redirectTo: 请传入url');
return false;
}
helpers_1.promisifyApiSimple('redirectTo', {
url: url
});
};
exports.redirectTo = redirectTo;
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
var getServerTime = function () { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('getServerTime', {})];
case 1:
result = _a.sent();
if (result === null || result === void 0 ? void 0 : result.time)
return [2 /*return*/, result.time];
return [2 /*return*/, result];
}
});
}); };
exports.getServerTime = getServerTime;
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
var collectGoods = function (id) { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!id) {
console.error('collectGoods: 请传入商品id');
return [2 /*return*/, false];
}
return [4 /*yield*/, helpers_1.promisifyApiToTb('collectGoods', { id: +id })];
case 1:
result = _a.sent();
if ((result === null || result === void 0 ? void 0 : result.error) === 11)
return [2 /*return*/, false];
return [2 /*return*/, result];
}
});
}); };
exports.collectGoods = collectGoods;
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
var checkGoodsCollectedStatus = function (id) { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!id) {
console.error('checkGoodsCollectedStatus: 请传入商品id');
return [2 /*return*/, false];
}
return [4 /*yield*/, helpers_1.promisifyApiToTb('checkGoodsCollectedStatus', { id: +id })];
case 1:
result = _a.sent();
if (result === null || result === void 0 ? void 0 : result.isCollect)
return [2 /*return*/, result.isCollect];
return [2 /*return*/, result];
}
});
}); };
exports.checkGoodsCollectedStatus = checkGoodsCollectedStatus;
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
var openDetail = function (itemId) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!itemId) {
console.error('openDetail: 请传入商品id');
return [2 /*return*/, false];
}
return [4 /*yield*/, helpers_1.promisifyApiToTb('openDetail', { itemId: String(itemId) })];
case 1: return [2 /*return*/, _a.sent()];
}
});
}); };
exports.openDetail = openDetail;
/**
* 创建音频实例
* @param {object} opts 配置对象 例 { src: '音频链接', autoplay: false }
*/
var createAudio = function (opts) {
var audioInstance = new helpers_1.AudioModel(opts);
return audioInstance;
};
exports.createAudio = createAudio;
/**
* 获取图片信息
* @param {string} src 图片地址
*/
var getImageInfo = function (src) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('getImageInfo', { src: src })];
case 1: return [2 /*return*/, _a.sent()];
}
});
}); };
exports.getImageInfo = getImageInfo;
/**
* 剪切板
* @param {text: string}
*/
var setClipboard = function (text) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('setClipboard', { text: text })];
case 1: return [2 /*return*/, _a.sent()];
}
});
}); };
exports.setClipboard = setClipboard;
/**
* 调起分享面板
*/
var showSharePanel = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
helpers_1.promisifyApiSimple('showSharePanel', {});
return [2 /*return*/];
});
}); };
exports.showSharePanel = showSharePanel;
/**
* 获取缓存数据
* @param key
*/
var getStorage = function (key) { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('getStorage', { key: key })];
case 1:
result = _a.sent();
if (result === null || result === void 0 ? void 0 : result.data)
return [2 /*return*/, result.data];
return [2 /*return*/, result];
}
});
}); };
exports.getStorage = getStorage;
/**
* 设置缓存数据
* @param key
* @param value
*/
var setStorage = function (key, value) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('setStorage', { key: key, data: value })];
case 1: return [2 /*return*/, _a.sent()];
}
});
}); };
exports.setStorage = setStorage;
/**
* 清除缓存数据
* @param key
*/
var removeStorage = function (key) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('removeStorage', { key: key })];
case 1: return [2 /*return*/, _a.sent()];
}
});
}); };
exports.removeStorage = removeStorage;
/**
* 自定义分析数据的上报接口
* @param eventType
* @param logkey
*/
var taobaoReportClick = function (eventType, logkey) {
// @ts-ignore
my.reportAnalytics(eventType, {
// 标志某一类事件,方便数据分析进行分组
'logkey': logkey
});
};
exports.taobaoReportClick = taobaoReportClick;
/**
* 打开BC客服聊天
* @param sellerNick
* @param itemId
*/
var openMessage = function (sellerNick, itemId) { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApiToTb('openMessage', { sellerNick: sellerNick, forceH5: false, params: { itemId: itemId } })];
case 1:
result = _a.sent();
return [2 /*return*/, result];
}
});
}); };
exports.openMessage = openMessage;
/**
* 显示指定商品 SKU 选择器
* @param itemId
*/
var showSkuModal = function (itemId) { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApiToTb('showSku', { itemId: itemId })];
case 1:
result = _a.sent();
return [2 /*return*/, result];
}
});
}); };
exports.showSkuModal = showSkuModal;
/**
* 隐藏正在展示的商品 SKU 选择器
*/
var hideSkuModal = function () { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApiToTb('hideSku', {})];
case 1:
result = _a.sent();
return [2 /*return*/, result];
}
});
}); };
exports.hideSkuModal = hideSkuModal;
/**
* 跳转订单页
* @param itemId
* @param skuId
* @param quantity
*/
var confirmCustomOrder = function (itemId, skuId, quantity) { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApiToTb('confirmCustomOrder', {
data: {
itemId: itemId,
skuId: skuId || -1,
quantity: quantity || 1,
customization: {}
}
})];
case 1:
result = _a.sent();
return [2 /*return*/, result];
}
});
}); };
exports.confirmCustomOrder = confirmCustomOrder;
//# sourceMappingURL=tb.js.map
\ No newline at end of file
{"version":3,"file":"tb.js","sourceRoot":"","sources":["../../src/core/tb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAKmB;AACnB;;;;;GAKG;AACI,IAAM,WAAW,GAAG,UAAC,OAAe,EAAE,QAAiB,EAAE,SAAqB;IACjF,4BAAkB,CAAC,WAAW,EAAC;QAC3B,OAAO,EAAE,OAAO,IAAI,WAAW;QAC/B,QAAQ,EAAE,QAAQ,IAAI,IAAI;QAC1B,OAAO,EAAE,SAAS;KACrB,CAAC,CAAA;AACN,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB;AACF;;;GAGG;AACI,IAAM,WAAW,GAAG,UAAC,O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AArD,MAAM,GAAG,SAA4C;gBACzD,sBAAO,MAAM,EAAA;;;KAChB,CAAA;AAHY,QAAA,YAAY,gBAGxB;AACD;;GAEG;AACI,IAAM,YAAY,GAAG;;;;oBACX,qBAAM,0BAAgB,CAAC,SAAS,EAAC,EAAE,CAAC,EAAA;;gBAA7C,MAAM,GAAG,SAAoC;gBACjD,sBAAO,MAAM,EAAA;;;KAChB,CAAA;AAHY,QAAA,YAAY,gBAGxB;AACD;;;;;GAKG;AACI,IAAM,kBAAkB,GAAG,UAAO,MAAc,EAAE,KAAc,EAAE,QAAiB;;;;oBACzE,qBAAM,0BAAgB,CAAC,oBAAoB,EAAC;oBACrD,IAAI,EAAE;wBACF,MAAM,QAAA;wBACN,KAAK,EAAE,KAAK,IAAI,CAAC,CAAC;wBAClB,QAAQ,EAAE,QAAQ,IAAI,CAAC;wBACvB,aAAa,EAAE,EAAE;qBACpB;iBACJ,CAAC,EAAA;;gBAPE,MAAM,GAAG,SAOX;gBACF,sBAAO,MAAM,EAAA;;;KAChB,CAAA;AAVY,QAAA,kBAAkB,sBAU9B"}
\ No newline at end of file
/**
* 获取淘宝用户收货地址
*/
export declare const getUserAddress: (opts?: {}) => Promise<unknown>;
/**
* 选择图片
* @param opts
*/
export declare const chooseImage: (opts?: {}) => Promise<unknown>;
/**
* 获取图片信息
* @param {*} opts chooseImage配置参数
*/
export declare const uploadImage: (opts?: {}) => Promise<any>;
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
export declare const getAuthUserInfo: () => Promise<unknown>;
/**
* 获取用户会员状态(Tmall使用)
*/
export declare const getUserStatus: () => Promise<unknown>;
/**
* 拉菲奖品发放(Tmall使用)
* @param params
*/
export declare const cloudTBIssue: (params: {
channel: string;
strategyCode: string;
code: string;
}) => Promise<unknown>;
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export declare const chattingSendCard: (requestInfo: IRequestInfo) => Promise<unknown>;
/**
* 文本风险校验
* @param {string} text 文本
*/
export declare const textRiskIdentification: (text: string) => Promise<unknown>;
/**
* 跳转店铺首页
* @param {string} shopId
*/
export declare const navigateToTaobaoPage: (shopId: string) => Promise<unknown>;
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.navigateToTaobaoPage = exports.textRiskIdentification = exports.chattingSendCard = exports.cloudTBIssue = exports.getUserStatus = exports.getAuthUserInfo = exports.uploadImage = exports.chooseImage = exports.getUserAddress = void 0;
var helpers_1 = require("../helpers");
/**
* 获取淘宝用户收货地址
*/
var getUserAddress = function (opts) {
if (opts === void 0) { opts = {}; }
return __awaiter(void 0, void 0, void 0, function () {
var defaults, _opts;
return __generator(this, function (_a) {
defaults = {
addAddress: 'show',
searchAddress: 'hide',
locateAddress: 'hide',
joinTag: '' // 分割收货地址符号(淘宝商家有特定发货需求)
};
_opts = Object.assign({}, defaults, opts);
return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore
my.authorize({
scopes: 'scope.addressList',
success: function () {
var addAddress = _opts.addAddress, searchAddress = _opts.searchAddress, locateAddress = _opts.locateAddress, joinTag = _opts.joinTag;
// @ts-ignore
if (!my.tb.chooseAddress) {
reject({
noSupport: true,
errorMessage: '当前版本不支持选择收货地址,请升级到最新版本'
});
return false;
}
// @ts-ignore
my.tb.chooseAddress({
addAddress: addAddress,
searchAddress: searchAddress,
locateAddress: locateAddress
}, function (res) {
var error = res.error, provinceName = res.provinceName, countyName = res.countyName, cityName = res.cityName, streetName = res.streetName, detailInfo = res.detailInfo, name = res.name, telNumber = res.telNumber;
// 如果有error为用户取消操作不做操作
if (error) {
resolve(false);
}
else {
resolve(__assign(__assign({}, res), { duibaAddress: {
name: name,
phone: telNumber,
address: [provinceName, cityName, countyName, streetName, detailInfo].join(joinTag)
} }));
}
}, function (res) {
reject(res);
});
},
fail: function (err) {
reject(err);
}
});
})];
});
});
};
exports.getUserAddress = getUserAddress;
/**
* 选择图片
* @param opts
*/
var chooseImage = function (opts) {
if (opts === void 0) { opts = {}; }
return __awaiter(void 0, void 0, void 0, function () {
var defaults, _opts, count, sourceType, compressLevel;
return __generator(this, function (_a) {
defaults = {
count: 1,
sourceType: ['camera', 'album'],
compressLevel: 1
};
_opts = Object.assign({}, defaults, opts);
count = _opts.count, sourceType = _opts.sourceType, compressLevel = _opts.compressLevel;
return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore
if (!my.chooseImage) {
reject({
noSupport: true,
errorMessage: '当前版本不支持选择图片,请升级到最新版本'
});
return false;
}
// @ts-ignore
my.chooseImage({
count: count,
sourceType: sourceType,
success: function (res) {
// @ts-ignore
my.compressImage({
apFilePaths: res.apFilePaths,
level: compressLevel,
success: function (data) {
resolve(data);
},
fail: function (err) {
resolve(err);
}
});
},
fail: function (err) {
// error code 2001 为摄像头授权取消、ios 11为用户取消操作不认作失败场景 、安卓 为1
if (err.error !== 2001 && err.error !== 11 && err.error !== 1) {
reject(err);
}
else {
resolve(false);
}
}
});
})];
});
});
};
exports.chooseImage = chooseImage;
/**
* 获取图片信息
* @param {*} opts chooseImage配置参数
*/
var uploadImage = function (opts) {
if (opts === void 0) { opts = {}; }
return __awaiter(void 0, void 0, void 0, function () {
var cloud, chooseImageResult, apFilePaths, filePath, imageInfo, imagePath, url;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
cloud = getApp().cloud;
if (!cloud) {
console.error('chattingSendCard: 请传入app.cloud');
return [2 /*return*/, false];
}
return [4 /*yield*/, exports.chooseImage(opts).catch(function (err) {
console.error('选择图片失败');
})];
case 1:
chooseImageResult = _a.sent();
if (!chooseImageResult) return [3 /*break*/, 4];
apFilePaths = chooseImageResult.apFilePaths;
filePath = apFilePaths[0];
return [4 /*yield*/, helpers_1.promisifyApi('getImageInfo', { src: filePath })
// 找不到图片信息
];
case 2:
imageInfo = _a.sent();
// 找不到图片信息
if (!imageInfo) {
return [2 /*return*/, false];
}
imagePath = imageInfo.path;
return [4 /*yield*/, cloud.file.uploadFile({
filePath: filePath,
fileType: 'image',
fileName: imagePath.split('/').pop()
})];
case 3:
url = (_a.sent()).url;
return [2 /*return*/, url];
case 4: return [2 /*return*/, false];
}
});
});
};
exports.uploadImage = uploadImage;
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
var getAuthUserInfo = function () {
return new Promise(function (resolve, reject) {
// @ts-ignore
my.authorize({
scopes: 'scope.userInfo',
success: function () {
// @ts-ignore
my.getAuthUserInfo({
success: function (userInfo) {
resolve(userInfo);
},
fail: function (err) {
reject(err);
}
});
},
fail: function (err) {
reject(err);
}
});
});
};
exports.getAuthUserInfo = getAuthUserInfo;
/**
* 获取用户会员状态(Tmall使用)
*/
var getUserStatus = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore
my.authorize({
scopes: "scope.campus.audit",
success: function () { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.getTmallMemberStatus()];
case 1:
result = _a.sent();
resolve(result.result);
return [2 /*return*/];
}
});
}); },
fail: function (err) {
console.log(err);
reject(err);
},
});
})];
});
}); };
exports.getUserStatus = getUserStatus;
/**
* 拉菲奖品发放(Tmall使用)
* @param params
*/
var cloudTBIssue = function (params) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore
my.authorize({
scopes: "scope.latourBenefit",
success: function () { return __awaiter(void 0, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.strategyEname(params)];
case 1:
result = _a.sent();
console.log(result, "result");
resolve(result);
return [2 /*return*/];
}
});
}); },
fail: function (err) {
console.log(err);
reject(err);
},
});
})];
});
}); };
exports.cloudTBIssue = cloudTBIssue;
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
var chattingSendCard = function (requestInfo) { return __awaiter(void 0, void 0, void 0, function () {
var cloud;
return __generator(this, function (_a) {
cloud = getApp().cloud;
if (!cloud) {
console.error('chattingSendCard: 请传入app.cloud');
return [2 /*return*/, false];
}
if (!requestInfo) {
console.error('chattingSendCard: 请传入卡片请求参数');
return [2 /*return*/, false];
}
return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore
my.authorize({
scopes: 'scope.groupChat',
success: function () { return __awaiter(void 0, void 0, void 0, function () {
var result, error;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, cloud.topApi
.invoke({
api: 'taobao.chatting.platform.message.sendcard',
data: { request_info: JSON.stringify(requestInfo) }
})
.catch(function (err) {
reject(err);
})];
case 1:
result = _a.sent();
if (result) {
error = result.error;
if (error) {
resolve(false);
}
else {
resolve(result);
}
}
return [2 /*return*/];
}
});
}); },
fail: function (err) {
if (err.error === 11) {
// error code 11 为用户取消操作不认作失败场景
resolve(false);
}
reject(err);
}
});
})];
});
}); };
exports.chattingSendCard = chattingSendCard;
/**
* 文本风险校验
* @param {string} text 文本
*/
var textRiskIdentification = function (text) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore
if (!my.tb.textRiskIdentification) {
reject({
noSupport: true,
errorMessage: '不支持文本校验'
});
}
// @ts-ignore
my.tb.textRiskIdentification({
data: {
text: text
},
success: function (res) {
if (res.data && res.data.result) {
var suggestion = res.data.result.suggestion;
if (suggestion === 'pass') {
resolve(true);
}
}
resolve(false);
},
fail: function (err) {
reject(err);
},
});
})];
});
}); };
exports.textRiskIdentification = textRiskIdentification;
/**
* 跳转店铺首页
* @param {string} shopId
*/
var navigateToTaobaoPage = function (shopId) {
return new Promise(function (resolve, reject) {
// @ts-ignore
my.tb.navigateToTaobaoPage({
appCode: 'shop',
appParams: {
shopId: String(shopId),
weexShopTab: "shopindexbar",
weexShopSubTab: "shopindex"
},
success: function (res) {
resolve(true);
},
fail: function (res) {
reject(res.error);
}
});
});
};
exports.navigateToTaobaoPage = navigateToTaobaoPage;
//# sourceMappingURL=tbFn.js.map
\ No newline at end of file
{"version":3,"file":"tbFn.js","sourceRoot":"","sources":["../../src/core/tbFn.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAImB;AACnB;;GAEG;AACI,IAAM,cAAc,GAAG,UAAO,IAAS;IAAT,qBAAA,EAAA,SAAS;;;;YACtC,QAAQ,GAAG;gBACb,UAAU,EAAE,MAAM;gBAClB,aAAa,EAAE,MAAM;gBACrB,aAAa,EAAE,MAAM;gBACrB,OAAO,EAAE,EAAE,CAAC,wBAAwB;aACrC,CAAC;YACE,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC9C,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;oBAC/B,aAAa;oBACb,EAAE,CAAC,SAAS,CAAC;wBACb,MAAM,EAAE,mBAAmB;wBAC3B,OAAO,EAAE;4BACC,IAAA,UAAU,GAA4C,KAAK,WAAjD,EAAE,aAAa,GAA6B,KAAK,cAAlC,EAAE,aAAa,GAAc,KAAK,cAAnB,EAAE,OAAO,GAAK,KAAK,QAAV,CAAW;4BACpE,aAAa;4BACb,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,aAAa,EAAE;gCACxB,MAAM,CAAC;oCACL,SAAS,EAAE,IAAI;oCACf,YAAY,EAAE,wBAAwB;iCACvC,CAAC,CAAC;gCACH,OAAO,KAAK,CAAC;6BACd;4BACD,aAAa;4BACb,EAAE,CAAC,EAAE,CAAC,aAAa,CACjB;gCACE,UAAU,YAAA;gCACV,aAAa,eAAA;gCACb,aAAa,e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;gBAC1B,cAAc,EAAC,WAAW;aAC1B;YACD,OAAO,EAAE,UAAC,GAAG;gBACZ,OAAO,CAAC,IAAI,CAAC,CAAA;YACd,CAAC;YACD,IAAI,EAAE,UAAC,GAAG;gBACT,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YAClB,CAAC;SACD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAA;AACH,CAAC,CAAA;AAlBY,QAAA,oBAAoB,wBAkBhC"}
\ No newline at end of file
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
export declare const commonToast: (content: any, duration: number, successCb: any) => string;
/**
* 简易alert
* @param {string} content toast内容
*/
export declare const simpleAlert: (content: any) => void;
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
export declare const getAuthUserInfo: () => Promise<{
nickName: string;
avatar: string;
mixNick: string;
}>;
/**
* 获取系统信息
* @returns {object} 小程序系统信息
*/
export declare const getSystemInfo: () => Promise<{
version: string;
}>;
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export declare const favorShop: (sellerId: any) => Promise<boolean>;
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export declare const checkShopFavoredStatus: (sellerId: any) => Promise<boolean>;
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
export declare const navigateToOutside: (url: any) => boolean;
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export declare const navigateTo: (url: any) => boolean;
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
export declare const redirectTo: (url: any) => boolean;
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
export declare const getServerTime: () => Promise<number>;
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
export declare const collectGoods: (id: any) => Promise<boolean>;
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
export declare const checkGoodsCollectedStatus: (id: any) => Promise<boolean>;
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
export declare const openDetail: (itemId: any) => Promise<boolean>;
/**
* 获取淘宝用户收货地址
*/
export declare const getUserAddress: (opts?: {}) => Promise<{
name: number;
phone: number;
address: number;
}>;
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export declare const chattingSendCard: (requestInfo: any) => Promise<boolean>;
/**
* 分享到群聊卡片
* @param {*} cloud 小程序云
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export declare const textRiskIdentification: (text: any) => Promise<boolean>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.textRiskIdentification = exports.chattingSendCard = exports.getUserAddress = exports.openDetail = exports.checkGoodsCollectedStatus = exports.collectGoods = exports.getServerTime = exports.redirectTo = exports.navigateTo = exports.navigateToOutside = exports.checkShopFavoredStatus = exports.favorShop = exports.getSystemInfo = exports.getAuthUserInfo = exports.simpleAlert = exports.commonToast = void 0;
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
var commonToast = function (content, duration, successCb) {
if (duration === void 0) { duration = 3000; }
return '暂不支持toast';
};
exports.commonToast = commonToast;
/**
* 简易alert
* @param {string} content toast内容
*/
var simpleAlert = function (content) {
alert(content);
};
exports.simpleAlert = simpleAlert;
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
var getAuthUserInfo = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, {
nickName: 'nickName',
avatar: '123',
mixNick: '1234'
}];
});
}); };
exports.getAuthUserInfo = getAuthUserInfo;
/**
* 获取系统信息
* @returns {object} 小程序系统信息
*/
var getSystemInfo = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, {
version: '9.5.0'
}];
});
}); };
exports.getSystemInfo = getSystemInfo;
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
var favorShop = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
if (!sellerId) {
console.error('favorShop: 请传入卖家Id');
return [2 /*return*/, false];
}
return [2 /*return*/, true];
});
}); };
exports.favorShop = favorShop;
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
var checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
if (!sellerId) {
console.error('checkShopFavoredStatus: 请传入卖家Id');
return [2 /*return*/, false];
}
return [2 /*return*/, true];
});
}); };
exports.checkShopFavoredStatus = checkShopFavoredStatus;
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
var navigateToOutside = function (url) {
if (!url) {
console.error('navigateToOutside: 请传入url');
return false;
}
window.location = url;
};
exports.navigateToOutside = navigateToOutside;
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
var navigateTo = function (url) {
if (!url) {
console.error('navigateTo: 请传入url');
return false;
}
window.location = url;
};
exports.navigateTo = navigateTo;
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
var redirectTo = function (url) {
if (!url) {
console.error('redirectTo: 请传入url');
return false;
}
// @ts-ignore
window.replace(url);
};
exports.redirectTo = redirectTo;
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
var getServerTime = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, +new Date()];
});
}); };
exports.getServerTime = getServerTime;
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
var collectGoods = function (id) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
if (!id) {
console.error('collectGoods: 请传入商品id');
return [2 /*return*/, false];
}
return [2 /*return*/, true];
});
}); };
exports.collectGoods = collectGoods;
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
var checkGoodsCollectedStatus = function (id) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
if (!id) {
console.error('checkGoodsCollectedStatus: 请传入商品id');
return [2 /*return*/, false];
}
return [2 /*return*/, true];
});
}); };
exports.checkGoodsCollectedStatus = checkGoodsCollectedStatus;
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
var openDetail = function (itemId) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
if (!itemId) {
console.error('openDetail: 请传入商品id');
return [2 /*return*/, false];
}
// @ts-ignore
window.location = 'https://item.taobao.com/item.htm?id=' + itemId;
return [2 /*return*/];
});
}); };
exports.openDetail = openDetail;
/**
* 获取淘宝用户收货地址
*/
var getUserAddress = function (opts) {
if (opts === void 0) { opts = {}; }
return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, {
name: 1,
phone: 1,
address: 123
}];
});
});
};
exports.getUserAddress = getUserAddress;
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
var chattingSendCard = function (requestInfo) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
alert('无法模拟');
return [2 /*return*/, false];
});
}); };
exports.chattingSendCard = chattingSendCard;
/**
* 分享到群聊卡片
* @param {*} cloud 小程序云
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
var textRiskIdentification = function (text) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, true];
});
}); };
exports.textRiskIdentification = textRiskIdentification;
//# sourceMappingURL=tbMock.js.map
\ No newline at end of file
{"version":3,"file":"tbMock.js","sourceRoot":"","sources":["../../src/core/tbMock.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACI,IAAM,WAAW,GAAG,UAAC,OAAO,EAAE,QAAe,EAAE,SAAS;IAA1B,yBAAA,EAAA,eAAe;IAChD,OAAO,WAAW,CAAC;AAC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MAAM,CAAC;;;KACrE,CAAC;AAPW,QAAA,UAAU,cAOrB;AACF;;GAEG;AACI,IAAM,cAAc,GAAG,UAAO,IAAS;IAAT,qBAAA,EAAA,SAAS;;;YAC1C,sBAAO;oBACH,IAAI,EAAE,CAAC;oBACP,KAAK,EAAE,CAAC;oBACR,OAAO,EAAE,GAAG;iBACf,EAAA;;;CACJ,CAAC;AANW,QAAA,cAAc,kBAMzB;AACF;;;GAGG;AACI,IAAM,gBAAgB,GAAG,UAAO,WAAW;;QAC9C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,sBAAO,KAAK,EAAC;;KAChB,CAAC;AAHW,QAAA,gBAAgB,oBAG3B;AACF;;;;GAIG;AACI,IAAM,sBAAsB,GAAG,UAAO,IAAI;;QAC7C,sBAAO,IAAI,EAAC;;KACf,CAAA;AAFY,QAAA,sBAAsB,0BAElC"}
\ No newline at end of file
/**
* 简易API封装
* @param methodName
* @param params
* @param name
*/
export declare const promisifyApiSimple: (methodName: string, params: IParamJSAPI, name?: string) => void;
/**
* 通用API封装
* @param methodName
* @param params
*/
export declare const promisifyApi: (methodName: string, params?: {}) => Promise<unknown>;
/**
* 通用API封装
* @param methodName
* @param params
*/
export declare const promisifyApiToTb: (methodName: string, params?: {}) => Promise<unknown>;
/**
* 创建音频类
*/
export declare class AudioModel {
constructor(opts: {
src: string;
});
}
/**
* 获取天猫会员状态
*/
export declare const getTmallMemberStatus: () => Promise<any>;
/**
* 拉菲奖品发放
* @param params
*/
export declare const strategyEname: (params: {
channel: string;
strategyCode: string;
code: string;
}) => Promise<any>;
/**
* loading
* @param methodName
* @param params
* @param name
*/
export declare const isLoading: (methodName: string) => void;
/**
* 数据请求
* @param params
* @param loading
*/
export declare const myRequest: (params: any, loading: boolean) => Promise<unknown>;
/**
* 云函数接口请求
* @param _cloudName
* @param handle
* @param params
* @param loading
* @param toastError
*/
export declare const cloudRequest: (cloud: any, _cloudName: string, handle: string, params: any, loading: boolean, toastError: boolean) => Promise<unknown>;
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.cloudRequest = exports.myRequest = exports.isLoading = exports.strategyEname = exports.getTmallMemberStatus = exports.AudioModel = exports.promisifyApiToTb = exports.promisifyApi = exports.promisifyApiSimple = void 0;
var tb_1 = require("../core/tb");
/**
* 简易API封装
* @param methodName
* @param params
* @param name
*/
var promisifyApiSimple = function (methodName, params, name) {
if (name) {
// @ts-ignore
my[methodName](name, params);
return;
}
// @ts-ignore
my[methodName](params);
};
exports.promisifyApiSimple = promisifyApiSimple;
/**
* 通用API封装
* @param methodName
* @param params
*/
var promisifyApi = function (methodName, params) {
if (params === void 0) { params = {}; }
return new Promise(function (resolve, reject) {
// @ts-ignore
my[methodName](__assign(__assign({}, params), { success: function (res) {
resolve(res);
}, fail: function (err) {
reject(err);
} }));
});
};
exports.promisifyApi = promisifyApi;
/**
* 通用API封装
* @param methodName
* @param params
*/
var promisifyApiToTb = function (methodName, params) {
if (params === void 0) { params = {}; }
return new Promise(function (resolve, reject) {
// @ts-ignore
my.tb[methodName](__assign(__assign({}, params), { success: function (res) {
resolve(res);
}, fail: function (err) {
reject(err);
} }));
});
};
exports.promisifyApiToTb = promisifyApiToTb;
/**
* 创建音频类
*/
var AudioModel = /** @class */ (function () {
function AudioModel(opts) {
var src = opts.src;
if (!src) {
console.error('请输入音频链接');
return false;
}
try {
// @ts-ignore
var innerAudioContext_1 = my.createInnerAudioContext();
Object.keys(opts).forEach(function (item) {
innerAudioContext_1[item] = opts[item];
});
return innerAudioContext_1;
}
catch (e) {
console.error('当前版本不支持音频');
}
}
return AudioModel;
}());
exports.AudioModel = AudioModel;
/**
* 获取天猫会员状态
*/
var getTmallMemberStatus = function () { return __awaiter(void 0, void 0, void 0, function () {
var cloud;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
cloud = app.cloud;
return [4 /*yield*/, cloud.topApi.invoke({
api: "tmall.campus.industry.app.audit.query",
data: {
source: "duibajk",
},
}).catch(function (err) {
console.log(err);
})];
case 1: return [2 /*return*/, (_a.sent()) || {}];
}
});
}); };
exports.getTmallMemberStatus = getTmallMemberStatus;
/**
* 拉菲奖品发放
* @param params
*/
var strategyEname = function (params) { return __awaiter(void 0, void 0, void 0, function () {
var cloud;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
cloud = app.cloud;
return [4 /*yield*/, cloud.topApi.invoke({
api: "alibaba.latour.strategy.issue",
data: {
channel: params.channel || "",
strategy_code: params.strategyCode || "",
selected_benefit_code: params.code || "",
},
}).catch(function (err) {
console.log("err", err);
})];
case 1: return [2 /*return*/, (_a.sent()) || {}];
}
});
}); };
exports.strategyEname = strategyEname;
/**
* loading
* @param methodName
* @param params
* @param name
*/
var isLoading = function (methodName) {
// @ts-ignore
my[methodName]();
};
exports.isLoading = isLoading;
/**
* 数据请求
* @param params
* @param loading
*/
var myRequest = function (params, loading) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore
my.request(params).then(function (_a) {
var res = _a.data;
console.log("\u8C03\u7528mock\u63A5\u53E3\u8FD4\u56DE\u7ED3\u679C", res);
loading && exports.isLoading('hideLoading');
if (res && !res.success) {
tb_1.commonToast(res.message || '系统错误');
}
resolve(res);
return res;
}).catch(function (e) {
loading && exports.isLoading('hideLoading');
console.log(e);
reject();
});
})];
});
}); };
exports.myRequest = myRequest;
/**
* 云函数接口请求
* @param _cloudName
* @param handle
* @param params
* @param loading
* @param toastError
*/
var cloudRequest = function (cloud, _cloudName, handle, params, loading, toastError) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore
loading && exports.isLoading('showLoading');
cloud.function.invoke(_cloudName, params, handle).then(function (res) {
console.log("%c" + handle + " \u53C2\u6570 ----->", 'color: #43bb88;font-size: 12px;', params);
console.log("%c" + handle + " \u8FD4\u56DE\u503C ----->", 'color: #43bb88;font-size: 12px;', res);
loading && exports.isLoading('hideLoading');
if (res && !res.success && toastError) {
tb_1.commonToast(res.message || '系统错误');
}
resolve(res);
return res;
}).catch(function (err) {
console.log(handle + " catch ----->", params, err);
loading && exports.isLoading('hideLoading');
reject();
});
})];
});
}); };
exports.cloudRequest = cloudRequest;
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAwC;AACxC;;;;;GAKG;AACI,IAAM,kBAAkB,GAAG,UAAC,UAAkB,EAAE,MAAmB,EAAE,IAAa;IACrF,IAAG,IAAI,EAAE;QACL,aAAa;QACb,EAAE,CAAC,UAAU,CAAC,CAAC,IAAI,EAAC,MAAM,CAAC,CAAC;QAC5B,OAAO;KACV;IACD,aAAa;IACb,EAAE,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAA;AARY,QAAA,kBAAkB,sBAQ9B;AACD;;;;GAIG;AACI,IAAM,YAAY,GAAI,UAAC,UAAkB,EAAE,MAAW;IAAX,uBAAA,EAAA,WAAW;IAC5D,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QAC5B,aAAa;QACnB,EAAE,CAAC,UAAU,CAAC,uBACV,MAAM,KACT,OAAO,EAAE,UAAA,GAAG;gBACX,OAAO,CAAC,GAAG,CAAC,CAAA;YACb,CAAC,EACD,IAAI,EAAE,UAAA,GAAG;gBACR,MAAM,CAAC,GAAG,CAAC,CAAA;YACZ,CAAC,IACA,CAAA;IACH,CAAC,CAAC,CAAA;AACH,CAAC,CAAA;AAbY,QAAA,YAAY,gBAaxB;AACD;;;;GAIG;AACI,IAAM,gBAAgB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GAAG,CAAA;gBACZ,CAAC,CAAC,CAAC,KAAK,CAAC,UAAC,GAAQ;oBAChB,OAAO,CAAC,GAAG,CAAI,MAAM,kBAAe,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;oBAClD,OAAO,IAAI,iBAAS,CAAC,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
/**
* 加密
* @param data
*/
export declare const md5: (data: any) => any;
/**
* my.request请求接口
* @param params
* @param res
* @param loading
* @param tornadoAPI
*/
export declare const tornadoAPICb: (params: any, res: any, loading: boolean, tornadoAPI: string) => Promise<unknown>;
/**
* 请求风池台接口数据
* @param tornadoAPI
* @param nickName
* @param handle
* @param loading
* @param params
*/
export declare const tornadoAPIFn: (tornadoAPI: string, nickName: string, handle: string, loading: boolean, params: any) => Promise<unknown>;
/**
* 请求mock数据
* @param reqConfig
* @param initConfig
* @param params
*/
export declare const requestMock: (reqConfig: IReqConfig, initConfig: IInitConfig, params: any) => Promise<unknown>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.requestMock = exports.tornadoAPIFn = exports.tornadoAPICb = exports.md5 = void 0;
var tbFn_1 = require("../core/tbFn");
var tb_1 = require("../core/tb");
var index_1 = require("./index");
var Buffer = require("buffer").Buffer;
var crypto = require("crypto");
/**
* 加密
* @param data
*/
var md5 = function (data) {
var buf = new Buffer(data);
var str = buf.toString("binary");
return crypto.createHash("md5").update(str).digest("hex").slice(0, 30);
};
exports.md5 = md5;
/**
* my.request请求接口
* @param params
* @param res
* @param loading
* @param tornadoAPI
*/
var tornadoAPICb = function (params, res, loading, tornadoAPI) { return __awaiter(void 0, void 0, void 0, function () {
var nickName, params_;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
nickName = res.nickName;
params.openId = exports.md5(nickName);
params_ = {
url: tornadoAPI,
method: 'post',
data: params,
dataType: 'json'
};
return [4 /*yield*/, index_1.myRequest(params_, loading)];
case 1: return [2 /*return*/, _a.sent()];
}
});
}); };
exports.tornadoAPICb = tornadoAPICb;
/**
* 请求风池台接口数据
* @param tornadoAPI
* @param nickName
* @param handle
* @param loading
* @param params
*/
var tornadoAPIFn = function (tornadoAPI, nickName, handle, loading, params) { return __awaiter(void 0, void 0, void 0, function () {
var matchRes, db, proxyIp, data_, params_;
return __generator(this, function (_a) {
matchRes = tornadoAPI.match(/db=(\w*)&proxyIp=([\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})/);
db = matchRes[1];
proxyIp = matchRes[2];
data_ = {
handler: handle,
data: params
};
console.log("data_", data_);
params_ = {
db: db,
proxyIp: proxyIp,
data: data_
};
if (!db || !proxyIp) {
tb_1.commonConfirm('风驰台地址错误', '请确认风驰台的地址是否正确,未查找到db和proxyIp');
return [2 /*return*/, false];
}
// nickName 转 md5 作为唯一的openId
if (!nickName) {
return [2 /*return*/, tbFn_1.getAuthUserInfo().catch(function (err) {
console.log('未授权成功', err);
}).then(function (res) {
return exports.tornadoAPICb(params_, res, loading, tornadoAPI);
})];
}
return [2 /*return*/];
});
}); };
exports.tornadoAPIFn = tornadoAPIFn;
/**
* 请求mock数据
* @param reqConfig
* @param initConfig
* @param params
*/
var requestMock = function (reqConfig, initConfig, params) { return __awaiter(void 0, void 0, void 0, function () {
var cloudName, handle, method, isShowLoading, requestType, tornadoAPI, nickName, mockUrlPrefix, mockUrl, requestPrefix, params_;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
cloudName = reqConfig.cloudName, handle = reqConfig.handle, method = reqConfig.method, isShowLoading = reqConfig.isShowLoading;
requestType = initConfig.requestType, tornadoAPI = initConfig.tornadoAPI, nickName = initConfig.nickName, mockUrlPrefix = initConfig.mockUrlPrefix, mockUrl = initConfig.mockUrl;
if (!(requestType === 'tornadoAPI')) return [3 /*break*/, 2];
return [4 /*yield*/, exports.tornadoAPIFn(tornadoAPI, nickName, handle, isShowLoading, params)];
case 1: return [2 /*return*/, _a.sent()];
case 2:
requestPrefix = mockUrl || mockUrlPrefix[requestType];
params_ = {
url: requestPrefix + cloudName + '.' + handle,
method: 'get',
data: params,
dataType: 'json'
};
return [4 /*yield*/, index_1.myRequest(params_, isShowLoading)];
case 3: return [2 /*return*/, _a.sent()];
}
});
}); };
exports.requestMock = requestMock;
//# sourceMappingURL=requestFn.js.map
\ No newline at end of file
{"version":3,"file":"requestFn.js","sourceRoot":"","sources":["../../src/helpers/requestFn.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA+C;AAC/C,iCAA0C;AAC1C,iCAAmC;AACnC,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAA;AACvC,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAChC;;;GAGG;AACI,IAAM,GAAG,GAAG,UAAC,IAAS;IACzB,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAA;AAJY,QAAA,GAAG,OAIf;AACD;;;;;;GAMG;AACI,IAAM,YAAY,GAAG,UAAO,MAAW,EAAE,GAAQ,EAAE,OAAgB,EAAE,UAAkB;;;;;gBAClF,QAAQ,GAAK,GAAG,SAAR,CAAQ;gBACxB,MAAM,CAAC,MAAM,GAAG,WAAG,CAAC,QAAQ,CAAC,CAAA;gBACvB,OAAO,GAAG;oBACZ,GAAG,EAAE,UAAU;oBACf,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,MAAM;iBACnB,CAAA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C,EAAE,MAAM,GAA4B,SAAS,OAArC,EAAE,MAAM,GAAoB,SAAS,OAA7B,EAAE,aAAa,GAAK,SAAS,cAAd,CAAc;gBACtD,WAAW,GAAmD,UAAU,YAA7D,EAAE,UAAU,GAAuC,UAAU,WAAjD,EAAE,QAAQ,GAA6B,UAAU,SAAvC,EAAE,aAAa,GAAc,UAAU,cAAxB,EAAE,OAAO,GAAK,UAAU,QAAf,CAAe;qBAE5E,CAAA,WAAW,KAAK,YAAY,CAAA,EAA5B,wBAA4B;gBACrB,qBAAM,oBAAY,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,EAAA;oBAA9E,sBAAO,SAAuE,EAAA;;gBAE5E,aAAa,GAAG,OAAO,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;gBACtD,OAAO,GAAG;oBACZ,GAAG,EAAE,aAAa,GAAG,SAAS,GAAG,GAAG,GAAG,MAAM;oBAC7C,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,MAAM;iBACnB,CAAA;gBACM,qBAAM,iBAAS,CAAC,OAAO,EAAE,aAAa,CAAC,EAAA;oBAA9C,sBAAO,SAAuC,EAAA;;;KACjD,CAAA;AAfY,QAAA,WAAW,eAevB"}
\ No newline at end of file
import * as utils from './utils';
import * as constants from './constants';
declare const _default: {
capi: {
getMyPrizeList: {
method: string;
handle: string;
isShowLoading: boolean;
};
receiveObjectPrize: {
method: string;
handle: string;
};
receiveEnamePrize: {
method: string;
handle: string;
};
getItemListByItemIds: {
method: string;
handle: string;
};
getCollectGoodsList: {
method: string;
handle: string;
};
doCompleteTask: {
method: string;
handle: string;
};
getVipInfo: {
method: string;
handle: string;
};
};
capiFn: (apiList: any, request: any) => {
receiveObjectPrize(params: any): Promise<boolean>;
getVipInfo(params: any): Promise<any>;
receiveEnamePrize(params: any): Promise<boolean>;
addStat(type: string | number): Promise<boolean>;
};
tb: {};
utils: typeof utils;
request: (header: IRequest) => false | ((handle: any, method: string, params: any, ext?: {
cloudName?: string;
isShowLoading?: boolean;
toastError?: boolean;
}) => Promise<unknown>);
constants: typeof constants;
};
export default _default;
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var tb = require("./core/tb");
var tbFn = require("./core/tbFn");
var utils = require("./utils");
var constants = require("./constants");
var capi_1 = require("./request/capi");
var capiFn_1 = require("./request/capiFn");
var request_1 = require("./request");
var _tb = {};
Object.entries(__assign(__assign({}, tb), tbFn)).forEach(function (_a) {
var key = _a[0], value = _a[1];
_tb[key] = value;
});
exports.default = {
capi: capi_1.default,
capiFn: capiFn_1.default,
tb: _tb,
utils: utils,
request: request_1.default,
constants: constants
};
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,8BAAgC;AAChC,kCAAoC;AAEpC,+BAAiC;AACjC,uCAAyC;AACzC,uCAAkC;AAClC,2CAAsC;AACtC,qCAAgC;AAEhC,IAAI,GAAG,GAAG,EAAE,CAAC;AACb,MAAM,CAAC,OAAO,uBAAM,EAAE,GAAK,IAAI,EAAG,CAAC,OAAO,CAAC,UAAC,EAAY;QAAX,GAAG,QAAA,EAAE,KAAK,QAAA;IACrD,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACnB,CAAC,CAAC,CAAC;AACH,kBAAe;IACb,IAAI,gBAAA;IACJ,MAAM,kBAAA;IACN,EAAE,EAAE,GAAG;IACP,KAAK,OAAA;IACL,OAAO,mBAAA;IACP,SAAS,WAAA;CACV,CAAA"}
\ No newline at end of file
declare const capi: {
getMyPrizeList: {
method: string;
handle: string;
isShowLoading: boolean;
};
receiveObjectPrize: {
method: string;
handle: string;
};
receiveEnamePrize: {
method: string;
handle: string;
};
getItemListByItemIds: {
method: string;
handle: string;
};
getCollectGoodsList: {
method: string;
handle: string;
};
doCompleteTask: {
method: string;
handle: string;
};
getVipInfo: {
method: string;
handle: string;
};
};
export default capi;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var capi = {
getMyPrizeList: {
method: 'GET',
handle: 'getMyPrizeList',
isShowLoading: false
},
receiveObjectPrize: { method: 'GET', handle: 'receiveObjectPrize' },
receiveEnamePrize: { method: 'GET', handle: 'receiveEnamePrize' },
getItemListByItemIds: { method: 'GET', handle: 'getItemListByItemIds' },
getCollectGoodsList: { method: 'GET', handle: 'getCollectGoodsList' },
doCompleteTask: { method: 'GET', handle: 'doCompleteTask' },
getVipInfo: { method: 'GET', handle: 'getVipInfo' }
};
exports.default = capi;
//# sourceMappingURL=capi.js.map
\ No newline at end of file
{"version":3,"file":"capi.js","sourceRoot":"","sources":["../../src/request/capi.ts"],"names":[],"mappings":";;AAAA,IAAM,IAAI,GAAG;IACT,cAAc,EAAE;QACd,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,gBAAgB;QACxB,aAAa,EAAE,KAAK;KACrB;IACD,kBAAkB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE;IACnE,iBAAiB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE;IACjE,oBAAoB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE;IACvE,mBAAmB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE;IACrE,cAAc,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAC3D,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE;CACpD,CAAC;AAEF,kBAAe,IAAI,CAAC"}
\ No newline at end of file
declare const capiFn: (apiList: any, request: any) => {
receiveObjectPrize(params: any): Promise<boolean>;
getVipInfo(params: any): Promise<any>;
receiveEnamePrize(params: any): Promise<boolean>;
addStat(type: number | string): Promise<boolean>;
};
export default capiFn;
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var tb_1 = require("../core/tb");
var tbFn_1 = require("../core/tbFn");
var utils_1 = require("../utils");
// 通用API封装方法
var capiFn = function (apiList, request) {
return {
receiveObjectPrize: function (params) {
return __awaiter(this, void 0, void 0, function () {
var _a, handle, method, ext, userAddress, _b, name, telNumber, provinceName, cityName, cityCode, countyName, detailInfo, streetName;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_a = utils_1.getRequestParams(apiList['receiveObjectPrize']), handle = _a.handle, method = _a.method, ext = _a.ext;
return [4 /*yield*/, tbFn_1.getUserAddress().catch(function (err) {
tb_1.commonToast(err.errorMessage);
})];
case 1:
userAddress = _c.sent();
if (!userAddress)
return [2 /*return*/, false];
_b = userAddress || {}, name = _b.name, telNumber = _b.telNumber, provinceName = _b.provinceName, cityName = _b.cityName, cityCode = _b.cityCode, countyName = _b.countyName, detailInfo = _b.detailInfo, streetName = _b.streetName;
params = __assign({ name: name, phone: telNumber, addressDetail: detailInfo, cityCode: cityCode, city: cityName, province: provinceName, area: countyName, streetName: streetName }, params);
return [4 /*yield*/, tb_1.commonConfirm('提示', '确认使用该收货地址:' + name + telNumber + userAddress.duibaAddress.address, function () {
return __awaiter(this, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, request(handle, method, params, ext).catch(function (res) {
tb_1.commonToast(res && res.message);
})];
case 1:
result = _a.sent();
if (result && result.success) {
return [2 /*return*/, true];
}
return [2 /*return*/];
}
});
});
})];
case 2:
_c.sent();
return [2 /*return*/, false];
}
});
});
},
getVipInfo: function (params) {
return __awaiter(this, void 0, void 0, function () {
var _a, handle, method, ext, result, isVip;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = utils_1.getRequestParams(apiList['getVipInfo']), handle = _a.handle, method = _a.method, ext = _a.ext;
return [4 /*yield*/, request(handle, method, params, ext).catch(function (res) {
tb_1.commonToast(res && res.message);
})];
case 1:
result = _b.sent();
if (result && result.success) {
isVip = result.data.isVip;
return [2 /*return*/, isVip];
}
return [2 /*return*/, false];
}
});
});
},
receiveEnamePrize: function (params) {
return __awaiter(this, void 0, void 0, function () {
var _a, handle, method, ext, result;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = utils_1.getRequestParams(apiList['receiveEnamePrize']), handle = _a.handle, method = _a.method, ext = _a.ext;
return [4 /*yield*/, request(handle, method, params, ext).catch(function (res) {
tb_1.commonToast(res && res.message);
})];
case 1:
result = _b.sent();
if (result && result.success) {
return [2 /*return*/, true];
}
return [2 /*return*/, false];
}
});
});
},
addStat: function (type) {
return __awaiter(this, void 0, void 0, function () {
var _a, handle, method, ext, result;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = utils_1.getRequestParams(apiList['addStat']), handle = _a.handle, method = _a.method, ext = _a.ext;
return [4 /*yield*/, request(handle, method, {
type: type
}, ext).catch(function (res) {
tb_1.commonToast(res && res.message);
})];
case 1:
result = _b.sent();
if (result && result.success) {
return [2 /*return*/, true];
}
return [2 /*return*/, false];
}
});
});
},
};
};
exports.default = capiFn;
//# sourceMappingURL=capiFn.js.map
\ No newline at end of file
{"version":3,"file":"capiFn.js","sourceRoot":"","sources":["../../src/request/capiFn.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAwD;AACxD,qCAA8C;AAC9C,kCAA4C;AAE5C,YAAY;AACZ,IAAM,MAAM,GAAG,UA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,YAAA,EAAE,GAAG,SAAA,CAA0C;4BACtD,qBAAM,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE;oCAC3C,IAAI,MAAA;iCACL,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,UAAA,GAAG;oCACf,gBAAW,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;gCAClC,CAAC,CAAC,EAAA;;4BAJI,MAAM,GAAG,SAIb;4BACF,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;gCAC5B,sBAAO,IAAI,EAAC;6BACb;4BACD,sBAAO,KAAK,EAAC;;;;SACd;KACF,CAAA;AACH,CAAC,CAAC;AAEF,kBAAe,MAAM,CAAC"}
\ No newline at end of file
/**
* 接口请求封装
* @param { cloud, cloudName, requestType, mockUrl }
*/
declare const request: (header: IRequest) => false | ((handle: any, method: string, params: any, ext?: {
cloudName?: string;
isShowLoading?: boolean;
toastError?: boolean;
}) => Promise<unknown>);
export default request;
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var requestFn_1 = require("../helpers/requestFn");
var helpers_1 = require("../helpers");
/**
* 接口请求封装
* @param { cloud, cloudName, requestType, mockUrl }
*/
var request = function (header) {
var cloud = header.cloud, cloudName = header.cloudName, _a = header.requestType, requestType = _a === void 0 ? 'cloud' : _a, mockUrl = header.mockUrl;
if (!cloud) {
console.error('请传入cloud');
return false;
}
if (!cloudName) {
console.error('请传入云函数名称');
return false;
}
return function (handle, method, params, ext) {
if (method === void 0) { method = 'POST'; }
return __awaiter(void 0, void 0, void 0, function () {
var _a, activityId, tornadoAPI, _b, nickName, _cloudName, _c, isShowLoading, _d, toastError, mockUrlPrefix, reqConfig, initConfig, params_;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
_a = getApp(), activityId = _a.activityId, tornadoAPI = _a.tornadoAPI, _b = _a.nickName, nickName = _b === void 0 ? '' : _b;
_cloudName = ext.cloudName || cloudName;
_c = ext.isShowLoading, isShowLoading = _c === void 0 ? false : _c, _d = ext.toastError, toastError = _d === void 0 ? true : _d;
mockUrlPrefix = {
ams: 'https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri=',
yapi: 'https://docs.dui88.com/mock/140/'
};
reqConfig = { cloudName: _cloudName, handle: handle, method: method, isShowLoading: isShowLoading };
initConfig = { requestType: requestType, tornadoAPI: tornadoAPI, nickName: nickName, mockUrlPrefix: mockUrlPrefix, mockUrl: mockUrl };
params_ = __assign({ activityId: activityId }, params);
if (!['ams', 'yapi', 'tornadoAPI'].includes(requestType)) return [3 /*break*/, 2];
return [4 /*yield*/, requestFn_1.requestMock(reqConfig, initConfig, params_)];
case 1: return [2 /*return*/, _e.sent()];
case 2: return [4 /*yield*/, helpers_1.cloudRequest(cloud, _cloudName, handle, params_, isShowLoading, toastError)];
case 3: return [2 /*return*/, _e.sent()];
}
});
});
};
};
exports.default = request;
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAmD;AACnD,sCAA0C;AAC1C;;;GAGG;AACH,IAAM,OAAO,GAAG,UAAC,MAAe;IACpB,IAAA,KAAK,GAAgD,MAAM,MAAtD,EAAE,SAAS,GAAqC,MAAM,UAA3C,EAAE,KAAmC,MAAM,YAApB,EAArB,WAAW,mBAAG,OAAO,KAAA,EAAE,OAAO,GAAK,MAAM,QAAX,CAAW;IACnE,IAAI,CAAC,KAAK,EAAE;QACR,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;KAChB;IACD,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,CAAC,KAAK,CA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化
* @param date 接收可以被new Date()方法转换的内容
* @param format 字符串,需要的格式例如:'yyyy/MM/dd hh:mm:ss'
* @returns {String}
*/
export declare const dateFormatter: (dateTxt: string, format?: string) => string;
/**
* 版本比较
* @param {string} cur 当前版本
* @param {string} compare 比较版本
*/
export declare const versionCompare: (cur: string, compare: string) => boolean;
/**
* 获取request请求所需参数
* @param {object/string} value API项配置
*/
export declare const getRequestParams: (value: any) => {
handle: string;
method: string;
ext: {};
defaultParams?: undefined;
} | {
handle: any;
method: any;
defaultParams: any;
ext: any;
};
declare type IApis<T> = {
[P in keyof T]: (params?: object, config?: {
isShowLoading?: boolean;
toastError?: boolean;
}) => {};
};
/**
* 生成API
* @param {array} apiList API数据数组
* @param {function} request 请求
*/
export declare const generateAPI: <T, K extends Function>(apiList: T, request: K) => IApis<T>;
/**
* 函数节流,普通防连点
* @param {fun} fun 函数
* @param {delay} delay 时间
*/
export declare const throttleHandle: (fun: (t: any) => any, delay?: number) => () => void;
/**
* 根据fileId获取图片地址
* @param fileId
*/
export declare const getImgShareUrl: (fileId: string | Array<string>) => Promise<any>;
/**
* 根据sellerId判断入会状态
* @param sellerId
*/
export declare const checkIsMember: (sellerId: number) => Promise<unknown>;
/**
* 毫秒转换成00:00:00格式
* @param ms 毫秒
*/
export declare const formatTimeStamp: (ms: number) => string;
/**
* 活动状态验证
* @param startTime
* @param endTime
* @param noCheck
*/
export declare const validateActivityStatus: (startTime: number, endTime: number, noCheck: boolean) => Promise<unknown>;
export {};
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateActivityStatus = exports.formatTimeStamp = exports.checkIsMember = exports.getImgShareUrl = exports.throttleHandle = exports.generateAPI = exports.getRequestParams = exports.versionCompare = exports.dateFormatter = void 0;
var tb_1 = require("../core/tb");
/**
* 时间格式化
* @param date 接收可以被new Date()方法转换的内容
* @param format 字符串,需要的格式例如:'yyyy/MM/dd hh:mm:ss'
* @returns {String}
*/
var dateFormatter = function (dateTxt, format) {
if (format === void 0) { format = 'yyyy/MM/dd'; }
if (!dateTxt)
return '-';
var date = new Date(typeof dateTxt === 'string' && isNaN(+dateTxt) ? dateTxt.replace(/-/g, '/') : dateTxt);
var o = {
'M+': date.getMonth() + 1,
'd+': date.getDate(),
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds(),
'q+': Math.floor((date.getMonth() + 3) / 3),
S: date.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
}
for (var k in o) {
if (new RegExp('(' + k + ')').test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
}
}
return format;
};
exports.dateFormatter = dateFormatter;
/**
* 版本比较
* @param {string} cur 当前版本
* @param {string} compare 比较版本
*/
var versionCompare = function (cur, compare) {
var _cur = cur.split('.');
var _compare = compare.split('.');
if (+_cur[0] < +_compare[0]) {
return false;
}
else if (+_cur[0] === +_compare[0] && +_cur[1] < +_compare[1]) {
return false;
}
else if (+_cur[0] === +_compare[0] && +_cur[1] === +_compare[1] && +_cur[2] < +_compare[2]) {
return false;
}
return true;
};
exports.versionCompare = versionCompare;
/**
* 获取request请求所需参数
* @param {object/string} value API项配置
*/
var getRequestParams = function (value) {
if (typeof value === 'string') {
return {
handle: value,
method: 'POST',
ext: {}
};
}
else if (typeof value === 'object') {
var handle = value.handle, _a = value.method, method = _a === void 0 ? 'POST' : _a, _b = value.defaultParams, defaultParams = _b === void 0 ? {} : _b, ext = __rest(value, ["handle", "method", "defaultParams"]);
return {
handle: handle,
method: method,
defaultParams: defaultParams,
ext: __assign({}, ext)
};
}
else {
console.error('getRequestParams: 传参有误');
}
};
exports.getRequestParams = getRequestParams;
/**
* 生成API
* @param {array} apiList API数据数组
* @param {function} request 请求
*/
var generateAPI = function (apiList, request) {
// @ts-ignore
var api = {};
Object.entries(apiList).forEach(function (_a) {
var key = _a[0], value = _a[1];
var _b = exports.getRequestParams(value), handle = _b.handle, method = _b.method, ext = _b.ext, defaultParams = _b.defaultParams;
api[key] = function (params, config) {
if (config === void 0) { config = {}; }
return request(handle, method, Object.assign({}, defaultParams, params), Object.assign({}, ext, config));
};
});
return api;
// return Object.keys(apiList).reduce((prev, curr) => {
// const { handle, method, ext, defaultParams } = getRequestParams(apiList[curr]);
// return {
// ...prev,
// [curr]: params => request(handle, method, Object.assign({}, defaultParams, params) , ext)
// }
// }, {})
};
exports.generateAPI = generateAPI;
/**
* 函数节流,普通防连点
* @param {fun} fun 函数
* @param {delay} delay 时间
*/
var throttleHandle = function (fun, delay) {
if (delay === void 0) { delay = 1000; }
var last, deferTimer;
return function () {
var now = +new Date();
if (last && now < last + delay) {
clearTimeout(deferTimer);
deferTimer = setTimeout(function () {
last = now;
}, delay);
}
else {
last = now;
fun.apply(this, arguments);
}
};
};
exports.throttleHandle = throttleHandle;
/**
* 根据fileId获取图片地址
* @param fileId
*/
var getImgShareUrl = function (fileId) { return __awaiter(void 0, void 0, void 0, function () {
var cloud, list;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
cloud = getApp().cloud;
return [4 /*yield*/, cloud.file.getTempFileURL({ fileId: fileId })];
case 1:
list = _a.sent();
if (typeof fileId === 'string')
return [2 /*return*/, list && list[0].url];
return [2 /*return*/, list];
}
});
}); };
exports.getImgShareUrl = getImgShareUrl;
/**
* 根据sellerId判断入会状态
* @param sellerId
*/
var checkIsMember = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () {
var memberPlugin;
return __generator(this, function (_a) {
memberPlugin = requirePlugin("cemMember");
return [2 /*return*/, new Promise(function (resolve, reject) {
memberPlugin.checkMember({
sellerId: sellerId,
success: function (res) {
var _a;
console.log('会员检查成功 :>> ', res);
var isMember = (res === null || res === void 0 ? void 0 : res.businessSuccess) && ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.isMember) === 'true';
resolve(isMember);
},
fail: function (res) {
console.log('会员检查失败 :>> ', res);
console.warn('checkMember 需在真机上调试');
reject(res);
}
});
})];
});
}); };
exports.checkIsMember = checkIsMember;
/**
* 毫秒转换成00:00:00格式
* @param ms 毫秒
*/
var formatTimeStamp = function (ms) {
var hours = parseInt(String(ms / (1000 * 60 * 60))), minutes = parseInt(String((ms % (1000 * 60 * 60)) / (1000 * 60))), seconds = parseInt(String((ms % (1000 * 60)) / 1000));
hours = hours < 10 ? '0' + hours : hours;
minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds;
return hours + ":" + minutes + ":" + seconds;
};
exports.formatTimeStamp = formatTimeStamp;
/**
* 活动状态验证
* @param startTime
* @param endTime
* @param noCheck
*/
var validateActivityStatus = function (startTime, endTime, noCheck) { return __awaiter(void 0, void 0, void 0, function () {
var nowTime;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, tb_1.getServerTime()];
case 1:
nowTime = _a.sent();
return [2 /*return*/, new Promise(function (resolve, reject) {
if (nowTime < startTime) {
tb_1.commonToast('活动未开始');
resolve(false);
}
else if (nowTime > endTime && !noCheck) {
tb_1.commonToast('活动已结束');
resolve(false);
}
else {
resolve(true);
}
})];
}
});
}); };
exports.validateActivityStatus = validateActivityStatus;
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index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G,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IACzC,OAAO,GAAG,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACjD,OAAO,GAAG,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACjD,OAAU,KAAK,SAAI,OAAO,SAAI,OAAS,CAAA;AAC3C,CAAC,CAAA;AARY,QAAA,eAAe,mBAQ3B;AACD;;;;;GAKG;AACI,IAAM,sBAAsB,GAAG,UAAO,SAAiB,EAAE,OAAe,EAAE,OAAgB;;;;oBAC/E,qBAAM,kBAAa,EAAE,EAAA;;gBAA/B,OAAO,GAAG,SAAqB;gBACrC,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAC,MAAM;wBAChC,IAAG,OAAO,GAAG,SAAS,EAAG;4BACvB,gBAAW,CAAC,OAAO,CAAC,CAAA;4BACpB,OAAO,CAAC,KAAK,CAAC,CAAA;yBACf;6BACI,IAAG,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE;4BACrC,gBAAW,CAAC,OAAO,CAAC,CAAA;4BACpB,OAAO,CAAC,KAAK,CAAC,CAAA;yBACf;6BACI;4BACH,OAAO,CAAC,IAAI,CAAC,CAAA;yBACd;oBACH,CAAC,CAAC,EAAA;;;KACH,CAAA;AAfY,QAAA,sBAAsB,0BAelC"}
\ No newline at end of file
{
"name": "tbcc-sdk-ts",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.12.13",
"resolved": "http://npm.dui88.com:80/@babel%2fcode-frame/-/code-frame-7.12.13.tgz",
"integrity": "sha1-3PyCa+72XnXFDiHTg319lXmN1lg=",
"optional": true,
"requires": {
"@babel/highlight": "^7.12.13"
}
},
"@babel/helper-validator-identifier": {
"version": "7.12.11",
"resolved": "http://npm.dui88.com:80/@babel%2fhelper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz",
"integrity": "sha1-yaHwIZF9y1zPDU5FPjmQIpgfye0=",
"optional": true
},
"@babel/highlight": {
"version": "7.13.8",
"resolved": "http://npm.dui88.com:80/@babel%2fhighlight/-/highlight-7.13.8.tgz",
"integrity": "sha1-ELLax4UmQk38H0dlDQ5BXf2dxIE=",
"optional": true,
"requires": {
"@babel/helper-validator-identifier": "^7.12.11",
"chalk": "^2.0.0",
"js-tokens": "^4.0.0"
},
"dependencies": {
"chalk": {
"version": "2.4.2",
"resolved": "http://npm.dui88.com:80/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ=",
"optional": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
}
}
},
"@eslint/eslintrc": {
"version": "0.3.0",
"resolved": "http://npm.dui88.com:80/@eslint%2feslintrc/-/eslintrc-0.3.0.tgz",
"integrity": "sha1-1zbWlj1wA7ZRTmMkvsnGAqw0Axg=",
"optional": true,
"requires": {
"ajv": "^6.12.4",
"debug": "^4.1.1",
"espree": "^7.3.0",
"globals": "^12.1.0",
"ignore": "^4.0.6",
"import-fresh": "^3.2.1",
"js-yaml": "^3.13.1",
"lodash": "^4.17.20",
"minimatch": "^3.0.4",
"strip-json-comments": "^3.1.1"
}
},
"@types/eslint-visitor-keys": {
"version": "1.0.0",
"resolved": "http://npm.dui88.com:80/@types%2feslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
"integrity": "sha1-HuMNeVRMqE1o1LPNsK9PIFZj3S0=",
"optional": true
},
"@types/json-schema": {
"version": "7.0.7",
"resolved": "http://npm.dui88.com:80/@types%2fjson-schema/-/json-schema-7.0.7.tgz",
"integrity": "sha1-mKmTUWyFnrDVxMjwmDF6nqaNua0=",
"optional": true
},
"@types/lodash": {
"version": "4.14.168",
"resolved": "http://npm.dui88.com:80/@types%2flodash/-/lodash-4.14.168.tgz",
"integrity": "sha1-/iRjLnm3rePxMoka//hsql5c4Ag=",
"optional": true
},
"@types/node": {
"version": "14.14.25",
"resolved": "http://npm.dui88.com:80/@types%2fnode/-/node-14.14.25.tgz",
"integrity": "sha1-FZZ6e1d/+BOD+biIqmcF1D+7rpM=",
"optional": true
},
"@typescript-eslint/eslint-plugin": {
"version": "3.10.1",
"resolved": "http://npm.dui88.com:80/@typescript-eslint%2feslint-plugin/-/eslint-plugin-3.10.1.tgz",
"integrity": "sha1-fgYTOKE4P1ntwgTGBYmfk9wuLI8=",
"optional": true,
"requires": {
"@typescript-eslint/experimental-utils": "3.10.1",
"debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
}
},
"@typescript-eslint/experimental-utils": {
"version": "3.10.1",
"resolved": "http://npm.dui88.com:80/@typescript-eslint%2fexperimental-utils/-/experimental-utils-3.10.1.tgz",
"integrity": "sha1-4Xn/yBqA68ri6gTgMy+LJRNFpoY=",
"optional": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/types": "3.10.1",
"@typescript-eslint/typescript-estree": "3.10.1",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
}
},
"@typescript-eslint/parser": {
"version": "3.10.1",
"resolved": "http://npm.dui88.com:80/@typescript-eslint%2fparser/-/parser-3.10.1.tgz",
"integrity": "sha1-GIOFjoPotEJifhrG9AiSUhEVVGc=",
"optional": true,
"requires": {
"@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "3.10.1",
"@typescript-eslint/types": "3.10.1",
"@typescript-eslint/typescript-estree": "3.10.1",
"eslint-visitor-keys": "^1.1.0"
}
},
"@typescript-eslint/types": {
"version": "3.10.1",
"resolved": "http://npm.dui88.com:80/@typescript-eslint%2ftypes/-/types-3.10.1.tgz",
"integrity": "sha1-HXRj+nwy2KI6tQioA8ov4m51hyc=",
"optional": true
},
"@typescript-eslint/typescript-estree": {
"version": "3.10.1",
"resolved": "http://npm.dui88.com:80/@typescript-eslint%2ftypescript-estree/-/typescript-estree-3.10.1.tgz",
"integrity": "sha1-/QBhzDit1PrUUTbWVECFafNluFM=",
"optional": true,
"requires": {
"@typescript-eslint/types": "3.10.1",
"@typescript-eslint/visitor-keys": "3.10.1",
"debug": "^4.1.1",
"glob": "^7.1.6",
"is-glob": "^4.0.1",
"lodash": "^4.17.15",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
}
},
"@typescript-eslint/visitor-keys": {
"version": "3.10.1",
"resolved": "http://npm.dui88.com:80/@typescript-eslint%2fvisitor-keys/-/visitor-keys-3.10.1.tgz",
"integrity": "sha1-zUJ0dz4+tjsuhwrGAidEh+zR6TE=",
"optional": true,
"requires": {
"eslint-visitor-keys": "^1.1.0"
}
},
"acorn": {
"version": "7.4.1",
"resolved": "http://npm.dui88.com:80/acorn/-/acorn-7.4.1.tgz",
"integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=",
"optional": true
},
"acorn-jsx": {
"version": "5.3.1",
"resolved": "http://npm.dui88.com:80/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
"integrity": "sha1-/IZh4Rt6wVOcR9v+oucrOvNNJns=",
"optional": true
},
"ajv": {
"version": "6.12.6",
"resolved": "http://npm.dui88.com:80/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=",
"optional": true,
"requires": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"ansi-colors": {
"version": "4.1.1",
"resolved": "http://npm.dui88.com:80/ansi-colors/-/ansi-colors-4.1.1.tgz",
"integrity": "sha1-y7muJWv3UK8eqzRPIpqif+lLo0g=",
"optional": true
},
"ansi-regex": {
"version": "5.0.0",
"resolved": "http://npm.dui88.com:80/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=",
"optional": true
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "http://npm.dui88.com:80/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=",
"optional": true,
"requires": {
"color-convert": "^1.9.0"
}
},
"arg": {
"version": "4.1.3",
"resolved": "http://npm.dui88.com:80/arg/-/arg-4.1.3.tgz",
"integrity": "sha1-Jp/HrVuOQstjyJbVZmAXJhwUQIk=",
"optional": true
},
"argparse": {
"version": "1.0.10",
"resolved": "http://npm.dui88.com:80/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=",
"optional": true,
"requires": {
"sprintf-js": "~1.0.2"
}
},
"astral-regex": {
"version": "2.0.0",
"resolved": "http://npm.dui88.com:80/astral-regex/-/astral-regex-2.0.0.tgz",
"integrity": "sha1-SDFDxWeu7UeFdZwIZXhtx319LjE=",
"optional": true
},
"balanced-match": {
"version": "1.0.0",
"resolved": "http://npm.dui88.com:80/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "http://npm.dui88.com:80/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=",
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"buffer-from": {
"version": "1.1.1",
"resolved": "http://npm.dui88.com:80/buffer-from/-/buffer-from-1.1.1.tgz",
"integrity": "sha1-MnE7wCj3XAL9txDXx7zsHyxgcO8=",
"optional": true
},
"callsites": {
"version": "3.1.0",
"resolved": "http://npm.dui88.com:80/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M=",
"optional": true
},
"chalk": {
"version": "4.1.0",
"resolved": "http://npm.dui88.com:80/chalk/-/chalk-4.1.0.tgz",
"integrity": "sha1-ThSHCmGNni7dl92DRf2dncMVZGo=",
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "http://npm.dui88.com:80/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "http://npm.dui88.com:80/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "http://npm.dui88.com:80/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "http://npm.dui88.com:80/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
"optional": true
},
"supports-color": {
"version": "7.2.0",
"resolved": "http://npm.dui88.com:80/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"color-convert": {
"version": "1.9.3",
"resolved": "http://npm.dui88.com:80/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=",
"optional": true,
"requires": {
"color-name": "1.1.3"
}
},
"color-name": {
"version": "1.1.3",
"resolved": "http://npm.dui88.com:80/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"optional": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "http://npm.dui88.com:80/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"optional": true
},
"create-require": {
"version": "1.1.1",
"resolved": "http://npm.dui88.com:80/create-require/-/create-require-1.1.1.tgz",
"integrity": "sha1-wdfo8eX2z8n/ZfnNNS03NIdWwzM=",
"optional": true
},
"cross-spawn": {
"version": "7.0.3",
"resolved": "http://npm.dui88.com:80/cross-spawn/-/cross-spawn-7.0.3.tgz",
"integrity": "sha1-9zqFudXUHQRVUcF34ogtSshXKKY=",
"optional": true,
"requires": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
}
},
"debug": {
"version": "4.3.1",
"resolved": "http://npm.dui88.com:80/debug/-/debug-4.3.1.tgz",
"integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=",
"optional": true,
"requires": {
"ms": "2.1.2"
}
},
"deep-is": {
"version": "0.1.3",
"resolved": "http://npm.dui88.com:80/deep-is/-/deep-is-0.1.3.tgz",
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
"optional": true
},
"diff": {
"version": "4.0.2",
"resolved": "http://npm.dui88.com:80/diff/-/diff-4.0.2.tgz",
"integrity": "sha1-YPOuy4nV+uUgwRqhnvwruYKq3n0=",
"optional": true
},
"doctrine": {
"version": "3.0.0",
"resolved": "http://npm.dui88.com:80/doctrine/-/doctrine-3.0.0.tgz",
"integrity": "sha1-rd6+rXKmV023g2OdyHoSF3OXOWE=",
"optional": true,
"requires": {
"esutils": "^2.0.2"
}
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "http://npm.dui88.com:80/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=",
"optional": true
},
"enquirer": {
"version": "2.3.6",
"resolved": "http://npm.dui88.com:80/enquirer/-/enquirer-2.3.6.tgz",
"integrity": "sha1-Kn/l3WNKHkElqXXsmU/1RW3Dc00=",
"optional": true,
"requires": {
"ansi-colors": "^4.1.1"
}
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "http://npm.dui88.com:80/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"optional": true
},
"eslint": {
"version": "7.19.0",
"resolved": "http://npm.dui88.com:80/eslint/-/eslint-7.19.0.tgz",
"integrity": "sha1-ZxliGxlrX61y5DOHmBMU5dDcP0E=",
"optional": true,
"requires": {
"@babel/code-frame": "^7.0.0",
"@eslint/eslintrc": "^0.3.0",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
"debug": "^4.0.1",
"doctrine": "^3.0.0",
"enquirer": "^2.3.5",
"eslint-scope": "^5.1.1",
"eslint-utils": "^2.1.0",
"eslint-visitor-keys": "^2.0.0",
"espree": "^7.3.1",
"esquery": "^1.2.0",
"esutils": "^2.0.2",
"file-entry-cache": "^6.0.0",
"functional-red-black-tree": "^1.0.1",
"glob-parent": "^5.0.0",
"globals": "^12.1.0",
"ignore": "^4.0.6",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
"lodash": "^4.17.20",
"minimatch": "^3.0.4",
"natural-compare": "^1.4.0",
"optionator": "^0.9.1",
"progress": "^2.0.0",
"regexpp": "^3.1.0",
"semver": "^7.2.1",
"strip-ansi": "^6.0.0",
"strip-json-comments": "^3.1.0",
"table": "^6.0.4",
"text-table": "^0.2.0",
"v8-compile-cache": "^2.0.3"
},
"dependencies": {
"eslint-visitor-keys": {
"version": "2.0.0",
"resolved": "http://npm.dui88.com:80/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz",
"integrity": "sha1-If3I+82ceVzAMh8FY3AglXUVEag=",
"optional": true
}
}
},
"eslint-config-prettier": {
"version": "6.15.0",
"resolved": "http://npm.dui88.com:80/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz",
"integrity": "sha1-f5P2y31FqS8VN6cOzAY2bhrG/tk=",
"optional": true,
"requires": {
"get-stdin": "^6.0.0"
}
},
"eslint-plugin-prettier": {
"version": "3.3.1",
"resolved": "http://npm.dui88.com:80/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz",
"integrity": "sha1-cHnPoklweJBQEeb4Lo3YRT0Tcbc=",
"optional": true,
"requires": {
"prettier-linter-helpers": "^1.0.0"
}
},
"eslint-scope": {
"version": "5.1.1",
"resolved": "http://npm.dui88.com:80/eslint-scope/-/eslint-scope-5.1.1.tgz",
"integrity": "sha1-54blmmbLkrP2wfsNUIqrF0hI9Iw=",
"optional": true,
"requires": {
"esrecurse": "^4.3.0",
"estraverse": "^4.1.1"
}
},
"eslint-utils": {
"version": "2.1.0",
"resolved": "http://npm.dui88.com:80/eslint-utils/-/eslint-utils-2.1.0.tgz",
"integrity": "sha1-0t5eA0JOcH3BDHQGjd7a5wh0Gyc=",
"optional": true,
"requires": {
"eslint-visitor-keys": "^1.1.0"
}
},
"eslint-visitor-keys": {
"version": "1.3.0",
"resolved": "http://npm.dui88.com:80/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
"integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=",
"optional": true
},
"espree": {
"version": "7.3.1",
"resolved": "http://npm.dui88.com:80/espree/-/espree-7.3.1.tgz",
"integrity": "sha1-8t8zC3Usb1UBn4vYm3ZgA5wbu7Y=",
"optional": true,
"requires": {
"acorn": "^7.4.0",
"acorn-jsx": "^5.3.1",
"eslint-visitor-keys": "^1.3.0"
}
},
"esprima": {
"version": "4.0.1",
"resolved": "http://npm.dui88.com:80/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=",
"optional": true
},
"esquery": {
"version": "1.4.0",
"resolved": "http://npm.dui88.com:80/esquery/-/esquery-1.4.0.tgz",
"integrity": "sha1-IUj/w4uC6McFff7UhCWz5h8PJKU=",
"optional": true,
"requires": {
"estraverse": "^5.1.0"
},
"dependencies": {
"estraverse": {
"version": "5.2.0",
"resolved": "http://npm.dui88.com:80/estraverse/-/estraverse-5.2.0.tgz",
"integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=",
"optional": true
}
}
},
"esrecurse": {
"version": "4.3.0",
"resolved": "http://npm.dui88.com:80/esrecurse/-/esrecurse-4.3.0.tgz",
"integrity": "sha1-eteWTWeauyi+5yzsY3WLHF0smSE=",
"optional": true,
"requires": {
"estraverse": "^5.2.0"
},
"dependencies": {
"estraverse": {
"version": "5.2.0",
"resolved": "http://npm.dui88.com:80/estraverse/-/estraverse-5.2.0.tgz",
"integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=",
"optional": true
}
}
},
"estraverse": {
"version": "4.3.0",
"resolved": "http://npm.dui88.com:80/estraverse/-/estraverse-4.3.0.tgz",
"integrity": "sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0=",
"optional": true
},
"esutils": {
"version": "2.0.3",
"resolved": "http://npm.dui88.com:80/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=",
"optional": true
},
"fast-deep-equal": {
"version": "3.1.3",
"resolved": "http://npm.dui88.com:80/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=",
"optional": true
},
"fast-diff": {
"version": "1.2.0",
"resolved": "http://npm.dui88.com:80/fast-diff/-/fast-diff-1.2.0.tgz",
"integrity": "sha1-c+4RmC2Gyq95WYKNUZz+kn+sXwM=",
"optional": true
},
"fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "http://npm.dui88.com:80/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=",
"optional": true
},
"fast-levenshtein": {
"version": "2.0.6",
"resolved": "http://npm.dui88.com:80/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
"optional": true
},
"file-entry-cache": {
"version": "6.0.1",
"resolved": "http://npm.dui88.com:80/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
"integrity": "sha1-IRst2WWcsDlLBz5zI6w8kz1SICc=",
"optional": true,
"requires": {
"flat-cache": "^3.0.4"
}
},
"flat-cache": {
"version": "3.0.4",
"resolved": "http://npm.dui88.com:80/flat-cache/-/flat-cache-3.0.4.tgz",
"integrity": "sha1-YbAzgwKy/p+Vfcwy/CqH8cMEixE=",
"optional": true,
"requires": {
"flatted": "^3.1.0",
"rimraf": "^3.0.2"
}
},
"flatted": {
"version": "3.1.1",
"resolved": "http://npm.dui88.com:80/flatted/-/flatted-3.1.1.tgz",
"integrity": "sha1-xLSJ6ACW2d8d/JfHmHGup8YXxGk=",
"optional": true
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "http://npm.dui88.com:80/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"optional": true
},
"functional-red-black-tree": {
"version": "1.0.1",
"resolved": "http://npm.dui88.com:80/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"optional": true
},
"get-stdin": {
"version": "6.0.0",
"resolved": "http://npm.dui88.com:80/get-stdin/-/get-stdin-6.0.0.tgz",
"integrity": "sha1-ngm/cSs2CrkiXoEgSPcf3pyJZXs=",
"optional": true
},
"glob": {
"version": "7.1.6",
"resolved": "http://npm.dui88.com:80/glob/-/glob-7.1.6.tgz",
"integrity": "sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=",
"optional": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"glob-parent": {
"version": "5.1.1",
"resolved": "http://npm.dui88.com:80/glob-parent/-/glob-parent-5.1.1.tgz",
"integrity": "sha1-tsHvQXxOVmPqSY8cRa+saRa7wik=",
"optional": true,
"requires": {
"is-glob": "^4.0.1"
}
},
"globals": {
"version": "12.4.0",
"resolved": "http://npm.dui88.com:80/globals/-/globals-12.4.0.tgz",
"integrity": "sha1-oYgTV2pBsAokqX5/gVkYwuGZJfg=",
"optional": true,
"requires": {
"type-fest": "^0.8.1"
}
},
"has-flag": {
"version": "3.0.0",
"resolved": "http://npm.dui88.com:80/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"optional": true
},
"ignore": {
"version": "4.0.6",
"resolved": "http://npm.dui88.com:80/ignore/-/ignore-4.0.6.tgz",
"integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=",
"optional": true
},
"import-fresh": {
"version": "3.3.0",
"resolved": "http://npm.dui88.com:80/import-fresh/-/import-fresh-3.3.0.tgz",
"integrity": "sha1-NxYsJfy566oublPVtNiM4X2eDCs=",
"optional": true,
"requires": {
"parent-module": "^1.0.0",
"resolve-from": "^4.0.0"
}
},
"imurmurhash": {
"version": "0.1.4",
"resolved": "http://npm.dui88.com:80/imurmurhash/-/imurmurhash-0.1.4.tgz",
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
"optional": true
},
"inflight": {
"version": "1.0.6",
"resolved": "http://npm.dui88.com:80/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"optional": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "http://npm.dui88.com:80/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=",
"optional": true
},
"is-extglob": {
"version": "2.1.1",
"resolved": "http://npm.dui88.com:80/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
"optional": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "http://npm.dui88.com:80/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=",
"optional": true
},
"is-glob": {
"version": "4.0.1",
"resolved": "http://npm.dui88.com:80/is-glob/-/is-glob-4.0.1.tgz",
"integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=",
"optional": true,
"requires": {
"is-extglob": "^2.1.1"
}
},
"isexe": {
"version": "2.0.0",
"resolved": "http://npm.dui88.com:80/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"optional": true
},
"js-tokens": {
"version": "4.0.0",
"resolved": "http://npm.dui88.com:80/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha1-GSA/tZmR35jjoocFDUZHzerzJJk=",
"optional": true
},
"js-yaml": {
"version": "3.14.1",
"resolved": "http://npm.dui88.com:80/js-yaml/-/js-yaml-3.14.1.tgz",
"integrity": "sha1-2ugS/bOCX6MGYJqHFzg8UMNqBTc=",
"optional": true,
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
}
},
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "http://npm.dui88.com:80/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA=",
"optional": true
},
"json-stable-stringify-without-jsonify": {
"version": "1.0.1",
"resolved": "http://npm.dui88.com:80/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
"optional": true
},
"levn": {
"version": "0.4.1",
"resolved": "http://npm.dui88.com:80/levn/-/levn-0.4.1.tgz",
"integrity": "sha1-rkViwAdHO5MqYgDUAyaN0v/8at4=",
"optional": true,
"requires": {
"prelude-ls": "^1.2.1",
"type-check": "~0.4.0"
}
},
"lodash": {
"version": "4.17.21",
"resolved": "http://npm.dui88.com:80/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw=",
"optional": true
},
"lru-cache": {
"version": "6.0.0",
"resolved": "http://npm.dui88.com:80/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha1-bW/mVw69lqr5D8rR2vo7JWbbOpQ=",
"optional": true,
"requires": {
"yallist": "^4.0.0"
}
},
"make-error": {
"version": "1.3.6",
"resolved": "http://npm.dui88.com:80/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha1-LrLjfqm2fEiR9oShOUeZr0hM96I=",
"optional": true
},
"minimatch": {
"version": "3.0.4",
"resolved": "http://npm.dui88.com:80/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=",
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"ms": {
"version": "2.1.2",
"resolved": "http://npm.dui88.com:80/ms/-/ms-2.1.2.tgz",
"integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=",
"optional": true
},
"natural-compare": {
"version": "1.4.0",
"resolved": "http://npm.dui88.com:80/natural-compare/-/natural-compare-1.4.0.tgz",
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"optional": true
},
"once": {
"version": "1.4.0",
"resolved": "http://npm.dui88.com:80/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"optional": true,
"requires": {
"wrappy": "1"
}
},
"optionator": {
"version": "0.9.1",
"resolved": "http://npm.dui88.com:80/optionator/-/optionator-0.9.1.tgz",
"integrity": "sha1-TyNqY3Pa4FZqbUPhMmZ09QwpFJk=",
"optional": true,
"requires": {
"deep-is": "^0.1.3",
"fast-levenshtein": "^2.0.6",
"levn": "^0.4.1",
"prelude-ls": "^1.2.1",
"type-check": "^0.4.0",
"word-wrap": "^1.2.3"
}
},
"parent-module": {
"version": "1.0.1",
"resolved": "http://npm.dui88.com:80/parent-module/-/parent-module-1.0.1.tgz",
"integrity": "sha1-aR0nCeeMefrjoVZiJFLQB2LKqqI=",
"optional": true,
"requires": {
"callsites": "^3.0.0"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "http://npm.dui88.com:80/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"optional": true
},
"path-key": {
"version": "3.1.1",
"resolved": "http://npm.dui88.com:80/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=",
"optional": true
},
"prelude-ls": {
"version": "1.2.1",
"resolved": "http://npm.dui88.com:80/prelude-ls/-/prelude-ls-1.2.1.tgz",
"integrity": "sha1-3rxkidem5rDnYRiIzsiAM30xY5Y=",
"optional": true
},
"prettier": {
"version": "2.2.1",
"resolved": "http://npm.dui88.com:80/prettier/-/prettier-2.2.1.tgz",
"integrity": "sha1-eVoaeN1S8HPaDNQrIfnJE4GSP/U=",
"optional": true
},
"prettier-linter-helpers": {
"version": "1.0.0",
"resolved": "http://npm.dui88.com:80/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
"integrity": "sha1-0j1B/hN1ZG3i0BBNNFSjAIgCz3s=",
"optional": true,
"requires": {
"fast-diff": "^1.1.2"
}
},
"progress": {
"version": "2.0.3",
"resolved": "http://npm.dui88.com:80/progress/-/progress-2.0.3.tgz",
"integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=",
"optional": true
},
"punycode": {
"version": "2.1.1",
"resolved": "http://npm.dui88.com:80/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew=",
"optional": true
},
"regexpp": {
"version": "3.1.0",
"resolved": "http://npm.dui88.com:80/regexpp/-/regexpp-3.1.0.tgz",
"integrity": "sha1-IG0K0KVkjP+9uK5GQ489xRyfeOI=",
"optional": true
},
"require-from-string": {
"version": "2.0.2",
"resolved": "http://npm.dui88.com:80/require-from-string/-/require-from-string-2.0.2.tgz",
"integrity": "sha1-iaf92TgmEmcxjq/hT5wy5ZjDaQk=",
"optional": true
},
"resolve-from": {
"version": "4.0.0",
"resolved": "http://npm.dui88.com:80/resolve-from/-/resolve-from-4.0.0.tgz",
"integrity": "sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY=",
"optional": true
},
"rimraf": {
"version": "3.0.2",
"resolved": "http://npm.dui88.com:80/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=",
"optional": true,
"requires": {
"glob": "^7.1.3"
}
},
"semver": {
"version": "7.3.4",
"resolved": "http://npm.dui88.com:80/semver/-/semver-7.3.4.tgz",
"integrity": "sha1-J6qn0uTKdkUvmNOt0JOnLJQ+3Jc=",
"optional": true,
"requires": {
"lru-cache": "^6.0.0"
}
},
"shebang-command": {
"version": "2.0.0",
"resolved": "http://npm.dui88.com:80/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=",
"optional": true,
"requires": {
"shebang-regex": "^3.0.0"
}
},
"shebang-regex": {
"version": "3.0.0",
"resolved": "http://npm.dui88.com:80/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=",
"optional": true
},
"slice-ansi": {
"version": "4.0.0",
"resolved": "http://npm.dui88.com:80/slice-ansi/-/slice-ansi-4.0.0.tgz",
"integrity": "sha1-UA6N0P1VsFgVCGJVsxla3ypF/ms=",
"optional": true,
"requires": {
"ansi-styles": "^4.0.0",
"astral-regex": "^2.0.0",
"is-fullwidth-code-point": "^3.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "http://npm.dui88.com:80/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "http://npm.dui88.com:80/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "http://npm.dui88.com:80/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
"optional": true
}
}
},
"source-map": {
"version": "0.6.1",
"resolved": "http://npm.dui88.com:80/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
"optional": true
},
"source-map-support": {
"version": "0.5.19",
"resolved": "http://npm.dui88.com:80/source-map-support/-/source-map-support-0.5.19.tgz",
"integrity": "sha1-qYti+G3K9PZzmWSMCFKRq56P7WE=",
"optional": true,
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"sprintf-js": {
"version": "1.0.3",
"resolved": "http://npm.dui88.com:80/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"optional": true
},
"string-width": {
"version": "4.2.2",
"resolved": "http://npm.dui88.com:80/string-width/-/string-width-4.2.2.tgz",
"integrity": "sha1-2v1PlVmnWFz7pSnGoKT3NIjr1MU=",
"optional": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.0"
}
},
"strip-ansi": {
"version": "6.0.0",
"resolved": "http://npm.dui88.com:80/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=",
"optional": true,
"requires": {
"ansi-regex": "^5.0.0"
}
},
"strip-json-comments": {
"version": "3.1.1",
"resolved": "http://npm.dui88.com:80/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
"integrity": "sha1-MfEoGzgyYwQ0gxwxDAHMzajL4AY=",
"optional": true
},
"supports-color": {
"version": "5.5.0",
"resolved": "http://npm.dui88.com:80/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=",
"optional": true,
"requires": {
"has-flag": "^3.0.0"
}
},
"table": {
"version": "6.0.7",
"resolved": "http://npm.dui88.com:80/table/-/table-6.0.7.tgz",
"integrity": "sha1-5FiX/7zBvPnoqHv0IPLJ5aelKjQ=",
"optional": true,
"requires": {
"ajv": "^7.0.2",
"lodash": "^4.17.20",
"slice-ansi": "^4.0.0",
"string-width": "^4.2.0"
},
"dependencies": {
"ajv": {
"version": "7.1.1",
"resolved": "http://npm.dui88.com:80/ajv/-/ajv-7.1.1.tgz",
"integrity": "sha1-Hms3pFQCH6mUFxPzi5UvwcjTKoQ=",
"optional": true,
"requires": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
}
},
"json-schema-traverse": {
"version": "1.0.0",
"resolved": "http://npm.dui88.com:80/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha1-rnvLNlard6c7pcSb9lTzjmtoYOI=",
"optional": true
}
}
},
"text-table": {
"version": "0.2.0",
"resolved": "http://npm.dui88.com:80/text-table/-/text-table-0.2.0.tgz",
"integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
"optional": true
},
"ts-node": {
"version": "9.1.1",
"resolved": "http://npm.dui88.com:80/ts-node/-/ts-node-9.1.1.tgz",
"integrity": "sha1-UamkUKPpWUAb2l8ASnLVS5NtN20=",
"optional": true,
"requires": {
"arg": "^4.1.0",
"create-require": "^1.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"source-map-support": "^0.5.17",
"yn": "3.1.1"
}
},
"tslib": {
"version": "1.14.1",
"resolved": "http://npm.dui88.com:80/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha1-zy04vcNKE0vK8QkcQfZhni9nLQA=",
"optional": true
},
"tsutils": {
"version": "3.20.0",
"resolved": "http://npm.dui88.com:80/tsutils/-/tsutils-3.20.0.tgz",
"integrity": "sha1-6gPqRUYuFGtT1wzgiT3kU/8k9pg=",
"optional": true,
"requires": {
"tslib": "^1.8.1"
}
},
"type-check": {
"version": "0.4.0",
"resolved": "http://npm.dui88.com:80/type-check/-/type-check-0.4.0.tgz",
"integrity": "sha1-B7ggO/pwVsBlcFDjzNLDdzC6uPE=",
"optional": true,
"requires": {
"prelude-ls": "^1.2.1"
}
},
"type-fest": {
"version": "0.8.1",
"resolved": "http://npm.dui88.com:80/type-fest/-/type-fest-0.8.1.tgz",
"integrity": "sha1-CeJJ696FHTseSNJ8EFREZn8XuD0=",
"optional": true
},
"typescript": {
"version": "3.9.7",
"resolved": "http://npm.dui88.com:80/typescript/-/typescript-3.9.7.tgz",
"integrity": "sha1-mNYApevcOPQMsndSLxLcgA6eJfo=",
"optional": true
},
"uri-js": {
"version": "4.4.1",
"resolved": "http://npm.dui88.com:80/uri-js/-/uri-js-4.4.1.tgz",
"integrity": "sha1-mxpSWVIlhZ5V9mnZKPiMbFfyp34=",
"optional": true,
"requires": {
"punycode": "^2.1.0"
}
},
"v8-compile-cache": {
"version": "2.2.0",
"resolved": "http://npm.dui88.com:80/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz",
"integrity": "sha1-lHHvo++RKNL3xqfKOcTda1BVsTI=",
"optional": true
},
"which": {
"version": "2.0.2",
"resolved": "http://npm.dui88.com:80/which/-/which-2.0.2.tgz",
"integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=",
"optional": true,
"requires": {
"isexe": "^2.0.0"
}
},
"word-wrap": {
"version": "1.2.3",
"resolved": "http://npm.dui88.com:80/word-wrap/-/word-wrap-1.2.3.tgz",
"integrity": "sha1-YQY29rH3A4kb00dxzLF/uTtHB5w=",
"optional": true
},
"wrappy": {
"version": "1.0.2",
"resolved": "http://npm.dui88.com:80/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"optional": true
},
"yallist": {
"version": "4.0.0",
"resolved": "http://npm.dui88.com:80/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha1-m7knkNnA7/7GO+c1GeEaNQGaOnI=",
"optional": true
},
"yn": {
"version": "3.1.1",
"resolved": "http://npm.dui88.com:80/yn/-/yn-3.1.1.tgz",
"integrity": "sha1-HodAGgnXZ8HV6rJqbkwYUYLS61A=",
"optional": true
}
}
}
{
"name": "tbcc-sdk-ts",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "tsc"
},
"config": {
"notNeedLogin": []
},
"optionalDependencies": {
"@types/lodash": "^4.14.160",
"@types/node": "^14.6.0",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "^2.0.5",
"ts-node": "^9.0.0",
"typescript": "^3.9.7"
},
"keywords": [],
"author": "",
"license": "ISC"
}
// 领取奖品状态
export const DRAW_STATUS = {
// 待领取
WAITAWARD: 1,
// 处理中
PROCESSING: 2,
// 领取成功
SUCCESS: 3,
// 领取失败
FAIL: 4,
// 已过期
EXPIRED: 5,
// 重新领取
RETRY: 6
}
// 奖品类型
export const PRIZE_TYPE = {
ENAME: 1,
CREDITS: 2,
OBJECT: 3,
THANKS: 5
};
\ No newline at end of file
import {
promisifyApiSimple,
promisifyApi,
promisifyApiToTb,
AudioModel
} from '../helpers'
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
export const commonToast = (content: string, duration?: number, successCb?: () => any) => {
promisifyApiSimple('showToast',{
content: content || '换个姿势再试一次~',
duration: duration || 3000,
success: successCb
})
};
/**
* 简易alert
* @param {string} content toast内容
*/
export const simpleAlert = (content: string) => {
promisifyApiSimple('alert',{
content
})
};
/**
* 通用确认弹窗
* @param {string} title 标题
* @param {string} content 内容
* @param {function} successCb 成功回调
*/
export const commonConfirm = async (title = '提示', content: string, successCb?: () => any) => {
promisifyApiSimple('confirm',{
title,
content,
confirmButtonText: '确定',
cancelButtonText: '取消',
success: result => {
const { confirm } = result;
if (confirm) {
successCb && successCb();
}
}
})
};
/**
* 获取系统信息
*/
export const getSystemInfo = async () => {
return await promisifyApi('getSystemInfo', {})
};
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const favorShop = async (sellerId: number) => {
if (!sellerId) {
return false;
}
let result: { error?: number } = await promisifyApiToTb('favorShop',{ id: +sellerId })
if(result?.error === 11) return false
return result
};
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const checkShopFavoredStatus = async (sellerId: number) => {
if (!sellerId) {
return false;
}
let result: { isFavor?: boolean } = await promisifyApiToTb('checkShopFavoredStatus',{ id: +sellerId })
if(result?.isFavor) return result.isFavor
return result
};
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
export const navigateToOutside = url => {
if (!url) {
console.error('navigateToOutside: 请传入url');
return false;
}
promisifyApiSimple('call',{
url
}, 'navigateToOutside')
};
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export const navigateTo = url => {
if (!url) {
console.error('navigateTo: 请传入url');
return false;
}
promisifyApiSimple('navigateTo',{
url
})
};
/**
* 返回页面
* @param {number} delta
*/
export const navigateBack = (delta?: number) => {
promisifyApiSimple('navigateBack',{
delta
})
};
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url
*/
export const redirectTo = (url: string) => {
if (!url) {
console.error('redirectTo: 请传入url');
return false;
}
promisifyApiSimple('redirectTo',{
url
})
};
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
export const getServerTime = async () => {
const result: { time?: string } = await promisifyApi('getServerTime', {})
if(result?.time) return result.time
return result
};
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
export const collectGoods = async (id: number) => {
if (!id) {
console.error('collectGoods: 请传入商品id');
return false;
}
let result: { error?: number } = await promisifyApiToTb('collectGoods',{ id: +id })
if(result?.error === 11) return false
return result
};
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
export const checkGoodsCollectedStatus = async (id: number) => {
if (!id) {
console.error('checkGoodsCollectedStatus: 请传入商品id');
return false;
}
let result: { isCollect?: boolean } = await promisifyApiToTb('checkGoodsCollectedStatus',{ id: +id })
if(result?.isCollect) return result.isCollect
return result
};
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
export const openDetail = async (itemId: string) => {
if (!itemId) {
console.error('openDetail: 请传入商品id');
return false;
}
return await promisifyApiToTb('openDetail',{ itemId: String(itemId) })
};
/**
* 创建音频实例
* @param {object} opts 配置对象 例 { src: '音频链接', autoplay: false }
*/
export const createAudio = (opts: { src: string, autoplay?: boolean}) => {
const audioInstance = new AudioModel(opts);
return audioInstance;
};
/**
* 获取图片信息
* @param {string} src 图片地址
*/
export const getImageInfo = async (src: string) => {
return await promisifyApi('getImageInfo', { src })
};
/**
* 剪切板
* @param {text: string}
*/
export const setClipboard = async (text: string) => {
return await promisifyApi('setClipboard', { text })
};
/**
* 调起分享面板
*/
export const showSharePanel = async () => {
promisifyApiSimple('showSharePanel',{})
}
/**
* 获取缓存数据
* @param key
*/
export const getStorage = async (key: string) => {
const result: { data?: string} = await promisifyApi('getStorage', { key })
if(result?.data) return result.data
return result
}
/**
* 设置缓存数据
* @param key
* @param value
*/
export const setStorage = async (key: string, value: any) => {
return await promisifyApi('setStorage', { key, data: value })
}
/**
* 清除缓存数据
* @param key
*/
export const removeStorage = async (key: string) => {
return await promisifyApi('removeStorage', { key })
}
/**
* 自定义分析数据的上报接口
* @param eventType
* @param logkey
*/
export const taobaoReportClick = (eventType: string,logkey: string) => {
// @ts-ignore
my.reportAnalytics(eventType, {
// 标志某一类事件,方便数据分析进行分组
'logkey': logkey
})
};
/**
* 打开BC客服聊天
* @param sellerNick
* @param itemId
*/
export const openMessage = async (sellerNick: string, itemId: string) => {
let result = await promisifyApiToTb('openMessage',{ sellerNick, forceH5: false, params: { itemId } })
return result
}
/**
* 显示指定商品 SKU 选择器
* @param itemId
*/
export const showSkuModal = async (itemId: string) => {
let result = await promisifyApiToTb('showSku',{ itemId })
return result
}
/**
* 隐藏正在展示的商品 SKU 选择器
*/
export const hideSkuModal = async () => {
let result = await promisifyApiToTb('hideSku',{})
return result
}
/**
* 跳转订单页
* @param itemId
* @param skuId
* @param quantity
*/
export const confirmCustomOrder = async (itemId: number, skuId?: number, quantity?: number) => {
let result = await promisifyApiToTb('confirmCustomOrder',{
data: {
itemId,
skuId: skuId || -1,
quantity: quantity || 1,
customization: {}
}
})
return result
}
\ No newline at end of file
import {
promisifyApi,
getTmallMemberStatus,
strategyEname
} from '../helpers'
/**
* 获取淘宝用户收货地址
*/
export const getUserAddress = async (opts = {}) => {
let defaults = {
addAddress: 'show',
searchAddress: 'hide',
locateAddress: 'hide',
joinTag: '' // 分割收货地址符号(淘宝商家有特定发货需求)
};
let _opts = Object.assign({}, defaults, opts);
return new Promise((resolve, reject) => {
// @ts-ignore
my.authorize({
scopes: 'scope.addressList',
success: () => {
const { addAddress, searchAddress, locateAddress, joinTag } = _opts;
// @ts-ignore
if (!my.tb.chooseAddress) {
reject({
noSupport: true,
errorMessage: '当前版本不支持选择收货地址,请升级到最新版本'
});
return false;
}
// @ts-ignore
my.tb.chooseAddress(
{
addAddress,
searchAddress,
locateAddress
},
res => {
const { error, provinceName, countyName, cityName, streetName, detailInfo, name, telNumber } = res;
// 如果有error为用户取消操作不做操作
if (error) {
resolve(false);
} else {
resolve({
...res,
duibaAddress: {
name,
phone: telNumber,
address: [provinceName, cityName, countyName, streetName, detailInfo].join(joinTag)
}
});
}
},
res => {
reject(res);
}
);
},
fail: err => {
reject(err)
}
});
});
};
/**
* 选择图片
* @param opts
*/
export const chooseImage = async (opts = {}) => {
let defaults = {
count: 1,
sourceType: ['camera', 'album'],
compressLevel: 1
};
let _opts = Object.assign({}, defaults, opts);
const { count, sourceType, compressLevel } = _opts;
return new Promise((resolve, reject) => {
// @ts-ignore
if (!my.chooseImage) {
reject({
noSupport: true,
errorMessage: '当前版本不支持选择图片,请升级到最新版本'
});
return false;
}
// @ts-ignore
my.chooseImage({
count,
sourceType,
success: res => {
// @ts-ignore
my.compressImage({
apFilePaths: res.apFilePaths,
level: compressLevel,
success: data => {
resolve(data);
},
fail: err => {
resolve(err);
}
});
},
fail: err => {
// error code 2001 为摄像头授权取消、ios 11为用户取消操作不认作失败场景 、安卓 为1
if (err.error !== 2001 && err.error !== 11 && err.error !== 1) {
reject(err);
} else {
resolve(false);
}
}
});
});
};
/**
* 获取图片信息
* @param {*} opts chooseImage配置参数
*/
export const uploadImage = async (opts = {}) => {
// @ts-ignore
const { cloud } = getApp();
if (!cloud) {
console.error('chattingSendCard: 请传入app.cloud');
return false;
}
const chooseImageResult: { apFilePaths?: Array<{}>} = await chooseImage(opts).catch(err => {
console.error('选择图片失败')
});
if (chooseImageResult) {
const { apFilePaths } = chooseImageResult;
const filePath = apFilePaths[0];
const imageInfo: { path?: string } = await promisifyApi('getImageInfo', { src: filePath })
// 找不到图片信息
if (!imageInfo) {
return false;
}
const { path: imagePath } = imageInfo;
const { url } = await cloud.file.uploadFile({
filePath,
fileType: 'image',
fileName: imagePath.split('/').pop()
});
return url;
}
return false;
}
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
export const getAuthUserInfo = () => {
return new Promise((resolve, reject) => {
// @ts-ignore
my.authorize({
scopes: 'scope.userInfo',
success: () => {
// @ts-ignore
my.getAuthUserInfo({
success: userInfo => {
resolve(userInfo);
},
fail: err => {
reject(err);
}
});
},
fail: err => {
reject(err);
}
});
});
};
/**
* 获取用户会员状态(Tmall使用)
*/
export const getUserStatus = async () => {
return new Promise((resolve, reject) => {
// @ts-ignore
my.authorize({
scopes: "scope.campus.audit",
success: async () => {
const result = await getTmallMemberStatus()
resolve(result.result);
},
fail: (err) => {
console.log(err);
reject(err);
},
});
});
}
/**
* 拉菲奖品发放(Tmall使用)
* @param params
*/
export const cloudTBIssue = async (params: { channel: string, strategyCode: string, code: string }) => {
return new Promise((resolve, reject) => {
// @ts-ignore
my.authorize({
scopes: "scope.latourBenefit",
success: async () => {
const result = await strategyEname(params)
console.log(result, "result");
resolve(result);
},
fail: (err) => {
console.log(err);
reject(err);
},
});
});
}
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export const chattingSendCard = async (requestInfo: IRequestInfo) => {
// @ts-ignore
const { cloud } = getApp();
if (!cloud) {
console.error('chattingSendCard: 请传入app.cloud');
return false;
}
if (!requestInfo) {
console.error('chattingSendCard: 请传入卡片请求参数');
return false;
}
return new Promise((resolve, reject) => {
// @ts-ignore
my.authorize({
scopes: 'scope.groupChat',
success: async () => {
const result = await cloud.topApi
.invoke({
api: 'taobao.chatting.platform.message.sendcard',
data: { request_info: JSON.stringify(requestInfo) }
})
.catch(err => {
reject(err);
});
if (result) {
const { error } = result;
if (error) {
resolve(false);
} else {
resolve(result);
}
}
},
fail: err => {
if (err.error === 11) {
// error code 11 为用户取消操作不认作失败场景
resolve(false);
}
reject(err);
}
});
});
};
/**
* 文本风险校验
* @param {string} text 文本
*/
export const textRiskIdentification = async (text: string) => {
return new Promise((resolve, reject) => {
// @ts-ignore
if (!my.tb.textRiskIdentification) {
reject({
noSupport: true,
errorMessage: '不支持文本校验'
});
}
// @ts-ignore
my.tb.textRiskIdentification({
data:{
text
},
success: res => {
if (res.data && res.data.result) {
const { suggestion }= res.data.result;
if (suggestion === 'pass') {
resolve(true);
}
}
resolve(false);
},
fail: err => {
reject(err)
},
})
})
}
/**
* 跳转店铺首页
* @param {string} shopId
*/
export const navigateToTaobaoPage = (shopId: string) => {
return new Promise((resolve, reject) => {
// @ts-ignore
my.tb.navigateToTaobaoPage({
appCode:'shop',
appParams:{
shopId: String(shopId),
weexShopTab:"shopindexbar",
weexShopSubTab:"shopindex"
},
success: (res) => {
resolve(true)
},
fail: (res) => {
reject(res.error)
}
});
})
}
\ No newline at end of file
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
export const commonToast = (content, duration = 3000, successCb) => {
return '暂不支持toast';
};
/**
* 简易alert
* @param {string} content toast内容
*/
export const simpleAlert = content => {
alert(content);
};
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
export const getAuthUserInfo = async () => {
return {
nickName: 'nickName',
avatar: '123',
mixNick: '1234'
};
};
/**
* 获取系统信息
* @returns {object} 小程序系统信息
*/
export const getSystemInfo = async () => {
return {
version: '9.5.0'
};
};
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const favorShop = async sellerId => {
if (!sellerId) {
console.error('favorShop: 请传入卖家Id');
return false;
}
return true;
};
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const checkShopFavoredStatus = async sellerId => {
if (!sellerId) {
console.error('checkShopFavoredStatus: 请传入卖家Id');
return false;
}
return true;
};
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
export const navigateToOutside = url => {
if (!url) {
console.error('navigateToOutside: 请传入url');
return false;
}
window.location = url;
};
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export const navigateTo = url => {
if (!url) {
console.error('navigateTo: 请传入url');
return false;
}
window.location = url;
};
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
export const redirectTo = url => {
if (!url) {
console.error('redirectTo: 请传入url');
return false;
}
// @ts-ignore
window.replace(url);
};
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
export const getServerTime = async () => {
return +new Date();
};
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
export const collectGoods = async id => {
if (!id) {
console.error('collectGoods: 请传入商品id');
return false;
}
return true;
};
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
export const checkGoodsCollectedStatus = async id => {
if (!id) {
console.error('checkGoodsCollectedStatus: 请传入商品id');
return false;
}
return true;
};
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
export const openDetail = async itemId => {
if (!itemId) {
console.error('openDetail: 请传入商品id');
return false;
}
// @ts-ignore
window.location = 'https://item.taobao.com/item.htm?id=' + itemId;
};
/**
* 获取淘宝用户收货地址
*/
export const getUserAddress = async (opts = {}) => {
return {
name: 1,
phone: 1,
address: 123
}
};
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export const chattingSendCard = async (requestInfo) => {
alert('无法模拟');
return false;
};
/**
* 分享到群聊卡片
* @param {*} cloud 小程序云
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export const textRiskIdentification = async (text) => {
return true;
}
\ No newline at end of file
import { commonToast } from '../core/tb'
/**
* 简易API封装
* @param methodName
* @param params
* @param name
*/
export const promisifyApiSimple = (methodName: string, params: IParamJSAPI, name?: string) => {
if(name) {
// @ts-ignore
my[methodName](name,params);
return;
}
// @ts-ignore
my[methodName](params);
}
/**
* 通用API封装
* @param methodName
* @param params
*/
export const promisifyApi = (methodName: string, params = {}) => {
return new Promise((resolve, reject) => {
// @ts-ignore
my[methodName]({
...params,
success: res => {
resolve(res)
},
fail: err => {
reject(err)
}
})
})
}
/**
* 通用API封装
* @param methodName
* @param params
*/
export const promisifyApiToTb = (methodName: string, params = {}) => {
return new Promise((resolve, reject) => {
// @ts-ignore
my.tb[methodName]({
...params,
success: res => {
resolve(res)
},
fail: err => {
reject(err)
}
})
})
}
/**
* 创建音频类
*/
export class AudioModel {
constructor(opts: { src: string }) {
const { src } = opts;
if (!src) {
console.error('请输入音频链接');
return false;
}
try {
// @ts-ignore
const innerAudioContext = my.createInnerAudioContext();
Object.keys(opts).forEach(item => {
innerAudioContext[item] = opts[item];
});
return innerAudioContext;
} catch (e) {
console.error('当前版本不支持音频');
}
}
}
/**
* 获取天猫会员状态
*/
export const getTmallMemberStatus = async () => {
// @ts-ignore
const { cloud } = app;
return (await cloud.topApi.invoke({
api: "tmall.campus.industry.app.audit.query",
data: {
source: "duibajk",
},
}).catch((err) => {
console.log(err);
})) || {};
}
/**
* 拉菲奖品发放
* @param params
*/
export const strategyEname = async (params: { channel: string, strategyCode: string, code: string }) => {
// @ts-ignore
const { cloud } = app;
return (await cloud.topApi.invoke({
api: "alibaba.latour.strategy.issue",
data: {
channel: params.channel || "",
strategy_code: params.strategyCode || "",
selected_benefit_code: params.code || "",
},
}).catch((err) => {
console.log("err", err);
})) || {}
}
/**
* loading
* @param methodName
* @param params
* @param name
*/
export const isLoading = (methodName: string) => {
// @ts-ignore
my[methodName]();
}
/**
* 数据请求
* @param params
* @param loading
*/
export const myRequest = async (params: any, loading: boolean) => {
return new Promise((resolve, reject) => {
// @ts-ignore
my.request(params).then(({ data: res }) => {
console.log(`调用mock接口返回结果`, res)
loading && isLoading('hideLoading')
if (res && !res.success) {
commonToast(res.message || '系统错误')
}
resolve(res)
return res
}).catch((e) => {
loading && isLoading('hideLoading')
console.log(e)
reject();
});
})
}
/**
* 云函数接口请求
* @param _cloudName
* @param handle
* @param params
* @param loading
* @param toastError
*/
export const cloudRequest = async (cloud: any, _cloudName:string, handle: string, params: any, loading: boolean, toastError: boolean) => {
return new Promise((resolve, reject) => {
// @ts-ignore
loading && isLoading('showLoading')
cloud.function.invoke(_cloudName, params, handle).then(res => {
console.log(`%c${handle} 参数 ----->`, 'color: #43bb88;font-size: 12px;', params)
console.log(`%c${handle} 返回值 ----->`, 'color: #43bb88;font-size: 12px;', res)
loading && isLoading('hideLoading')
if (res && !res.success && toastError) {
commonToast(res.message || '系统错误')
}
resolve(res)
return res
}).catch((err: any) => {
console.log(`${handle} catch ----->`, params, err)
loading && isLoading('hideLoading')
reject();
});
});
}
\ No newline at end of file
import { getAuthUserInfo } from '../core/tbFn';
import { commonConfirm } from '../core/tb'
import { myRequest } from './index'
const Buffer = require("buffer").Buffer
const crypto = require("crypto")
/**
* 加密
* @param data
*/
export const md5 = (data: any) => {
var buf = new Buffer(data);
var str = buf.toString("binary");
return crypto.createHash("md5").update(str).digest("hex").slice(0, 30);
}
/**
* my.request请求接口
* @param params
* @param res
* @param loading
* @param tornadoAPI
*/
export const tornadoAPICb = async (params: any, res: any, loading: boolean, tornadoAPI: string) => {
const { nickName } = res
params.openId = md5(nickName)
const params_ = {
url: tornadoAPI,
method: 'post',
data: params,
dataType: 'json'
}
return await myRequest(params_, loading)
}
/**
* 请求风池台接口数据
* @param tornadoAPI
* @param nickName
* @param handle
* @param loading
* @param params
*/
export const tornadoAPIFn = async (tornadoAPI: string, nickName: string, handle: string, loading: boolean, params: any) => {
// 处理涉及的三个参数
let matchRes = tornadoAPI.match(/db=(\w*)&proxyIp=([\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})/)
let db = matchRes[1]
let proxyIp = matchRes[2]
let data_ = {
handler: handle,
data: params
}
console.log(`data_`, data_)
let params_ = {
db,
proxyIp,
data: data_
}
if (!db || !proxyIp) {
commonConfirm('风驰台地址错误','请确认风驰台的地址是否正确,未查找到db和proxyIp')
return false
}
// nickName 转 md5 作为唯一的openId
if (!nickName) {
return getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
}).then(res=> {
return tornadoAPICb(params_, res, loading, tornadoAPI)
})
}
}
/**
* 请求mock数据
* @param reqConfig
* @param initConfig
* @param params
*/
export const requestMock = async (reqConfig: IReqConfig, initConfig: IInitConfig, params: any) => {
const { cloudName, handle, method, isShowLoading } = reqConfig
const { requestType, tornadoAPI, nickName, mockUrlPrefix, mockUrl } = initConfig
// 若请求的是风驰台的api
if (requestType === 'tornadoAPI') {
return await tornadoAPIFn(tornadoAPI, nickName, handle, isShowLoading, params)
}
const requestPrefix = mockUrl || mockUrlPrefix[requestType];
const params_ = {
url: requestPrefix + cloudName + '.' + handle,
method: 'get',
data: params,
dataType: 'json'
}
return await myRequest(params_, isShowLoading)
}
\ No newline at end of file
import * as tb from './core/tb';
import * as tbFn from './core/tbFn';
import * as tbMock from './core/tbMock';
import * as utils from './utils';
import * as constants from './constants';
import capi from './request/capi';
import capiFn from './request/capiFn';
import request from './request';
let _tb = {};
Object.entries({ ...tb, ...tbFn }).forEach(([key, value]) => {
_tb[key] = value;
});
export default {
capi,
capiFn,
tb: _tb,
utils,
request,
constants
}
\ No newline at end of file
const capi = {
getMyPrizeList: {
method: 'GET',
handle: 'getMyPrizeList',
isShowLoading: false
},
receiveObjectPrize: { method: 'GET', handle: 'receiveObjectPrize' },
receiveEnamePrize: { method: 'GET', handle: 'receiveEnamePrize' },
getItemListByItemIds: { method: 'GET', handle: 'getItemListByItemIds' },
getCollectGoodsList: { method: 'GET', handle: 'getCollectGoodsList' },
doCompleteTask: { method: 'GET', handle: 'doCompleteTask' },
getVipInfo: { method: 'GET', handle: 'getVipInfo' }
};
export default capi;
\ No newline at end of file
import { commonToast, commonConfirm } from '../core/tb';
import { getUserAddress } from '../core/tbFn';
import { getRequestParams } from '../utils';
// 通用API封装方法
const capiFn = (apiList, request) => {
return {
async receiveObjectPrize(params) {
const { handle, method, ext } = getRequestParams(apiList['receiveObjectPrize']);
const userAddress: IAddress = await getUserAddress().catch(err => {
commonToast(err.errorMessage);
});
if(!userAddress) return false
const { name, telNumber, provinceName, cityName, cityCode, countyName, detailInfo, streetName } = userAddress || {};
params = {
name,
phone: telNumber,
addressDetail: detailInfo,
cityCode,
city: cityName,
province: provinceName,
area: countyName,
streetName,
...params
}
await commonConfirm('提示', '确认使用该收货地址:' + name + telNumber + userAddress.duibaAddress.address, async function() {
const result = await request(handle, method, params, ext).catch(res => {
commonToast(res && res.message);
});
if (result && result.success) {
return true;
}
})
return false
},
async getVipInfo(params) {
const { handle, method, ext } = getRequestParams(apiList['getVipInfo']);
const result = await request(handle, method, params, ext).catch(res => {
commonToast(res && res.message);
});
if (result && result.success) {
const { isVip } = result.data
return isVip;
}
return false;
},
async receiveEnamePrize(params) {
const { handle, method, ext } = getRequestParams(apiList['receiveEnamePrize']);
const result = await request(handle, method, params, ext).catch(res => {
commonToast(res && res.message);
});
if (result && result.success) {
return true;
}
return false;
},
async addStat(type: number | string) {
const { handle, method, ext } = getRequestParams(apiList['addStat']);
const result = await request(handle, method, {
type
}, ext).catch(res => {
commonToast(res && res.message);
});
if (result && result.success) {
return true;
}
return false;
},
}
};
export default capiFn;
import { requestMock } from '../helpers/requestFn';
import { cloudRequest } from '../helpers';
/**
* 接口请求封装
* @param { cloud, cloudName, requestType, mockUrl }
*/
const request = (header:IRequest) => {
const { cloud, cloudName, requestType = 'cloud', mockUrl } = header
if (!cloud) {
console.error('请传入cloud');
return false;
}
if (!cloudName) {
console.error('请传入云函数名称');
return false;
}
return async (handle, method = 'POST', params, ext?: { cloudName?: string, isShowLoading?: boolean, toastError?: boolean }) => {
// @ts-ignore
const { activityId, tornadoAPI, nickName = '' } = getApp();
const _cloudName = ext.cloudName || cloudName;
const { isShowLoading = false, toastError = true } = ext;
const mockUrlPrefix = {
ams: 'https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri=',
yapi: 'https://docs.dui88.com/mock/140/'
};
const reqConfig = { cloudName: _cloudName, handle, method, isShowLoading }
const initConfig = { requestType, tornadoAPI, nickName, mockUrlPrefix, mockUrl }
const params_ = { activityId, ...params }
if (['ams', 'yapi', 'tornadoAPI'].includes(requestType)) return await requestMock(reqConfig, initConfig, params_);
return await cloudRequest(cloud, _cloudName, handle, params_, isShowLoading, toastError);
}
}
export default request
\ No newline at end of file
/** @format */
interface IParamJSAPI {
title?: string
content?: string
duration?: number
success?: (t?: any) => any
url?: string
delta?: number
confirmButtonText?: string
cancelButtonText?: string
}
interface IAddress {
name?: string
telNumber?: string
provinceName?: string
cityName?: string
cityCode?:string
countyName?: string
detailInfo?: string
streetName?: string
duibaAddress?: ISubAddress
}
interface ISubAddress {
address: string
}
interface IRequest {
cloud: string
cloudName: string
requestType?: string
mockUrl?: string
}
interface IReqConfig {
cloudName: string
handle: string
method: string
isShowLoading: boolean
}
interface IInitConfig {
requestType: string
tornadoAPI: string
nickName: string
mockUrlPrefix: IMockUrlPrefix
mockUrl: string
}
interface IMockUrlPrefix {
ams: string
yapi: string
}
interface IRequestInfo {
group_id: string
weex_data_json: string
message_id: string
card_template_id: string
app_secret: string
biz_ext_map?: string
app_code?: string
wx_display_name?: string
wx_display_type?: string
target_open_id?: string
at_open_id?: string
target_user_nick?: string
at_user_nick?: string
}
interface ISkuInfo {
status: string
itemId: string
skuId: string
quantity: string
}
\ No newline at end of file
import { commonToast, getServerTime } from '../core/tb';
/**
* 时间格式化
* @param date 接收可以被new Date()方法转换的内容
* @param format 字符串,需要的格式例如:'yyyy/MM/dd hh:mm:ss'
* @returns {String}
*/
export const dateFormatter = (dateTxt: string, format = 'yyyy/MM/dd') => {
if (!dateTxt) return '-';
const date = new Date(
typeof dateTxt === 'string' && isNaN(+dateTxt) ? dateTxt.replace(/-/g, '/') : dateTxt
);
let o = {
'M+': date.getMonth() + 1,
'd+': date.getDate(),
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds(),
'q+': Math.floor((date.getMonth() + 3) / 3),
S: date.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(
RegExp.$1,
(date.getFullYear() + '').substr(4 - RegExp.$1.length)
);
}
for (let k in o) {
if (new RegExp('(' + k + ')').test(format)) {
format = format.replace(
RegExp.$1,
RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
);
}
}
return format;
};
/**
* 版本比较
* @param {string} cur 当前版本
* @param {string} compare 比较版本
*/
export const versionCompare = (cur: string, compare: string) => {
const _cur = cur.split('.');
const _compare = compare.split('.');
if (+_cur[0] < +_compare[0]) {
return false;
} else if ( +_cur[0] === +_compare[0] && +_cur[1] < +_compare[1] ) {
return false;
} else if (+_cur[0] === +_compare[0] && +_cur[1] === +_compare[1] && +_cur[2] < +_compare[2]) {
return false;
}
return true;
};
/**
* 获取request请求所需参数
* @param {object/string} value API项配置
*/
export const getRequestParams = (value: any) => {
if (typeof value === 'string') {
return {
handle: value,
method: 'POST',
ext: {}
}
} else if (typeof value === 'object') {
const { handle, method = 'POST', defaultParams = {}, ...ext } = value;
return {
handle,
method,
defaultParams,
ext: { ...ext }
}
} else {
console.error('getRequestParams: 传参有误');
}
};
type IApis<T> = {
[P in keyof T]: (params?: object, config?: {
isShowLoading?: boolean, // 请求是否loading
toastError?: boolean // 请求失败是否 toast错误
}) => {}
}
/**
* 生成API
* @param {array} apiList API数据数组
* @param {function} request 请求
*/
export const generateAPI = <T, K extends Function>(apiList: T, request: K): IApis<T> => {
// @ts-ignore
const api: IApis<typeof apiList> = {};
Object.entries(apiList).forEach(([key, value]) => {
const { handle, method, ext, defaultParams } = getRequestParams(value);
api[key] = (params, config = {}) => request(handle, method, Object.assign({}, defaultParams, params) , Object.assign({}, ext, config));
});
return api;
// return Object.keys(apiList).reduce((prev, curr) => {
// const { handle, method, ext, defaultParams } = getRequestParams(apiList[curr]);
// return {
// ...prev,
// [curr]: params => request(handle, method, Object.assign({}, defaultParams, params) , ext)
// }
// }, {})
};
/**
* 函数节流,普通防连点
* @param {fun} fun 函数
* @param {delay} delay 时间
*/
export const throttleHandle = (fun: (t: any) => any, delay: number = 1000) => {
let last: number, deferTimer: any;
return function () {
let now = +new Date();
if (last && now < last + delay) {
clearTimeout(deferTimer);
deferTimer = setTimeout(() => {
last = now;
}, delay);
} else {
last = now;
fun.apply(this, arguments);
}
};
}
/**
* 根据fileId获取图片地址
* @param fileId
*/
export const getImgShareUrl = async (fileId: string | Array<string>) => {
// @ts-ignore
const { cloud } = getApp()
let list = await cloud.file.getTempFileURL({ fileId })
if(typeof fileId === 'string') return list && list[0].url
return list
}
/**
* 根据sellerId判断入会状态
* @param sellerId
*/
export const checkIsMember = async (sellerId: number) => {
// @ts-ignore
const memberPlugin = requirePlugin("cemMember");
return new Promise((resolve,reject) => {
memberPlugin.checkMember({
sellerId,
success: (res) => {
console.log('会员检查成功 :>> ', res)
let isMember = res?.businessSuccess && res?.data?.isMember === 'true'
resolve(isMember)
},
fail: (res) => {
console.log('会员检查失败 :>> ', res)
console.warn('checkMember 需在真机上调试')
reject(res)
}
})
})
}
/**
* 毫秒转换成00:00:00格式
* @param ms 毫秒
*/
export const formatTimeStamp = (ms: number) => {
let hours: number | string = parseInt(String(ms / (1000 * 60 * 60))),
minutes: number | string = parseInt(String((ms % (1000 * 60 * 60)) / (1000 * 60))),
seconds: number | string = parseInt(String((ms % (1000 * 60)) / 1000));
hours = hours < 10 ? '0' + hours : hours;
minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds;
return `${hours}:${minutes}:${seconds}`
}
/**
* 活动状态验证
* @param startTime
* @param endTime
* @param noCheck
*/
export const validateActivityStatus = async (startTime: number, endTime: number, noCheck: boolean) => {
const nowTime = await getServerTime()
return new Promise((resolve,reject) => {
if(nowTime < startTime ) {
commonToast('活动未开始')
resolve(false)
}
else if(nowTime > endTime && !noCheck) {
commonToast('活动已结束')
resolve(false)
}
else {
resolve(true)
}
})
}
\ No newline at end of file
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"lib": [
"es6", "dom", "es7"
],
"typeRoots": ["./node_modules/@types/", "./src/typings/"],
"outDir": "./lib",
"sourceMap": true,
"module": "commonjs",
"watch": true,
"moduleResolution": "node",
"allowJs": true,
"isolatedModules": false,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"suppressImplicitAnyIndexErrors": true
},
"include": [
"./src/**/*"
],
"exclude": [
"./lib/**/*"
]
}
\ No newline at end of file
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/code-frame@^7.0.0":
version "7.12.13"
resolved "http://npm.dui88.com:80/@babel%2fcode-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658"
integrity sha1-3PyCa+72XnXFDiHTg319lXmN1lg=
dependencies:
"@babel/highlight" "^7.12.13"
"@babel/helper-validator-identifier@^7.12.11":
version "7.12.11"
resolved "http://npm.dui88.com:80/@babel%2fhelper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed"
integrity sha1-yaHwIZF9y1zPDU5FPjmQIpgfye0=
"@babel/highlight@^7.12.13":
version "7.12.13"
resolved "http://npm.dui88.com:80/@babel%2fhighlight/-/highlight-7.12.13.tgz#8ab538393e00370b26271b01fa08f7f27f2e795c"
integrity sha1-irU4OT4ANwsmJxsB+gj38n8ueVw=
dependencies:
"@babel/helper-validator-identifier" "^7.12.11"
chalk "^2.0.0"
js-tokens "^4.0.0"
"@eslint/eslintrc@^0.3.0":
version "0.3.0"
resolved "http://npm.dui88.com:80/@eslint%2feslintrc/-/eslintrc-0.3.0.tgz#d736d6963d7003b6514e6324bec9c602ac340318"
integrity sha1-1zbWlj1wA7ZRTmMkvsnGAqw0Axg=
dependencies:
ajv "^6.12.4"
debug "^4.1.1"
espree "^7.3.0"
globals "^12.1.0"
ignore "^4.0.6"
import-fresh "^3.2.1"
js-yaml "^3.13.1"
lodash "^4.17.20"
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
"@types/eslint-visitor-keys@^1.0.0":
version "1.0.0"
resolved "http://npm.dui88.com:80/@types%2feslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d"
integrity sha1-HuMNeVRMqE1o1LPNsK9PIFZj3S0=
"@types/json-schema@^7.0.3":
version "7.0.7"
resolved "http://npm.dui88.com:80/@types%2fjson-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad"
integrity sha1-mKmTUWyFnrDVxMjwmDF6nqaNua0=
"@types/lodash@^4.14.160":
version "4.14.168"
resolved "http://npm.dui88.com:80/@types%2flodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
integrity sha1-/iRjLnm3rePxMoka//hsql5c4Ag=
"@types/node@^14.6.0":
version "14.14.25"
resolved "http://npm.dui88.com:80/@types%2fnode/-/node-14.14.25.tgz#15967a7b577ff81383f9b888aa6705d43fbbae93"
integrity sha1-FZZ6e1d/+BOD+biIqmcF1D+7rpM=
"@typescript-eslint/eslint-plugin@^3.9.1":
version "3.10.1"
resolved "http://npm.dui88.com:80/@typescript-eslint%2feslint-plugin/-/eslint-plugin-3.10.1.tgz#7e061338a1383f59edc204c605899f93dc2e2c8f"
integrity sha1-fgYTOKE4P1ntwgTGBYmfk9wuLI8=
dependencies:
"@typescript-eslint/experimental-utils" "3.10.1"
debug "^4.1.1"
functional-red-black-tree "^1.0.1"
regexpp "^3.0.0"
semver "^7.3.2"
tsutils "^3.17.1"
"@typescript-eslint/experimental-utils@3.10.1":
version "3.10.1"
resolved "http://npm.dui88.com:80/@typescript-eslint%2fexperimental-utils/-/experimental-utils-3.10.1.tgz#e179ffc81a80ebcae2ea04e0332f8b251345a686"
integrity sha1-4Xn/yBqA68ri6gTgMy+LJRNFpoY=
dependencies:
"@types/json-schema" "^7.0.3"
"@typescript-eslint/types" "3.10.1"
"@typescript-eslint/typescript-estree" "3.10.1"
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"
"@typescript-eslint/parser@^3.9.1":
version "3.10.1"
resolved "http://npm.dui88.com:80/@typescript-eslint%2fparser/-/parser-3.10.1.tgz#1883858e83e8b442627e1ac6f408925211155467"
integrity sha1-GIOFjoPotEJifhrG9AiSUhEVVGc=
dependencies:
"@types/eslint-visitor-keys" "^1.0.0"
"@typescript-eslint/experimental-utils" "3.10.1"
"@typescript-eslint/types" "3.10.1"
"@typescript-eslint/typescript-estree" "3.10.1"
eslint-visitor-keys "^1.1.0"
"@typescript-eslint/types@3.10.1":
version "3.10.1"
resolved "http://npm.dui88.com:80/@typescript-eslint%2ftypes/-/types-3.10.1.tgz#1d7463fa7c32d8a23ab508a803ca2fe26e758727"
integrity sha1-HXRj+nwy2KI6tQioA8ov4m51hyc=
"@typescript-eslint/typescript-estree@3.10.1":
version "3.10.1"
resolved "http://npm.dui88.com:80/@typescript-eslint%2ftypescript-estree/-/typescript-estree-3.10.1.tgz#fd0061cc38add4fad45136d654408569f365b853"
integrity sha1-/QBhzDit1PrUUTbWVECFafNluFM=
dependencies:
"@typescript-eslint/types" "3.10.1"
"@typescript-eslint/visitor-keys" "3.10.1"
debug "^4.1.1"
glob "^7.1.6"
is-glob "^4.0.1"
lodash "^4.17.15"
semver "^7.3.2"
tsutils "^3.17.1"
"@typescript-eslint/visitor-keys@3.10.1":
version "3.10.1"
resolved "http://npm.dui88.com:80/@typescript-eslint%2fvisitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931"
integrity sha1-zUJ0dz4+tjsuhwrGAidEh+zR6TE=
dependencies:
eslint-visitor-keys "^1.1.0"
acorn-jsx@^5.3.1:
version "5.3.1"
resolved "http://npm.dui88.com:80/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b"
integrity sha1-/IZh4Rt6wVOcR9v+oucrOvNNJns=
acorn@^7.4.0:
version "7.4.1"
resolved "http://npm.dui88.com:80/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
integrity sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=
ajv@^6.10.0, ajv@^6.12.4:
version "6.12.6"
resolved "http://npm.dui88.com:80/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4"
integrity sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=
dependencies:
fast-deep-equal "^3.1.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ajv@^7.0.2:
version "7.0.4"
resolved "http://npm.dui88.com:80/ajv/-/ajv-7.0.4.tgz#827e5f5ae32f5e5c1637db61f253a112229b5e2f"
integrity sha1-gn5fWuMvXlwWN9th8lOhEiKbXi8=
dependencies:
fast-deep-equal "^3.1.1"
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"
uri-js "^4.2.2"
ansi-colors@^4.1.1:
version "4.1.1"
resolved "http://npm.dui88.com:80/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348"
integrity sha1-y7muJWv3UK8eqzRPIpqif+lLo0g=
ansi-regex@^5.0.0:
version "5.0.0"
resolved "http://npm.dui88.com:80/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
integrity sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=
ansi-styles@^3.2.1:
version "3.2.1"
resolved "http://npm.dui88.com:80/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
integrity sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=
dependencies:
color-convert "^1.9.0"
ansi-styles@^4.0.0, ansi-styles@^4.1.0:
version "4.3.0"
resolved "http://npm.dui88.com:80/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
integrity sha1-7dgDYornHATIWuegkG7a00tkiTc=
dependencies:
color-convert "^2.0.1"
arg@^4.1.0:
version "4.1.3"
resolved "http://npm.dui88.com:80/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
integrity sha1-Jp/HrVuOQstjyJbVZmAXJhwUQIk=
argparse@^1.0.7:
version "1.0.10"
resolved "http://npm.dui88.com:80/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
integrity sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=
dependencies:
sprintf-js "~1.0.2"
astral-regex@^2.0.0:
version "2.0.0"
resolved "http://npm.dui88.com:80/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31"
integrity sha1-SDFDxWeu7UeFdZwIZXhtx319LjE=
balanced-match@^1.0.0:
version "1.0.0"
resolved "http://npm.dui88.com:80/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
brace-expansion@^1.1.7:
version "1.1.11"
resolved "http://npm.dui88.com:80/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
buffer-from@^1.0.0:
version "1.1.1"
resolved "http://npm.dui88.com:80/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
integrity sha1-MnE7wCj3XAL9txDXx7zsHyxgcO8=
callsites@^3.0.0:
version "3.1.0"
resolved "http://npm.dui88.com:80/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
integrity sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M=
chalk@^2.0.0:
version "2.4.2"
resolved "http://npm.dui88.com:80/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ=
dependencies:
ansi-styles "^3.2.1"
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
chalk@^4.0.0:
version "4.1.0"
resolved "http://npm.dui88.com:80/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a"
integrity sha1-ThSHCmGNni7dl92DRf2dncMVZGo=
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
color-convert@^1.9.0:
version "1.9.3"
resolved "http://npm.dui88.com:80/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
integrity sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=
dependencies:
color-name "1.1.3"
color-convert@^2.0.1:
version "2.0.1"
resolved "http://npm.dui88.com:80/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
integrity sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=
dependencies:
color-name "~1.1.4"
color-name@1.1.3:
version "1.1.3"
resolved "http://npm.dui88.com:80/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
color-name@~1.1.4:
version "1.1.4"
resolved "http://npm.dui88.com:80/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=
concat-map@0.0.1:
version "0.0.1"
resolved "http://npm.dui88.com:80/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
create-require@^1.1.0:
version "1.1.1"
resolved "http://npm.dui88.com:80/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha1-wdfo8eX2z8n/ZfnNNS03NIdWwzM=
cross-spawn@^7.0.2:
version "7.0.3"
resolved "http://npm.dui88.com:80/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha1-9zqFudXUHQRVUcF34ogtSshXKKY=
dependencies:
path-key "^3.1.0"
shebang-command "^2.0.0"
which "^2.0.1"
debug@^4.0.1, debug@^4.1.1:
version "4.3.1"
resolved "http://npm.dui88.com:80/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee"
integrity sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=
dependencies:
ms "2.1.2"
deep-is@^0.1.3:
version "0.1.3"
resolved "http://npm.dui88.com:80/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
diff@^4.0.1:
version "4.0.2"
resolved "http://npm.dui88.com:80/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha1-YPOuy4nV+uUgwRqhnvwruYKq3n0=
doctrine@^3.0.0:
version "3.0.0"
resolved "http://npm.dui88.com:80/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961"
integrity sha1-rd6+rXKmV023g2OdyHoSF3OXOWE=
dependencies:
esutils "^2.0.2"
emoji-regex@^8.0.0:
version "8.0.0"
resolved "http://npm.dui88.com:80/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=
enquirer@^2.3.5:
version "2.3.6"
resolved "http://npm.dui88.com:80/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d"
integrity sha1-Kn/l3WNKHkElqXXsmU/1RW3Dc00=
dependencies:
ansi-colors "^4.1.1"
escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "http://npm.dui88.com:80/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
eslint-config-prettier@^6.11.0:
version "6.15.0"
resolved "http://npm.dui88.com:80/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9"
integrity sha1-f5P2y31FqS8VN6cOzAY2bhrG/tk=
dependencies:
get-stdin "^6.0.0"
eslint-plugin-prettier@^3.1.4:
version "3.3.1"
resolved "http://npm.dui88.com:80/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz#7079cfa2497078905011e6f82e8dd8453d1371b7"
integrity sha1-cHnPoklweJBQEeb4Lo3YRT0Tcbc=
dependencies:
prettier-linter-helpers "^1.0.0"
eslint-scope@^5.0.0, eslint-scope@^5.1.1:
version "5.1.1"
resolved "http://npm.dui88.com:80/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
integrity sha1-54blmmbLkrP2wfsNUIqrF0hI9Iw=
dependencies:
esrecurse "^4.3.0"
estraverse "^4.1.1"
eslint-utils@^2.0.0, eslint-utils@^2.1.0:
version "2.1.0"
resolved "http://npm.dui88.com:80/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27"
integrity sha1-0t5eA0JOcH3BDHQGjd7a5wh0Gyc=
dependencies:
eslint-visitor-keys "^1.1.0"
eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0:
version "1.3.0"
resolved "http://npm.dui88.com:80/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
integrity sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=
eslint-visitor-keys@^2.0.0:
version "2.0.0"
resolved "http://npm.dui88.com:80/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
integrity sha1-If3I+82ceVzAMh8FY3AglXUVEag=
eslint@^7.7.0:
version "7.19.0"
resolved "http://npm.dui88.com:80/eslint/-/eslint-7.19.0.tgz#6719621b196b5fad72e43387981314e5d0dc3f41"
integrity sha1-ZxliGxlrX61y5DOHmBMU5dDcP0E=
dependencies:
"@babel/code-frame" "^7.0.0"
"@eslint/eslintrc" "^0.3.0"
ajv "^6.10.0"
chalk "^4.0.0"
cross-spawn "^7.0.2"
debug "^4.0.1"
doctrine "^3.0.0"
enquirer "^2.3.5"
eslint-scope "^5.1.1"
eslint-utils "^2.1.0"
eslint-visitor-keys "^2.0.0"
espree "^7.3.1"
esquery "^1.2.0"
esutils "^2.0.2"
file-entry-cache "^6.0.0"
functional-red-black-tree "^1.0.1"
glob-parent "^5.0.0"
globals "^12.1.0"
ignore "^4.0.6"
import-fresh "^3.0.0"
imurmurhash "^0.1.4"
is-glob "^4.0.0"
js-yaml "^3.13.1"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.4.1"
lodash "^4.17.20"
minimatch "^3.0.4"
natural-compare "^1.4.0"
optionator "^0.9.1"
progress "^2.0.0"
regexpp "^3.1.0"
semver "^7.2.1"
strip-ansi "^6.0.0"
strip-json-comments "^3.1.0"
table "^6.0.4"
text-table "^0.2.0"
v8-compile-cache "^2.0.3"
espree@^7.3.0, espree@^7.3.1:
version "7.3.1"
resolved "http://npm.dui88.com:80/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6"
integrity sha1-8t8zC3Usb1UBn4vYm3ZgA5wbu7Y=
dependencies:
acorn "^7.4.0"
acorn-jsx "^5.3.1"
eslint-visitor-keys "^1.3.0"
esprima@^4.0.0:
version "4.0.1"
resolved "http://npm.dui88.com:80/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=
esquery@^1.2.0:
version "1.4.0"
resolved "http://npm.dui88.com:80/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5"
integrity sha1-IUj/w4uC6McFff7UhCWz5h8PJKU=
dependencies:
estraverse "^5.1.0"
esrecurse@^4.3.0:
version "4.3.0"
resolved "http://npm.dui88.com:80/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921"
integrity sha1-eteWTWeauyi+5yzsY3WLHF0smSE=
dependencies:
estraverse "^5.2.0"
estraverse@^4.1.1:
version "4.3.0"
resolved "http://npm.dui88.com:80/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d"
integrity sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0=
estraverse@^5.1.0, estraverse@^5.2.0:
version "5.2.0"
resolved "http://npm.dui88.com:80/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880"
integrity sha1-MH30JUfmzHMk088DwVXVzbjFOIA=
esutils@^2.0.2:
version "2.0.3"
resolved "http://npm.dui88.com:80/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
integrity sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=
fast-deep-equal@^3.1.1:
version "3.1.3"
resolved "http://npm.dui88.com:80/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=
fast-diff@^1.1.2:
version "1.2.0"
resolved "http://npm.dui88.com:80/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
integrity sha1-c+4RmC2Gyq95WYKNUZz+kn+sXwM=
fast-json-stable-stringify@^2.0.0:
version "2.1.0"
resolved "http://npm.dui88.com:80/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
integrity sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=
fast-levenshtein@^2.0.6:
version "2.0.6"
resolved "http://npm.dui88.com:80/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=
file-entry-cache@^6.0.0:
version "6.0.0"
resolved "http://npm.dui88.com:80/file-entry-cache/-/file-entry-cache-6.0.0.tgz#7921a89c391c6d93efec2169ac6bf300c527ea0a"
integrity sha1-eSGonDkcbZPv7CFprGvzAMUn6go=
dependencies:
flat-cache "^3.0.4"
flat-cache@^3.0.4:
version "3.0.4"
resolved "http://npm.dui88.com:80/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
integrity sha1-YbAzgwKy/p+Vfcwy/CqH8cMEixE=
dependencies:
flatted "^3.1.0"
rimraf "^3.0.2"
flatted@^3.1.0:
version "3.1.1"
resolved "http://npm.dui88.com:80/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469"
integrity sha1-xLSJ6ACW2d8d/JfHmHGup8YXxGk=
fs.realpath@^1.0.0:
version "1.0.0"
resolved "http://npm.dui88.com:80/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
functional-red-black-tree@^1.0.1:
version "1.0.1"
resolved "http://npm.dui88.com:80/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
get-stdin@^6.0.0:
version "6.0.0"
resolved "http://npm.dui88.com:80/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b"
integrity sha1-ngm/cSs2CrkiXoEgSPcf3pyJZXs=
glob-parent@^5.0.0:
version "5.1.1"
resolved "http://npm.dui88.com:80/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229"
integrity sha1-tsHvQXxOVmPqSY8cRa+saRa7wik=
dependencies:
is-glob "^4.0.1"
glob@^7.1.3, glob@^7.1.6:
version "7.1.6"
resolved "http://npm.dui88.com:80/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
globals@^12.1.0:
version "12.4.0"
resolved "http://npm.dui88.com:80/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8"
integrity sha1-oYgTV2pBsAokqX5/gVkYwuGZJfg=
dependencies:
type-fest "^0.8.1"
has-flag@^3.0.0:
version "3.0.0"
resolved "http://npm.dui88.com:80/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
has-flag@^4.0.0:
version "4.0.0"
resolved "http://npm.dui88.com:80/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=
ignore@^4.0.6:
version "4.0.6"
resolved "http://npm.dui88.com:80/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
integrity sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=
import-fresh@^3.0.0, import-fresh@^3.2.1:
version "3.3.0"
resolved "http://npm.dui88.com:80/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b"
integrity sha1-NxYsJfy566oublPVtNiM4X2eDCs=
dependencies:
parent-module "^1.0.0"
resolve-from "^4.0.0"
imurmurhash@^0.1.4:
version "0.1.4"
resolved "http://npm.dui88.com:80/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
inflight@^1.0.4:
version "1.0.6"
resolved "http://npm.dui88.com:80/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2:
version "2.0.4"
resolved "http://npm.dui88.com:80/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=
is-extglob@^2.1.1:
version "2.1.1"
resolved "http://npm.dui88.com:80/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=
is-fullwidth-code-point@^3.0.0:
version "3.0.0"
resolved "http://npm.dui88.com:80/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
integrity sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=
is-glob@^4.0.0, is-glob@^4.0.1:
version "4.0.1"
resolved "http://npm.dui88.com:80/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc"
integrity sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=
dependencies:
is-extglob "^2.1.1"
isexe@^2.0.0:
version "2.0.0"
resolved "http://npm.dui88.com:80/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
js-tokens@^4.0.0:
version "4.0.0"
resolved "http://npm.dui88.com:80/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha1-GSA/tZmR35jjoocFDUZHzerzJJk=
js-yaml@^3.13.1:
version "3.14.1"
resolved "http://npm.dui88.com:80/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
integrity sha1-2ugS/bOCX6MGYJqHFzg8UMNqBTc=
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"
json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "http://npm.dui88.com:80/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
integrity sha1-afaofZUTq4u4/mO9sJecRI5oRmA=
json-schema-traverse@^1.0.0:
version "1.0.0"
resolved "http://npm.dui88.com:80/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2"
integrity sha1-rnvLNlard6c7pcSb9lTzjmtoYOI=
json-stable-stringify-without-jsonify@^1.0.1:
version "1.0.1"
resolved "http://npm.dui88.com:80/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=
levn@^0.4.1:
version "0.4.1"
resolved "http://npm.dui88.com:80/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade"
integrity sha1-rkViwAdHO5MqYgDUAyaN0v/8at4=
dependencies:
prelude-ls "^1.2.1"
type-check "~0.4.0"
lodash@^4.17.15, lodash@^4.17.20:
version "4.17.20"
resolved "http://npm.dui88.com:80/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha1-tEqbYpe8tpjxxRo1RaKzs2jVnFI=
lru-cache@^6.0.0:
version "6.0.0"
resolved "http://npm.dui88.com:80/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
integrity sha1-bW/mVw69lqr5D8rR2vo7JWbbOpQ=
dependencies:
yallist "^4.0.0"
make-error@^1.1.1:
version "1.3.6"
resolved "http://npm.dui88.com:80/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
integrity sha1-LrLjfqm2fEiR9oShOUeZr0hM96I=
minimatch@^3.0.4:
version "3.0.4"
resolved "http://npm.dui88.com:80/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=
dependencies:
brace-expansion "^1.1.7"
ms@2.1.2:
version "2.1.2"
resolved "http://npm.dui88.com:80/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=
natural-compare@^1.4.0:
version "1.4.0"
resolved "http://npm.dui88.com:80/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=
once@^1.3.0:
version "1.4.0"
resolved "http://npm.dui88.com:80/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
dependencies:
wrappy "1"
optionator@^0.9.1:
version "0.9.1"
resolved "http://npm.dui88.com:80/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499"
integrity sha1-TyNqY3Pa4FZqbUPhMmZ09QwpFJk=
dependencies:
deep-is "^0.1.3"
fast-levenshtein "^2.0.6"
levn "^0.4.1"
prelude-ls "^1.2.1"
type-check "^0.4.0"
word-wrap "^1.2.3"
parent-module@^1.0.0:
version "1.0.1"
resolved "http://npm.dui88.com:80/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
integrity sha1-aR0nCeeMefrjoVZiJFLQB2LKqqI=
dependencies:
callsites "^3.0.0"
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "http://npm.dui88.com:80/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
path-key@^3.1.0:
version "3.1.1"
resolved "http://npm.dui88.com:80/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=
prelude-ls@^1.2.1:
version "1.2.1"
resolved "http://npm.dui88.com:80/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha1-3rxkidem5rDnYRiIzsiAM30xY5Y=
prettier-linter-helpers@^1.0.0:
version "1.0.0"
resolved "http://npm.dui88.com:80/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
integrity sha1-0j1B/hN1ZG3i0BBNNFSjAIgCz3s=
dependencies:
fast-diff "^1.1.2"
prettier@^2.0.5:
version "2.2.1"
resolved "http://npm.dui88.com:80/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
integrity sha1-eVoaeN1S8HPaDNQrIfnJE4GSP/U=
progress@^2.0.0:
version "2.0.3"
resolved "http://npm.dui88.com:80/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
integrity sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=
punycode@^2.1.0:
version "2.1.1"
resolved "http://npm.dui88.com:80/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha1-tYsBCsQMIsVldhbI0sLALHv0eew=
regexpp@^3.0.0, regexpp@^3.1.0:
version "3.1.0"
resolved "http://npm.dui88.com:80/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2"
integrity sha1-IG0K0KVkjP+9uK5GQ489xRyfeOI=
require-from-string@^2.0.2:
version "2.0.2"
resolved "http://npm.dui88.com:80/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"
integrity sha1-iaf92TgmEmcxjq/hT5wy5ZjDaQk=
resolve-from@^4.0.0:
version "4.0.0"
resolved "http://npm.dui88.com:80/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
integrity sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY=
rimraf@^3.0.2:
version "3.0.2"
resolved "http://npm.dui88.com:80/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
integrity sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=
dependencies:
glob "^7.1.3"
semver@^7.2.1, semver@^7.3.2:
version "7.3.4"
resolved "http://npm.dui88.com:80/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97"
integrity sha1-J6qn0uTKdkUvmNOt0JOnLJQ+3Jc=
dependencies:
lru-cache "^6.0.0"
shebang-command@^2.0.0:
version "2.0.0"
resolved "http://npm.dui88.com:80/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
integrity sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=
dependencies:
shebang-regex "^3.0.0"
shebang-regex@^3.0.0:
version "3.0.0"
resolved "http://npm.dui88.com:80/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
integrity sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=
slice-ansi@^4.0.0:
version "4.0.0"
resolved "http://npm.dui88.com:80/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b"
integrity sha1-UA6N0P1VsFgVCGJVsxla3ypF/ms=
dependencies:
ansi-styles "^4.0.0"
astral-regex "^2.0.0"
is-fullwidth-code-point "^3.0.0"
source-map-support@^0.5.17:
version "0.5.19"
resolved "http://npm.dui88.com:80/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
integrity sha1-qYti+G3K9PZzmWSMCFKRq56P7WE=
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"
source-map@^0.6.0:
version "0.6.1"
resolved "http://npm.dui88.com:80/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha1-dHIq8y6WFOnCh6jQu95IteLxomM=
sprintf-js@~1.0.2:
version "1.0.3"
resolved "http://npm.dui88.com:80/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
string-width@^4.2.0:
version "4.2.0"
resolved "http://npm.dui88.com:80/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5"
integrity sha1-lSGCxGzHssMT0VluYjmSvRY7crU=
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.0"
strip-ansi@^6.0.0:
version "6.0.0"
resolved "http://npm.dui88.com:80/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532"
integrity sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=
dependencies:
ansi-regex "^5.0.0"
strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
version "3.1.1"
resolved "http://npm.dui88.com:80/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha1-MfEoGzgyYwQ0gxwxDAHMzajL4AY=
supports-color@^5.3.0:
version "5.5.0"
resolved "http://npm.dui88.com:80/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
integrity sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=
dependencies:
has-flag "^3.0.0"
supports-color@^7.1.0:
version "7.2.0"
resolved "http://npm.dui88.com:80/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
integrity sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=
dependencies:
has-flag "^4.0.0"
table@^6.0.4:
version "6.0.7"
resolved "http://npm.dui88.com:80/table/-/table-6.0.7.tgz#e45897ffbcc1bcf9e8a87bf420f2c9e5a7a52a34"
integrity sha1-5FiX/7zBvPnoqHv0IPLJ5aelKjQ=
dependencies:
ajv "^7.0.2"
lodash "^4.17.20"
slice-ansi "^4.0.0"
string-width "^4.2.0"
text-table@^0.2.0:
version "0.2.0"
resolved "http://npm.dui88.com:80/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
ts-node@^9.0.0:
version "9.1.1"
resolved "http://npm.dui88.com:80/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d"
integrity sha1-UamkUKPpWUAb2l8ASnLVS5NtN20=
dependencies:
arg "^4.1.0"
create-require "^1.1.0"
diff "^4.0.1"
make-error "^1.1.1"
source-map-support "^0.5.17"
yn "3.1.1"
tslib@^1.8.1:
version "1.14.1"
resolved "http://npm.dui88.com:80/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha1-zy04vcNKE0vK8QkcQfZhni9nLQA=
tsutils@^3.17.1:
version "3.20.0"
resolved "http://npm.dui88.com:80/tsutils/-/tsutils-3.20.0.tgz#ea03ea45462e146b53d70ce0893de453ff24f698"
integrity sha1-6gPqRUYuFGtT1wzgiT3kU/8k9pg=
dependencies:
tslib "^1.8.1"
type-check@^0.4.0, type-check@~0.4.0:
version "0.4.0"
resolved "http://npm.dui88.com:80/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"
integrity sha1-B7ggO/pwVsBlcFDjzNLDdzC6uPE=
dependencies:
prelude-ls "^1.2.1"
type-fest@^0.8.1:
version "0.8.1"
resolved "http://npm.dui88.com:80/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha1-CeJJ696FHTseSNJ8EFREZn8XuD0=
typescript@^3.9.7:
version "3.9.7"
resolved "http://npm.dui88.com:80/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
integrity sha1-mNYApevcOPQMsndSLxLcgA6eJfo=
uri-js@^4.2.2:
version "4.4.1"
resolved "http://npm.dui88.com:80/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
integrity sha1-mxpSWVIlhZ5V9mnZKPiMbFfyp34=
dependencies:
punycode "^2.1.0"
v8-compile-cache@^2.0.3:
version "2.2.0"
resolved "http://npm.dui88.com:80/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132"
integrity sha1-lHHvo++RKNL3xqfKOcTda1BVsTI=
which@^2.0.1:
version "2.0.2"
resolved "http://npm.dui88.com:80/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
integrity sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=
dependencies:
isexe "^2.0.0"
word-wrap@^1.2.3:
version "1.2.3"
resolved "http://npm.dui88.com:80/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
integrity sha1-YQY29rH3A4kb00dxzLF/uTtHB5w=
wrappy@1:
version "1.0.2"
resolved "http://npm.dui88.com:80/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
yallist@^4.0.0:
version "4.0.0"
resolved "http://npm.dui88.com:80/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha1-m7knkNnA7/7GO+c1GeEaNQGaOnI=
yn@3.1.1:
version "3.1.1"
resolved "http://npm.dui88.com:80/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
integrity sha1-HodAGgnXZ8HV6rJqbkwYUYLS61A=
import { Buffer } from 'buffer'
import crypto from 'crypto'
import { commonToast, getAuthUserInfo } from './tb'
const request = ({ cloud, cloudName, requestType = 'cloud', mockUrl }) => {
// if (!cloud) {
// console.error('请传入cloud');
// return false;
// }
// if (!cloudName) {
// console.error('请传入云函数名称');
// return false;
// }
return async(handle, params = {}, ext = {}) => {
const defaultExt = {
method: 'GET',
showLoading: false,
toastError: true
}
ext = Object.assign({}, defaultExt, ext)
const method = ext.method
const { activityId, tornadoAPI, nickName = '' } = getApp()
// 默认注入activityId
params = { activityId, ...params }
if (!params.activityId) {
console.error(`${handle}:请传入activityId`)
return false
}
// console.info(params?.data, handle)
const _cloudName = ext.cloudName || cloudName
const { showLoading } = ext
const hideMyLoading = () => {
if (showLoading) {
my.hideLoading()
}
}
if (showLoading) {
my.showLoading()
}
const requestMock = () => {
// 若请求的是风驰台的api
if (requestType === 'tornadoAPI') {
// 处理涉及的三个参数
const matchRes = tornadoAPI.match(/db=(\w*)&proxyIp=([\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})/)
const db = matchRes[1]
const proxyIp = matchRes[2]
const data_ = {
handler: handle,
data: params
}
console.log('data_', data_)
const params_ = {
db,
proxyIp,
data: data_
}
console.log('params_', params_)
// nickName 转 md5 作为唯一的openId
if (!nickName) {
return getAuthUserInfo().catch(err => {
console.log('未授权成功', err)
}).then(res => {
return cb(res)
})
}
// return cb({nickName: '卞龙亭'})
function cb(userInfo) {
if (!db || !proxyIp) {
my.confirm({
title: '风驰台地址错误',
content: '请确认风驰台的地址是否正确,未查找到db和proxyIp',
confirmButtonText: '确定',
cancelButtonText: '取消'
})
return false
}
// @ts-ignore
params_.openId = md5(userInfo.nickName)
return new Promise((resolve, reject) => {
my.request({
url: tornadoAPI,
method: 'post',
data: params_,
dataType: 'json'
}).then(({ data: res }) => {
console.log('调用风驰台返回结果', res)
hideMyLoading()
if (res && res.success) {
resolve(res)
} else {
reject(res)
}
}).catch((e) => {
hideMyLoading()
reject(e)
})
})
function md5(data) {
const buf = Buffer.from(data)
const str = buf.toString('binary')
return crypto.createHash('md5').update(str).digest('hex').slice(0, 30)
}
}
} else {
const mockUrlPrefix = {
ams: 'https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri=',
yapi: 'https://docs.dui88.com/mock/140/'
}
// @ts-ignore
const requestPrefix = mockUrl || mockUrlPrefix[requestType]
return new Promise((resolve, reject) => {
my.request({
url: requestPrefix + _cloudName + '.' + handle,
method,
data: params,
dataType: 'json'
}).then(({ data: res }) => {
hideMyLoading()
if (res && !res.success && ext.toastError) {
commonToast(res.message || '系统错误')
}
resolve(res)
}).catch((e) => {
hideMyLoading()
if (ext.toastError) {
commonToast('系统错误')
}
reject(e)
})
})
}
}
const requestCloud = () => {
return new Promise((resolve, reject) => {
cloud.function.invoke(_cloudName, params, handle).then((res) => {
console.log(`%c${handle} 参数 ----->`, 'color: #43bb88;font-size: 12px;', params)
console.log(`%c${handle} 返回值 ----->`, 'color: #43bb88;font-size: 12px;', res)
hideMyLoading()
if (res && !res.success && ext.toastError) {
commonToast(res.message || '系统错误')
}
resolve(res)
return res
}).catch((err) => {
console.log(`${handle} catch ----->`, params, err)
hideMyLoading()
reject(err)
})
})
}
return [ 'ams', 'yapi', 'tornadoAPI' ].includes(requestType) ? requestMock() : requestCloud()
}
}
export default request
// eslint-disable-next-line no-undef
const memberPlugin = requirePlugin('cemMember')
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
export const commonToast = (content, duration = 3000, successCb) => {
my.showToast({
content: content || '换个姿势再试一次~',
duration,
success: successCb
})
}
/**
* 简易alert
* @param {string} content toast内容
*/
export const simpleAlert = content => {
my.alert({
content
})
}
/**
* 通用确认弹窗
* @param {string} title 标题
* @param {string} content 内容
* @param {function} successCb 成功回调
*/
export const commonConfirm = (title = '提示', content, successCb) => {
my.confirm({
title,
content,
confirmButtonText: '确定',
cancelButtonText: '取消',
success: result => {
const { confirm } = result
if (confirm) {
successCb && successCb()
}
}
})
}
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
export const getAuthUserInfo = async() => {
return new Promise((resolve, reject) => {
my.authorize({
scopes: 'scope.userInfo',
success: () => {
my.getAuthUserInfo({
success: userInfo => {
resolve(userInfo)
},
fail: err => {
reject(err)
}
})
},
fail: err => {
reject(err)
}
})
})
}
/**
* 获取系统信息
* @returns {object} 小程序系统信息
*/
export const getSystemInfo = async() => {
return new Promise((resolve, reject) => {
my.getSystemInfo({
success: res => {
resolve(res)
},
fail: err => {
reject(err)
}
})
})
}
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const favorShop = async sellerId => {
if (!sellerId) {
console.error('favorShop: 请传入卖家Id')
return false
}
return new Promise((resolve, reject) => {
my.tb.favorShop({
id: +sellerId,
success: res => {
resolve(res)
},
fail: err => {
if (err.error === 11) {
// error code 11 为用户取消操作不认作失败场景
resolve(false)
}
reject(err)
}
})
})
}
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const checkShopFavoredStatus = async sellerId => {
if (!sellerId) {
console.error('checkShopFavoredStatus: 请传入卖家Id')
return false
}
return new Promise((resolve, reject) => {
my.tb.checkShopFavoredStatus({
id: +sellerId,
success: res => {
// checkShopFavoredStatus 仅支持真机调用
resolve(res?.isFavor === undefined ? true : res?.isFavor)
},
fail: err => {
reject(err)
}
})
})
}
export const checkIsMember = (sellerId = '') => {
return new Promise((resolve, reject) => {
memberPlugin.checkMember({
// sellerId为可选参数,不填则为当前小程序Owner用户ID
sellerId,
success(res) {
console.log('会员检查成功 :>> ', res)
resolve(res)
},
fail(v) {
console.log('会员检查失败 :>> ', v)
console.warn('checkMember 需在真机上调试')
reject(v)
// my.alert({
// title: '会员检查失败',
// content: JSON.stringify(v)
// })
}
})
})
}
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
export const navigateToOutside = url => {
if (!url) {
console.error('navigateToOutside: 请传入url')
return false
}
my.call('navigateToOutside', { url })
}
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export const navigateTo = url => {
if (!url) {
console.error('navigateTo: 请传入url')
return false
}
my.navigateTo({ url })
}
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
export const redirectTo = url => {
if (!url) {
console.error('redirectTo: 请传入url')
return false
}
my.redirectTo({ url })
}
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
export const getServerTime = async() => {
return new Promise((resolve, reject) => {
my.getServerTime({
success: res => {
resolve(res.time)
},
fail: err => {
reject(err)
}
})
})
}
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
export const collectGoods = async id => {
if (!id) {
console.error('collectGoods: 请传入商品id')
return false
}
return new Promise((resolve, reject) => {
my.tb.collectGoods({
id: +id,
success: res => {
resolve(res)
},
fail: err => {
if (err.error === 11) {
// error code 11 为用户取消操作不认作失败场景
resolve(false)
}
reject(err)
}
})
})
}
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
export const checkGoodsCollectedStatus = async id => {
if (!id) {
console.error('checkGoodsCollectedStatus: 请传入商品id')
return false
}
return new Promise(resolve => {
my.tb.checkGoodsCollectedStatus({
id: +id,
success: res => {
resolve(res.isCollect)
}
})
})
}
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
export const openDetail = async itemId => {
if (!itemId) {
console.error('openDetail: 请传入商品id')
return false
}
return new Promise((resolve, reject) => {
my.tb.openDetail({
itemId: itemId + '',
success: res => {
resolve(res)
},
fail: res => {
reject(res)
}
})
})
}
/**
* 创建音频类
*/
class AudioModel {
constructor(opts = {}) {
const { src } = opts
if (!src) {
console.error('请输入音频链接')
return false
}
try {
const innerAudioContext = my.createInnerAudioContext()
Object.keys(opts).forEach(item => {
innerAudioContext[item] = opts[item]
})
return innerAudioContext
} catch (e) {
console.error('当前版本不支持音频')
}
}
}
/**
* 创建音频实例
* @param {object} opts 配置对象 例 { src: '音频链接', autoplay: false }
*/
export const createAudio = opts => {
const audioInstance = new AudioModel(opts)
return audioInstance
}
/**
* 获取淘宝用户收货地址
*/
export const getUserAddress = async(opts = {}) => {
const defaults = {
addAddress: 'show',
searchAddress: 'hide',
locateAddress: 'hide',
joinTag: '' // 分割收货地址符号(淘宝商家有特定发货需求)
}
const _opts = Object.assign({}, defaults, opts)
return new Promise((resolve, reject) => {
my.authorize({
scopes: 'scope.addressList',
success: () => {
const { addAddress, searchAddress, locateAddress, joinTag } = _opts
if (!my.tb.chooseAddress) {
/* eslint-disable*/
reject({
noSupport: true,
errorMessage: '当前版本不支持选择收货地址,请升级到最新版本'
})
return false
}
my.tb.chooseAddress(
{
addAddress,
searchAddress,
locateAddress
},
res => {
const { error, provinceName, countyName, cityName, streetName, detailInfo, name, telNumber } = res
// 如果有error为用户取消操作不做操作
if (error) {
resolve(false)
} else {
resolve({
...res,
duibaAddress: {
name,
phone: telNumber,
address: [ provinceName, cityName, countyName, streetName, detailInfo ].join(joinTag)
}
})
}
},
res => {
reject(res)
}
)
},
fail: err => {
reject(err)
}
})
})
}
/**
* 选择图片
*/
export const chooseImage = async(opts = {}) => {
const defaults = {
count: 1,
sourceType: [ 'camera', 'album' ],
compressLevel: 1
}
const _opts = Object.assign({}, defaults, opts)
const { count, sourceType, compressLevel } = _opts
return new Promise((resolve, reject) => {
if (!my.chooseImage) {
reject({
noSupport: true,
errorMessage: '当前版本不支持选择图片,请升级到最新版本'
})
return false
}
my.chooseImage({
count,
sourceType,
success: res => {
my.compressImage({
apFilePaths: res.apFilePaths,
level: compressLevel,
success: data => {
resolve(data)
},
fail: err => {
resolve(err)
}
})
},
fail: err => {
// error code 2001 为摄像头授权取消、ios 11为用户取消操作不认作失败场景 、安卓 为1
if (err.error !== 2001 && err.error !== 11 && err.error !== 1) {
reject(err)
} else {
resolve(false)
}
}
})
})
}
/**
* 获取图片信息
* @param {string} src 图片地址
*/
export const getImageInfo = async src => {
return new Promise((resolve, reject) => {
my.getImageInfo({
src,
success: res => {
resolve(res)
},
fail: err => {
reject(err)
}
})
})
}
/**
* 获取图片信息
* @param {*} opts chooseImage配置参数
*/
export const uploadImage = async(opts = {}) => {
const { cloud } = getApp()
if (!cloud) {
console.error('chattingSendCard: 请传入app.cloud')
return false
}
const chooseImageResult = await chooseImage(opts).catch(err => {
commonToast(err && (err.errorMessage || '选择图片失败'))
})
if (chooseImageResult) {
const { apFilePaths } = chooseImageResult
const filePath = apFilePaths[0]
const imageInfo = await getImageInfo(filePath).catch(err => {
commonToast(err && err.errorMessage)
})
// 找不到图片信息
if (!imageInfo) {
return false
}
const { path: imagePath } = imageInfo
const { url } = await cloud.file.uploadFile({
filePath,
fileType: 'image',
fileName: imagePath.split('/').pop()
})
return url
}
return false
}
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export const chattingSendCard = async(requestInfo) => {
const { cloud } = getApp()
if (!cloud) {
console.error('chattingSendCard: 请传入app.cloud')
return false
}
if (!requestInfo) {
console.error('chattingSendCard: 请传入卡片请求参数')
return false
}
return new Promise((resolve, reject) => {
my.authorize({
scopes: 'scope.groupChat',
success: async() => {
const result = await cloud.topApi
.invoke({
api: 'taobao.chatting.platform.message.sendcard',
data: { request_info: JSON.stringify(requestInfo) }
})
.catch(err => {
reject(err)
})
if (result) {
const { error } = result
if (error) {
resolve(false)
} else {
resolve(result)
}
}
},
fail: err => {
if (err.error === 11) {
// error code 11 为用户取消操作不认作失败场景
resolve(false)
}
reject(err)
}
})
})
}
/**
* 文本风险校验
* @param {string} text 文本
*/
export const textRiskIdentification = async(text) => {
return new Promise((resolve, reject) => {
if (!my.tb.textRiskIdentification) {
/* eslint-disable*/
reject({
noSupport: true,
errorMessage: '不支持文本校验'
})
}
my.tb.textRiskIdentification({
data: {
text
},
success: res => {
if (res.data && res.data.result) {
const { suggestion } = res.data.result
if (suggestion === 'pass') {
resolve(true)
}
}
resolve(false)
},
fail: err => {
reject(err)
}
})
})
}
// 剪切板
export const setClipboard = async(params) => {
return await promisifyMyApi('setClipboard', params)
}
function promisifyMyApi(methodName, params = {}) {
return new Promise((resolve, reject) => {
my[methodName]({
...params,
success: res => {
resolve(res)
},
fail: err => {
reject(err)
}
})
})
}
export const noopFn = () => {}
export const noopFn = () => { }
...@@ -2082,10 +2082,10 @@ ...@@ -2082,10 +2082,10 @@
dependencies: dependencies:
"@types/lodash" "*" "@types/lodash" "*"
"@types/lodash@*": "@types/lodash@*", "@types/lodash@^4.14.160":
version "4.14.168" version "4.14.168"
resolved "http://npm.dui88.com:80/@types%2flodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
integrity sha1-/iRjLnm3rePxMoka//hsql5c4Ag= integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==
"@types/mdast@^3.0.0": "@types/mdast@^3.0.0":
version "3.0.3" version "3.0.3"
...@@ -2109,6 +2109,11 @@ ...@@ -2109,6 +2109,11 @@
resolved "http://npm.dui88.com:80/@types%2fnode/-/node-14.14.31.tgz#72286bd33d137aa0d152d47ec7c1762563d34055" resolved "http://npm.dui88.com:80/@types%2fnode/-/node-14.14.31.tgz#72286bd33d137aa0d152d47ec7c1762563d34055"
integrity sha1-cihr0z0TeqDRUtR+x8F2JWPTQFU= integrity sha1-cihr0z0TeqDRUtR+x8F2JWPTQFU=
"@types/node@^14.6.0":
version "14.14.32"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.32.tgz#90c5c4a8d72bbbfe53033f122341343249183448"
integrity sha512-/Ctrftx/zp4m8JOujM5ZhwzlWLx22nbQJiVqz8/zE15gOeEW+uly3FSX4fGFpcfEvFzXcMCJwq9lGVWgyARXhg==
"@types/normalize-package-data@^2.4.0": "@types/normalize-package-data@^2.4.0":
version "2.4.0" version "2.4.0"
resolved "http://npm.dui88.com:80/@types%2fnormalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" resolved "http://npm.dui88.com:80/@types%2fnormalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
...@@ -2186,6 +2191,18 @@ ...@@ -2186,6 +2191,18 @@
resolved "http://npm.dui88.com:80/@types%2fwebpack-env/-/webpack-env-1.16.0.tgz#8c0a9435dfa7b3b1be76562f3070efb3f92637b4" resolved "http://npm.dui88.com:80/@types%2fwebpack-env/-/webpack-env-1.16.0.tgz#8c0a9435dfa7b3b1be76562f3070efb3f92637b4"
integrity sha1-jAqUNd+ns7G+dlYvMHDvs/kmN7Q= integrity sha1-jAqUNd+ns7G+dlYvMHDvs/kmN7Q=
"@typescript-eslint/eslint-plugin@^3.9.1":
version "3.10.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.1.tgz#7e061338a1383f59edc204c605899f93dc2e2c8f"
integrity sha512-PQg0emRtzZFWq6PxBcdxRH3QIQiyFO3WCVpRL3fgj5oQS3CDs3AeAKfv4DxNhzn8ITdNJGJ4D3Qw8eAJf3lXeQ==
dependencies:
"@typescript-eslint/experimental-utils" "3.10.1"
debug "^4.1.1"
functional-red-black-tree "^1.0.1"
regexpp "^3.0.0"
semver "^7.3.2"
tsutils "^3.17.1"
"@typescript-eslint/experimental-utils@2.34.0": "@typescript-eslint/experimental-utils@2.34.0":
version "2.34.0" version "2.34.0"
resolved "http://npm.dui88.com:80/@typescript-eslint%2fexperimental-utils/-/experimental-utils-2.34.0.tgz#d3524b644cdb40eebceca67f8cf3e4cc9c8f980f" resolved "http://npm.dui88.com:80/@typescript-eslint%2fexperimental-utils/-/experimental-utils-2.34.0.tgz#d3524b644cdb40eebceca67f8cf3e4cc9c8f980f"
...@@ -2196,6 +2213,17 @@ ...@@ -2196,6 +2213,17 @@
eslint-scope "^5.0.0" eslint-scope "^5.0.0"
eslint-utils "^2.0.0" eslint-utils "^2.0.0"
"@typescript-eslint/experimental-utils@3.10.1":
version "3.10.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz#e179ffc81a80ebcae2ea04e0332f8b251345a686"
integrity sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw==
dependencies:
"@types/json-schema" "^7.0.3"
"@typescript-eslint/types" "3.10.1"
"@typescript-eslint/typescript-estree" "3.10.1"
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"
"@typescript-eslint/parser@^2.0.0", "@typescript-eslint/parser@^2.x": "@typescript-eslint/parser@^2.0.0", "@typescript-eslint/parser@^2.x":
version "2.34.0" version "2.34.0"
resolved "http://npm.dui88.com:80/@typescript-eslint%2fparser/-/parser-2.34.0.tgz#50252630ca319685420e9a39ca05fe185a256bc8" resolved "http://npm.dui88.com:80/@typescript-eslint%2fparser/-/parser-2.34.0.tgz#50252630ca319685420e9a39ca05fe185a256bc8"
...@@ -2206,6 +2234,22 @@ ...@@ -2206,6 +2234,22 @@
"@typescript-eslint/typescript-estree" "2.34.0" "@typescript-eslint/typescript-estree" "2.34.0"
eslint-visitor-keys "^1.1.0" eslint-visitor-keys "^1.1.0"
"@typescript-eslint/parser@^3.9.1":
version "3.10.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.10.1.tgz#1883858e83e8b442627e1ac6f408925211155467"
integrity sha512-Ug1RcWcrJP02hmtaXVS3axPPTTPnZjupqhgj+NnZ6BCkwSImWk/283347+x9wN+lqOdK9Eo3vsyiyDHgsmiEJw==
dependencies:
"@types/eslint-visitor-keys" "^1.0.0"
"@typescript-eslint/experimental-utils" "3.10.1"
"@typescript-eslint/types" "3.10.1"
"@typescript-eslint/typescript-estree" "3.10.1"
eslint-visitor-keys "^1.1.0"
"@typescript-eslint/types@3.10.1":
version "3.10.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.10.1.tgz#1d7463fa7c32d8a23ab508a803ca2fe26e758727"
integrity sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ==
"@typescript-eslint/typescript-estree@2.34.0": "@typescript-eslint/typescript-estree@2.34.0":
version "2.34.0" version "2.34.0"
resolved "http://npm.dui88.com:80/@typescript-eslint%2ftypescript-estree/-/typescript-estree-2.34.0.tgz#14aeb6353b39ef0732cc7f1b8285294937cf37d5" resolved "http://npm.dui88.com:80/@typescript-eslint%2ftypescript-estree/-/typescript-estree-2.34.0.tgz#14aeb6353b39ef0732cc7f1b8285294937cf37d5"
...@@ -2219,6 +2263,27 @@ ...@@ -2219,6 +2263,27 @@
semver "^7.3.2" semver "^7.3.2"
tsutils "^3.17.1" tsutils "^3.17.1"
"@typescript-eslint/typescript-estree@3.10.1":
version "3.10.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz#fd0061cc38add4fad45136d654408569f365b853"
integrity sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w==
dependencies:
"@typescript-eslint/types" "3.10.1"
"@typescript-eslint/visitor-keys" "3.10.1"
debug "^4.1.1"
glob "^7.1.6"
is-glob "^4.0.1"
lodash "^4.17.15"
semver "^7.3.2"
tsutils "^3.17.1"
"@typescript-eslint/visitor-keys@3.10.1":
version "3.10.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931"
integrity sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ==
dependencies:
eslint-visitor-keys "^1.1.0"
"@unimodules/core@~5.5.0", "@unimodules/core@~5.5.1": "@unimodules/core@~5.5.0", "@unimodules/core@~5.5.1":
version "5.5.1" version "5.5.1"
resolved "http://npm.dui88.com:80/@unimodules%2fcore/-/core-5.5.1.tgz#82afe960568c58da62c76ea45ca77aa43a31ce13" resolved "http://npm.dui88.com:80/@unimodules%2fcore/-/core-5.5.1.tgz#82afe960568c58da62c76ea45ca77aa43a31ce13"
...@@ -5787,6 +5852,13 @@ escodegen@^1.11.1: ...@@ -5787,6 +5852,13 @@ escodegen@^1.11.1:
optionalDependencies: optionalDependencies:
source-map "~0.6.1" source-map "~0.6.1"
eslint-config-prettier@^6.11.0:
version "6.15.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9"
integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw==
dependencies:
get-stdin "^6.0.0"
eslint-config-standard-jsx@^10.0.0: eslint-config-standard-jsx@^10.0.0:
version "10.0.0" version "10.0.0"
resolved "http://npm.dui88.com:80/eslint-config-standard-jsx/-/eslint-config-standard-jsx-10.0.0.tgz#dc24992661325a2e480e2c3091d669f19034e18d" resolved "http://npm.dui88.com:80/eslint-config-standard-jsx/-/eslint-config-standard-jsx-10.0.0.tgz#dc24992661325a2e480e2c3091d669f19034e18d"
...@@ -5865,6 +5937,13 @@ eslint-plugin-node@^11.1.0: ...@@ -5865,6 +5937,13 @@ eslint-plugin-node@^11.1.0:
resolve "^1.10.1" resolve "^1.10.1"
semver "^6.1.0" semver "^6.1.0"
eslint-plugin-prettier@^3.1.4:
version "3.3.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz#7079cfa2497078905011e6f82e8dd8453d1371b7"
integrity sha512-Rq3jkcFY8RYeQLgk2cCwuc0P7SEFwDravPhsJZOQ5N4YI4DSg50NyqJ/9gdZHzQlHf8MvafSesbNJCcP/FF6pQ==
dependencies:
prettier-linter-helpers "^1.0.0"
eslint-plugin-promise@^4.3.1: eslint-plugin-promise@^4.3.1:
version "4.3.1" version "4.3.1"
resolved "http://npm.dui88.com:80/eslint-plugin-promise/-/eslint-plugin-promise-4.3.1.tgz#61485df2a359e03149fdafc0a68b0e030ad2ac45" resolved "http://npm.dui88.com:80/eslint-plugin-promise/-/eslint-plugin-promise-4.3.1.tgz#61485df2a359e03149fdafc0a68b0e030ad2ac45"
...@@ -6058,10 +6137,10 @@ eslint@^6.1.0: ...@@ -6058,10 +6137,10 @@ eslint@^6.1.0:
text-table "^0.2.0" text-table "^0.2.0"
v8-compile-cache "^2.0.3" v8-compile-cache "^2.0.3"
eslint@^7.12.1: eslint@^7.12.1, eslint@^7.7.0:
version "7.21.0" version "7.21.0"
resolved "http://npm.dui88.com:80/eslint/-/eslint-7.21.0.tgz#4ecd5b8c5b44f5dedc9b8a110b01bbfeb15d1c83" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.21.0.tgz#4ecd5b8c5b44f5dedc9b8a110b01bbfeb15d1c83"
integrity sha1-Ts1bjFtE9d7cm4oRCwG7/rFdHIM= integrity sha512-W2aJbXpMNofUp0ztQaF40fveSsJBjlSCSWpy//gzfTvwC+USs/nceBrKmlJOiM8r1bLwP2EuYkCqArn/6QTIgg==
dependencies: dependencies:
"@babel/code-frame" "7.12.11" "@babel/code-frame" "7.12.11"
"@eslint/eslintrc" "^0.4.0" "@eslint/eslintrc" "^0.4.0"
...@@ -6535,6 +6614,11 @@ fast-deep-equal@^3.1.1: ...@@ -6535,6 +6614,11 @@ fast-deep-equal@^3.1.1:
resolved "http://npm.dui88.com:80/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" resolved "http://npm.dui88.com:80/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU= integrity sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=
fast-diff@^1.1.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
fast-glob@^2.0.2: fast-glob@^2.0.2:
version "2.2.7" version "2.2.7"
resolved "http://npm.dui88.com:80/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" resolved "http://npm.dui88.com:80/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d"
...@@ -11640,11 +11724,23 @@ preserve@^0.2.0: ...@@ -11640,11 +11724,23 @@ preserve@^0.2.0:
resolved "http://npm.dui88.com:80/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" resolved "http://npm.dui88.com:80/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
prettier-linter-helpers@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
dependencies:
fast-diff "^1.1.2"
prettier@^1.14.2, prettier@^1.16.4: prettier@^1.14.2, prettier@^1.16.4:
version "1.19.1" version "1.19.1"
resolved "http://npm.dui88.com:80/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" resolved "http://npm.dui88.com:80/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha1-99f1/4qc2HKnvkyhQglZVqYHl8s= integrity sha1-99f1/4qc2HKnvkyhQglZVqYHl8s=
prettier@^2.0.5:
version "2.2.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
pretty-bytes@^5.3.0: pretty-bytes@^5.3.0:
version "5.6.0" version "5.6.0"
resolved "http://npm.dui88.com:80/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb" resolved "http://npm.dui88.com:80/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"
...@@ -14098,6 +14194,20 @@ taro-ui@^3.0.0-alpha.3: ...@@ -14098,6 +14194,20 @@ taro-ui@^3.0.0-alpha.3:
lodash "^4.17.10" lodash "^4.17.10"
prop-types "^15.7.2" prop-types "^15.7.2"
tbcc-sdk-ts@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/tbcc-sdk-ts/-/tbcc-sdk-ts-1.0.2.tgz#af78ef609af8e972a8628cd2ac4cfa5757c422ce"
integrity sha512-cVXOZmY9sjGjEsSVlFxBcrOmRA5K099DoCfGEtYuFfR94gsR4OdSnB/BELfIan4bnzPXPddS5MjM567wsNbnww==
optionalDependencies:
"@types/lodash" "^4.14.160"
"@types/node" "^14.6.0"
"@typescript-eslint/eslint-plugin" "^3.9.1"
"@typescript-eslint/parser" "^3.9.1"
eslint "^7.7.0"
eslint-config-prettier "^6.11.0"
eslint-plugin-prettier "^3.1.4"
prettier "^2.0.5"
term-size@^1.2.0: term-size@^1.2.0:
version "1.2.0" version "1.2.0"
resolved "http://npm.dui88.com:80/term-size/-/term-size-1.2.0.tgz#458b83887f288fc56d6fffbfad262e26638efa69" resolved "http://npm.dui88.com:80/term-size/-/term-size-1.2.0.tgz#458b83887f288fc56d6fffbfad262e26638efa69"
......
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