فهرست منبع

新增axios和finally配置

caojunjie 4 سال پیش
والد
کامیت
723554efb8
6فایلهای تغییر یافته به همراه272 افزوده شده و 38 حذف شده
  1. 2 1
      .gitignore
  2. 4 0
      README.md
  3. 53 0
      common/request/request.js
  4. 3 37
      manifest.json
  5. 208 0
      package-lock.json
  6. 2 0
      package.json

+ 2 - 1
.gitignore

@@ -1,2 +1,3 @@
 unpackage
-.idea
+.idea
+node_modules

+ 4 - 0
README.md

@@ -5,6 +5,10 @@
 <h3 align="center">赛轮全钢项目</h3>
 
 
+## 需安装配置
+axios参考[axios](http://www.axios-js.com/zh-cn/)官网地址
+finally参考[安装命令](npm i promise.prototype.finally -S)官网地址无
+
 
 ## 说明
 扩展了vant的icon字体库

+ 53 - 0
common/request/request.js

@@ -0,0 +1,53 @@
+//使用方法
+// require("promise.prototype.finally").shim();  //使用时请引用finally
+// import {request} from '../../request/request'
+
+// request({
+//     url: '/room/list',
+// }).then(res => {
+//     console.log(res)
+// }).catch(err => {
+//     console.log(err)
+// }).finally(() => {
+//     Loading.close()
+// })
+
+//配置文件
+import axios from 'axios'
+
+export function request(config) {
+    let newVar = axios.create({
+         baseURL: "http://192.168.237.6:9002",
+        timeout: 10000
+    });
+    return newVar(config);
+}
+
+//在uni-app中使用对app有效果,h5不需要
+axios.defaults.adapter = function (config) {
+    return new Promise((resolve, reject) => {
+        var settle = require('axios/lib/core/settle');
+        var buildURL = require('axios/lib/helpers/buildURL');
+        uni.request({
+            method: config.method.toUpperCase(),
+            url: config.baseURL + buildURL(config.url, config.params, config.paramsSerializer),
+            header: config.headers,
+            data: config.data,
+            dataType: config.dataType,
+            responseType: config.responseType,
+            sslVerify: config.sslVerify,
+            complete: function complete(response) {
+                response = {
+                    data: response.data,
+                    status: response.statusCode,
+                    errMsg: response.errMsg,
+                    header: response.header,
+                    config: config
+                };
+
+                settle(resolve, reject, response);
+            }
+        })
+    })
+}
+

+ 3 - 37
manifest.json

@@ -1,8 +1,8 @@
 {
     "name" : "SAILUN_TBR",
     "appid" : "__UNI__0C3473D",
-    "description" : "多平台快速开发的UI框架",
-    "versionName" : "1.7.7",
+    "description" : "测试",
+    "versionName" : "0.0.0.0.0.1",
     "versionCode" : "100",
     "transformPx" : false,
     "app-plus" : {
@@ -90,41 +90,7 @@
                 }
             }
         },
-        "nativePlugins" : {
-            "Mpaas-Scan" : {
-                "License" : "",
-                "WorkspaceId" : "",
-                "AppId" : "_UNI_0C3473D",
-                "__plugin_info__" : {
-                    "name" : "支付宝原生扫码插件",
-                    "description" : "支付宝原生扫码组件,包体积仅0.7MB,15分钟即可完成接入。同时,mPaaS提供「扫码分析」大盘",
-                    "platforms" : "Android,iOS",
-                    "url" : "https://ext.dcloud.net.cn/plugin?id=2636",
-                    "android_package_name" : "com.sailuntbr.store",
-                    "ios_bundle_id" : "",
-                    "isCloud" : true,
-                    "bought" : 1,
-                    "pid" : "2636",
-                    "parameters" : {
-                        "License" : {
-                            "des" : "Android平台的License,,请填写Android的config文件中的mpaasConfigLicense对应的值",
-                            "key" : "mpaasConfigLicense",
-                            "value" : ""
-                        },
-                        "WorkspaceId" : {
-                            "des" : "Android平台的WorkspaceId,请填写Android的config文件中的workspaceId对应的值",
-                            "key" : "workspaceId",
-                            "value" : ""
-                        },
-                        "AppId" : {
-                            "des" : "Android平台的AppId,请填写Android的config文件中的appId对应的值",
-                            "key" : "mobilegw.appid",
-                            "value" : ""
-                        }
-                    }
-                }
-            }
-        }
+        "nativePlugins" : {}
     },
     "quickapp" : {},
     "mp-weixin" : {

+ 208 - 0
package-lock.json

@@ -4,6 +4,214 @@
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
+    "axios": {
+      "version": "0.21.0",
+      "resolved": "https://registry.npm.taobao.org/axios/download/axios-0.21.0.tgz?cache=0&sync_timestamp=1603468826655&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Faxios%2Fdownload%2Faxios-0.21.0.tgz",
+      "integrity": "sha1-Jt8IiAOiNQ3/LCf5b++Z/klEKso=",
+      "requires": {
+        "follow-redirects": "^1.10.0"
+      }
+    },
+    "call-bind": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npm.taobao.org/call-bind/download/call-bind-1.0.0.tgz?cache=0&sync_timestamp=1604117008862&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcall-bind%2Fdownload%2Fcall-bind-1.0.0.tgz",
+      "integrity": "sha1-JBJwVLs/m9y0sfuCQYGGBy93uM4=",
+      "requires": {
+        "function-bind": "^1.1.1",
+        "get-intrinsic": "^1.0.0"
+      }
+    },
+    "define-properties": {
+      "version": "1.1.3",
+      "resolved": "https://registry.npm.taobao.org/define-properties/download/define-properties-1.1.3.tgz",
+      "integrity": "sha1-z4jabL7ib+bbcJT2HYcMvYTO6fE=",
+      "requires": {
+        "object-keys": "^1.0.12"
+      }
+    },
+    "es-abstract": {
+      "version": "1.17.7",
+      "resolved": "https://registry.npm.taobao.org/es-abstract/download/es-abstract-1.17.7.tgz",
+      "integrity": "sha1-pN5hsvZpifx0IWdsHLl4dXOs5Uw=",
+      "requires": {
+        "es-to-primitive": "^1.2.1",
+        "function-bind": "^1.1.1",
+        "has": "^1.0.3",
+        "has-symbols": "^1.0.1",
+        "is-callable": "^1.2.2",
+        "is-regex": "^1.1.1",
+        "object-inspect": "^1.8.0",
+        "object-keys": "^1.1.1",
+        "object.assign": "^4.1.1",
+        "string.prototype.trimend": "^1.0.1",
+        "string.prototype.trimstart": "^1.0.1"
+      }
+    },
+    "es-to-primitive": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npm.taobao.org/es-to-primitive/download/es-to-primitive-1.2.1.tgz",
+      "integrity": "sha1-5VzUyc3BiLzvsDs2bHNjI/xciYo=",
+      "requires": {
+        "is-callable": "^1.1.4",
+        "is-date-object": "^1.0.1",
+        "is-symbol": "^1.0.2"
+      }
+    },
+    "follow-redirects": {
+      "version": "1.13.0",
+      "resolved": "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.13.0.tgz?cache=0&sync_timestamp=1597057976909&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.13.0.tgz",
+      "integrity": "sha1-tC6Nk6Kn7qXtiGM2dtZZe8jjhNs="
+    },
+    "function-bind": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npm.taobao.org/function-bind/download/function-bind-1.1.1.tgz",
+      "integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0="
+    },
+    "get-intrinsic": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npm.taobao.org/get-intrinsic/download/get-intrinsic-1.0.1.tgz?cache=0&sync_timestamp=1604120592084&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fget-intrinsic%2Fdownload%2Fget-intrinsic-1.0.1.tgz",
+      "integrity": "sha1-lKl2j8vdBZWhySc6rPTInQdWMb4=",
+      "requires": {
+        "function-bind": "^1.1.1",
+        "has": "^1.0.3",
+        "has-symbols": "^1.0.1"
+      }
+    },
+    "has": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npm.taobao.org/has/download/has-1.0.3.tgz",
+      "integrity": "sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=",
+      "requires": {
+        "function-bind": "^1.1.1"
+      }
+    },
+    "has-symbols": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npm.taobao.org/has-symbols/download/has-symbols-1.0.1.tgz",
+      "integrity": "sha1-n1IUdYpEGWxAbZvXbOv4HsLdMeg="
+    },
+    "is-callable": {
+      "version": "1.2.2",
+      "resolved": "https://registry.npm.taobao.org/is-callable/download/is-callable-1.2.2.tgz",
+      "integrity": "sha1-x8ZxXNItTdtI0+GZcCI6zquwgNk="
+    },
+    "is-date-object": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npm.taobao.org/is-date-object/download/is-date-object-1.0.2.tgz",
+      "integrity": "sha1-vac28s2P0G0yhE53Q7+nSUw7/X4="
+    },
+    "is-negative-zero": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npm.taobao.org/is-negative-zero/download/is-negative-zero-2.0.0.tgz",
+      "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE="
+    },
+    "is-regex": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npm.taobao.org/is-regex/download/is-regex-1.1.1.tgz?cache=0&sync_timestamp=1596555640141&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-regex%2Fdownload%2Fis-regex-1.1.1.tgz",
+      "integrity": "sha1-xvmKrMVG9s7FRooHt7FTq1ZKV7k=",
+      "requires": {
+        "has-symbols": "^1.0.1"
+      }
+    },
+    "is-symbol": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npm.taobao.org/is-symbol/download/is-symbol-1.0.3.tgz",
+      "integrity": "sha1-OOEBS55jKb4N6dJKQU/XRB7GGTc=",
+      "requires": {
+        "has-symbols": "^1.0.1"
+      }
+    },
+    "object-inspect": {
+      "version": "1.8.0",
+      "resolved": "https://registry.npm.taobao.org/object-inspect/download/object-inspect-1.8.0.tgz?cache=0&sync_timestamp=1592545089271&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fobject-inspect%2Fdownload%2Fobject-inspect-1.8.0.tgz",
+      "integrity": "sha1-34B+Xs9TpgnMa/6T6sPMe+WzqdA="
+    },
+    "object-keys": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npm.taobao.org/object-keys/download/object-keys-1.1.1.tgz",
+      "integrity": "sha1-HEfyct8nfzsdrwYWd9nILiMixg4="
+    },
+    "object.assign": {
+      "version": "4.1.2",
+      "resolved": "https://registry.npm.taobao.org/object.assign/download/object.assign-4.1.2.tgz?cache=0&sync_timestamp=1604115183005&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fobject.assign%2Fdownload%2Fobject.assign-4.1.2.tgz",
+      "integrity": "sha1-DtVKNC7Os3s4/3brgxoOeIy2OUA=",
+      "requires": {
+        "call-bind": "^1.0.0",
+        "define-properties": "^1.1.3",
+        "has-symbols": "^1.0.1",
+        "object-keys": "^1.1.1"
+      }
+    },
+    "promise.prototype.finally": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npm.taobao.org/promise.prototype.finally/download/promise.prototype.finally-3.1.2.tgz",
+      "integrity": "sha1-uK+JFgycZzzv47TEQ1tTz9AocGc=",
+      "requires": {
+        "define-properties": "^1.1.3",
+        "es-abstract": "^1.17.0-next.0",
+        "function-bind": "^1.1.1"
+      }
+    },
+    "string.prototype.trimend": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npm.taobao.org/string.prototype.trimend/download/string.prototype.trimend-1.0.2.tgz?cache=0&sync_timestamp=1603220012319&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring.prototype.trimend%2Fdownload%2Fstring.prototype.trimend-1.0.2.tgz",
+      "integrity": "sha1-bd2ah5a8cUtImjriIkaiCPN7+kY=",
+      "requires": {
+        "define-properties": "^1.1.3",
+        "es-abstract": "^1.18.0-next.1"
+      },
+      "dependencies": {
+        "es-abstract": {
+          "version": "1.18.0-next.1",
+          "resolved": "https://registry.npm.taobao.org/es-abstract/download/es-abstract-1.18.0-next.1.tgz",
+          "integrity": "sha1-bjoKS9pxflAjqzuOkL7DYQjSLGg=",
+          "requires": {
+            "es-to-primitive": "^1.2.1",
+            "function-bind": "^1.1.1",
+            "has": "^1.0.3",
+            "has-symbols": "^1.0.1",
+            "is-callable": "^1.2.2",
+            "is-negative-zero": "^2.0.0",
+            "is-regex": "^1.1.1",
+            "object-inspect": "^1.8.0",
+            "object-keys": "^1.1.1",
+            "object.assign": "^4.1.1",
+            "string.prototype.trimend": "^1.0.1",
+            "string.prototype.trimstart": "^1.0.1"
+          }
+        }
+      }
+    },
+    "string.prototype.trimstart": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npm.taobao.org/string.prototype.trimstart/download/string.prototype.trimstart-1.0.2.tgz?cache=0&sync_timestamp=1603220012476&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring.prototype.trimstart%2Fdownload%2Fstring.prototype.trimstart-1.0.2.tgz",
+      "integrity": "sha1-ItRdqBAVMJzQzdeXh+iRn8XGE+c=",
+      "requires": {
+        "define-properties": "^1.1.3",
+        "es-abstract": "^1.18.0-next.1"
+      },
+      "dependencies": {
+        "es-abstract": {
+          "version": "1.18.0-next.1",
+          "resolved": "https://registry.npm.taobao.org/es-abstract/download/es-abstract-1.18.0-next.1.tgz",
+          "integrity": "sha1-bjoKS9pxflAjqzuOkL7DYQjSLGg=",
+          "requires": {
+            "es-to-primitive": "^1.2.1",
+            "function-bind": "^1.1.1",
+            "has": "^1.0.3",
+            "has-symbols": "^1.0.1",
+            "is-callable": "^1.2.2",
+            "is-negative-zero": "^2.0.0",
+            "is-regex": "^1.1.1",
+            "object-inspect": "^1.8.0",
+            "object-keys": "^1.1.1",
+            "object.assign": "^4.1.1",
+            "string.prototype.trimend": "^1.0.1",
+            "string.prototype.trimstart": "^1.0.1"
+          }
+        }
+      }
+    },
     "vue-i18n": {
       "version": "8.20.0",
       "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.20.0.tgz",

+ 2 - 0
package.json

@@ -18,6 +18,8 @@
   },
   "homepage": "https://github.com/YanxinNet/uView#readme",
   "dependencies": {
+    "axios": "^0.21.0",
+    "promise.prototype.finally": "^3.1.2",
     "vue-i18n": "^8.20.0"
   }
 }