Commit 96b10d19 authored by wildfirecode13's avatar wildfirecode13

1

parent 6542de23
......@@ -2,7 +2,7 @@
import React, { Component } from 'react';
import resList from '../../resconfig/resList';
//import API from '../../api';
import API from '../../api';
import './pagefrontpage.less';
......@@ -11,6 +11,12 @@ class Pagefrontpage extends Component {
super(props);
this.state = this.state || { resList: resList };
}
componentDidMount() {
API.getRule().then((res) => {
});
}
render() {
return (
<div className="frontpage">
......
const g = typeof global !== 'undefined' ? global : self;
g.appXAppJson = {
"app": {
"$homepage": "pages/pagefrontpage/pagefrontpage"
}
};
if(!self.Map || !self.Set || !self.Symbol) {
importScripts('https://gw.alipayobjects.com/as/g/appx_release/deps/1.0.3/es6-set-map-symbol.js');
}
\ No newline at end of file
require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$');
require('../../pages/pagefrontpage/pagefrontpage?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
if(!self.__appxInited) {
self.__appxInited = 1;
require('./config$');
if( navigator.userAgent && (navigator.userAgent.indexOf('LyraVM') > 0 || navigator.userAgent.indexOf('AlipayIDE') > 0) ) {
var AFAppX = self.AFAppX.getAppContext ? self.AFAppX.getAppContext().AFAppX : self.AFAppX;
} else {
importScripts('https://appx/af-appx.worker.min.js');
var AFAppX = self.AFAppX;
}
self.getCurrentPages = AFAppX.getCurrentPages;
self.getApp = AFAppX.getApp;
self.Page = AFAppX.Page;
self.App = AFAppX.App;
self.my = AFAppX.bridge || AFAppX.abridge;
self.abridge = self.my;
self.Component = AFAppX.WorkerComponent || function(){};
self.$global = AFAppX.$global;
self.requirePlugin = AFAppX.requirePlugin;
if(AFAppX.registerApp) {
AFAppX.registerApp({
appJSON: appXAppJson,
});
}
function success() {
require('../../app');
require('../../pages/pagefrontpage/pagefrontpage?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
}
self.bootstrapApp ? self.bootstrapApp({ success }) : success();
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const app = getApp();
console.log('fuckapp',app)
const { tbcc, cloudName, cloud, requestType } = app;
const { utils: { generateAPI }, request: tbccRequest, capi } = tbcc;
const apicfg_1 = require("./apicfg");
const request = tbccRequest({
cloud,
cloudName,
requestType
});
// api handle 列表
const apiList = Object.assign(Object.assign({}, capi), apicfg_1.default);
// 生成API
const API = generateAPI(apiList, request);
exports.default = API;
//# sourceMappingURL=api.js.map
\ No newline at end of file
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../src/packages/jsx2taobao/template/api/api.js"],"names":[],"mappings":";;AAAA,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;AACrB,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;AAEpD,MAAM,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;AACpE,qCAA8B;AAC9B,MAAM,OAAO,GAAG,WAAW,CAAC;IAC1B,KAAK;IACL,SAAS;IACT,WAAW;CACZ,CAAC,CAAC;AAEH,gBAAgB;AAChB,MAAM,OAAO,mCACR,IAAI,GACJ,gBAAM,CACV,CAAC;AAEF,QAAQ;AACR,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAE1C,kBAAe,GAAG,CAAC"}
\ No newline at end of file
let projectId = window.CFG.projectId || '';
const apiCfg = {
getRule:`/projectx/${projectId}/projectRule.query`,
getRule2:`/projectx/${projectId}/projectRule2.query`,
doJoin: {
uri: `/projectx/${projectId}/join.do`,
method: "post"
}
}
export default apiCfg;
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mp_cloud_sdk_1 = require("@tbmp/mp-cloud-sdk");
mp_cloud_sdk_1.default.init({
env: 'test' // 云函数环境 test 测试环境 online 线上环境
});
const tbcc = require('./tbcc-sdk').default;
console.log('fuck tbcc',tbcc)
App({
tbcc,
requestType: 'cloud',
cloudName: '',
cloud: // 主云函数项目名
mp_cloud_sdk_1.default,
activityId: "",
onLaunch(options) {
this.handleQuery(options.query || {});
},
onShow(options) {
// 从后台被 scheme 重新打开
},
/**
* 处理链接参数
* @param {object} query 小程序链接上的参数
*/
handleQuery(query) {
const { activityId } = query;
activityId && (this.activityId = activityId);
}
});
//# sourceMappingURL=app.js.map
\ No newline at end of file
{"pages":["pages/pagefrontpage/pagefrontpage"],"window":{}}
\ No newline at end of file
.rulepanel {
top: 0rpx;
left: 0rpx;
width: 750rpx;
height: 1624rpx;
display: block;
position: absolute;
}
.rulepanel .image {
width: 300rpx;
height: 300rpx;
opacity: 1;
display: block;
left: 0rpx;
top: 0rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
<view class="rulepanel">
<image class="image" src={{resList['eb602b5e-fd36-4968-bed0-ec786cd8e1c0'].url}} />
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
Component({
props: {},
data: {},
methods: {},
onInit(props) {
this.setData(this.data || {
resList: resList
});
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
This diff is collapsed.
{
"_from": "@tbmp/mp-cloud-sdk@^1.3.8",
"_id": "@tbmp/mp-cloud-sdk@1.4.2",
"_inBundle": false,
"_integrity": "sha1-/49BtdDaNJ6H9+f9DDBMPgt/BbQ=",
"_location": "/@tbmp/mp-cloud-sdk",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@tbmp/mp-cloud-sdk@^1.3.8",
"name": "@tbmp/mp-cloud-sdk",
"escapedName": "@tbmp%2fmp-cloud-sdk",
"scope": "@tbmp",
"rawSpec": "^1.3.8",
"saveSpec": null,
"fetchSpec": "^1.3.8"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npm.taobao.org/@tbmp/mp-cloud-sdk/download/@tbmp/mp-cloud-sdk-1.4.2.tgz",
"_shasum": "ff8f41b5d0da349e87f7e7fd0c304c3e0b7f05b4",
"_spec": "@tbmp/mp-cloud-sdk@^1.3.8",
"_where": "/Users/wanghongyuan/hello_taobao/project/dist",
"author": "",
"bundleDependencies": false,
"deprecated": false,
"description": "",
"gitHead": "c074f811312aea20c97a289aa9ac785e72de2368",
"license": "ISC",
"main": "index.js",
"name": "@tbmp/mp-cloud-sdk",
"publishConfig": {
"access": "public"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"types": "./types/platforms/mp/index.d.ts",
"version": "1.4.2"
}
import { Db } from "./db";
export interface IFindOptions {
/**
* 查询的文档数量限制
*/
limit?: number;
/**
* 跳过的文档数量
*/
skip?: number;
/**
* 排序规则
*/
sort?: object;
/**
* 查询后过滤的字段
*/
projection?: object;
}
export declare class CollectionReference {
/**
* 初始化
*
* @internal
*
* @param db - 数据库的引用
* @param coll - 集合名称
*/
private _db;
private _coll;
constructor(db: Db, coll: string);
/**
* 读取集合名字
*/
readonly name: string;
/**
* 对集合执行聚合查询
* @param pipeline 聚合查询对象
*/
aggregate(pipeline: object | object[]): Promise<any>;
/**
* 获取集合中复合条件的记录数量
* @param filter 过滤条件
*/
count(filter: object): Promise<any>;
/**
* 删除集合中的一批记录
* @param filter 过滤条件
*/
deleteMany(filter: object): Promise<any>;
/**
* 查找集合中符合条件的所有记录
* @param filter 过滤条件
* @param options 查询配置项
*/
find(filter: any, options?: IFindOptions): Promise<any>;
/**
* 替换一条数据
* @param filter 过滤条件
* @param data 新数据
*/
replaceOne(filter: object, data: object): Promise<any>;
/**
* 在集合中添加一条记录
* @param data 带插入的数据
*/
insertOne(data: object): Promise<any>;
/**
* 在集合中添加一批记录
* @param data 待插入的数据,只能为数组
*/
insertMany(data: object[]): Promise<any>;
/**
*
* @param filter 过滤条件
* @param data 更新规则
*
*/
updateMany(filter: object, data: object): Promise<any>;
}
import { CollectionReference } from "./collection";
import { IAsyncInvokeOptions } from "../../shared/types";
import { ICloudService } from "../interface/cloudService";
export declare class Db extends ICloudService {
/**
* 获取集合的引用
*
* @param collName - 集合名称
*/
collection(collName: string): CollectionReference;
/**
* 创建集合
*/
createCollection(name: string, options: {
collName: string;
} & IAsyncInvokeOptions): Promise<any>;
dbRequest(action?: string, params?: any): Promise<any>;
}
import { Db } from "./db";
export default Db;
import { IAsyncInvokeOptions } from '../../shared/types';
import { ICloudService } from '../interface/cloudService';
export interface ICallFunctionOptions extends IAsyncInvokeOptions {
name: string;
data: any;
}
export interface IInvokeMethod {
(IAsyncInvokeOptions: any): void;
}
export default class CloudFunction extends ICloudService {
invoke(name: string, data?: object, handler?: string): Promise<any>;
private fcRequest;
}
import { Request } from "../../shared/request";
export interface ICloudServiceOptions {
env?: 'test' | 'online' | 'pre';
}
export declare abstract class ICloudService {
options: ICloudServiceOptions;
request: Request;
constructor(options: ICloudServiceOptions, request: Request);
init?(): void;
}
import Powermsg from '@ali/lib-powermsg-sdk';
import { Env } from '../../shared/types';
export default class Client {
env: Env;
pmg: Powermsg;
deviceId: string;
initing: boolean;
queue: (() => void)[];
config: any;
constructor(env: Env);
init: () => Promise<any>;
onMessage: (callback: any) => Promise<() => void>;
private createPwgInstance;
}
import { ICloudService, ICloudServiceOptions } from "../interface/cloudService";
import Client from './client';
import Server from './server';
export default class Message extends ICloudService {
server: Server;
client: Client;
constructor(options: ICloudServiceOptions);
}
import { Request } from '../../shared/request';
import { Env } from "../../../packages/mp-cloud-node-sdk/types/shared/types";
interface IPushOptions {
subType: number;
deviceId?: string;
data: object;
pushType: string;
}
export default class Server {
env: Env;
request: Request;
constructor(env: Env, request: Request);
push(options: IPushOptions): Promise<any>;
}
export {};
import {ICloudService} from "../../interface/cloudService";
export default class Application extends ICloudService {
httpRequest(options: {path: string, params?: any, body?: any, headers?: any, method?: string, exts?: any}): Promise<any>;
}
import {ICloudService} from "../../interface/cloudService";
export default class Process extends ICloudService {
invoke(options: { api: string, data?: any, headers?: any }): Promise<any>;
private topRequest;
}
import {ICloudService} from "../../interface/cloudService";
export default class Qimen extends ICloudService {
invoke(options: { api: string, data?: any, targetAppKey?: any, headers?: any }): Promise<any>;
private topRequest;
}
import {ICloudService} from "../../interface/cloudService";
export default class Top extends ICloudService {
invoke(options: { api: string, data?: any, headers?: any, authScope?: string }): Promise<any>;
private topRequest;
}
import { IRequestOptions } from "../../../shared/request";
export default class Top {
client: any;
context: IRequestOptions;
constructor(context: IRequestOptions);
invoke(apiName: string, data?: any, httpHeaders?: any): Promise<any>;
}
import { IAsyncInvokeOptions } from "../../shared/types";
import { ICloudService } from "../interface/cloudService";
export interface IUploadFileOptions extends IAsyncInvokeOptions {
/**
* 选择到的本地文件路径
*/
filePath: string;
/**
* 文件类型, image/audio/video
*/
fileType: FileTypes;
/**
* 云存储文件名可带路径, 如a/xxx.jpg
*/
fileName?: string;
/**
* web环境上传 file对象
*/
file?: any;
}
export interface IDownloadFileOptions extends IAsyncInvokeOptions {
fileType?: FileTypes;
fileId: string;
}
export interface ITempFileURLOptions extends IAsyncInvokeOptions {
fileList: string[];
}
export declare type IDeleteFileOptions = IDownloadFileOptions;
export declare type FileTypes = "image" | "video" | "audio";
export default class CloudStorage extends ICloudService {
private parseUploadResult;
private parsePostUploadResult;
private parseAusUploadResult;
/**
* 文件上传
* 1.获取上传配置
* 2.调用my.api上传
* 3.建立存储关系
* @param options
*/
uploadFile(options: IUploadFileOptions): Promise<any>;
/**
* 删除文件
* @param options
*/
deleteFile(options: IDeleteFileOptions): Promise<boolean>;
/**
* 根据文件id(cloud://)获取授权的url
* @param options
*/
getTempFileURL(options: IAsyncInvokeOptions & {
fileType: string;
fileId: string | string[];
}): Promise<any>;
/**
* 从服务端获取文件并在本地读取
* @param options
*/
readRemoteFile(options: IAsyncInvokeOptions & {
url: string;
}): Promise<ArrayBuffer>;
/**
* 存储的请求代理, 统一sdk环境和存储环境
* @param action
* @param data
* @param requestType
*/
private storageRequest;
}
import { Cloud } from '../mp';
declare const cloudInstance: Cloud;
export default cloudInstance;
import { Cloud as MpCloud } from '../mp';
import { ICloudOptions } from '../../shared/types';
import Client from '../../core/message/client';
import { IProxy } from '../../shared/request';
export declare class Cloud extends MpCloud {
message: {
client: Client;
};
init(options: ICloudOptions, proxy: IProxy): Promise<boolean>;
}
declare const _default: Cloud;
export default _default;
import {IProxy} from '../../shared/request';
import {ICloudOptions} from '../../shared/types';
import CloudFunction from '../../core/functions';
import CloudStorage from '../../core/storage';
import Db from '../../core/db';
import Top from '../../core/openApi/client/top';
import Qimen from '../../core/openApi/client/qimen';
import Process from '../../core/openApi/client/process';
import Application from '../../core/openApi/client/application';
export declare class Cloud {
function: CloudFunction;
file: CloudStorage;
db: Db;
topApi: Top;
qimenApi: Qimen;
processApi: Process;
application: Application;
init(options: ICloudOptions, proxy?: IProxy): Promise<boolean>;
}
declare const _default: Cloud;
export default _default;
import { IProxy, IRequestOptions } from '../../shared/request';
import { ICloudOptions } from '../../shared/types';
import CloudFunction from '../../core/functions';
import Database from '../../core/db';
import Server from '../../core/message/server';
import Top from '../../core/openApi/server/top';
export declare class Cloud {
private _options;
db: Database;
function: CloudFunction;
message: {
server: Server;
};
private request;
topApi: Top;
setEnv(env: any): void;
init(options: ICloudOptions & IRequestOptions, proxy: IProxy): void;
}
export declare function cloud(context: any, options: ICloudOptions): Cloud;
export declare const BASE_APIS: {
GET_SESSION: string;
GET_SECRET: string;
};
export declare const STORAGE_KEYS: {
SECRET: string;
};
export declare const ENV_CONFIG: {
pre: {
gw: string;
};
online: {
gw: string;
};
};
import { IAsyncInvokeOptions } from "./types";
export declare function invokeCallback(options: IAsyncInvokeOptions, asyncTask: Promise<any>): Promise<void>;
export declare function myApiPromisify(method: (options: any) => void, options?: any): Promise<any>;
export declare function getUserId(): Promise<string>;
export declare function noop(): void;
export declare function invokeTaskCallback(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
export declare function safeAccess(props: any, keys: string[] | string, def?: any): any;
export declare function getValue(key: string): Promise<any>;
export declare function setValue(key: string, data: any): Promise<any>;
export interface IRequestOptions {
appKey?: string,
sourceAppKey?: string,
requestAppKey?:string,
miniappId?: string,
sourceMiniAppId?: string,
appOwnerOpenId?: string,
signSecret?: string;
sessionKey?: string;
requestId?: string;
cloudId?: string;
openId?: string;
unionId?: string;
userNick?: string,
mixNick?: string,
session?: string;
accessToken?: string;
env?: string;
}
export declare enum RequestTypes {
MTOP = 1,
MY = 2,
GATEWAY = 3
}
export interface IGatewayResponse {
error_response: {
code: string;
};
}
export interface IRequestDetail {
url: string;
data?: any;
rawData?: any;
method?: string;
headers?: any;
dataType?: string;
v?: string;
__is_retry_task__?: boolean;
env?: string;
mtopOptions?: any;
}
export interface IProxyOptions {
gatewayUrl?: string;
dataProxyGatewayUrl?: string;
}
export declare abstract class IProxy {
options: IProxyOptions;
abstract apply(task: IRequestDetail, requestType?: RequestTypes): Promise<any>;
constructor(options?: IProxyOptions);
}
export declare class Request {
networkType?: string;
options: IRequestOptions;
tasks: {
detail: IRequestDetail;
success?: (res: any) => void;
fail?: (res: any) => void;
}[];
proxy: IProxy;
inited: boolean;
pauseExecTask: boolean;
init(options: IRequestOptions, proxy: IProxy): Promise<void>;
listenNetworkChange(): Promise<void>;
static getRequestType(url: string): RequestTypes;
/**
* 验证响应结果, 特定情况下重试请求
* @param res
*/
private verifyResponse;
private tryThrowError;
private sendGatewayRequest;
flushGatewayRequestQueue(reject?: boolean): void;
exec(detail: IRequestDetail, requestType?: RequestTypes): Promise<any>;
/**
*
* @param url 网关请求
* @param method 请求方法
* @param queryString
* @param headers mc_开头的http header
* @param content json body
*/
private getHttpRequestSign;
/**
* 对网关请求签名
* @param detail
*/
private createGatewayRequest;
}
export declare const request: Request;
export interface ICallback {
(res: any): void;
}
export interface IHttpRequestOptions extends IAsyncInvokeOptions {
url: string;
method?: string;
headers?: any;
data?: any;
dataType?: string;
}
export declare type Env = 'test' | 'pre' | 'online';
export declare type Envs = {
database: Env;
file: Env;
function: Env;
message: Env;
};
export interface ICloudOptions {
env?: Env | Envs;
appKey?: string;
}
declare global {
interface Window {
}
var my: {
httpRequest: (options: IHttpRequestOptions) => void;
sendMtop: (options: any) => void;
alert: (options: {
title?: string;
content?: string;
}) => void;
};
var NODE_PLATFORM: boolean;
var SDK_VERSION: string;
}
export interface IAsyncInvokeOptions {
success?: ICallback;
fail?: ICallback;
complete?: ICallback;
}
export declare type AsyncInvokeResult = Promise<any> | void;
export declare type Constructor<T = {}> = new (...args: any[]) => T;
import { IAsyncInvokeOptions, Env, Envs } from "./types";
export declare function noop(): void;
export declare function invokeTaskCallback(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
export declare function safeAccess(props: any, keys: string[] | string, def?: any): any;
export declare function invokeCallback(options: IAsyncInvokeOptions, asyncTask: Promise<any>): Promise<void>;
export declare function myApiPromisify(method: (options: any) => void, options?: any): Promise<any>;
export declare function getUserId(): Promise<string>;
export declare function getEnvs(env: Env | Envs): Envs;
{
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@tbmp/mp-cloud-sdk": {
"version": "1.4.2",
"resolved": "https://registry.npm.taobao.org/@tbmp/mp-cloud-sdk/download/@tbmp/mp-cloud-sdk-1.4.2.tgz",
"integrity": "sha1-/49BtdDaNJ6H9+f9DDBMPgt/BbQ="
}
}
}
{
"name": "",
"version": "1.0.0",
"main": "",
"license": "MIT",
"dependencies": {
"@tbmp/mp-cloud-sdk": "^1.3.8"
}
}
.frontpage {
width: 750rpx;
height: 1624rpx;
opacity: 1;
position: absolute;
background-image: url(//yun.duiba.com.cn/aurora/assets/fb115c35b78fc3e792ee94b5831cca0c43174c0d.jpg);
}
.frontpage .frontpage_placeholder {
width: 750rpx;
height: 1624rpx;
opacity: 1;
position: absolute;
background-image: url();
}
.frontpage .frontpage_wrapper {
width: 673rpx;
height: 1065rpx;
opacity: 1;
left: 37rpx;
top: 328rpx;
position: absolute;
}
.frontpage .frontpage_wrapper .frontpage_btn {
width: 458rpx;
height: 138rpx;
opacity: 1;
left: 108rpx;
top: 880rpx;
position: absolute;
}
.frontpage .frontpage_wrapper .frontpage_txt {
width: 673rpx;
height: 30rpx;
opacity: 1;
left: 0rpx;
top: 1042rpx;
position: absolute;
font-size: 14.93076;
color: #ffffff;
text-align: center;
}
.frontpage .frontpage_wrapper .frontpage_image {
width: 673rpx;
height: 830rpx;
opacity: 1;
position: absolute;
}
<view class="frontpage">
<image class="frontpage_placeholder" src={{resList['9bfe28c7-7e25-4631-b5f1-0f52d4fb0643'].url}} />
<view class="frontpage_wrapper">
<image class="frontpage_btn" src={{resList['55c6197d-b4a9-45bc-92d8-328cc151512f'].url}} />
<label class="frontpage_txt">已有 120382 人参与</label>
<image class="frontpage_image" src={{resList['e4a03a02-4a52-4276-97e3-9f3dade11dfb'].url}} />
</view>
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
import API from '../../api';
Page({
data: {},
onLoad(props) {
this.setData(this.data || {
resList: resList
});
},
onReady() {
API.getRule().then(res => {});
}
});
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
/**
* 目前没有用到
* @param {*} resList
* @param {*} uuid
*/
const getSrcByUuid = (resList, uuid) => {
resList = resList || [];
for (let i = 0; i < resList.length; i++) {
if (resList[i].uuid == uuid) {
return resList[i].url
}
}
}
module.exports = {
getSrcByUuid
}
\ No newline at end of file
const resList = {
'81133fa6-44b7-4a3f-b5d6-25e3da99cb8b': {
name: 'frontpage_placeholder',
ext: '.png',
uuid: '81133fa6-44b7-4a3f-b5d6-25e3da99cb8b',
url: '//yun.duiba.com.cn/spark-prod/assets/807317256624fc9e2d7aa080a5693b88a1cb0a43.png'
},
'55c6197d-b4a9-45bc-92d8-328cc151512f': {
name: 'frontpage_btn',
ext: '.png',
uuid: '55c6197d-b4a9-45bc-92d8-328cc151512f',
url: '//yun.duiba.com.cn/spark-prod/assets/ca79bd0c916e1bbadc7d4011439084061f0dc642.png'
},
'e4a03a02-4a52-4276-97e3-9f3dade11dfb': {
name: 'frontpage_image',
ext: '.png',
uuid: 'e4a03a02-4a52-4276-97e3-9f3dade11dfb',
url: '//yun.duiba.com.cn/spark-prod/assets/dc13e362bec7ac50ca21e84a882c87b9e3c7d3d5.png'
},
'9bfe28c7-7e25-4631-b5f1-0f52d4fb0643': {
name: 'bg',
ext: '.jpg',
url: '//yun.duiba.com.cn/spark-prod/assets/bg.fb115c35b78fc3e792ee94b5831cca0c43174c0d.jpg',
uuid: '9bfe28c7-7e25-4631-b5f1-0f52d4fb0643'
}
};
export default resList;
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tb = require("./lib/tb");
const tbMock = require("./lib/tbMock");
const utils = require("./lib/utils");
const constants = require("./lib/constants");
const capi_1 = require("./lib/capi");
const request_1 = require("./lib/request");
const isH5 = 'undefined' !== typeof window;
// 如果为h5环境走mock数据
let _tb = {};
Object.entries(tb).forEach(([key, value]) => {
_tb[key] = isH5 ? tbMock[key] : value;
});
exports.default = {
capi: capi_1.default,
tb: _tb,
utils,
request: request_1.default,
constants
};
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/packages/jsx2taobao/template/api/tbcc-sdk/index.js"],"names":[],"mappings":";;AAAA,+BAA+B;AAC/B,uCAAuC;AACvC,qCAAqC;AACrC,6CAA6C;AAC7C,qCAA8B;AAC9B,2CAAoC;AAEpC,MAAM,IAAI,GAAG,WAAW,KAAK,OAAO,MAAM,CAAC;AAE3C,iBAAiB;AACjB,IAAI,GAAG,GAAG,EAAE,CAAC;AACb,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IAC1C,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACxC,CAAC,CAAC,CAAC;AAEH,kBAAe;IACb,IAAI,EAAJ,cAAI;IACJ,EAAE,EAAE,GAAG;IACP,KAAK;IACL,OAAO,EAAP,iBAAO;IACP,SAAS;CACV,CAAC"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const capi = {
getMyPrizeList: {
handle: 'getMyPrizeList',
isShowLoading: true
},
receiveObjectPrize: 'receiveObjectPrize',
receiveEnamePrize: 'receiveEnamePrize'
};
exports.default = capi;
//# sourceMappingURL=capi.js.map
\ No newline at end of file
{"version":3,"file":"capi.js","sourceRoot":"","sources":["../../../../../../../src/packages/jsx2taobao/template/api/tbcc-sdk/lib/capi.js"],"names":[],"mappings":";;AAAA,MAAM,IAAI,GAAG;IACX,cAAc,EAAE;QACd,MAAM,EAAE,gBAAgB;QACxB,aAAa,EAAE,IAAI;KACpB;IACD,kBAAkB,EAAE,oBAAoB;IACxC,iBAAiB,EAAE,mBAAmB;CACvC,CAAC;AAEF,kBAAe,IAAI,CAAC"}
\ No newline at end of file
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tb_1 = require("./tb");
const utils_1 = require("./utils");
// 通用API封装方法
const capiFn = (apiList, request) => {
return {
receiveObjectPrize(params) {
return __awaiter(this, void 0, void 0, function* () {
const { handle, method, ext } = utils_1.getRequestParams(apiList['receiveObjectPrize']);
const userAddress = yield tb_1.getUserAddress().catch(err => {
tb_1.commonToast(err.errorMessage);
});
if (userAddress) {
const { name, phone, address } = userAddress.duibaAddress;
commonConfirm('提示', '确认使用该收货地址:' + name + phone + address, () => __awaiter(this, void 0, void 0, function* () {
params = Object.assign({ name,
phone,
address }, params);
const result = yield request(handle, method, params, ext).catch(res => {
tb_1.commonToast(res && res.message);
});
if (result && result.success) {
return true;
}
}));
}
return false;
});
},
receiveEnamePrize(params) {
return __awaiter(this, void 0, void 0, function* () {
const { handle, method, ext } = utils_1.getRequestParams(apiList['receiveEnamePrize']);
const result = yield request(handle, method, params, ext).catch(res => {
tb_1.commonToast(res && res.message);
});
if (result && result.success) {
return true;
}
return false;
});
}
};
};
exports.default = capiFn;
//# sourceMappingURL=capiFn.js.map
\ No newline at end of file
{"version":3,"file":"capiFn.js","sourceRoot":"","sources":["../../../../../../../src/packages/jsx2taobao/template/api/tbcc-sdk/lib/capiFn.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAAmD;AACnD,mCAA2C;AAE3C,YAAY;AACZ,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IAClC,OAAO;QACC,kBAAkB,CAAC,MAAM;;gBAC7B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,wBAAgB,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC;gBAChF,MAAM,WAAW,GAAG,MAAM,mBAAc,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;oBACrD,gBAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAChC,CAAC,CAAC,CAAC;gBACH,IAAI,WAAW,EAAE;oBACf,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC,YAAY,CAAC;oBAC1D,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,GAAG,KAAK,GAAG,OAAO,EAAE,GAAS,EAAE;wBACpE,MAAM,mBACJ,IAAI;4BACJ,KAAK;4BACL,OAAO,IACJ,MAAM,CACV,CAAA;wBACD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;4BACpE,gBAAW,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;wBAClC,CAAC,CAAC,CAAC;wBACH,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;4BAC5B,OAAO,IAAI,CAAC;yBACb;oBACH,CAAC,CAAA,CAAC,CAAC;iBACJ;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SAAA;QACK,iBAAiB,CAAC,MAAM;;gBAC5B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,wBAAgB,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC;gBAC/E,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;oBACpE,gBAAW,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;gBAClC,CAAC,CAAC,CAAC;gBACH,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;oBAC5B,OAAO,IAAI,CAAC;iBACb;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SAAA;KACF,CAAA;AACH,CAAC,CAAC;AAGF,kBAAe,MAAM,CAAC"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PRIZE_TYPE = exports.DRAW_STATUS = void 0;
// 领取奖品状态
exports.DRAW_STATUS = {
// 待领取
WAITAWARD: 1,
// 处理中
PROCESSING: 2,
// 领取成功
SUCCESS: 3,
// 领取失败
FAIL: 4,
// 已过期
EXPIRED: 5,
// 重新领取
RETRY: 6
};
// 奖品类型
exports.PRIZE_TYPE = {
ENAME: 1,
CREDITS: 2,
OBJECT: 3,
THANKS: 5
};
//# sourceMappingURL=constants.js.map
\ No newline at end of file
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../src/packages/jsx2taobao/template/api/tbcc-sdk/lib/constants.js"],"names":[],"mappings":";;;AAAA,SAAS;AACI,QAAA,WAAW,GAAG;IACzB,MAAM;IACN,SAAS,EAAE,CAAC;IACZ,MAAM;IACN,UAAU,EAAE,CAAC;IACb,OAAO;IACP,OAAO,EAAE,CAAC;IACV,OAAO;IACP,IAAI,EAAE,CAAC;IACP,MAAM;IACN,OAAO,EAAE,CAAC;IACV,OAAO;IACP,KAAK,EAAE,CAAC;CACT,CAAA;AAED,OAAO;AACM,QAAA,UAAU,GAAG;IACxB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACV,CAAC"}
\ No newline at end of file
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const AMS_URL = 'https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri=';
const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
if (!cloud) {
console.error('请传入cloud');
return false;
}
if (!cloudName) {
console.error('请传入云函数名称');
return false;
}
return (handle, method, params, ext = {}) => __awaiter(void 0, void 0, void 0, function* () {
const { activityId } = getApp();
// 默认注入activityId
params = Object.assign({ activityId }, params);
if (!params.activityId) {
console.error(`${handle}:请传入activityId`);
return false;
}
const _cloudName = ext.cloudName || cloudName;
const { isShowLoading } = ext;
const hideMyLoading = () => {
if (isShowLoading) {
my.hideLoading();
}
};
if (isShowLoading) {
my.showLoading();
}
const requestAms = () => {
return new Promise((resolve, reject) => {
my.request({
url: AMS_URL + _cloudName + '.' + handle,
method,
data: params,
dataType: 'json'
}).then(({ data: res }) => {
hideMyLoading();
if (res && res.success) {
resolve(res);
}
else {
reject(res);
}
}).catch(() => {
hideMyLoading();
reject();
});
});
};
const requestCloud = () => {
return new Promise((resolve, reject) => {
cloud.function.invoke(_cloudName, params, handle).then(res => {
console.log(handle, params, res);
hideMyLoading();
if (res && res.success) {
resolve(res);
}
else {
reject(res);
}
return res;
}).catch(() => {
hideMyLoading();
reject();
});
});
};
return requestType === 'ams' ? requestAms() : requestCloud();
});
};
exports.default = request;
//# sourceMappingURL=request.js.map
\ No newline at end of file
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../../../../src/packages/jsx2taobao/template/api/tbcc-sdk/lib/request.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,OAAO,GAAG,iFAAiF,CAAC;AAElG,MAAM,OAAO,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,GAAG,OAAO,EAAE,EAAE,EAAE;IAC9D,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;KACd;IACD,OAAO,CAAO,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE;QAChD,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,CAAC;QAChC,iBAAiB;QACjB,MAAM,mBAAK,UAAU,IAAK,MAAM,CAAE,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACtB,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,gBAAgB,CAAC,CAAC;YACzC,OAAO,KAAK,CAAC;SACd;QACD,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,IAAI,SAAS,CAAC;QAC9C,MAAM,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC;QAC9B,MAAM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G,CAAC,CAAC;qBACd;yBAAM;wBACL,MAAM,CAAC,GAAG,CAAC,CAAC;qBACb;oBACD,OAAO,GAAG,CAAC;gBACb,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;oBACZ,aAAa,EAAE,CAAC;oBAChB,MAAM,EAAE,CAAC;gBACX,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IAC/D,CAAC,CAAA,CAAC;AAEJ,CAAC,CAAC;AAEF,kBAAe,OAAO,CAAC"}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.textRiskIdentification = exports.chattingSendCard = exports.uploadImage = exports.getImageInfo = exports.chooseImage = exports.getUserAddress = exports.openDetail = exports.checkGoodsCollectedStatus = exports.collectGoods = exports.getServerTime = exports.redirectTo = exports.navigateTo = exports.navigateToOutside = exports.checkShopFavoredStatus = exports.favorShop = exports.getSystemInfo = exports.getAuthUserInfo = exports.commonConfirm = exports.simpleAlert = exports.commonToast = void 0;
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
exports.commonToast = (content, duration = 3000, successCb) => {
return '暂不支持toast';
};
/**
* 简易alert
* @param {string} content toast内容
*/
exports.simpleAlert = content => {
alert(content);
};
/**
* 通用确认弹窗
* @param {string} title 标题
* @param {string} content 内容
* @param {function} successCb 成功回调
*/
exports.commonConfirm = (title = '提示', content, successCb) => {
my.confirm({
title,
content,
confirmButtonText: '确定',
cancelButtonText: '取消',
success: result => {
const { confirm } = result;
if (confirm) {
successCb && successCb();
}
}
});
};
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
exports.getAuthUserInfo = () => __awaiter(void 0, void 0, void 0, function* () {
return {
nickName: 'nickName',
avatar: '123',
mixNick: '1234'
};
});
/**
* 获取系统信息
* @returns {object} 小程序系统信息
*/
exports.getSystemInfo = () => __awaiter(void 0, void 0, void 0, function* () {
return {
version: '9.5.0'
};
});
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
exports.favorShop = (sellerId) => __awaiter(void 0, void 0, void 0, function* () {
if (!sellerId) {
console.error('favorShop: 请传入卖家Id');
return false;
}
return {};
});
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
exports.checkShopFavoredStatus = (sellerId) => __awaiter(void 0, void 0, void 0, function* () {
if (!sellerId) {
console.error('checkShopFavoredStatus: 请传入卖家Id');
return false;
}
return true;
});
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
exports.navigateToOutside = url => {
if (!url) {
console.error('navigateToOutside: 请传入url');
return false;
}
window.location = url;
};
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
exports.navigateTo = url => {
if (!url) {
console.error('navigateTo: 请传入url');
return false;
}
window.location = url;
};
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
exports.redirectTo = url => {
if (!url) {
console.error('redirectTo: 请传入url');
return false;
}
window.replace(url);
};
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
exports.getServerTime = () => __awaiter(void 0, void 0, void 0, function* () {
return +new Date();
});
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
exports.collectGoods = (id) => __awaiter(void 0, void 0, void 0, function* () {
if (!id) {
console.error('collectGoods: 请传入商品id');
return false;
}
return {};
});
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
exports.checkGoodsCollectedStatus = (id) => __awaiter(void 0, void 0, void 0, function* () {
if (!id) {
console.error('checkGoodsCollectedStatus: 请传入商品id');
return false;
}
return true;
});
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
exports.openDetail = (itemId) => __awaiter(void 0, void 0, void 0, function* () {
if (!itemId) {
console.error('openDetail: 请传入商品id');
return false;
}
window.location = 'https://item.taobao.com/item.htm?id=' + itemId;
});
/**
* 获取淘宝用户收货地址
*/
exports.getUserAddress = (opts = {}) => __awaiter(void 0, void 0, void 0, function* () {
return {
name: 1,
phone: 1,
address: 123
};
});
/**
* 选择图片
*/
exports.chooseImage = (opts = {}) => __awaiter(void 0, void 0, void 0, function* () {
let defaults = {
count: 1,
sourceType: ['camera', 'album'],
compressLevel: 1
};
let _opts = Object.assign({}, defaults, opts);
const { count, sourceType, compressLevel } = _opts;
return new Promise((resolve, reject) => {
if (!my.chooseImage) {
reject({
noSupport: true,
errorMessage: '当前版本不支持选择收货地址,请升级到最新版本'
});
return false;
}
my.chooseImage({
count,
sourceType,
success: res => {
my.compressImage({
apFilePaths: res.apFilePaths,
level: compressLevel,
success: data => {
resolve(data);
},
fail: err => {
resolve(err);
}
});
},
fail: err => {
// error code 2001 为摄像头授权取消、ios 11为用户取消操作不认作失败场景 、安卓 为1
if (err.error !== 2001 && err.error !== 11 && err.error !== 1) {
reject(err);
}
else {
resolve(false);
}
}
});
});
});
/**
* 获取图片信息
* @param {string} src 图片地址
*/
exports.getImageInfo = (src) => __awaiter(void 0, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
my.getImageInfo({
src,
success: res => {
resolve(res);
},
fail: err => {
reject(err);
}
});
});
});
/**
* 获取图片信息
* @param {*} opts chooseImage配置参数
*/
exports.uploadImage = (opts = {}) => __awaiter(void 0, void 0, void 0, function* () {
const { cloud } = getApp();
if (!cloud) {
console.error('chattingSendCard: 请传入app.cloud');
return false;
}
const chooseImageResult = yield exports.chooseImage(opts).catch(err => {
exports.commonToast(err && (err.errorMessage || '选择图片失败'));
});
if (chooseImageResult) {
const { apFilePaths } = chooseImageResult;
const filePath = apFilePaths[0];
const imageInfo = yield exports.getImageInfo(filePath).catch(err => {
exports.commonToast(err && err.errorMessage);
});
// 找不到图片信息
if (!imageInfo) {
return false;
}
const { path: imagePath } = imageInfo;
const { url } = yield cloud.file.uploadFile({
filePath,
fileType: 'image',
fileName: imagePath.split('/').pop()
});
return url;
}
return false;
});
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
exports.chattingSendCard = (requestInfo) => __awaiter(void 0, void 0, void 0, function* () {
alert('无法模拟');
return false;
});
/**
* 分享到群聊卡片
* @param {*} cloud 小程序云
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
exports.textRiskIdentification = (text) => __awaiter(void 0, void 0, void 0, function* () {
return true;
});
//# sourceMappingURL=tbMock.js.map
\ No newline at end of file
{"version":3,"file":"tbMock.js","sourceRoot":"","sources":["../../../../../../../src/packages/jsx2taobao/template/api/tbcc-sdk/lib/tbMock.js"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;GAKG;AACU,QAAA,WAAW,GAAG,CAAC,OAAO,EAAE,QAAQ,GAAG,IAAI,EAAE,SAAS,EAAE,EAAE;IACjE,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF;;;GAGG;AACU,QAAA,WAAW,GAAG,OAAO,CAAC,EAAE;IACnC,KAAK,CAAC,OAAO,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;GAKG;AACU,QAAA,aAAa,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE;IAChE,EAAE,CAAC,OAAO,CAAC;QACT,KAAK;QACL,OAAO;QACP,iBAAiB,EAAE,IAAI;Q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MAAM,oBAAY,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;YACzD,mBAAW,CAAC,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,UAAU;QACV,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,KAAK,CAAC;SACd;QACD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;QACtC,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;YAC1C,QAAQ;YACR,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;SACrC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAA;AAED;;;GAGG;AACU,QAAA,gBAAgB,GAAG,CAAO,WAAW,EAAE,EAAE;IACpD,KAAK,CAAC,MAAM,CAAC,CAAC;IACd,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC;AAEF;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,CAAO,IAAI,EAAE,EAAE;IACnD,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAA"}
\ No newline at end of file
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateAPI = exports.getRequestParams = exports.versionCompare = exports.dateFormatter = void 0;
const capiFn_1 = require("./capiFn");
/**
* 时间格式化
* @param date 接收可以被new Date()方法转换的内容
* @param format 字符串,需要的格式例如:'yyyy/MM/dd hh:mm:ss'
* @returns {String}
*/
exports.dateFormatter = (date, format = 'yyyy/MM/dd') => {
if (!date)
return '-';
date = new Date(typeof date === 'string' && isNaN(date) ? date.replace(/-/g, '/') : date);
let o = {
'M+': date.getMonth() + 1,
'd+': date.getDate(),
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds(),
'q+': Math.floor((date.getMonth() + 3) / 3),
S: date.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
}
for (let k in o) {
if (new RegExp('(' + k + ')').test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
}
}
return format;
};
/**
* 版本比较
* @param {string} cur 当前版本
* @param {string} compare 比较版本
*/
exports.versionCompare = (cur, compare) => {
const _cur = cur.split('.');
const _compare = compare.split('.');
if (+_cur[0] < +_compare[0]) {
return false;
}
else if (+_cur[0] === +_compare[0] && +_cur[1] < +_compare[1]) {
return false;
}
else if (+_cur[0] === +_compare[0] && +_cur[1] === +_compare[1] && +_cur[2] < +_compare[2]) {
return false;
}
return true;
};
/**
* 获取request请求所需参数
* @param {object/string} value API项配置
*/
exports.getRequestParams = value => {
if (typeof value === 'string') {
return {
handle: value,
method: 'POST',
ext: {}
};
}
else if (typeof value === 'object') {
const { handle, method = 'POST' } = value, ext = __rest(value, ["handle", "method"]);
return {
handle,
method,
ext: Object.assign({}, ext)
};
}
else {
console.error('getRequestParams: 传参有误');
}
};
/**
* 生成API
* @param {array} apiList API数据数组
* @param {function} request 请求
*/
exports.generateAPI = (apiList, request) => {
const api = {};
Object.entries(apiList).forEach(([key, value]) => {
const { handle, method, ext } = exports.getRequestParams(value);
api[key] = params => request(handle, method, params, ext);
});
api.fn = capiFn_1.default(apiList, request);
return api;
};
//# sourceMappingURL=utils.js.map
\ No newline at end of file
{"version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gBAAgB,GAAG,KAAK,CAAC,EAAE;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO;YACL,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,EAAE;SACR,CAAA;KACF;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,KAAa,KAAK,EAAb,GAAG,UAAK,KAAK,EAA3C,oBAAmC,CAAQ,CAAC;QAClD,OAAO;YACL,MAAM;YACN,MAAM;YACN,GAAG,oBAAO,GAAG,CAAE;SAChB,CAAA;KACF;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;KACzC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACU,QAAA,WAAW,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IAC9C,MAAM,GAAG,GAAG,EAAE,CAAC;IACf,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC/C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,wBAAgB,CAAC,KAAK,CAAC,CAAC;QACxD,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,EAAE,GAAG,gBAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
\ No newline at end of file
export const getfucked=()=>{console.log('getfucked')}
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