Commit c8973039 authored by qinhaitao's avatar qinhaitao

feat:任务

parent 162d8903
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 tbRequest from './utils/request'
import conifg from './config' import conifg from './config'
const { utils: { generateAPI }, request: tbccRequest, capi, capiFn } = tbccTs; const { utils: { generateAPI }, request: tbccRequest, capi, capiFn } = tbccTs
const { cloudName, requestType } = conifg const { cloudName, requestType } = conifg
const request2 = tbccRequest({ const request = tbccRequest({
cloud, cloud,
cloudName, cloudName,
requestType requestType
});
const request = tbRequest({
cloud,
requestType,
cloudName
}) })
/** /**
const defaultConfig = { const defaultConfig = {
method: 'GET', method: 'GET',
...@@ -45,40 +39,10 @@ const apiList = { ...@@ -45,40 +39,10 @@ const apiList = {
getVipInfo: 'getVipInfo', getVipInfo: 'getVipInfo',
getCollectGoodsList: 'getCollectGoodsList', getCollectGoodsList: 'getCollectGoodsList',
getItemListByItemIds: 'getItemListByItemIds' getItemListByItemIds: 'getItemListByItemIds'
}; }
// 生成API // 生成API
const API = generateAPI(apiList, request2); const API = generateAPI(apiList, request)
API['fn'] = capiFn(apiList, request2); API.fn = capiFn(apiList, request)
export default API;
export const login = (params, config) => request('login', params, config)
export const getActivityBaseInfoById = (params, config) => request('getActivityBaseInfoById', params, config)
export const getVipInfo = (params, config) => request('getVipInfo', params, config)
export const getShareInfo = (params, config) => request('getShareInfo', params, config)
export const getMyPrizeList = (params, config) => request('getMyPrizeList', params, config)
export const receiveEnamePrize = (params, config) => request('receiveEnamePrize', params, config)
export const receiveObjectPrize = (params, config) => request('receiveObjectPrize', params, config)
export const doHelp = (params, config) => request('doHelp', params, config)
export const drawLotteryPrize = (params, config) => request('drawLotteryPrize', params, config)
export const resetTest = (params, config) => request('resetTest', params, config)
export const addStat = (params, config) => request('addStat', params, config)
export const receiveTaskRewards = (params, config) => request('receiveTaskRewards', params, config)
export const getTaskList = (params, config) => request('getTaskList', params, config)
export const getCollectGoodsList = (params, config) => request('getCollectGoodsList', params, config)
export const getItemListByItemIds = (params, config) => request('getItemListByItemIds', params, config) export default API
...@@ -4,7 +4,7 @@ import { useThrottle } from '@/hooks/useThrottle' ...@@ -4,7 +4,7 @@ import { useThrottle } from '@/hooks/useThrottle'
import classnames from 'classnames' 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 { doHelp } from '@/api' import API from '@/api'
import { checkIsMember, commonToast } from '@/utils/tb' import { checkIsMember, commonToast } from '@/utils/tb'
import { showToast } from '@tarojs/taro' import { showToast } from '@tarojs/taro'
import { useLoginInfoModel } from '@/store' import { useLoginInfoModel } from '@/store'
...@@ -17,7 +17,7 @@ export default function RuleModal(props) { ...@@ -17,7 +17,7 @@ export default function RuleModal(props) {
const { loginInfo: { inviteId } } = useLoginInfoModel() const { loginInfo: { inviteId } } = useLoginInfoModel()
const onAuthSuccess = async() => { const onAuthSuccess = async() => {
const helpRes = await doHelp({ inviteId }) const helpRes = await API.doHelp({ inviteId })
if (helpRes?.success) { if (helpRes?.success) {
showToast({ title: '助力成功' }) showToast({ title: '助力成功' })
...@@ -34,7 +34,7 @@ export default function RuleModal(props) { ...@@ -34,7 +34,7 @@ export default function RuleModal(props) {
const onDoHelp = useThrottle(async() => { const onDoHelp = useThrottle(async() => {
// 条件不是需要新会员的情况下,直接助力 // 条件不是需要新会员的情况下,直接助力
if (!newVip) { if (!newVip) {
const helpRes = await doHelp({ inviteId }) const helpRes = await API.doHelp({ inviteId })
if (helpRes?.success) { if (helpRes?.success) {
showToast({ title: '助力成功' }) showToast({ title: '助力成功' })
......
...@@ -2,15 +2,17 @@ import { View, ScrollView, Image } from '@tarojs/components' ...@@ -2,15 +2,17 @@ import { View, ScrollView, Image } from '@tarojs/components'
import classnames from 'classnames' import classnames from 'classnames'
import React, { useEffect, useState } 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'
export default function GoodsPage(props) { export default function GoodsPage(props) {
const { const {
isBackFlag = 0, goodsList = [], task = { isBackFlag = 0, goodsList = [],
task = {
itemId: '617724147979,617724563528,617300295119', itemId: '617724147979,617724563528,617300295119',
taskType: 'browseGoods', taskType: 'browseGoods',
type: '02', type: '02', // 01 banner 02
bannerHeight: 430, bannerHeight: 430,
image: { image: {
bg: '//yun.dui88.com/taobaomini/clientCTest/goods_bg@2x.png', bg: '//yun.dui88.com/taobaomini/clientCTest/goods_bg@2x.png',
...@@ -26,33 +28,33 @@ export default function GoodsPage(props) { ...@@ -26,33 +28,33 @@ export default function GoodsPage(props) {
onCompleteTask onCompleteTask
} = props } = props
const goToGoodsDetail = async (item) => { const goToGoodsDetail = async(item) => {
const { taskType } = task const { taskType } = task
const { itemId } = item const { itemId } = item
if(taskType == 'browseGoods') { if (taskType === 'browseGoods') {
onOpenDetail && onOpenDetail(itemId) onOpenDetail && onOpenDetail(itemId)
} }
await openDetail(String(itemId)) await openDetail(String(itemId))
} }
// 收藏商品 // 收藏商品
const goToCollectGoods = async (item) => { const goToCollectGoods = async(item) => {
let { itemId, collected } = item const { itemId, collected } = item
const { taskType } = task const { taskType } = task
if(collected) { if (collected) {
commonToast('您已收藏过该商品了') commonToast('您已收藏过该商品了')
return; return
} }
//判断是否活动外已收藏商品 // 判断是否活动外已收藏商品
let isCollected = await checkGoodsCollectedStatus(+itemId) const isCollected = await checkGoodsCollectedStatus(+itemId)
if(isCollected) { if (isCollected) {
onCompleteTask && onCompleteTask(taskType, itemId) onCompleteTask && onCompleteTask(taskType, itemId)
return; return
} }
let result = await collectGoods(+itemId) const result = await collectGoods(+itemId)
if(result) { if (result) {
onCompleteTask && onCompleteTask(taskType, itemId) onCompleteTask && onCompleteTask(taskType, itemId)
} }
} }
......
export default { export default {
component: true, component: true,
usingComponents: { usingComponents: {
'member-modal': '../_miniprogram/memberModal/memberModal' 'member-modal': '../_miniprogram/memberModal/memberModal'
} }
} }
\ No newline at end of file
import { View, ScrollView, Image } from '@tarojs/components' import { View, ScrollView, Image } from '@tarojs/components'
import React, { useState, useEffect, useCallback } from 'react' 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 { STAT_TYPE, SELLER_ID } from '@/const' import config from '@/config'
import { useThrottle } from '@/hooks/useThrottle'
import { TASK_STATUS, TASK_CONFIG } from '@/const'
import './TasksModal.less' import './TasksModal.less'
const { throttleHandle } = tbccTs.utils;
const { commonToast, favorShop, navigateTo, navigateToOutside, showSharePanel } = tbccTs.tb; const { commonToast, favorShop, navigateTo, navigateToOutside, showSharePanel } = tbccTs.tb
export default function TasksModal(props) { export default function TasksModal(props) {
const app = getApp() const app = getApp()
...@@ -17,103 +19,90 @@ export default function TasksModal(props) { ...@@ -17,103 +19,90 @@ export default function TasksModal(props) {
const [ currentTaskType, setCurrentTaskType ] = useState('') const [ currentTaskType, setCurrentTaskType ] = useState('')
const [ preBrowseTime, setPreBrowseTime ] = useState(null) const [ preBrowseTime, setPreBrowseTime ] = useState(null)
const { taskList, taskConfig, fetchTaskList } = useTasks() const { taskList, fetchTaskList } = useTasks()
const { taskIcon, commonTaskTxt, doTaskTxt, browseType, browseTime } = taskConfig const { taskIcon, commonTaskTxt, doTaskTxt, browseType, browseTime } = TASK_CONFIG
useEffect(() => { useEffect(() => {
console.warn('taskFlag1'+taskFlag) console.warn('taskFlag1' + taskFlag)
console.warn('taskFlag'+props.taskFlag) console.warn('taskFlag' + props.taskFlag)
if(app.isFlashTask && taskFlag !== props.taskFlag) {
if(preBrowseTime && ((Date.now() - preBrowseTime) / 1000) >= browseTime) {
doCompleteTaskHandle(currentTaskType,true)
}
else {
// fetchTaskList()
}
}
},[props.taskFlag])
const handleTapItem = async (item) => {
const { status, taskType, url, itemIds, keepTime } = item
if(status == 3) return;
if(status == 2) {
const { success, data } = await API.receiveTaskRewards({ taskType }).catch(res => {
commonToast(res && res.message);
}) || {};
if (success && data) {
const { rewards, receiveTimes } = data
let message = taskType == 'invites' ?
`成功邀请${receiveTimes}名好友,抽盒次数+${rewards}`:`抽盒次数+${rewards}`
commonToast(message) if (app.isFlashTask && taskFlag !== props.taskFlag) {
if (preBrowseTime && ((Date.now() - preBrowseTime) / 1000) >= browseTime) {
doCompleteTaskHandle(currentTaskType, true)
} else {
fetchTaskList() fetchTaskList()
onUpdate && onUpdate()
} }
} }
else { }, [ props.taskFlag ])
goToComplete(taskType,url,itemIds,keepTime)
const handleTapItem = useThrottle(async(item) => {
const { status, taskType } = item
const tapFn = {
[TASK_STATUS.WAIT_RECEIVE]: async() => {
const { success, data } = await API.receiveTaskRewards({ taskType })
if (success && data) {
const { rewards } = data
commonToast(`领取成功,次数+${rewards}`)
fetchTaskList()
onUpdate && onUpdate()
}
},
[TASK_STATUS.WAIT_DO]: () => goToComplete(item)
} }
}
const goToComplete = async (taskType,url,itemIds,keepTime) => { tapFn[status] && tapFn[status]()
switch(taskType) { })
case 'member':
// 去加入会员 const goToComplete = async(item) => {
setMemberShopVisible(true) const { taskType, url, itemIds, keepTime } = item
break; setCurrentTaskType(taskType)
case 'follow': const completeFn = {
let isFollow = await favorShop(SELLER_ID) member: () => setMemberShopVisible(true),
if(isFollow) { invites: () => showSharePanel(),
follow: async() => {
const isFollow = await favorShop(config.sellerId)
if (isFollow) {
doCompleteTaskHandle(taskType) doCompleteTaskHandle(taskType)
} }
break; },
case 'invites': // 跳转任务
// 邀请好友 jumpLink: async() => {
showSharePanel();
await API.fn.addStat(STAT_TYPE.GO_TO_INVITE)
break;
case 'jumpLink':
// 跳转任务
navigateToOutside(url || 'https://www.feizhu.com') navigateToOutside(url || 'https://www.feizhu.com')
if(browseType === 1) { if (browseType === 1) {
doCompleteTaskHandle(taskType) doCompleteTaskHandle(taskType)
} } else {
else {
app.isFlashTask = true app.isFlashTask = true
setPreBrowseTime(Date.now()) setPreBrowseTime(Date.now())
setCurrentTaskType(taskType)
} }
break; },
case 'browseGoods': browseGoods: async() => {
// 跳转浏览页面 browseGoods
app.isFlashTask = true app.isFlashTask = true
if (url) {
navigateToOutside(url)
return
}
navigateTo(`/pages/browseGoods/browseGoods?itemIds=${itemIds}&keepTime=${keepTime}`) navigateTo(`/pages/browseGoods/browseGoods?itemIds=${itemIds}&keepTime=${keepTime}`)
break; },
case 'orderGoods': orderGoods: async() => {
// 跳转下单页面
app.isFlashTask = true app.isFlashTask = true
if (url) {
navigateToOutside(url)
return
}
navigateTo(`/pages/orderGoods/orderGoods?itemIds=${itemIds}`) navigateTo(`/pages/orderGoods/orderGoods?itemIds=${itemIds}`)
break; },
case 'collectGoods': collectGoods: async() => {
// 跳转收藏页面
app.isFlashTask = true app.isFlashTask = true
navigateTo(`/pages/collectGoods/collectGoods?itemIds=${itemIds}`) navigateTo(`/pages/collectGoods/collectGoods?itemIds=${itemIds}`)
break; },
case 'sign': sign: () => doCompleteTaskHandle(taskType)
// 签到
doCompleteTaskHandle(taskType)
break;
} }
completeFn[taskType] && completeFn[taskType]()
} }
const doCompleteTaskHandle = async (taskType, flag) => { const doCompleteTaskHandle = async(taskType, flag) => {
const { success, data } = await API.doCompleteTask({ taskType }).catch(res => { const { success } = await API.doCompleteTask({ taskType })
res && commonToast(res.message) if (success) {
}) || {}
if(success) {
await fetchTaskList() await fetchTaskList()
flag && setPreBrowseTime(null) flag && setPreBrowseTime(null)
} }
...@@ -124,6 +113,7 @@ export default function TasksModal(props) { ...@@ -124,6 +113,7 @@ export default function TasksModal(props) {
} }
const onAuthSuccess = () => { const onAuthSuccess = () => {
setMemberShopVisible(false) setMemberShopVisible(false)
doCompleteTaskHandle('member')
} }
const onAuthFail = () => { const onAuthFail = () => {
setMemberShopVisible(false) setMemberShopVisible(false)
...@@ -135,39 +125,38 @@ export default function TasksModal(props) { ...@@ -135,39 +125,38 @@ export default function TasksModal(props) {
return ( return (
<> <>
<Popup onClose={onClose} height="700rpx"> <Popup onClose={onCloseModal} height='700rpx'>
<View className="task-modal-container"> <View className='task-modal-container'>
<View className="task-modal-content"> <View className='task-modal-content'>
<View className="task-modal__close" /> <View className='task-modal-content__title'>任务模块</View>
<View className="task-modal-content__title">任务模块</View> <View className='task-modal-content__list'>
<View className="task-modal-content__list"> <ScrollView scroll-y='{{true}}' className='task-modal-content__scroll'>
<ScrollView scroll-y="{{true}}" className="task-modal-content__scroll"> {
{ taskList.map((item, i) => {
taskList.map((item,i) =>{
return ( return (
<View className="task-modal-content-item" key={'task_I'+i}> <View className='task-modal-content-item' key={'task_I' + i}>
<View className="task-modal-content-item__left"> <View className='task-modal-content-item__left'>
<Image src={taskIcon[item.taskType]} mode="widthFix" /> <Image src={taskIcon[item.taskType]} mode='widthFix' />
</View> </View>
<View className="task-modal-content-item__left-label"> <View className='task-modal-content-item__left-label'>
<View className="task-modal-content-item__left-title">{item.title}</View> <View className='task-modal-content-item__left-title'>{item.title}</View>
<View className="task-modal-content-item__left-reward">抽盒次数+{item.rewards}</View> <View className='task-modal-content-item__left-reward'>抽盒次数+{item.rewards}</View>
</View> </View>
<View className={'task-modal-content__list-item__right'+ ' '+'task-item__status-'+item.status} onClick={ () => throttleHandle(handleTapItem(item),2000)}> <View className={'task-modal-content__list-item__right' + ' ' + 'task-item__status-' + item.status} onClick={() => handleTapItem(item)}>
{ {
item.status == 1 ? doTaskTxt[item.taskType] : commonTaskTxt[item.status] item.status === TASK_STATUS.WAIT_DO ? (doTaskTxt[item.taskType] || '去完成') : commonTaskTxt[item.status]
} }
</View> </View>
</View> </View>
) )
}) })
} }
</ScrollView> </ScrollView>
</View>
</View> </View>
</View> </View>
</View> </Popup>
</Popup> {memberShopVisible && <member-modal onClose={onCloseMemberModal} onAuthFail={onAuthFail} onAuthSuccess={onAuthSuccess} />}
{memberShopVisible && <member-modal onClose={onCloseMemberModal} onAuthFail={onAuthFail} onAuthSuccess={onAuthSuccess} />}
</> </>
) )
} }
...@@ -4,19 +4,17 @@ import classnames from 'classnames' ...@@ -4,19 +4,17 @@ import classnames from 'classnames'
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import Overlay from '../Overlay/Overlay' import Overlay from '../Overlay/Overlay'
import styles from './Popup.module.less' import styles from './Popup.module.less'
export default function Popup(props) { export default function Popup(props) {
const { const {
onClose = noopFn, onClose = noopFn,
position = 'bottom', position = 'bottom',
height = '30%', height = 'auto',
width = '100%', width = '100%',
backgroundColor = '#fff', backgroundColor = '#fff',
closeOnClickOverlay = true, closeOnClickOverlay = false,
closebale = false, closebale = true,
closeButtonStyle = { right: 6, top: -36 } closeButtonStyle = { right: 6, top: -36 }
} = props } = props
...@@ -46,9 +44,9 @@ export default function Popup(props) { ...@@ -46,9 +44,9 @@ export default function Popup(props) {
return ( return (
<View className={wrapClass}> <View className={wrapClass}>
<Overlay onTap={onClickOverlay} /> <Overlay onTap={onClickOverlay} />
<View className={contentClass} style={{ width, height, backgroundColor }}> <View className={contentClass} style={{ width, height, backgroundColor }}>
{ closebale && <View className={styles.close_button} onClick={onCloseModal} style={closeButtonStyle}></View>} {closebale && <View className={styles.close_button} onClick={onCloseModal} style={closeButtonStyle} />}
{props.children} {props.children}
</View> </View>
......
export default { export default {
env: 'test', // 云函数环境 test 测试环境 online 线上环境 env: 'test', // 云函数环境 test 测试环境 online 线上环境
requestType: 'cloud', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口 requestType: 'cloud', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口
cloudName: 'yapi', // 主云函数项目名 CommonToC cloudName: 'richMan', // 主云函数项目名 CommonToC
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: '601b9eef9897b41ad0f26834' // 默认活动id defaultActivityId: '5ff7e0a3e5c0d7dafd30dce5' // 默认活动id
} }
...@@ -54,11 +54,47 @@ export const ACTIVITY_STATUS = { ...@@ -54,11 +54,47 @@ export const ACTIVITY_STATUS = {
END: 3 // 已经结束 END: 3 // 已经结束
} }
// 数据埋点 // 任务频率类型常量
export const STAT_TYPE = { export const TASK_RATE_TYPE = {
GO_TO_INVITE: 2, // 点击邀请按钮的uv FOREVER: 1,
EVERYDAY: 2,
NOLIMIT: 3
} }
export const SHARE_IMG_FILE_ID = 'cloud://09C241349017A4A1F67E4FE7AF2B3520//share_new_02.png' // 分享图片fileId // 任务状态
export const TASK_STATUS = {
WAIT_DO: 1, // 未完成
WAIT_RECEIVE: 2, // 待领取
DONE: 3 // 已完成
}
export const SELLER_ID = 2374579403 // 商家sellerId export const TASK_CONFIG = {
taskIcon: { // 任务图标
follow: '//yun.duiba.com.cn/baicaoweiFarmer/follow.png',
member: '//yun.duiba.com.cn/baicaoweiFarmer/memberStar1.png',
invites: '//yun.duiba.com.cn/baicaoweiFarmer/invites.png',
jumpLink: '//yun.duiba.com.cn/baicaoweiFarmer/browseGoodsLink.png',
browseGoods: '//yun.duiba.com.cn/baicaoweiFarmer/browseGoods.png',
orderGoods: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png',
collectGoods: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png',
sign: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png',
exchangeCredits: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
},
commonTaskTxt: {
1: '去完成',
2: '待领取',
3: '已完成'
},
doTaskTxt: {
follow: '立即关注',
invites: '去邀请',
member: '1秒入会',
sign: '立即签到',
jumpLink: '去完成',
browseGoods: '去完成',
orderGoods: '去完成',
collectGoods: '去完成'
},
browseType: 1, // 1 跳转即算完成 2 跳转浏览15s 才算完成
browseTime: 15 // 浏览时间
}
...@@ -6,6 +6,7 @@ import { checkShopFavoredStatus } from '../utils/tb' ...@@ -6,6 +6,7 @@ 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'
const { login } = API const { login } = API
/** /**
......
...@@ -9,12 +9,13 @@ import { useState, useEffect } from 'react' ...@@ -9,12 +9,13 @@ import { useState, useEffect } from 'react'
* @param {*} [config={}] { * @param {*} [config={}] {
method: 'GET', method: 'GET',
showLoading: false, showLoading: false,
toastError: true toastError: true,
manual: false 手动触发
} }
* @return {*} * @return {*}
*/ */
export function useRequest(api, params = {}, config = {}) { export function useRequest(api, params = {}, config = { manual: false }) {
const [ data, setData ] = useState(null) const [ data, setData ] = useState({})
const [ code, setCode ] = useState('') const [ code, setCode ] = useState('')
const [ success, setSuccess ] = useState(false) const [ success, setSuccess ] = useState(false)
const [ message, setMessage ] = useState('') const [ message, setMessage ] = useState('')
...@@ -40,7 +41,8 @@ export function useRequest(api, params = {}, config = {}) { ...@@ -40,7 +41,8 @@ export function useRequest(api, params = {}, config = {}) {
} }
useEffect(async => { useEffect(async => {
request() console.log('config :>> ', config)
!config.manual && request()
}, []) }, [])
return { return {
...@@ -49,6 +51,7 @@ export function useRequest(api, params = {}, config = {}) { ...@@ -49,6 +51,7 @@ export function useRequest(api, params = {}, config = {}) {
success, success,
message, message,
loading, loading,
error error,
run: request
} }
} }
import API from '@/api' import API from '@/api'
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { useRequest } from './useRequest'
export function useTasks() { export function useTasks() {
const [ taskList, setTaskList ] = useState([]) const { data, run: fetchTaskList } = useRequest(API.getTaskList, {}, { manual: false })
const mockTaskList = [ // const mockTaskList = [
{ // {
taskType: 'follow', // taskType: 'follow',
title: '关注店铺', // title: '关注店铺',
taskRateType: 1, // taskRateType: 1,
times: 1, // times: 1,
completeTimes: 0, // completeTimes: 0,
status: 1, // status: 1,
rewards: 1 // rewards: 1
}, // },
{ // {
taskType: 'member', // taskType: 'member',
title: '加入会员', // title: '加入会员',
taskRateType: 1, // taskRateType: 1,
times: 1, // times: 1,
completeTimes: 0, // completeTimes: 0,
status: 1, // status: 1,
rewards: 1 // rewards: 1
}, // },
{ // {
taskType: 'invites', // taskType: 'invites',
title: '邀请好友入会', // title: '邀请好友入会',
taskRateType: 1, // taskRateType: 1,
times: 3, // times: 3,
completeTimes: 0, // completeTimes: 0,
status: 1, // status: 1,
rewards: 1 // rewards: 1
}, // },
{ // {
taskType: 'jumpLink', // taskType: 'jumpLink',
title: '浏览店铺15s', // title: '浏览店铺15s',
taskRateType: 2, // taskRateType: 2,
times: 1, // times: 1,
completeTimes: 0, // completeTimes: 0,
status: 1, // status: 1,
rewards: 1 // rewards: 1
}, // },
{ // {
taskType: 'browseGoods', // taskType: 'browseGoods',
itemIds: '617724147979,617724563528,617300295119', // itemIds: '617724147979,617724563528,617300295119',
title: '浏览商品', // title: '浏览商品',
taskRateType: 2, // taskRateType: 2,
times: 1, // times: 1,
completeTimes: 0, // completeTimes: 0,
status: 1, // status: 1,
rewards: 1 // rewards: 1
}, // },
{ // {
taskType: 'orderGoods', // taskType: 'orderGoods',
itemIds: '617724147979,617724563528,617300295119', // itemIds: '617724147979,617724563528,617300295119',
title: '下单任务', // title: '下单任务',
taskRateType: 2, // taskRateType: 2,
times: 1, // times: 1,
completeTimes: 0, // completeTimes: 0,
status: 1, // status: 1,
rewards: 1 // rewards: 1
}, // },
{ // {
taskType: 'collectGoods', // taskType: 'collectGoods',
title: '收藏商品', // title: '收藏商品',
itemIds: '617724147979,617724563528,617300295119', // itemIds: '617724147979,617724563528,617300295119',
taskRateType: 2, // taskRateType: 2,
times: 1, // times: 1,
todayCompleteTimes: 0, // todayCompleteTimes: 0,
status: 1, // status: 1,
rewards: 1 // rewards: 1
}, // },
{ // {
taskType: 'sign', // taskType: 'sign',
title: '每日签到', // title: '每日签到',
taskRateType: 2, // taskRateType: 2,
times: 1, // times: 1,
todayCompleteTimes: 0, // todayCompleteTimes: 0,
status: 1, // status: 1,
rewards: 1 // rewards: 1
} // }
] // ]
const taskConfig = {
taskIcon: {// 任务图标
follow: '//yun.duiba.com.cn/baicaoweiFarmer/follow.png',
member: '//yun.duiba.com.cn/baicaoweiFarmer/memberStar1.png',
invites: '//yun.duiba.com.cn/baicaoweiFarmer/invites.png',
jumpLink: '//yun.duiba.com.cn/baicaoweiFarmer/browseGoodsLink.png',
browseGoods: '//yun.duiba.com.cn/baicaoweiFarmer/browseGoods.png',
orderGoods: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png',
collectGoods: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png',
sign: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png',
},
commonTaskTxt: {
1: '去完成',
2: '待领取',
3: '已完成'
},
doTaskTxt: {
follow: '立即关注',
invites: '去邀请',
member: '1秒入会',
sign: '立即签到',
jumpLink: '去完成',
browseGoods: '去完成',
orderGoods: '去完成',
collectGoods: '去完成',
},
browseType: 1, // 1 跳转即算完成 2 跳转浏览15s 才算完成
browseTime: 15, // 浏览时间
}
async function fetchTaskList() {
const { data, success } = await API.getTaskList().catch(res => {
console.log(res)
})
if (success && data?.list?.length) {
setTaskList(data?.list)
// setTaskList(mockTaskList)
return;
}
setTaskList(mockTaskList)
}
useEffect(async () => {
fetchTaskList()
}, [])
return { return {
taskList, taskList: data?.list || [],
taskConfig, fetchTaskList
fetchTaskList,
} }
} }
import { useRef, useEffect, useCallback } from 'react' import { useRef, useEffect, useCallback } from 'react'
export function useThrottle(fn, delay, dep = []) { export function useThrottle(fn, delay = 2000, dep = []) {
const { current } = useRef({ fn, timer: null }) const { current } = useRef({ fn, timer: null })
useEffect(function() { useEffect(function() {
current.fn = fn current.fn = fn
......
export default { export default {
navigationBarTitleText: '我的奖品', navigationBarTitleText: '浏览商品',
enableSkia: 'true', enableSkia: 'true',
allowsBounceVertical: 'NO', allowsBounceVertical: 'NO',
enableShareAppMessage: true enableShareAppMessage: true
......
...@@ -4,64 +4,64 @@ import GoodsPage from '@/components/GoodsPage/GoodsPage' ...@@ -4,64 +4,64 @@ import GoodsPage from '@/components/GoodsPage/GoodsPage'
import tbccTs from '@/tbcc-sdk-ts' 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 { useRequest } from '@/hooks/useRequest' import { useRequest } from '@/hooks/useRequest'
const { throttleHandle } = tbccTs.utils;
const { commonToast, favorShop, navigateTo, navigateToOutside, showSharePanel } = tbccTs.tb; const { commonToast } = tbccTs.tb
const browseConfig = {
taskType: 'browseGoods',
type: '01',
image: {
bg: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_bg@2x.png',
banner: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_banner@2x.png',
title: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_title@2x.png',
collect: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_collection@2x.png',
no_collect: '//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png'
},
color: '#181818'
}
function BrowseGoodsPage() { function BrowseGoodsPage() {
const [ goodsList, setGoodsList ] = useState([])
const [ percent, setPercent ] = useState(0) const [ percent, setPercent ] = useState(0)
const [isJumpLink, setIsJumpLink ] = useState(false) const [ isJumpLink, setIsJumpLink ] = useState(false)
const browseConfig = {
taskType: 'browseGoods', const { browseType, browseTime } = TASK_CONFIG
type: '01',
image: {
bg: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_bg@2x.png',
banner: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_banner@2x.png',
title: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_title@2x.png',
collect: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_collection@2x.png',
no_collect: '//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png',
},
color: '#181818'
}
let browserTimer = null let browserTimer = null
let usePercent = 0 let usePercent = 0
const completeTime = 15
const completeType = 1 const { params: { itemIds, keepTime } } = useRouter()
const router = useRouter()
const { itemIds, keepTime } = router?.params const { data: { list = [] }, success: listSuccess } = useRequest(API.getItemListByItemIds, { itemIds }, { isShowLoading: true })
const { data, success } = useRequest(API.getItemListByItemIds,{ itemIds })
useEffect(() => { useEffect(() => {
success && setGoodsList(data) listSuccess && list.length && browseGoodsTimes()
browseGoodsTimes() }, [ list ])
},[ goodsList ])
useDidShow(() => { useDidShow(() => {
//重新回到页面开启倒计时 // 重新回到页面开启倒计时
if(!browserTimer && completeType == 1 && isJumpLink) { if (!browserTimer && browseType === 1 && isJumpLink) {
usePercent = percent usePercent = percent
browseGoodsTimes() browseGoodsTimes()
} }
}) })
const onCompleteTask = async (itemId) => { const onCompleteTask = async(itemId) => {
const { success, data } = await API.doCompleteTask({ taskType: browseConfig.taskType, itemId }).catch(res => { const { success } = await API.doCompleteTask({ taskType: browseConfig.taskType, itemId })
res && commonToast(res.message) if (success) {
}) || {}
if(success) {
commonToast('浏览成功') commonToast('浏览成功')
setIsJumpLink(false) setIsJumpLink(false)
} }
} }
const onOpenDetail = (itemId) => { const onOpenDetail = (itemId) => {
if(completeType == 1) { if (browseType === 1) {
setPercent(usePercent) setPercent(usePercent)
setIsJumpLink(true) setIsJumpLink(true)
clearInterval(this.timer) clearInterval(this.timer)
return; return
} }
onCompleteTask(itemId) onCompleteTask(itemId)
} }
...@@ -69,16 +69,16 @@ function BrowseGoodsPage() { ...@@ -69,16 +69,16 @@ function BrowseGoodsPage() {
const browseGoodsTimes = () => { const browseGoodsTimes = () => {
browserTimer = setInterval(() => { browserTimer = setInterval(() => {
usePercent += 1 usePercent += 1
const keepTime_ = +keepTime || completeTime const keepTime_ = +keepTime || browseTime
if (usePercent >= keepTime_) { if (usePercent >= keepTime_) {
onCompleteTask() onCompleteTask()
clearInterval(browserTimer) clearInterval(browserTimer)
} }
},1000) }, 1000)
} }
return ( return (
<View> <View>
<GoodsPage goodsList={goodsList} task={browseConfig} onOpenDetail={() => onOpenDetail} /> <GoodsPage goodsList={list} task={browseConfig} onOpenDetail={() => onOpenDetail} />
</View> </View>
) )
} }
......
...@@ -5,13 +5,11 @@ import { SHARE_CONFIG } from '@/const.js' ...@@ -5,13 +5,11 @@ import { SHARE_CONFIG } from '@/const.js'
import { useLogin, useLoginFromShare } from '@/hooks/useLogin' import { useLogin, useLoginFromShare } from '@/hooks/useLogin'
import { useActivityInfoModel, useLoginInfoModel } from '@/store' import { useActivityInfoModel, useLoginInfoModel } from '@/store'
import API from '@/api' import API from '@/api'
import tbccTs from '@/tbcc-sdk-ts'
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 { throttleHandle, checkIsMember } = tbccTs.utils;
const INDEX_CONFIG = { const INDEX_CONFIG = {
bg: '', // 背景 bg: '', // 背景
...@@ -61,7 +59,6 @@ function Index() { ...@@ -61,7 +59,6 @@ function Index() {
useDidShow(() => { useDidShow(() => {
setTaskFlag(Math.floor(Math.random() * 1000)) setTaskFlag(Math.floor(Math.random() * 1000))
}) })
const onClose = () => { const onClose = () => {
setMemberVisible(false) setMemberVisible(false)
...@@ -86,11 +83,11 @@ function Index() { ...@@ -86,11 +83,11 @@ function Index() {
<View className={styles.bemember} onTap={() => setMemberVisible(true)}>入会</View> <View className={styles.bemember} onTap={() => setMemberVisible(true)}>入会</View>
{ {
tasksModalVisible && tasksModalVisible &&
<TasksModal <TasksModal
taskFlag={taskFlag} taskFlag={taskFlag}
onUpdate={ () => {} } onUpdate={() => {}}
onClose={() => setTasksModalVisible(false)} onClose={() => setTasksModalVisible(false)}
/> />
} }
{ {
......
...@@ -7,8 +7,9 @@ import tbccTs from '@/tbcc-sdk-ts' ...@@ -7,8 +7,9 @@ import tbccTs from '@/tbcc-sdk-ts'
import { useThrottle } from '@/hooks/useThrottle' import { useThrottle } from '@/hooks/useThrottle'
import { useDidShow } from '@tarojs/taro' import { useDidShow } from '@tarojs/taro'
import './myPrize.less' import './myPrize.less'
const { throttleHandle, checkIsMember, dateFormatter } = tbccTs.utils;
const { commonToast, getUserAddress, navigateToOutside, setClipboard } = tbccTs.tb; const { throttleHandle, checkIsMember, dateFormatter } = tbccTs.utils
const { commonToast, getUserAddress, navigateToOutside, setClipboard } = tbccTs.tb
const { getMyPrizeList, receiveEnamePrize, receiveObjectPrize } = API const { getMyPrizeList, receiveEnamePrize, receiveObjectPrize } = API
// 我的奖品配置项 // 我的奖品配置项
......
...@@ -44,29 +44,31 @@ var helpers_1 = require("../helpers"); ...@@ -44,29 +44,31 @@ var helpers_1 = require("../helpers");
* @param {number} duration 显示时长 * @param {number} duration 显示时长
* @param {function} successCb 成功回调 * @param {function} successCb 成功回调
*/ */
exports.commonToast = function (content, duration, successCb) { var commonToast = function (content, duration, successCb) {
helpers_1.promisifyApiSimple('showToast', { helpers_1.promisifyApiSimple('showToast', {
content: content || '换个姿势再试一次~', content: content || '换个姿势再试一次~',
duration: duration || 3000, duration: duration || 3000,
success: successCb success: successCb
}); });
}; };
exports.commonToast = commonToast;
/** /**
* 简易alert * 简易alert
* @param {string} content toast内容 * @param {string} content toast内容
*/ */
exports.simpleAlert = function (content) { var simpleAlert = function (content) {
helpers_1.promisifyApiSimple('alert', { helpers_1.promisifyApiSimple('alert', {
content: content content: content
}); });
}; };
exports.simpleAlert = simpleAlert;
/** /**
* 通用确认弹窗 * 通用确认弹窗
* @param {string} title 标题 * @param {string} title 标题
* @param {string} content 内容 * @param {string} content 内容
* @param {function} successCb 成功回调 * @param {function} successCb 成功回调
*/ */
exports.commonConfirm = function (title, content, successCb) { var commonConfirm = function (title, content, successCb) {
if (title === void 0) { title = '提示'; } if (title === void 0) { title = '提示'; }
return __awaiter(void 0, void 0, void 0, function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
...@@ -86,10 +88,11 @@ exports.commonConfirm = function (title, content, successCb) { ...@@ -86,10 +88,11 @@ exports.commonConfirm = function (title, content, successCb) {
}); });
}); });
}; };
exports.commonConfirm = commonConfirm;
/** /**
* 获取系统信息 * 获取系统信息
*/ */
exports.getSystemInfo = function () { return __awaiter(void 0, void 0, void 0, function () { var getSystemInfo = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('getSystemInfo', {})]; case 0: return [4 /*yield*/, helpers_1.promisifyApi('getSystemInfo', {})];
...@@ -97,12 +100,13 @@ exports.getSystemInfo = function () { return __awaiter(void 0, void 0, void 0, f ...@@ -97,12 +100,13 @@ exports.getSystemInfo = function () { return __awaiter(void 0, void 0, void 0, f
} }
}); });
}); }; }); };
exports.getSystemInfo = getSystemInfo;
/** /**
* 执行关注店铺 * 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id * @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态 * @returns {boolean} 关注状态
*/ */
exports.favorShop = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () { var favorShop = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () {
var result; var result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -119,12 +123,13 @@ exports.favorShop = function (sellerId) { return __awaiter(void 0, void 0, void ...@@ -119,12 +123,13 @@ exports.favorShop = function (sellerId) { return __awaiter(void 0, void 0, void
} }
}); });
}); }; }); };
exports.favorShop = favorShop;
/** /**
* 判断是否关注店铺 * 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id * @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态 * @returns {boolean} 关注状态
*/ */
exports.checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () { var checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () {
var result; var result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -141,11 +146,12 @@ exports.checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, ...@@ -141,11 +146,12 @@ exports.checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0,
} }
}); });
}); }; }); };
exports.checkShopFavoredStatus = checkShopFavoredStatus;
/** /**
* 跳转到外部链接 * 跳转到外部链接
* @param {string} url 跳转链接 * @param {string} url 跳转链接
*/ */
exports.navigateToOutside = function (url) { var navigateToOutside = function (url) {
if (!url) { if (!url) {
console.error('navigateToOutside: 请传入url'); console.error('navigateToOutside: 请传入url');
return false; return false;
...@@ -154,11 +160,12 @@ exports.navigateToOutside = function (url) { ...@@ -154,11 +160,12 @@ exports.navigateToOutside = function (url) {
url: url url: url
}, 'navigateToOutside'); }, 'navigateToOutside');
}; };
exports.navigateToOutside = navigateToOutside;
/** /**
* 跳转到内部链接(新开窗口) * 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接 * @param {string} url 跳转链接
*/ */
exports.navigateTo = function (url) { var navigateTo = function (url) {
if (!url) { if (!url) {
console.error('navigateTo: 请传入url'); console.error('navigateTo: 请传入url');
return false; return false;
...@@ -167,20 +174,22 @@ exports.navigateTo = function (url) { ...@@ -167,20 +174,22 @@ exports.navigateTo = function (url) {
url: url url: url
}); });
}; };
exports.navigateTo = navigateTo;
/** /**
* 返回页面 * 返回页面
* @param {number} delta * @param {number} delta
*/ */
exports.navigateBack = function (delta) { var navigateBack = function (delta) {
helpers_1.promisifyApiSimple('navigateBack', { helpers_1.promisifyApiSimple('navigateBack', {
delta: delta delta: delta
}); });
}; };
exports.navigateBack = navigateBack;
/** /**
* 跳转到内部链接(不新开窗口) * 跳转到内部链接(不新开窗口)
* @param {string} url * @param {string} url
*/ */
exports.redirectTo = function (url) { var redirectTo = function (url) {
if (!url) { if (!url) {
console.error('redirectTo: 请传入url'); console.error('redirectTo: 请传入url');
return false; return false;
...@@ -189,11 +198,12 @@ exports.redirectTo = function (url) { ...@@ -189,11 +198,12 @@ exports.redirectTo = function (url) {
url: url url: url
}); });
}; };
exports.redirectTo = redirectTo;
/** /**
* 获取服务器时间 * 获取服务器时间
* @returns {number} 服务器时间戳 * @returns {number} 服务器时间戳
*/ */
exports.getServerTime = function () { return __awaiter(void 0, void 0, void 0, function () { var getServerTime = function () { return __awaiter(void 0, void 0, void 0, function () {
var result; var result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -206,12 +216,13 @@ exports.getServerTime = function () { return __awaiter(void 0, void 0, void 0, f ...@@ -206,12 +216,13 @@ exports.getServerTime = function () { return __awaiter(void 0, void 0, void 0, f
} }
}); });
}); }; }); };
exports.getServerTime = getServerTime;
/** /**
* 收藏商品 * 收藏商品
* @param {number} 商品id * @param {number} 商品id
* @returns {object} 收藏结果 * @returns {object} 收藏结果
*/ */
exports.collectGoods = function (id) { return __awaiter(void 0, void 0, void 0, function () { var collectGoods = function (id) { return __awaiter(void 0, void 0, void 0, function () {
var result; var result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -229,12 +240,13 @@ exports.collectGoods = function (id) { return __awaiter(void 0, void 0, void 0, ...@@ -229,12 +240,13 @@ exports.collectGoods = function (id) { return __awaiter(void 0, void 0, void 0,
} }
}); });
}); }; }); };
exports.collectGoods = collectGoods;
/** /**
* 查询商品收藏状态 * 查询商品收藏状态
* @param {number} 商品id * @param {number} 商品id
* @returns {boolean} 商品收场状态 * @returns {boolean} 商品收场状态
*/ */
exports.checkGoodsCollectedStatus = function (id) { return __awaiter(void 0, void 0, void 0, function () { var checkGoodsCollectedStatus = function (id) { return __awaiter(void 0, void 0, void 0, function () {
var result; var result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -252,11 +264,12 @@ exports.checkGoodsCollectedStatus = function (id) { return __awaiter(void 0, voi ...@@ -252,11 +264,12 @@ exports.checkGoodsCollectedStatus = function (id) { return __awaiter(void 0, voi
} }
}); });
}); }; }); };
exports.checkGoodsCollectedStatus = checkGoodsCollectedStatus;
/** /**
* 跳转到淘宝商品页 * 跳转到淘宝商品页
* @param {string} itemId 商品ID * @param {string} itemId 商品ID
*/ */
exports.openDetail = function (itemId) { return __awaiter(void 0, void 0, void 0, function () { var openDetail = function (itemId) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
...@@ -269,19 +282,21 @@ exports.openDetail = function (itemId) { return __awaiter(void 0, void 0, void 0 ...@@ -269,19 +282,21 @@ exports.openDetail = function (itemId) { return __awaiter(void 0, void 0, void 0
} }
}); });
}); }; }); };
exports.openDetail = openDetail;
/** /**
* 创建音频实例 * 创建音频实例
* @param {object} opts 配置对象 例 { src: '音频链接', autoplay: false } * @param {object} opts 配置对象 例 { src: '音频链接', autoplay: false }
*/ */
exports.createAudio = function (opts) { var createAudio = function (opts) {
var audioInstance = new helpers_1.AudioModel(opts); var audioInstance = new helpers_1.AudioModel(opts);
return audioInstance; return audioInstance;
}; };
exports.createAudio = createAudio;
/** /**
* 获取图片信息 * 获取图片信息
* @param {string} src 图片地址 * @param {string} src 图片地址
*/ */
exports.getImageInfo = function (src) { return __awaiter(void 0, void 0, void 0, function () { var getImageInfo = function (src) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('getImageInfo', { src: src })]; case 0: return [4 /*yield*/, helpers_1.promisifyApi('getImageInfo', { src: src })];
...@@ -289,11 +304,12 @@ exports.getImageInfo = function (src) { return __awaiter(void 0, void 0, void 0, ...@@ -289,11 +304,12 @@ exports.getImageInfo = function (src) { return __awaiter(void 0, void 0, void 0,
} }
}); });
}); }; }); };
exports.getImageInfo = getImageInfo;
/** /**
* 剪切板 * 剪切板
* @param {text: string} * @param {text: string}
*/ */
exports.setClipboard = function (text) { return __awaiter(void 0, void 0, void 0, function () { var setClipboard = function (text) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('setClipboard', { text: text })]; case 0: return [4 /*yield*/, helpers_1.promisifyApi('setClipboard', { text: text })];
...@@ -301,20 +317,22 @@ exports.setClipboard = function (text) { return __awaiter(void 0, void 0, void 0 ...@@ -301,20 +317,22 @@ exports.setClipboard = function (text) { return __awaiter(void 0, void 0, void 0
} }
}); });
}); }; }); };
exports.setClipboard = setClipboard;
/** /**
* 调起分享面板 * 调起分享面板
*/ */
exports.showSharePanel = function () { return __awaiter(void 0, void 0, void 0, function () { var showSharePanel = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
helpers_1.promisifyApiSimple('showSharePanel', {}); helpers_1.promisifyApiSimple('showSharePanel', {});
return [2 /*return*/]; return [2 /*return*/];
}); });
}); }; }); };
exports.showSharePanel = showSharePanel;
/** /**
* 获取缓存数据 * 获取缓存数据
* @param key * @param key
*/ */
exports.getStorage = function (key) { return __awaiter(void 0, void 0, void 0, function () { var getStorage = function (key) { return __awaiter(void 0, void 0, void 0, function () {
var result; var result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -327,12 +345,13 @@ exports.getStorage = function (key) { return __awaiter(void 0, void 0, void 0, f ...@@ -327,12 +345,13 @@ exports.getStorage = function (key) { return __awaiter(void 0, void 0, void 0, f
} }
}); });
}); }; }); };
exports.getStorage = getStorage;
/** /**
* 设置缓存数据 * 设置缓存数据
* @param key * @param key
* @param value * @param value
*/ */
exports.setStorage = function (key, value) { return __awaiter(void 0, void 0, void 0, function () { var setStorage = function (key, value) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('setStorage', { key: key, data: value })]; case 0: return [4 /*yield*/, helpers_1.promisifyApi('setStorage', { key: key, data: value })];
...@@ -340,11 +359,12 @@ exports.setStorage = function (key, value) { return __awaiter(void 0, void 0, vo ...@@ -340,11 +359,12 @@ exports.setStorage = function (key, value) { return __awaiter(void 0, void 0, vo
} }
}); });
}); }; }); };
exports.setStorage = setStorage;
/** /**
* 清除缓存数据 * 清除缓存数据
* @param key * @param key
*/ */
exports.removeStorage = function (key) { return __awaiter(void 0, void 0, void 0, function () { var removeStorage = function (key) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: return [4 /*yield*/, helpers_1.promisifyApi('removeStorage', { key: key })]; case 0: return [4 /*yield*/, helpers_1.promisifyApi('removeStorage', { key: key })];
...@@ -352,24 +372,26 @@ exports.removeStorage = function (key) { return __awaiter(void 0, void 0, void 0 ...@@ -352,24 +372,26 @@ exports.removeStorage = function (key) { return __awaiter(void 0, void 0, void 0
} }
}); });
}); }; }); };
exports.removeStorage = removeStorage;
/** /**
* 自定义分析数据的上报接口 * 自定义分析数据的上报接口
* @param eventType * @param eventType
* @param logkey * @param logkey
*/ */
exports.taobaoReportClick = function (eventType, logkey) { var taobaoReportClick = function (eventType, logkey) {
// @ts-ignore // @ts-ignore
my.reportAnalytics(eventType, { my.reportAnalytics(eventType, {
// 标志某一类事件,方便数据分析进行分组 // 标志某一类事件,方便数据分析进行分组
'logkey': logkey 'logkey': logkey
}); });
}; };
exports.taobaoReportClick = taobaoReportClick;
/** /**
* 打开BC客服聊天 * 打开BC客服聊天
* @param sellerNick * @param sellerNick
* @param itemId * @param itemId
*/ */
exports.openMessage = function (sellerNick, itemId) { return __awaiter(void 0, void 0, void 0, function () { var openMessage = function (sellerNick, itemId) { return __awaiter(void 0, void 0, void 0, function () {
var result; var result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -380,11 +402,12 @@ exports.openMessage = function (sellerNick, itemId) { return __awaiter(void 0, v ...@@ -380,11 +402,12 @@ exports.openMessage = function (sellerNick, itemId) { return __awaiter(void 0, v
} }
}); });
}); }; }); };
exports.openMessage = openMessage;
/** /**
* 显示指定商品 SKU 选择器 * 显示指定商品 SKU 选择器
* @param itemId * @param itemId
*/ */
exports.showSkuModal = function (itemId) { return __awaiter(void 0, void 0, void 0, function () { var showSkuModal = function (itemId) { return __awaiter(void 0, void 0, void 0, function () {
var result; var result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -395,10 +418,11 @@ exports.showSkuModal = function (itemId) { return __awaiter(void 0, void 0, void ...@@ -395,10 +418,11 @@ exports.showSkuModal = function (itemId) { return __awaiter(void 0, void 0, void
} }
}); });
}); }; }); };
exports.showSkuModal = showSkuModal;
/** /**
* 隐藏正在展示的商品 SKU 选择器 * 隐藏正在展示的商品 SKU 选择器
*/ */
exports.hideSkuModal = function () { return __awaiter(void 0, void 0, void 0, function () { var hideSkuModal = function () { return __awaiter(void 0, void 0, void 0, function () {
var result; var result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -409,13 +433,14 @@ exports.hideSkuModal = function () { return __awaiter(void 0, void 0, void 0, fu ...@@ -409,13 +433,14 @@ exports.hideSkuModal = function () { return __awaiter(void 0, void 0, void 0, fu
} }
}); });
}); }; }); };
exports.hideSkuModal = hideSkuModal;
/** /**
* 跳转订单页 * 跳转订单页
* @param itemId * @param itemId
* @param skuId * @param skuId
* @param quantity * @param quantity
*/ */
exports.confirmCustomOrder = function (itemId, skuId, quantity) { return __awaiter(void 0, void 0, void 0, function () { var confirmCustomOrder = function (itemId, skuId, quantity) { return __awaiter(void 0, void 0, void 0, function () {
var result; var result;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -433,4 +458,5 @@ exports.confirmCustomOrder = function (itemId, skuId, quantity) { return __await ...@@ -433,4 +458,5 @@ exports.confirmCustomOrder = function (itemId, skuId, quantity) { return __await
} }
}); });
}); }; }); };
exports.confirmCustomOrder = confirmCustomOrder;
//# sourceMappingURL=tb.js.map //# 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;AACU,QAAA,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;AACF;;;GAGG;AACU,QAAA,WAAW,GAAG,UAAC,OAAe;IACvC,4BAAkB,CAAC,OAAO,EAAC;QACvB,OAAO,SAAA;KACV,CAAC,CAAA;AACN,CAAC,CAAC;AACF;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ACnD,qBAAM,0BAAgB,CAAC,aAAa,EAAC,EAAE,UAAU,YAAA,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,QAAA,EAAE,EAAE,CAAC,EAAA;;gBAAjG,MAAM,GAAG,SAAwF;gBACrG,sBAAO,MAAM,EAAA;;;KAChB,CAAA;AAHY,QAAA,WAAW,eAGvB;AACD;;;GAGG;AACI,IAAM,YAAY,GAAG,UAAO,MAAc;;;;oBAChC,qBAAM,0BAAgB,CAAC,SAAS,EAAC,EAAE,MAAM,QAAA,EAAE,CAAC,EAAA;;gBAArD,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 \ No newline at end of file
...@@ -52,7 +52,7 @@ var helpers_1 = require("../helpers"); ...@@ -52,7 +52,7 @@ var helpers_1 = require("../helpers");
/** /**
* 获取淘宝用户收货地址 * 获取淘宝用户收货地址
*/ */
exports.getUserAddress = function (opts) { var getUserAddress = function (opts) {
if (opts === void 0) { opts = {}; } if (opts === void 0) { opts = {}; }
return __awaiter(void 0, void 0, void 0, function () { return __awaiter(void 0, void 0, void 0, function () {
var defaults, _opts; var defaults, _opts;
...@@ -108,11 +108,12 @@ exports.getUserAddress = function (opts) { ...@@ -108,11 +108,12 @@ exports.getUserAddress = function (opts) {
}); });
}); });
}; };
exports.getUserAddress = getUserAddress;
/** /**
* 选择图片 * 选择图片
* @param opts * @param opts
*/ */
exports.chooseImage = function (opts) { var chooseImage = function (opts) {
if (opts === void 0) { opts = {}; } if (opts === void 0) { opts = {}; }
return __awaiter(void 0, void 0, void 0, function () { return __awaiter(void 0, void 0, void 0, function () {
var defaults, _opts, count, sourceType, compressLevel; var defaults, _opts, count, sourceType, compressLevel;
...@@ -164,11 +165,12 @@ exports.chooseImage = function (opts) { ...@@ -164,11 +165,12 @@ exports.chooseImage = function (opts) {
}); });
}); });
}; };
exports.chooseImage = chooseImage;
/** /**
* 获取图片信息 * 获取图片信息
* @param {*} opts chooseImage配置参数 * @param {*} opts chooseImage配置参数
*/ */
exports.uploadImage = function (opts) { var uploadImage = function (opts) {
if (opts === void 0) { opts = {}; } if (opts === void 0) { opts = {}; }
return __awaiter(void 0, void 0, void 0, function () { return __awaiter(void 0, void 0, void 0, function () {
var cloud, chooseImageResult, apFilePaths, filePath, imageInfo, imagePath, url; var cloud, chooseImageResult, apFilePaths, filePath, imageInfo, imagePath, url;
...@@ -211,11 +213,12 @@ exports.uploadImage = function (opts) { ...@@ -211,11 +213,12 @@ exports.uploadImage = function (opts) {
}); });
}); });
}; };
exports.uploadImage = uploadImage;
/** /**
* 获取授权用户信息 * 获取授权用户信息
* @returns {object} 用户登录信息 * @returns {object} 用户登录信息
*/ */
exports.getAuthUserInfo = function () { var getAuthUserInfo = function () {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
my.authorize({ my.authorize({
...@@ -237,10 +240,11 @@ exports.getAuthUserInfo = function () { ...@@ -237,10 +240,11 @@ exports.getAuthUserInfo = function () {
}); });
}); });
}; };
exports.getAuthUserInfo = getAuthUserInfo;
/** /**
* 获取用户会员状态(Tmall使用) * 获取用户会员状态(Tmall使用)
*/ */
exports.getUserStatus = function () { return __awaiter(void 0, void 0, void 0, function () { var getUserStatus = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) { return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
...@@ -266,11 +270,12 @@ exports.getUserStatus = function () { return __awaiter(void 0, void 0, void 0, f ...@@ -266,11 +270,12 @@ exports.getUserStatus = function () { return __awaiter(void 0, void 0, void 0, f
})]; })];
}); });
}); }; }); };
exports.getUserStatus = getUserStatus;
/** /**
* 拉菲奖品发放(Tmall使用) * 拉菲奖品发放(Tmall使用)
* @param params * @param params
*/ */
exports.cloudTBIssue = function (params) { return __awaiter(void 0, void 0, void 0, function () { var cloudTBIssue = function (params) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) { return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
...@@ -297,11 +302,12 @@ exports.cloudTBIssue = function (params) { return __awaiter(void 0, void 0, void ...@@ -297,11 +302,12 @@ exports.cloudTBIssue = function (params) { return __awaiter(void 0, void 0, void
})]; })];
}); });
}); }; }); };
exports.cloudTBIssue = cloudTBIssue;
/** /**
* 分享到群聊卡片 * 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数 * @param {object} requestInfo 分享到群聊卡片所需请求参数
*/ */
exports.chattingSendCard = function (requestInfo) { return __awaiter(void 0, void 0, void 0, function () { var chattingSendCard = function (requestInfo) { return __awaiter(void 0, void 0, void 0, function () {
var cloud; var cloud;
return __generator(this, function (_a) { return __generator(this, function (_a) {
cloud = getApp().cloud; cloud = getApp().cloud;
...@@ -355,11 +361,12 @@ exports.chattingSendCard = function (requestInfo) { return __awaiter(void 0, voi ...@@ -355,11 +361,12 @@ exports.chattingSendCard = function (requestInfo) { return __awaiter(void 0, voi
})]; })];
}); });
}); }; }); };
exports.chattingSendCard = chattingSendCard;
/** /**
* 文本风险校验 * 文本风险校验
* @param {string} text 文本 * @param {string} text 文本
*/ */
exports.textRiskIdentification = function (text) { return __awaiter(void 0, void 0, void 0, function () { var textRiskIdentification = function (text) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) { return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
...@@ -390,11 +397,12 @@ exports.textRiskIdentification = function (text) { return __awaiter(void 0, void ...@@ -390,11 +397,12 @@ exports.textRiskIdentification = function (text) { return __awaiter(void 0, void
})]; })];
}); });
}); }; }); };
exports.textRiskIdentification = textRiskIdentification;
/** /**
* 跳转店铺首页 * 跳转店铺首页
* @param {string} shopId * @param {string} shopId
*/ */
exports.navigateToTaobaoPage = function (shopId) { var navigateToTaobaoPage = function (shopId) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
my.tb.navigateToTaobaoPage({ my.tb.navigateToTaobaoPage({
...@@ -413,4 +421,5 @@ exports.navigateToTaobaoPage = function (shopId) { ...@@ -413,4 +421,5 @@ exports.navigateToTaobaoPage = function (shopId) {
}); });
}); });
}; };
exports.navigateToTaobaoPage = navigateToTaobaoPage;
//# sourceMappingURL=tbFn.js.map //# 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;AACU,QAAA,cAAc,GAAG,UAAO,IAAS;IAAT,qBAAA,EAAA,SAAS;;;;YACtC,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U,GAAI,GAAG,CAAC,IAAI,CAAC,MAAM,WAAnB,CAAoB;4BACtC,IAAI,UAAU,KAAK,MAAM,EAAE;gCAC3B,OAAO,CAAC,IAAI,CAAC,CAAC;6BACb;yBACD;wBACD,OAAO,CAAC,KAAK,CAAC,CAAC;oBAChB,CAAC;oBACD,IAAI,EAAE,UAAA,GAAG;wBACR,MAAM,CAAC,GAAG,CAAC,CAAA;oBACZ,CAAC;iBACD,CAAC,CAAA;YACH,CAAC,CAAC,EAAA;;KACF,CAAA;AA5BY,QAAA,sBAAsB,0BA4BlC;AACD;;;GAGG;AACI,IAAM,oBAAoB,GAAG,UAAC,MAAc;IAClD,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QAClC,aAAa;QACb,EAAE,CAAC,EAAE,CAAC,oBAAoB,CAAC;YAC1B,OAAO,EAAC,MAAM;YACd,SAAS,EAAC;gBACT,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;gBACtB,WAAW,EAAC,cAAc;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 \ No newline at end of file
...@@ -43,22 +43,24 @@ exports.textRiskIdentification = exports.chattingSendCard = exports.getUserAddre ...@@ -43,22 +43,24 @@ exports.textRiskIdentification = exports.chattingSendCard = exports.getUserAddre
* @param {number} duration 显示时长 * @param {number} duration 显示时长
* @param {function} successCb 成功回调 * @param {function} successCb 成功回调
*/ */
exports.commonToast = function (content, duration, successCb) { var commonToast = function (content, duration, successCb) {
if (duration === void 0) { duration = 3000; } if (duration === void 0) { duration = 3000; }
return '暂不支持toast'; return '暂不支持toast';
}; };
exports.commonToast = commonToast;
/** /**
* 简易alert * 简易alert
* @param {string} content toast内容 * @param {string} content toast内容
*/ */
exports.simpleAlert = function (content) { var simpleAlert = function (content) {
alert(content); alert(content);
}; };
exports.simpleAlert = simpleAlert;
/** /**
* 获取授权用户信息 * 获取授权用户信息
* @returns {object} 用户登录信息 * @returns {object} 用户登录信息
*/ */
exports.getAuthUserInfo = function () { return __awaiter(void 0, void 0, void 0, function () { var getAuthUserInfo = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
return [2 /*return*/, { return [2 /*return*/, {
nickName: 'nickName', nickName: 'nickName',
...@@ -67,23 +69,25 @@ exports.getAuthUserInfo = function () { return __awaiter(void 0, void 0, void 0, ...@@ -67,23 +69,25 @@ exports.getAuthUserInfo = function () { return __awaiter(void 0, void 0, void 0,
}]; }];
}); });
}); }; }); };
exports.getAuthUserInfo = getAuthUserInfo;
/** /**
* 获取系统信息 * 获取系统信息
* @returns {object} 小程序系统信息 * @returns {object} 小程序系统信息
*/ */
exports.getSystemInfo = function () { return __awaiter(void 0, void 0, void 0, function () { var getSystemInfo = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
return [2 /*return*/, { return [2 /*return*/, {
version: '9.5.0' version: '9.5.0'
}]; }];
}); });
}); }; }); };
exports.getSystemInfo = getSystemInfo;
/** /**
* 执行关注店铺 * 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id * @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态 * @returns {boolean} 关注状态
*/ */
exports.favorShop = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () { var favorShop = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
if (!sellerId) { if (!sellerId) {
console.error('favorShop: 请传入卖家Id'); console.error('favorShop: 请传入卖家Id');
...@@ -92,12 +96,13 @@ exports.favorShop = function (sellerId) { return __awaiter(void 0, void 0, void ...@@ -92,12 +96,13 @@ exports.favorShop = function (sellerId) { return __awaiter(void 0, void 0, void
return [2 /*return*/, true]; return [2 /*return*/, true];
}); });
}); }; }); };
exports.favorShop = favorShop;
/** /**
* 判断是否关注店铺 * 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id * @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态 * @returns {boolean} 关注状态
*/ */
exports.checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () { var checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
if (!sellerId) { if (!sellerId) {
console.error('checkShopFavoredStatus: 请传入卖家Id'); console.error('checkShopFavoredStatus: 请传入卖家Id');
...@@ -106,33 +111,36 @@ exports.checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, ...@@ -106,33 +111,36 @@ exports.checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0,
return [2 /*return*/, true]; return [2 /*return*/, true];
}); });
}); }; }); };
exports.checkShopFavoredStatus = checkShopFavoredStatus;
/** /**
* 跳转到外部链接 * 跳转到外部链接
* @param {string} url 跳转链接 * @param {string} url 跳转链接
*/ */
exports.navigateToOutside = function (url) { var navigateToOutside = function (url) {
if (!url) { if (!url) {
console.error('navigateToOutside: 请传入url'); console.error('navigateToOutside: 请传入url');
return false; return false;
} }
window.location = url; window.location = url;
}; };
exports.navigateToOutside = navigateToOutside;
/** /**
* 跳转到内部链接(新开窗口) * 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接 * @param {string} url 跳转链接
*/ */
exports.navigateTo = function (url) { var navigateTo = function (url) {
if (!url) { if (!url) {
console.error('navigateTo: 请传入url'); console.error('navigateTo: 请传入url');
return false; return false;
} }
window.location = url; window.location = url;
}; };
exports.navigateTo = navigateTo;
/** /**
* 跳转到内部链接(不新开窗口) * 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接 * @param {string} url 跳转链接
*/ */
exports.redirectTo = function (url) { var redirectTo = function (url) {
if (!url) { if (!url) {
console.error('redirectTo: 请传入url'); console.error('redirectTo: 请传入url');
return false; return false;
...@@ -140,21 +148,23 @@ exports.redirectTo = function (url) { ...@@ -140,21 +148,23 @@ exports.redirectTo = function (url) {
// @ts-ignore // @ts-ignore
window.replace(url); window.replace(url);
}; };
exports.redirectTo = redirectTo;
/** /**
* 获取服务器时间 * 获取服务器时间
* @returns {number} 服务器时间戳 * @returns {number} 服务器时间戳
*/ */
exports.getServerTime = function () { return __awaiter(void 0, void 0, void 0, function () { var getServerTime = function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
return [2 /*return*/, +new Date()]; return [2 /*return*/, +new Date()];
}); });
}); }; }); };
exports.getServerTime = getServerTime;
/** /**
* 收藏商品 * 收藏商品
* @param {number} 商品id * @param {number} 商品id
* @returns {object} 收藏结果 * @returns {object} 收藏结果
*/ */
exports.collectGoods = function (id) { return __awaiter(void 0, void 0, void 0, function () { var collectGoods = function (id) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
if (!id) { if (!id) {
console.error('collectGoods: 请传入商品id'); console.error('collectGoods: 请传入商品id');
...@@ -163,12 +173,13 @@ exports.collectGoods = function (id) { return __awaiter(void 0, void 0, void 0, ...@@ -163,12 +173,13 @@ exports.collectGoods = function (id) { return __awaiter(void 0, void 0, void 0,
return [2 /*return*/, true]; return [2 /*return*/, true];
}); });
}); }; }); };
exports.collectGoods = collectGoods;
/** /**
* 查询商品收藏状态 * 查询商品收藏状态
* @param {number} 商品id * @param {number} 商品id
* @returns {boolean} 商品收场状态 * @returns {boolean} 商品收场状态
*/ */
exports.checkGoodsCollectedStatus = function (id) { return __awaiter(void 0, void 0, void 0, function () { var checkGoodsCollectedStatus = function (id) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
if (!id) { if (!id) {
console.error('checkGoodsCollectedStatus: 请传入商品id'); console.error('checkGoodsCollectedStatus: 请传入商品id');
...@@ -177,11 +188,12 @@ exports.checkGoodsCollectedStatus = function (id) { return __awaiter(void 0, voi ...@@ -177,11 +188,12 @@ exports.checkGoodsCollectedStatus = function (id) { return __awaiter(void 0, voi
return [2 /*return*/, true]; return [2 /*return*/, true];
}); });
}); }; }); };
exports.checkGoodsCollectedStatus = checkGoodsCollectedStatus;
/** /**
* 跳转到淘宝商品页 * 跳转到淘宝商品页
* @param {string} itemId 商品ID * @param {string} itemId 商品ID
*/ */
exports.openDetail = function (itemId) { return __awaiter(void 0, void 0, void 0, function () { var openDetail = function (itemId) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
if (!itemId) { if (!itemId) {
console.error('openDetail: 请传入商品id'); console.error('openDetail: 请传入商品id');
...@@ -192,10 +204,11 @@ exports.openDetail = function (itemId) { return __awaiter(void 0, void 0, void 0 ...@@ -192,10 +204,11 @@ exports.openDetail = function (itemId) { return __awaiter(void 0, void 0, void 0
return [2 /*return*/]; return [2 /*return*/];
}); });
}); }; }); };
exports.openDetail = openDetail;
/** /**
* 获取淘宝用户收货地址 * 获取淘宝用户收货地址
*/ */
exports.getUserAddress = function (opts) { var getUserAddress = function (opts) {
if (opts === void 0) { opts = {}; } if (opts === void 0) { opts = {}; }
return __awaiter(void 0, void 0, void 0, function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
...@@ -207,24 +220,27 @@ exports.getUserAddress = function (opts) { ...@@ -207,24 +220,27 @@ exports.getUserAddress = function (opts) {
}); });
}); });
}; };
exports.getUserAddress = getUserAddress;
/** /**
* 分享到群聊卡片 * 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数 * @param {object} requestInfo 分享到群聊卡片所需请求参数
*/ */
exports.chattingSendCard = function (requestInfo) { return __awaiter(void 0, void 0, void 0, function () { var chattingSendCard = function (requestInfo) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
alert('无法模拟'); alert('无法模拟');
return [2 /*return*/, false]; return [2 /*return*/, false];
}); });
}); }; }); };
exports.chattingSendCard = chattingSendCard;
/** /**
* 分享到群聊卡片 * 分享到群聊卡片
* @param {*} cloud 小程序云 * @param {*} cloud 小程序云
* @param {object} requestInfo 分享到群聊卡片所需请求参数 * @param {object} requestInfo 分享到群聊卡片所需请求参数
*/ */
exports.textRiskIdentification = function (text) { return __awaiter(void 0, void 0, void 0, function () { var textRiskIdentification = function (text) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
return [2 /*return*/, true]; return [2 /*return*/, true];
}); });
}); }; }); };
exports.textRiskIdentification = textRiskIdentification;
//# sourceMappingURL=tbMock.js.map //# 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;AACU,QAAA,WAAW,GAAG,UAAC,OAAO,EAAE,QAAe,EAAE,SAAS;IAA1B,yBAAA,EAAA,eAAe;IAChD,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AACF;;;GAGG;AACU,QAAA,WAAW,GAAG,UAAA,OAAO;IAC9B,KAAK,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAC;AACF;;;GAGG;AACU,QAAA,eAAe,GAAG;;QAC3B,sBAAO;gBACH,QAAQ,EAAE,UAAU;gBACpB,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,MAAM;aAClB,EAAC;;KACL,CAAC;AAEF;;;GAGG;AACU,QAAA,aAAa,GAAG;;QACzB,sBAAO;gBACH,OAAO,EAAE,OAAO;aACnB,EAAC;;KACL,CAAC;AACF;;;;GAIG;AACU,QAAA,SAAS,GAAG,UAAM,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OrB;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 \ No newline at end of file
...@@ -55,7 +55,7 @@ var tb_1 = require("../core/tb"); ...@@ -55,7 +55,7 @@ var tb_1 = require("../core/tb");
* @param params * @param params
* @param name * @param name
*/ */
exports.promisifyApiSimple = function (methodName, params, name) { var promisifyApiSimple = function (methodName, params, name) {
if (name) { if (name) {
// @ts-ignore // @ts-ignore
my[methodName](name, params); my[methodName](name, params);
...@@ -64,12 +64,13 @@ exports.promisifyApiSimple = function (methodName, params, name) { ...@@ -64,12 +64,13 @@ exports.promisifyApiSimple = function (methodName, params, name) {
// @ts-ignore // @ts-ignore
my[methodName](params); my[methodName](params);
}; };
exports.promisifyApiSimple = promisifyApiSimple;
/** /**
* 通用API封装 * 通用API封装
* @param methodName * @param methodName
* @param params * @param params
*/ */
exports.promisifyApi = function (methodName, params) { var promisifyApi = function (methodName, params) {
if (params === void 0) { params = {}; } if (params === void 0) { params = {}; }
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
...@@ -80,12 +81,13 @@ exports.promisifyApi = function (methodName, params) { ...@@ -80,12 +81,13 @@ exports.promisifyApi = function (methodName, params) {
} })); } }));
}); });
}; };
exports.promisifyApi = promisifyApi;
/** /**
* 通用API封装 * 通用API封装
* @param methodName * @param methodName
* @param params * @param params
*/ */
exports.promisifyApiToTb = function (methodName, params) { var promisifyApiToTb = function (methodName, params) {
if (params === void 0) { params = {}; } if (params === void 0) { params = {}; }
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
...@@ -96,6 +98,7 @@ exports.promisifyApiToTb = function (methodName, params) { ...@@ -96,6 +98,7 @@ exports.promisifyApiToTb = function (methodName, params) {
} })); } }));
}); });
}; };
exports.promisifyApiToTb = promisifyApiToTb;
/** /**
* 创建音频类 * 创建音频类
*/ */
...@@ -124,7 +127,7 @@ exports.AudioModel = AudioModel; ...@@ -124,7 +127,7 @@ exports.AudioModel = AudioModel;
/** /**
* 获取天猫会员状态 * 获取天猫会员状态
*/ */
exports.getTmallMemberStatus = function () { return __awaiter(void 0, void 0, void 0, function () { var getTmallMemberStatus = function () { return __awaiter(void 0, void 0, void 0, function () {
var cloud; var cloud;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -142,11 +145,12 @@ exports.getTmallMemberStatus = function () { return __awaiter(void 0, void 0, vo ...@@ -142,11 +145,12 @@ exports.getTmallMemberStatus = function () { return __awaiter(void 0, void 0, vo
} }
}); });
}); }; }); };
exports.getTmallMemberStatus = getTmallMemberStatus;
/** /**
* 拉菲奖品发放 * 拉菲奖品发放
* @param params * @param params
*/ */
exports.strategyEname = function (params) { return __awaiter(void 0, void 0, void 0, function () { var strategyEname = function (params) { return __awaiter(void 0, void 0, void 0, function () {
var cloud; var cloud;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -166,22 +170,24 @@ exports.strategyEname = function (params) { return __awaiter(void 0, void 0, voi ...@@ -166,22 +170,24 @@ exports.strategyEname = function (params) { return __awaiter(void 0, void 0, voi
} }
}); });
}); }; }); };
exports.strategyEname = strategyEname;
/** /**
* loading * loading
* @param methodName * @param methodName
* @param params * @param params
* @param name * @param name
*/ */
exports.isLoading = function (methodName) { var isLoading = function (methodName) {
// @ts-ignore // @ts-ignore
my[methodName](); my[methodName]();
}; };
exports.isLoading = isLoading;
/** /**
* 数据请求 * 数据请求
* @param params * @param params
* @param loading * @param loading
*/ */
exports.myRequest = function (params, loading) { return __awaiter(void 0, void 0, void 0, function () { var myRequest = function (params, loading) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) { return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
...@@ -202,6 +208,7 @@ exports.myRequest = function (params, loading) { return __awaiter(void 0, void 0 ...@@ -202,6 +208,7 @@ exports.myRequest = function (params, loading) { return __awaiter(void 0, void 0
})]; })];
}); });
}); }; }); };
exports.myRequest = myRequest;
/** /**
* 云函数接口请求 * 云函数接口请求
* @param _cloudName * @param _cloudName
...@@ -210,10 +217,11 @@ exports.myRequest = function (params, loading) { return __awaiter(void 0, void 0 ...@@ -210,10 +217,11 @@ exports.myRequest = function (params, loading) { return __awaiter(void 0, void 0
* @param loading * @param loading
* @param toastError * @param toastError
*/ */
exports.cloudRequest = function (cloud, _cloudName, handle, params, loading, toastError) { return __awaiter(void 0, void 0, void 0, function () { var cloudRequest = function (cloud, _cloudName, handle, params, loading, toastError) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) { return [2 /*return*/, new Promise(function (resolve, reject) {
// @ts-ignore // @ts-ignore
loading && exports.isLoading('showLoading');
cloud.function.invoke(_cloudName, params, handle).then(function (res) { 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 + " \u53C2\u6570 ----->", 'color: #43bb88;font-size: 12px;', params);
console.log("%c" + handle + " \u8FD4\u56DE\u503C ----->", 'color: #43bb88;font-size: 12px;', res); console.log("%c" + handle + " \u8FD4\u56DE\u503C ----->", 'color: #43bb88;font-size: 12px;', res);
...@@ -231,4 +239,5 @@ exports.cloudRequest = function (cloud, _cloudName, handle, params, loading, toa ...@@ -231,4 +239,5 @@ exports.cloudRequest = function (cloud, _cloudName, handle, params, loading, toa
})]; })];
}); });
}); }; }); };
exports.cloudRequest = cloudRequest;
//# sourceMappingURL=index.js.map //# 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;AACU,QAAA,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;AACD;;;;GAIG;AACU,QAAA,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;AACD;;;;GAIG;AACU,QAAA,gBAAgB,GAAI,UAAC,UAAkB,EAAE,MAAW;IAAX,uBAAA,EAAA,WAAW;IAChE,OAAO,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oBxB"}
\ No newline at end of file \ No newline at end of file
...@@ -46,11 +46,12 @@ var crypto = require("crypto"); ...@@ -46,11 +46,12 @@ var crypto = require("crypto");
* 加密 * 加密
* @param data * @param data
*/ */
exports.md5 = function (data) { var md5 = function (data) {
var buf = new Buffer(data); var buf = new Buffer(data);
var str = buf.toString("binary"); var str = buf.toString("binary");
return crypto.createHash("md5").update(str).digest("hex").slice(0, 30); return crypto.createHash("md5").update(str).digest("hex").slice(0, 30);
}; };
exports.md5 = md5;
/** /**
* my.request请求接口 * my.request请求接口
* @param params * @param params
...@@ -58,7 +59,7 @@ exports.md5 = function (data) { ...@@ -58,7 +59,7 @@ exports.md5 = function (data) {
* @param loading * @param loading
* @param tornadoAPI * @param tornadoAPI
*/ */
exports.tornadoAPICb = function (params, res, loading, tornadoAPI) { return __awaiter(void 0, void 0, void 0, function () { var tornadoAPICb = function (params, res, loading, tornadoAPI) { return __awaiter(void 0, void 0, void 0, function () {
var nickName, params_; var nickName, params_;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -76,6 +77,7 @@ exports.tornadoAPICb = function (params, res, loading, tornadoAPI) { return __aw ...@@ -76,6 +77,7 @@ exports.tornadoAPICb = function (params, res, loading, tornadoAPI) { return __aw
} }
}); });
}); }; }); };
exports.tornadoAPICb = tornadoAPICb;
/** /**
* 请求风池台接口数据 * 请求风池台接口数据
* @param tornadoAPI * @param tornadoAPI
...@@ -84,7 +86,7 @@ exports.tornadoAPICb = function (params, res, loading, tornadoAPI) { return __aw ...@@ -84,7 +86,7 @@ exports.tornadoAPICb = function (params, res, loading, tornadoAPI) { return __aw
* @param loading * @param loading
* @param params * @param params
*/ */
exports.tornadoAPIFn = function (tornadoAPI, nickName, handle, loading, params) { return __awaiter(void 0, void 0, void 0, function () { var tornadoAPIFn = function (tornadoAPI, nickName, handle, loading, params) { return __awaiter(void 0, void 0, void 0, function () {
var matchRes, db, proxyIp, data_, params_; var matchRes, db, proxyIp, data_, params_;
return __generator(this, function (_a) { return __generator(this, function (_a) {
matchRes = tornadoAPI.match(/db=(\w*)&proxyIp=([\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})/); matchRes = tornadoAPI.match(/db=(\w*)&proxyIp=([\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})/);
...@@ -115,13 +117,14 @@ exports.tornadoAPIFn = function (tornadoAPI, nickName, handle, loading, params) ...@@ -115,13 +117,14 @@ exports.tornadoAPIFn = function (tornadoAPI, nickName, handle, loading, params)
return [2 /*return*/]; return [2 /*return*/];
}); });
}); }; }); };
exports.tornadoAPIFn = tornadoAPIFn;
/** /**
* 请求mock数据 * 请求mock数据
* @param reqConfig * @param reqConfig
* @param initConfig * @param initConfig
* @param params * @param params
*/ */
exports.requestMock = function (reqConfig, initConfig, params) { return __awaiter(void 0, void 0, void 0, function () { 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_; var cloudName, handle, method, isShowLoading, requestType, tornadoAPI, nickName, mockUrlPrefix, mockUrl, requestPrefix, params_;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -144,4 +147,5 @@ exports.requestMock = function (reqConfig, initConfig, params) { return __awaite ...@@ -144,4 +147,5 @@ exports.requestMock = function (reqConfig, initConfig, params) { return __awaite
} }
}); });
}); }; }); };
exports.requestMock = requestMock;
//# sourceMappingURL=requestFn.js.map //# 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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AAS,UAA7C,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 \ 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;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MAAM,QAAA,EAAE,aAAa,eAAA,EAAE,CAAA;wBACpE,UAAU,GAAG,EAAE,WAAW,aAAA,EAAE,UAAU,YAAA,EAAE,QAAQ,UAAA,EAAE,aAAa,eAAA,EAAE,OAAO,SAAA,EAAE,CAAA;wBAC1E,OAAO,cAAK,UAAU,YAAA,IAAK,MAAM,CAAE,CAAA;6BAErC,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAnD,wBAAmD;wBAAS,qBAAM,uBAAW,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,EAAA;4BAAxD,sBAAO,SAAiD,EAAC;4BAG3G,qBAAM,sBAAY,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,CAAC,EAAA;4BAAxF,sBAAO,SAAiF,EAAC;;;;KAC5F,CAAA;AACL,CAAC,CAAA;AACD,kBAAe,OAAO,CAAA"}
\ No newline at end of file \ No newline at end of file
...@@ -26,12 +26,18 @@ export declare const getRequestParams: (value: any) => { ...@@ -26,12 +26,18 @@ export declare const getRequestParams: (value: any) => {
defaultParams: any; defaultParams: any;
ext: any; ext: any;
}; };
declare type IApis<T> = {
[P in keyof T]: (params?: object, config?: {
isShowLoading?: boolean;
toastError?: boolean;
}) => {};
};
/** /**
* 生成API * 生成API
* @param {array} apiList API数据数组 * @param {array} apiList API数据数组
* @param {function} request 请求 * @param {function} request 请求
*/ */
export declare const generateAPI: (apiList: any, request: any) => {}; export declare const generateAPI: <T, K extends Function>(apiList: T, request: K) => IApis<T>;
/** /**
* 函数节流,普通防连点 * 函数节流,普通防连点
* @param {fun} fun 函数 * @param {fun} fun 函数
...@@ -60,3 +66,4 @@ export declare const formatTimeStamp: (ms: number) => string; ...@@ -60,3 +66,4 @@ export declare const formatTimeStamp: (ms: number) => string;
* @param noCheck * @param noCheck
*/ */
export declare const validateActivityStatus: (startTime: number, endTime: number, noCheck: boolean) => Promise<unknown>; export declare const validateActivityStatus: (startTime: number, endTime: number, noCheck: boolean) => Promise<unknown>;
export {};
...@@ -66,7 +66,7 @@ var tb_1 = require("../core/tb"); ...@@ -66,7 +66,7 @@ var tb_1 = require("../core/tb");
* @param format 字符串,需要的格式例如:'yyyy/MM/dd hh:mm:ss' * @param format 字符串,需要的格式例如:'yyyy/MM/dd hh:mm:ss'
* @returns {String} * @returns {String}
*/ */
exports.dateFormatter = function (dateTxt, format) { var dateFormatter = function (dateTxt, format) {
if (format === void 0) { format = 'yyyy/MM/dd'; } if (format === void 0) { format = 'yyyy/MM/dd'; }
if (!dateTxt) if (!dateTxt)
return '-'; return '-';
...@@ -90,12 +90,13 @@ exports.dateFormatter = function (dateTxt, format) { ...@@ -90,12 +90,13 @@ exports.dateFormatter = function (dateTxt, format) {
} }
return format; return format;
}; };
exports.dateFormatter = dateFormatter;
/** /**
* 版本比较 * 版本比较
* @param {string} cur 当前版本 * @param {string} cur 当前版本
* @param {string} compare 比较版本 * @param {string} compare 比较版本
*/ */
exports.versionCompare = function (cur, compare) { var versionCompare = function (cur, compare) {
var _cur = cur.split('.'); var _cur = cur.split('.');
var _compare = compare.split('.'); var _compare = compare.split('.');
if (+_cur[0] < +_compare[0]) { if (+_cur[0] < +_compare[0]) {
...@@ -109,11 +110,12 @@ exports.versionCompare = function (cur, compare) { ...@@ -109,11 +110,12 @@ exports.versionCompare = function (cur, compare) {
} }
return true; return true;
}; };
exports.versionCompare = versionCompare;
/** /**
* 获取request请求所需参数 * 获取request请求所需参数
* @param {object/string} value API项配置 * @param {object/string} value API项配置
*/ */
exports.getRequestParams = function (value) { var getRequestParams = function (value) {
if (typeof value === 'string') { if (typeof value === 'string') {
return { return {
handle: value, handle: value,
...@@ -134,26 +136,39 @@ exports.getRequestParams = function (value) { ...@@ -134,26 +136,39 @@ exports.getRequestParams = function (value) {
console.error('getRequestParams: 传参有误'); console.error('getRequestParams: 传参有误');
} }
}; };
exports.getRequestParams = getRequestParams;
/** /**
* 生成API * 生成API
* @param {array} apiList API数据数组 * @param {array} apiList API数据数组
* @param {function} request 请求 * @param {function} request 请求
*/ */
exports.generateAPI = function (apiList, request) { var generateAPI = function (apiList, request) {
// @ts-ignore
var api = {}; var api = {};
Object.entries(apiList).forEach(function (_a) { Object.entries(apiList).forEach(function (_a) {
var key = _a[0], value = _a[1]; var key = _a[0], value = _a[1];
var _b = exports.getRequestParams(value), handle = _b.handle, method = _b.method, ext = _b.ext, defaultParams = _b.defaultParams; var _b = exports.getRequestParams(value), handle = _b.handle, method = _b.method, ext = _b.ext, defaultParams = _b.defaultParams;
api[key] = function (params) { return request(handle, method, Object.assign({}, defaultParams, params), ext); }; 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 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 {fun} fun 函数
* @param {delay} delay 时间 * @param {delay} delay 时间
*/ */
exports.throttleHandle = function (fun, delay) { var throttleHandle = function (fun, delay) {
if (delay === void 0) { delay = 1000; } if (delay === void 0) { delay = 1000; }
var last, deferTimer; var last, deferTimer;
return function () { return function () {
...@@ -170,11 +185,12 @@ exports.throttleHandle = function (fun, delay) { ...@@ -170,11 +185,12 @@ exports.throttleHandle = function (fun, delay) {
} }
}; };
}; };
exports.throttleHandle = throttleHandle;
/** /**
* 根据fileId获取图片地址 * 根据fileId获取图片地址
* @param fileId * @param fileId
*/ */
exports.getImgShareUrl = function (fileId) { return __awaiter(void 0, void 0, void 0, function () { var getImgShareUrl = function (fileId) { return __awaiter(void 0, void 0, void 0, function () {
var cloud, list; var cloud, list;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -189,11 +205,12 @@ exports.getImgShareUrl = function (fileId) { return __awaiter(void 0, void 0, vo ...@@ -189,11 +205,12 @@ exports.getImgShareUrl = function (fileId) { return __awaiter(void 0, void 0, vo
} }
}); });
}); }; }); };
exports.getImgShareUrl = getImgShareUrl;
/** /**
* 根据sellerId判断入会状态 * 根据sellerId判断入会状态
* @param sellerId * @param sellerId
*/ */
exports.checkIsMember = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () { var checkIsMember = function (sellerId) { return __awaiter(void 0, void 0, void 0, function () {
var memberPlugin; var memberPlugin;
return __generator(this, function (_a) { return __generator(this, function (_a) {
memberPlugin = requirePlugin("cemMember"); memberPlugin = requirePlugin("cemMember");
...@@ -215,24 +232,26 @@ exports.checkIsMember = function (sellerId) { return __awaiter(void 0, void 0, v ...@@ -215,24 +232,26 @@ exports.checkIsMember = function (sellerId) { return __awaiter(void 0, void 0, v
})]; })];
}); });
}); }; }); };
exports.checkIsMember = checkIsMember;
/** /**
* 毫秒转换成00:00:00格式 * 毫秒转换成00:00:00格式
* @param ms 毫秒 * @param ms 毫秒
*/ */
exports.formatTimeStamp = function (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)); 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; hours = hours < 10 ? '0' + hours : hours;
minutes = minutes < 10 ? '0' + minutes : minutes; minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds; seconds = seconds < 10 ? '0' + seconds : seconds;
return hours + ":" + minutes + ":" + seconds; return hours + ":" + minutes + ":" + seconds;
}; };
exports.formatTimeStamp = formatTimeStamp;
/** /**
* 活动状态验证 * 活动状态验证
* @param startTime * @param startTime
* @param endTime * @param endTime
* @param noCheck * @param noCheck
*/ */
exports.validateActivityStatus = function (startTime, endTime, noCheck) { return __awaiter(void 0, void 0, void 0, function () { var validateActivityStatus = function (startTime, endTime, noCheck) { return __awaiter(void 0, void 0, void 0, function () {
var nowTime; var nowTime;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -255,4 +274,5 @@ exports.validateActivityStatus = function (startTime, endTime, noCheck) { return ...@@ -255,4 +274,5 @@ exports.validateActivityStatus = function (startTime, endTime, noCheck) { return
} }
}); });
}); }; }); };
exports.validateActivityStatus = validateActivityStatus;
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAwD;AACxD;;;;;GAKG;AACU,QAAA,aAAa,GAAG,UAAC,OAAe,EAAE,MAAqB;IAArB,uBAAA,EAAA,qBAAqB;IAChE,IAAI,CAAC,OAAO;QAAE,OAAO,GAAG,CAAC;IAEzB,IAAM,IAAI,GAAG,IAAI,IAAI,CACnB,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CACtF,CAAC;IACF,IAAI,CAAC,GAAG;QACN,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;QACzB,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;QACpB,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE;QACrB,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE;QACvB,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE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AC,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 \ No newline at end of file
...@@ -151,6 +151,7 @@ export const myRequest = async (params: any, loading: boolean) => { ...@@ -151,6 +151,7 @@ export const myRequest = async (params: any, loading: boolean) => {
export const cloudRequest = async (cloud: any, _cloudName:string, handle: string, params: any, loading: boolean, toastError: boolean) => { export const cloudRequest = async (cloud: any, _cloudName:string, handle: string, params: any, loading: boolean, toastError: boolean) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// @ts-ignore // @ts-ignore
loading && isLoading('showLoading')
cloud.function.invoke(_cloudName, params, handle).then(res => { 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;', params)
console.log(`%c${handle} 返回值 ----->`, 'color: #43bb88;font-size: 12px;', res) console.log(`%c${handle} 返回值 ----->`, 'color: #43bb88;font-size: 12px;', res)
......
...@@ -28,7 +28,8 @@ const request = (header:IRequest) => { ...@@ -28,7 +28,8 @@ const request = (header:IRequest) => {
const initConfig = { requestType, tornadoAPI, nickName, mockUrlPrefix, mockUrl } const initConfig = { requestType, tornadoAPI, nickName, mockUrlPrefix, mockUrl }
const params_ = { activityId, ...params } const params_ = { activityId, ...params }
if(['ams', 'yapi', 'tornadoAPI'].includes(requestType)) return await requestMock(reqConfig, initConfig, params_); if (['ams', 'yapi', 'tornadoAPI'].includes(requestType)) return await requestMock(reqConfig, initConfig, params_);
return await cloudRequest(cloud, _cloudName, handle, params_, isShowLoading, toastError); return await cloudRequest(cloud, _cloudName, handle, params_, isShowLoading, toastError);
} }
......
...@@ -76,18 +76,35 @@ export const getRequestParams = (value: any) => { ...@@ -76,18 +76,35 @@ export const getRequestParams = (value: any) => {
console.error('getRequestParams: 传参有误'); console.error('getRequestParams: 传参有误');
} }
}; };
type IApis<T> = {
[P in keyof T]: (params?: object, config?: {
isShowLoading?: boolean, // 请求是否loading
toastError?: boolean // 请求失败是否 toast错误
}) => {}
}
/** /**
* 生成API * 生成API
* @param {array} apiList API数据数组 * @param {array} apiList API数据数组
* @param {function} request 请求 * @param {function} request 请求
*/ */
export const generateAPI = (apiList, request) => { export const generateAPI = <T, K extends Function>(apiList: T, request: K): IApis<T> => {
const api = {}; // @ts-ignore
const api: IApis<typeof apiList> = {};
Object.entries(apiList).forEach(([key, value]) => { Object.entries(apiList).forEach(([key, value]) => {
const { handle, method, ext, defaultParams } = getRequestParams(value); const { handle, method, ext, defaultParams } = getRequestParams(value);
api[key] = params => request(handle, method, Object.assign({}, defaultParams, params) , ext); api[key] = (params, config = {}) => request(handle, method, Object.assign({}, defaultParams, params) , Object.assign({}, ext, config));
}); });
return api;
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)
// }
// }, {})
}; };
/** /**
* 函数节流,普通防连点 * 函数节流,普通防连点
......
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