Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tbcc-sdk-ts
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
qinhaitao
tbcc-sdk-ts
Commits
b4c5b919
Commit
b4c5b919
authored
Apr 01, 2021
by
mqf_0707
Browse files
Options
Browse Files
Download
Plain Diff
修复getStorage首次返回状态
parents
b8663266
09ae4bcf
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
56 additions
and
377 deletions
+56
-377
tb.js
lib/core/tb.js
+3
-1
tb.js.map
lib/core/tb.js.map
+1
-1
tbFn.js
lib/core/tbFn.js
+19
-11
tbFn.js.map
lib/core/tbFn.js.map
+1
-1
tbMock.d.ts
lib/core/tbMock.d.ts
+0
-96
tbMock.js
lib/core/tbMock.js
+0
-246
tbMock.js.map
lib/core/tbMock.js.map
+0
-1
package.json
package.json
+1
-1
tb.ts
src/core/tb.ts
+2
-1
tbFn.ts
src/core/tbFn.ts
+26
-17
index.d.ts
src/typing/index.d.ts
+3
-1
No files found.
lib/core/tb.js
View file @
b4c5b919
...
@@ -140,8 +140,10 @@ var checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void
...
@@ -140,8 +140,10 @@ var checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void
return
[
4
/*yield*/
,
helpers_1
.
promisifyApiToTb
(
'checkShopFavoredStatus'
,
{
id
:
+
sellerId
})];
return
[
4
/*yield*/
,
helpers_1
.
promisifyApiToTb
(
'checkShopFavoredStatus'
,
{
id
:
+
sellerId
})];
case
1
:
case
1
:
result
=
_a
.
sent
();
result
=
_a
.
sent
();
if
(
result
===
null
||
result
===
void
0
?
void
0
:
result
.
isFavor
)
if
(
(
result
===
null
||
result
===
void
0
?
void
0
:
result
.
isFavor
)
!==
undefined
)
return
[
2
/*return*/
,
result
.
isFavor
];
return
[
2
/*return*/
,
result
.
isFavor
];
if
(
result
===
'checkShopFavoredStatus 仅支持真机调用,请在手机淘宝中运行'
)
return
[
2
/*return*/
,
true
];
return
[
2
/*return*/
,
result
];
return
[
2
/*return*/
,
result
];
}
}
});
});
...
...
lib/core/tb.js.map
View file @
b4c5b919
This diff is collapsed.
Click to expand it.
lib/core/tbFn.js
View file @
b4c5b919
...
@@ -220,24 +220,32 @@ exports.uploadImage = uploadImage;
...
@@ -220,24 +220,32 @@ exports.uploadImage = uploadImage;
*/
*/
var
getAuthUserInfo
=
function
()
{
var
getAuthUserInfo
=
function
()
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
// @ts-ignore
my
.
getAuthUserInfo
({
my
.
authorize
({
success
:
function
(
userInfo
)
{
scopes
:
'scope.userInfo'
,
resolve
(
userInfo
);
success
:
function
()
{
},
// @ts-ignore
fail
:
function
(
err
)
{
my
.
getAuthUserInfo
({
my
.
authorize
({
success
:
function
(
userInfo
)
{
scopes
:
'scope.userInfo'
,
resolve
(
userInfo
);
success
:
function
()
{
console
.
log
(
'执行 my.authorize'
);
// @ts-ignore
my
.
getAuthUserInfo
({
success
:
function
(
userInfo
)
{
resolve
(
userInfo
);
},
fail
:
function
(
err
)
{
reject
(
err
);
}
});
},
},
fail
:
function
(
err
)
{
fail
:
function
(
err
)
{
reject
(
err
);
reject
(
err
);
}
}
});
});
},
fail
:
function
(
err
)
{
reject
(
err
);
}
}
});
});
// @ts-ignore
});
});
};
};
exports
.
getAuthUserInfo
=
getAuthUserInfo
;
exports
.
getAuthUserInfo
=
getAuthUserInfo
;
...
...
lib/core/tbFn.js.map
View file @
b4c5b919
This diff is collapsed.
Click to expand it.
lib/core/tbMock.d.ts
deleted
100644 → 0
View file @
b8663266
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
export
declare
const
commonToast
:
(
content
:
any
,
duration
:
number
,
successCb
:
any
)
=>
string
;
/**
* 简易alert
* @param {string} content toast内容
*/
export
declare
const
simpleAlert
:
(
content
:
any
)
=>
void
;
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
export
declare
const
getAuthUserInfo
:
()
=>
Promise
<
{
nickName
:
string
;
avatar
:
string
;
mixNick
:
string
;
}
>
;
/**
* 获取系统信息
* @returns {object} 小程序系统信息
*/
export
declare
const
getSystemInfo
:
()
=>
Promise
<
{
version
:
string
;
}
>
;
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export
declare
const
favorShop
:
(
sellerId
:
any
)
=>
Promise
<
boolean
>
;
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export
declare
const
checkShopFavoredStatus
:
(
sellerId
:
any
)
=>
Promise
<
boolean
>
;
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
export
declare
const
navigateToOutside
:
(
url
:
any
)
=>
boolean
;
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export
declare
const
navigateTo
:
(
url
:
any
)
=>
boolean
;
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
export
declare
const
redirectTo
:
(
url
:
any
)
=>
boolean
;
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
export
declare
const
getServerTime
:
()
=>
Promise
<
number
>
;
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
export
declare
const
collectGoods
:
(
id
:
any
)
=>
Promise
<
boolean
>
;
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
export
declare
const
checkGoodsCollectedStatus
:
(
id
:
any
)
=>
Promise
<
boolean
>
;
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
export
declare
const
openDetail
:
(
itemId
:
any
)
=>
Promise
<
boolean
>
;
/**
* 获取淘宝用户收货地址
*/
export
declare
const
getUserAddress
:
(
opts
?:
{})
=>
Promise
<
{
name
:
number
;
phone
:
number
;
address
:
number
;
}
>
;
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export
declare
const
chattingSendCard
:
(
requestInfo
:
any
)
=>
Promise
<
boolean
>
;
/**
* 分享到群聊卡片
* @param {*} cloud 小程序云
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export
declare
const
textRiskIdentification
:
(
text
:
any
)
=>
Promise
<
boolean
>
;
lib/core/tbMock.js
deleted
100644 → 0
View file @
b8663266
"use strict"
;
var
__awaiter
=
(
this
&&
this
.
__awaiter
)
||
function
(
thisArg
,
_arguments
,
P
,
generator
)
{
function
adopt
(
value
)
{
return
value
instanceof
P
?
value
:
new
P
(
function
(
resolve
)
{
resolve
(
value
);
});
}
return
new
(
P
||
(
P
=
Promise
))(
function
(
resolve
,
reject
)
{
function
fulfilled
(
value
)
{
try
{
step
(
generator
.
next
(
value
));
}
catch
(
e
)
{
reject
(
e
);
}
}
function
rejected
(
value
)
{
try
{
step
(
generator
[
"throw"
](
value
));
}
catch
(
e
)
{
reject
(
e
);
}
}
function
step
(
result
)
{
result
.
done
?
resolve
(
result
.
value
)
:
adopt
(
result
.
value
).
then
(
fulfilled
,
rejected
);
}
step
((
generator
=
generator
.
apply
(
thisArg
,
_arguments
||
[])).
next
());
});
};
var
__generator
=
(
this
&&
this
.
__generator
)
||
function
(
thisArg
,
body
)
{
var
_
=
{
label
:
0
,
sent
:
function
()
{
if
(
t
[
0
]
&
1
)
throw
t
[
1
];
return
t
[
1
];
},
trys
:
[],
ops
:
[]
},
f
,
y
,
t
,
g
;
return
g
=
{
next
:
verb
(
0
),
"throw"
:
verb
(
1
),
"return"
:
verb
(
2
)
},
typeof
Symbol
===
"function"
&&
(
g
[
Symbol
.
iterator
]
=
function
()
{
return
this
;
}),
g
;
function
verb
(
n
)
{
return
function
(
v
)
{
return
step
([
n
,
v
]);
};
}
function
step
(
op
)
{
if
(
f
)
throw
new
TypeError
(
"Generator is already executing."
);
while
(
_
)
try
{
if
(
f
=
1
,
y
&&
(
t
=
op
[
0
]
&
2
?
y
[
"return"
]
:
op
[
0
]
?
y
[
"throw"
]
||
((
t
=
y
[
"return"
])
&&
t
.
call
(
y
),
0
)
:
y
.
next
)
&&
!
(
t
=
t
.
call
(
y
,
op
[
1
])).
done
)
return
t
;
if
(
y
=
0
,
t
)
op
=
[
op
[
0
]
&
2
,
t
.
value
];
switch
(
op
[
0
])
{
case
0
:
case
1
:
t
=
op
;
break
;
case
4
:
_
.
label
++
;
return
{
value
:
op
[
1
],
done
:
false
};
case
5
:
_
.
label
++
;
y
=
op
[
1
];
op
=
[
0
];
continue
;
case
7
:
op
=
_
.
ops
.
pop
();
_
.
trys
.
pop
();
continue
;
default
:
if
(
!
(
t
=
_
.
trys
,
t
=
t
.
length
>
0
&&
t
[
t
.
length
-
1
])
&&
(
op
[
0
]
===
6
||
op
[
0
]
===
2
))
{
_
=
0
;
continue
;
}
if
(
op
[
0
]
===
3
&&
(
!
t
||
(
op
[
1
]
>
t
[
0
]
&&
op
[
1
]
<
t
[
3
])))
{
_
.
label
=
op
[
1
];
break
;
}
if
(
op
[
0
]
===
6
&&
_
.
label
<
t
[
1
])
{
_
.
label
=
t
[
1
];
t
=
op
;
break
;
}
if
(
t
&&
_
.
label
<
t
[
2
])
{
_
.
label
=
t
[
2
];
_
.
ops
.
push
(
op
);
break
;
}
if
(
t
[
2
])
_
.
ops
.
pop
();
_
.
trys
.
pop
();
continue
;
}
op
=
body
.
call
(
thisArg
,
_
);
}
catch
(
e
)
{
op
=
[
6
,
e
];
y
=
0
;
}
finally
{
f
=
t
=
0
;
}
if
(
op
[
0
]
&
5
)
throw
op
[
1
];
return
{
value
:
op
[
0
]
?
op
[
1
]
:
void
0
,
done
:
true
};
}
};
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
textRiskIdentification
=
exports
.
chattingSendCard
=
exports
.
getUserAddress
=
exports
.
openDetail
=
exports
.
checkGoodsCollectedStatus
=
exports
.
collectGoods
=
exports
.
getServerTime
=
exports
.
redirectTo
=
exports
.
navigateTo
=
exports
.
navigateToOutside
=
exports
.
checkShopFavoredStatus
=
exports
.
favorShop
=
exports
.
getSystemInfo
=
exports
.
getAuthUserInfo
=
exports
.
simpleAlert
=
exports
.
commonToast
=
void
0
;
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
var
commonToast
=
function
(
content
,
duration
,
successCb
)
{
if
(
duration
===
void
0
)
{
duration
=
3000
;
}
return
'暂不支持toast'
;
};
exports
.
commonToast
=
commonToast
;
/**
* 简易alert
* @param {string} content toast内容
*/
var
simpleAlert
=
function
(
content
)
{
alert
(
content
);
};
exports
.
simpleAlert
=
simpleAlert
;
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
var
getAuthUserInfo
=
function
()
{
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
return
[
2
/*return*/
,
{
nickName
:
'nickName'
,
avatar
:
'123'
,
mixNick
:
'1234'
}];
});
});
};
exports
.
getAuthUserInfo
=
getAuthUserInfo
;
/**
* 获取系统信息
* @returns {object} 小程序系统信息
*/
var
getSystemInfo
=
function
()
{
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
return
[
2
/*return*/
,
{
version
:
'9.5.0'
}];
});
});
};
exports
.
getSystemInfo
=
getSystemInfo
;
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
var
favorShop
=
function
(
sellerId
)
{
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
if
(
!
sellerId
)
{
console
.
error
(
'favorShop: 请传入卖家Id'
);
return
[
2
/*return*/
,
false
];
}
return
[
2
/*return*/
,
true
];
});
});
};
exports
.
favorShop
=
favorShop
;
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
var
checkShopFavoredStatus
=
function
(
sellerId
)
{
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
if
(
!
sellerId
)
{
console
.
error
(
'checkShopFavoredStatus: 请传入卖家Id'
);
return
[
2
/*return*/
,
false
];
}
return
[
2
/*return*/
,
true
];
});
});
};
exports
.
checkShopFavoredStatus
=
checkShopFavoredStatus
;
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
var
navigateToOutside
=
function
(
url
)
{
if
(
!
url
)
{
console
.
error
(
'navigateToOutside: 请传入url'
);
return
false
;
}
window
.
location
=
url
;
};
exports
.
navigateToOutside
=
navigateToOutside
;
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
var
navigateTo
=
function
(
url
)
{
if
(
!
url
)
{
console
.
error
(
'navigateTo: 请传入url'
);
return
false
;
}
window
.
location
=
url
;
};
exports
.
navigateTo
=
navigateTo
;
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
var
redirectTo
=
function
(
url
)
{
if
(
!
url
)
{
console
.
error
(
'redirectTo: 请传入url'
);
return
false
;
}
// @ts-ignore
window
.
replace
(
url
);
};
exports
.
redirectTo
=
redirectTo
;
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
var
getServerTime
=
function
()
{
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
return
[
2
/*return*/
,
+
new
Date
()];
});
});
};
exports
.
getServerTime
=
getServerTime
;
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
var
collectGoods
=
function
(
id
)
{
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
if
(
!
id
)
{
console
.
error
(
'collectGoods: 请传入商品id'
);
return
[
2
/*return*/
,
false
];
}
return
[
2
/*return*/
,
true
];
});
});
};
exports
.
collectGoods
=
collectGoods
;
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
var
checkGoodsCollectedStatus
=
function
(
id
)
{
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
if
(
!
id
)
{
console
.
error
(
'checkGoodsCollectedStatus: 请传入商品id'
);
return
[
2
/*return*/
,
false
];
}
return
[
2
/*return*/
,
true
];
});
});
};
exports
.
checkGoodsCollectedStatus
=
checkGoodsCollectedStatus
;
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
var
openDetail
=
function
(
itemId
)
{
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
if
(
!
itemId
)
{
console
.
error
(
'openDetail: 请传入商品id'
);
return
[
2
/*return*/
,
false
];
}
// @ts-ignore
window
.
location
=
'https://item.taobao.com/item.htm?id='
+
itemId
;
return
[
2
/*return*/
];
});
});
};
exports
.
openDetail
=
openDetail
;
/**
* 获取淘宝用户收货地址
*/
var
getUserAddress
=
function
(
opts
)
{
if
(
opts
===
void
0
)
{
opts
=
{};
}
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
return
[
2
/*return*/
,
{
name
:
1
,
phone
:
1
,
address
:
123
}];
});
});
};
exports
.
getUserAddress
=
getUserAddress
;
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
var
chattingSendCard
=
function
(
requestInfo
)
{
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
alert
(
'无法模拟'
);
return
[
2
/*return*/
,
false
];
});
});
};
exports
.
chattingSendCard
=
chattingSendCard
;
/**
* 分享到群聊卡片
* @param {*} cloud 小程序云
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
var
textRiskIdentification
=
function
(
text
)
{
return
__awaiter
(
void
0
,
void
0
,
void
0
,
function
()
{
return
__generator
(
this
,
function
(
_a
)
{
return
[
2
/*return*/
,
true
];
});
});
};
exports
.
textRiskIdentification
=
textRiskIdentification
;
//# sourceMappingURL=tbMock.js.map
\ No newline at end of file
lib/core/tbMock.js.map
deleted
100644 → 0
View file @
b8663266
{"version":3,"file":"tbMock.js","sourceRoot":"","sources":["../../src/core/tbMock.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACI,IAAM,WAAW,GAAG,UAAC,OAAO,EAAE,QAAe,EAAE,SAAS;IAA1B,yBAAA,EAAA,eAAe;IAChD,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AACF;;;GAGG;AACI,IAAM,WAAW,GAAG,UAAA,OAAO;IAC9B,KAAK,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AACF;;;GAGG;AACI,IAAM,eAAe,GAAG;;QAC3B,sBAAO;gBACH,QAAQ,EAAE,UAAU;gBACpB,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,MAAM;aAClB,EAAC;;KACL,CAAC;AANW,QAAA,eAAe,mBAM1B;AAEF;;;GAGG;AACI,IAAM,aAAa,GAAG;;QACzB,sBAAO;gBACH,OAAO,EAAE,OAAO;aACnB,EAAC;;KACL,CAAC;AAJW,QAAA,aAAa,iBAIxB;AACF;;;;GAIG;AACI,IAAM,SAAS,GAAG,UAAM,QAAQ;;QACnC,IAAI,CAAC,QAAQ,EAAE;YACX,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACpC,sBAAO,KAAK,EAAC;SAChB;QACD,sBAAO,IAAI,EAAC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"1.0.
4
"
,
"description"
:
""
,
"description"
:
""
,
"main"
:
"lib/index.js"
,
"main"
:
"lib/index.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
src/core/tb.ts
View file @
b4c5b919
...
@@ -75,7 +75,8 @@ export const checkShopFavoredStatus = async (sellerId: number) => {
...
@@ -75,7 +75,8 @@ export const checkShopFavoredStatus = async (sellerId: number) => {
return
false
;
return
false
;
}
}
let
result
:
{
isFavor
?:
boolean
}
=
await
promisifyApiToTb
(
'checkShopFavoredStatus'
,{
id
:
+
sellerId
})
let
result
:
{
isFavor
?:
boolean
}
=
await
promisifyApiToTb
(
'checkShopFavoredStatus'
,{
id
:
+
sellerId
})
if
(
result
?.
isFavor
)
return
result
.
isFavor
if
(
result
?.
isFavor
!==
undefined
)
return
result
.
isFavor
if
(
result
===
'checkShopFavoredStatus 仅支持真机调用,请在手机淘宝中运行'
)
return
true
return
result
return
result
};
};
/**
/**
...
...
src/core/tbFn.ts
View file @
b4c5b919
...
@@ -149,24 +149,33 @@ export const uploadImage = async (opts = {}) => {
...
@@ -149,24 +149,33 @@ export const uploadImage = async (opts = {}) => {
*/
*/
export
const
getAuthUserInfo
=
()
=>
{
export
const
getAuthUserInfo
=
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
my
.
getAuthUserInfo
({
success
:
userInfo
=>
{
resolve
(
userInfo
);
},
fail
:
err
=>
{
my
.
authorize
({
scopes
:
'scope.userInfo'
,
success
:
()
=>
{
console
.
log
(
'执行 my.authorize'
)
// @ts-ignore
my
.
getAuthUserInfo
({
success
:
userInfo
=>
{
resolve
(
userInfo
);
},
fail
:
err
=>
{
reject
(
err
);
}
});
},
fail
:
err
=>
{
reject
(
err
);
}
});
}
});
// @ts-ignore
// @ts-ignore
my
.
authorize
({
scopes
:
'scope.userInfo'
,
success
:
()
=>
{
// @ts-ignore
my
.
getAuthUserInfo
({
success
:
userInfo
=>
{
resolve
(
userInfo
);
},
fail
:
err
=>
{
reject
(
err
);
}
});
},
fail
:
err
=>
{
reject
(
err
);
}
});
});
});
};
};
/**
/**
...
...
src/typing/index.d.ts
View file @
b4c5b919
...
@@ -75,4 +75,6 @@ interface ISkuInfo {
...
@@ -75,4 +75,6 @@ interface ISkuInfo {
itemId
:
string
itemId
:
string
skuId
:
string
skuId
:
string
quantity
:
string
quantity
:
string
}
}
\ No newline at end of file
declare
var
my
:
any
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment