Zhengxiaowei преди 5 години
родител
ревизия
4b019ee6a3
променени са 5 файла, в които са добавени 118 реда и са изтрити 115 реда
  1. 5 2
      package.json
  2. 15 15
      src/api/fly.js
  3. 1 1
      src/manifest.json
  4. 5 5
      src/views/Index/index.ux
  5. 92 92
      src/views/Phone/index.ux

+ 5 - 2
package.json

@@ -22,5 +22,8 @@
   },
   "dependencies": {
     "flyio": "^0.6.14"
-  }
-}
+  },
+  "browserslist": [
+    "chrome 65"
+  ]
+}

+ 15 - 15
src/api/fly.js

@@ -9,17 +9,17 @@ import fetch from "@system.fetch";
 import Fly from "flyio/dist/npm/hap";
 import apiConfig from "./config";
 import prompt from '@system.prompt';
-import { getToken, clearToken,getSendOrderId } from "./utils";
+import { getToken, clearToken, getSendOrderId } from "./utils";
 import it from "../helper/interface.js";
 var fly = new Fly(fetch);
 var qs = require('qs');
 var appInfo = it.getAppInfo();
-var appDev,sendOrderId;
-it.getAppDev((res)=>{
-  appDev=res;
+var appDev, sendOrderId;
+it.getAppDev((res) => {
+  appDev = res;
 })
-getSendOrderId((id)=>{
-  sendOrderId=id;
+getSendOrderId((id) => {
+  sendOrderId = id;
 })
 
 fly.config.baseURL = apiConfig.baseURL;
@@ -32,19 +32,19 @@ fly.interceptors.request.use(async config => {
   // 过滤一些不需要登录的路由d
   if (filterNoToken.indexOf(config.url) === -1) {
     let token = await getToken();
-    if (config.headers){
+    if (config.headers) {
       config.headers.Authorization = token;
       config.headers["X-Version"] = appInfo.versionName;
       config.headers["X-Brand"] = qs.stringify(appDev);
-      if(sendOrderId) config.headers["send_order_id"]=sendOrderId;
-    } 
-    else{
-      if(sendOrderId){
-        config.headers = { Authorization: token,'X-Version':appInfo.versionName,'X-Brand':qs.stringify(appDev),'send_order_id':sendOrderId };
-      }else{
-        config.headers = { Authorization: token,'X-Version':appInfo.versionName,'X-Brand':qs.stringify(appDev)};
+      if (sendOrderId) config.headers["send_order_id"] = sendOrderId;
+    }
+    else {
+      if (sendOrderId) {
+        config.headers = { Authorization: token, 'X-Version': appInfo.versionName, 'X-Brand': qs.stringify(appDev), 'send_order_id': sendOrderId };
+      } else {
+        config.headers = { Authorization: token, 'X-Version': appInfo.versionName, 'X-Brand': qs.stringify(appDev) };
       }
-    } 
+    }
     if (config.method === "POST") {
       config.body = qs.stringify(config.body);
     }

+ 1 - 1
src/manifest.json

@@ -3,7 +3,7 @@
   "name": "追书云",
   "versionName": "1.0.8",
   "versionCode": "9",
-  "minPlatformVersion": "1020",
+  "minPlatformVersion": "1040",
   "icon": "/assets/imgs/logo.png",
   "features": [
     {

+ 5 - 5
src/views/Index/index.ux

@@ -114,11 +114,11 @@ export default {
   },
   onBackPress() {
     // 退出逻辑
-    if (this.$app.$def.data.backClickCount === 0) {
-      this.$app.$def.data.backClickCount++;
-      this.$app.$def.createShortcut();
-      return true;
-    }
+    // if (this.$app.$def.data.backClickCount === 0) {
+    //   this.$app.$def.data.backClickCount++;
+    //   this.$app.$def.createShortcut();
+    //   return true;
+    // }
   },
   /**
    * 当用户点击菜单按钮时触发,调用app中定义的方法showMenu

+ 92 - 92
src/views/Phone/index.ux

@@ -1,93 +1,93 @@
-<template>
-  <div class="phone-wrap">
-    <div class="input-content">
-      <div class="input-item">
-        <input class="input-text" type="tel" placeholder="请输入手机号" value="{{mobile}}" style="placeholder-color: #CCC" onchange="updateMobile"></input>
-      </div>
-      <div class="input-item">
-        <input class="input-text" type="number" maxlength="6" placeholder="请输入验证码" value="{{code}}" style="placeholder-color: #CCC" onchange="updateMessage"></input>
-        <text class="send-msg" if="{{!hasSend}}" @click="sendMsg">获取验证码</text>
-        <text class="send-msg disabled" else>重新获取{{duration}}</text>
-      </div>
-    </div>
-    <input type="button" value="绑定手机号" class="bind-button" @click="bindUser"> </input>
-  </div>
-</template>
-<script>
-import { validatePhone  } from '../../helper/interface';
-import { sendCode, userBind } from '../../api/index';
-import router from '@system.router';
-import prompt from '@system.prompt';
-export default {
-  private: {
-    hasSend: false,
-    duration: 120,
-    mobile: null,
-    code: null
-
-  },
-  onInit() {
-
-  },
-  async sendMsg() {
-    let result = validatePhone(this.mobile);
-    if (result) {
-      let res = await sendCode({ phone: this.mobile });
-      this.countDown();
-    } else {
-      prompt.showToast({
-        message: '手机号格式不正确'
-      })
-    }
-  },
-  updateMobile(e) {
-    this.mobile = e.value;
-  },
-  updateMessage(e) {
-    this.code = e.value;
-  },
-  //倒计时
-  countDown() {
-    this.hasSend = true;
-    let time = setInterval(() => {
-      this.duration--;
-      if (this.duration < 1) {
-        clearInterval(time);
-        this.duration = 120;
-        this.hasSend = false;
-      }
-    }, 1000);
-  },
-  //绑定用户
-  async bindUser() {
-    if (!this.mobile || !this.code) {
-      prompt.showToast({
-        message: '请输入手机号和验证码'
-      })
-      return false;
-    }
-    if (!validatePhone(this.mobile)) {
-      prompt.showToast({
-        message: '手机号码格式不正确'
-      })
-      return false;
-    }
-    let params = {
-      phone: this.mobile,
-      code: this.code
-    }
-    let res = await userBind(params);
-    prompt.showToast({
-      message: '绑定成功!'
-    })
-    setTimeout(()=>{
-      router.back();
-    },1500)
-
-  }
-
-}
-</script>
-<style lang="less">
-@import "../../assets/less/phone.less";
+<template>
+  <div class="phone-wrap">
+    <div class="input-content">
+      <div class="input-item">
+        <input class="input-text" type="tel" placeholder="请输入手机号" value="{{mobile}}" style="placeholder-color: #CCC" onchange="updateMobile"></input>
+      </div>
+      <div class="input-item">
+        <input class="input-text" type="number" maxlength="6" placeholder="请输入验证码" value="{{code}}" style="placeholder-color: #CCC" onchange="updateMessage"></input>
+        <text class="send-msg" if="{{!hasSend}}" @click="sendMsg">获取验证码</text>
+        <text class="send-msg disabled" else>重新获取{{duration}}</text>
+      </div>
+    </div>
+    <input type="button" value="绑定手机号" class="bind-button" @click="bindUser"> </input>
+  </div>
+</template>
+<script>
+import it from '../../helper/interface.js';
+import { sendCode, userBind } from '../../api/index';
+import router from '@system.router';
+import prompt from '@system.prompt';
+export default {
+  private: {
+    hasSend: false,
+    duration: 120,
+    mobile: null,
+    code: null
+
+  },
+  onInit() {
+
+  },
+  async sendMsg() {
+    let result = it.validatePhone(this.mobile);
+    if (result) {
+      let res = await sendCode({ phone: this.mobile });
+      this.countDown();
+    } else {
+      prompt.showToast({
+        message: '手机号格式不正确'
+      })
+    }
+  },
+  updateMobile(e) {
+    this.mobile = e.value;
+  },
+  updateMessage(e) {
+    this.code = e.value;
+  },
+  //倒计时
+  countDown() {
+    this.hasSend = true;
+    let time = setInterval(() => {
+      this.duration--;
+      if (this.duration < 1) {
+        clearInterval(time);
+        this.duration = 120;
+        this.hasSend = false;
+      }
+    }, 1000);
+  },
+  //绑定用户
+  async bindUser() {
+    if (!this.mobile || !this.code) {
+      prompt.showToast({
+        message: '请输入手机号和验证码'
+      })
+      return false;
+    }
+    if (!validatePhone(this.mobile)) {
+      prompt.showToast({
+        message: '手机号码格式不正确'
+      })
+      return false;
+    }
+    let params = {
+      phone: this.mobile,
+      code: this.code
+    }
+    let res = await userBind(params);
+    prompt.showToast({
+      message: '绑定成功!'
+    })
+    setTimeout(()=>{
+      router.back();
+    },1500)
+
+  }
+
+}
+</script>
+<style lang="less">
+@import "../../assets/less/phone.less";
 </style>