xiabx преди 5 години
родител
ревизия
c8eadd3218
променени са 3 файла, в които са добавени 20 реда и са изтрити 4 реда
  1. 7 0
      src/api/fly.js
  2. 11 2
      src/helper/interface.js
  3. 2 2
      src/manifest.json

+ 7 - 0
src/api/fly.js

@@ -14,6 +14,10 @@ import it from "../helper/interface.js";
 var fly = new Fly(fetch);
 var qs = require('qs');
 var appInfo = it.getAppInfo();
+var appDev;
+it.getAppDev((res)=>{
+  appDev=res;
+})
 fly.config.baseURL = apiConfig.baseURL;
 fly.config.headers["Content-Type"] =
   "application/x-www-form-urlencoded;charset=utf-8";
@@ -24,12 +28,15 @@ fly.interceptors.request.use(async config => {
   // 过滤一些不需要登录的路由d
   if (filterNoToken.indexOf(config.url) === -1) {
     let token = await getToken();
+  
     if (config.headers){
       config.headers.Authorization = token;
       config.headers["X-Version"] = appInfo.versionName;
+      config.headers["X-Brand"] = qs.stringify(appDev);
     } 
     else{
       config.headers = { Authorization: token,'X-Version':appInfo.versionName };
+      config.headers = { Authorization: token,'X-Brand':qs.stringify(appDev) };
     } 
     if (config.method === "POST") {
       config.body = qs.stringify(config.body);

+ 11 - 2
src/helper/interface.js

@@ -19,7 +19,15 @@ const getAppInfo = () => {
   const appInfo = app.getInfo();
   return appInfo;
 }
-
+//获取设备明细
+const getAppDev = (fn) => {
+  device.getInfo({
+    success: (ret)=> {
+     fn&&fn(ret)
+    }
+  })
+  
+}
 //获取是否创建图标
 const getShortCut = (fn) => {
   shortcut.hasInstalled({
@@ -88,5 +96,6 @@ export default {
   hasCreateShortCut,
   showMenu,
   getShortCut,
-  getAppInfo
+  getAppInfo,
+  getAppDev
 }

+ 2 - 2
src/manifest.json

@@ -1,8 +1,8 @@
 {
   "package": "com.beidao.kuaiying.zsy",
   "name": "追书云",
-  "versionName": "1.0.5",
-  "versionCode": "6",
+  "versionName": "1.0.6",
+  "versionCode": "7",
   "minPlatformVersion": "1020",
   "icon": "/assets/imgs/logo.png",
   "features": [