|
@@ -3,9 +3,9 @@ import fly from "./fly";
|
|
|
import qs from "qs";
|
|
|
import storage from "@system.storage";
|
|
|
import device from "@system.device";
|
|
|
-import request from '@system.request';
|
|
|
-import media from '@system.media';
|
|
|
-import prompt from '@system.prompt';
|
|
|
+import request from "@system.request";
|
|
|
+import media from "@system.media";
|
|
|
+import prompt from "@system.prompt";
|
|
|
// 获取token
|
|
|
let token = null;
|
|
|
export const getToken = async () => {
|
|
@@ -14,7 +14,7 @@ export const getToken = async () => {
|
|
|
if (!token) token = (await storage.get({ key: "token" })).data;
|
|
|
|
|
|
// token格式化
|
|
|
- if (token && (typeof token === "string")) token = JSON.parse(token);
|
|
|
+ if (token && typeof token === "string") token = JSON.parse(token);
|
|
|
|
|
|
console.log("checkToken", checkToken(token));
|
|
|
|
|
@@ -156,3 +156,9 @@ export const downImg = photoPath => {
|
|
|
fail: () => {}
|
|
|
});
|
|
|
};
|
|
|
+//校验手机号
|
|
|
+export const validatePhone = phone => {
|
|
|
+ const VALIDATE_REG = /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[0-9]|18[0-9]|14[57]|19[89])[0-9]{8}$/;
|
|
|
+ const isMobile = VALIDATE_REG.test(phone);
|
|
|
+ return isMobile;
|
|
|
+};
|