sportlifejs 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of sportlifejs might be problematic. Click here for more details.

package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # 介绍
2
+ sportlifejs是一个JavaScript实用工具库,里边是常用的各种方法
3
+
4
+ src文件下边存放的是一些常用的需要封装的js文件,js文件中写了很多方法,最后以对象形式抛出
5
+
6
+ index.js相当于一个统一的入口,在index.js中将src中每一个js文件抛出的对象导入,并最后抛出这些对象
7
+
8
+ # 安装
9
+
10
+ npm install sportlifejs
11
+
12
+ 当本工具库更新后,需要重新安装
13
+
14
+ npm install sportlifejs@latest
15
+
16
+ # 使用
17
+ 在项目中使用
18
+
19
+ import sportlifejs from 'sportlifejs'
20
+
21
+ 调用方法: sportlifejs.方法名
22
+
23
+ 例如 sportlifejs.getDataType(100)
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import sportlifejs from './src/sportCommon.js'
2
+ import getResData from './src/axios.js'
3
+
4
+
5
+ export default {
6
+ sportlifejs,
7
+ getResData
8
+ }
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "sportlifejs",
3
+ "version": "1.1.2",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "DJJ",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "axios": "^1.2.1"
14
+ }
15
+ }
package/src/axios.js ADDED
@@ -0,0 +1,33 @@
1
+ import axios from "axios"
2
+
3
+ const service = axios.create();
4
+ service.defaults.headers.post["Content-Type"] =
5
+ "application/x-www-form-urlencoded;charset=UTF-8";
6
+ service.defaults.withCredentials = true;
7
+ //新增请求超时时间-nyh
8
+ service.defaults.timeout = 60 * 1000;
9
+
10
+
11
+ service.post("https://mlife.jf365.boc.cn/AppPrj/cgi.do?dns=undefined&gtype=9&attest=-339418059&imei=123477",{
12
+ // commodityIds: '"10223311000008_XSDI","10223311000002_XSDI","10223311000003_XSDI","10223311000005_XSDI","10223311000006_XSDI","10223311000000_XSDI","10223311000010_XSDI","10223311000009_XSDI","10223311000004_XSDI","10223311000007_XSDI","10223311000001_XSDI","6023179772736_DONG","6023129003457_DONG"',
13
+ // venueIds: 'b0cf151531d7407598521143c4d4b705',
14
+ txnId: '2COD100005',
15
+ commodityType: '0',
16
+ previewOpenFlag: '1',
17
+ userPlt: '00',
18
+ lon: '116.299634',
19
+ lat: '39.987725',
20
+ longitude: '116.299634',
21
+ latitude: '39.987725',
22
+ })
23
+ .then((res) => {
24
+ console.log(res.data);
25
+ getResData(res.data)
26
+ })
27
+ .catch(function (error) {
28
+ console.log(error);
29
+ });
30
+ function getResData(data) {
31
+ return data
32
+ }
33
+ export default getResData
@@ -0,0 +1,20 @@
1
+ function getDataType(target){
2
+ let type = typeof target
3
+ // 判断是否是复杂数据类型
4
+ if(type === 'object'){
5
+ return Object.prototype.toString.call(target).replace(/^\[object (\S+)\]$/, '$1').toLowerCase();
6
+ }else{
7
+ // 基础数据类型直接返回
8
+ return type
9
+ }
10
+ }
11
+
12
+ function getaAdd (a, b) {
13
+ return a+b
14
+ }
15
+
16
+ //以对象形式导出这些方法
17
+ export default{
18
+ getDataType,
19
+ getaAdd,
20
+ }