Răsfoiți Sursa

用户注册:短信提醒使用原生alert

honghaitzz11 6 ani în urmă
părinte
comite
c2456a8a4c

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
www/webapp/housekeeping/asset/css/app.css


+ 7 - 26
www/webapp/housekeeping/asset/index.html

@@ -1,27 +1,8 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta charset=utf-8>
-  <title>家政</title>
-  <meta charset=UTF-8>
-  <meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1">
-  <meta http-equiv=X-UA-Compatible content="ie=edge">
-  <link rel=stylesheet href=https://res.wx.qq.com/open/libs/weui/1.1.2/weui.min.css>
-  <script type=text/javascript src=https://res.wx.qq.com/open/libs/weuijs/1.1.2/weui.min.js></script>
-  <link href=/css/app.css rel=stylesheet>
-</head>
-<style>html {
-  font-size: 120%;
-}
+<!DOCTYPE html><html><head><meta charset=utf-8><title>家政</title><meta charset=UTF-8><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1"><meta http-equiv=X-UA-Compatible content="ie=edge"><link rel=stylesheet href=https://res.wx.qq.com/open/libs/weui/1.1.2/weui.min.css><script type=text/javascript src=https://res.wx.qq.com/open/libs/weuijs/1.1.2/weui.min.js></script><link href=/css/app.css rel=stylesheet></head><style>html {
+    font-size: 120%;
+  }
 
-* {
-  padding: 0;
-  margin: 0;
-}</style>
-<body>
-<div id=app></div>
-<script type=text/javascript src=/js/manifest.js></script>
-<script type=text/javascript src=/js/vendor.js></script>
-<script type=text/javascript src=/js/app.js></script>
-</body>
-</html>
+  * {
+    padding: 0;
+    margin: 0;
+  }</style><body><div id=app></div><script type=text/javascript src=/js/manifest.js></script><script type=text/javascript src=/js/vendor.js></script><script type=text/javascript src=/js/app.js></script></body></html>

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
www/webapp/housekeeping/asset/js/app.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
www/webapp/housekeeping/asset/js/app.js.map


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
www/webapp/housekeeping/asset/js/manifest.js.map


+ 18 - 12
www/webapp/housekeeping/src/components/userId.vue

@@ -4,25 +4,31 @@
   </div>
 </template>
 <script>
-  import config from '@/config'
+  import config from "@/config";
+
   export default {
-    name:'userId',
-    data(){
-      return{
-        userId:null
-      }
+    name: "userId",
+    data() {
+      return {
+        userId: null,
+      };
     },
-    created(){
-      this.userId = config.user_id
-    }
-  }
+    created() {
+      this.userId = config.user_id;
+      this.$router.push({
+        path: "/userInfo", query: {
+          test: true,
+        },
+      });
+    },
+  };
 </script>
 <style scoped lang='less'>
-  input{
+  input {
     height: 50px;
     width: 80%;
     display: block;
     margin: 10vh auto 0;
     text-align: center;
   }
-</style>
+</style>

+ 60 - 59
www/webapp/housekeeping/src/components/userInfo.vue

@@ -45,35 +45,34 @@
 </template>
 <script>
   // import axios from 'axios'
-  import _ from '@/config'
-  import {XInput, Group, XButton, Cell} from 'vux'
+  import _ from "@/config";
+  import {XInput, Group, XButton, Cell} from "vux";
 
   export default {
-    name: 'userInfo',
+    name: "userInfo",
     components: {
       XInput,
       XButton,
       Group,
-      Cell
+      Cell,
     },
     data() {
       return {
-        name: '完善信息',
-        userName: '',
-        mobile: '',
-        createCode: '', // 验证码
-        iCreateCode: '', // 用户输入的验证码
-        code: '', // 短信验证码
-        iCode: '', // 用户输入的短信验证码
-      }
+        name: "完善信息",
+        userName: "",
+        mobile: "",
+        createCode: "", // 验证码
+        iCreateCode: "", // 用户输入的验证码
+        code: "", // 短信验证码
+        iCode: "", // 用户输入的短信验证码
+        test: "",
+      };
     },
     created() {
       this.createCode = createCode();
-      /*      _.$http('/o2o/user/info',{
-              user_id: _.user_id
-            },res=>{
-              console.log(res.data);
-            })*/
+      if (this.$route.query.test && this.$route.query.test !== "") {
+        this.test = true;
+      }
     },
     watch: {
       // 短信验证码
@@ -86,55 +85,41 @@
             this.iCreateCodeShow = false;
             this.oldNumber = this.number;
             if (!this.iCodeShow) {
-              weui.alert('手机号码验证成功,请您填写您的需求并提交!');
-              return
+              window.alert("手机号码验证成功,请您填写您的需求并提交!");
             }
           }
         }
-      }
+      },
     },
     methods: {
       submit() {
         let self = this;
-//        console.log(this.iCode)
-////        console.log(this.userName)
-//        console.log(this.code)
         // 用户名判断
         if (!self.userName) {
-          weui.alert('请输入您的姓名');
-          return
+          window.alert("请输入您的姓名");
+          return;
         }
         // 检验手机号码
-        // console.log(self.iCode);
-        // console.log(self.code);
         if (Number.parseInt(self.iCode) !== self.code) {
-          weui.alert('您手机号码未通过验证,请重新操作!');
-          return
+          window.alert("您手机号码未通过验证,请重新操作!");
+          return;
+        }
+        if (self.test) {
+          window.alert("注册成功");
+          self.$router.push({path: "/"});
+          return;
         }
         // 提交数据
-        _.$http('/j/HouseKeeping/AddUserInfo', {
+        _.$http("/j/HouseKeeping/AddUserInfo", {
           user_id: _.user_id,
           mobile: self.mobile,
-          name: self.userName
+          name: self.userName,
         }, res => {
           if (res.data.success) {
-            weui.alert('注册成功', function () {
-              self.$router.push({path: '/'});
-              return
-            });
-          }
-          // console.log(res);
-        })
-
-        /*axios.post(_.apiPath + 'j/HouseKeeping/AddUserInfo&user_id=' + _.user_id + '&mobile=' + self.mobile + '&name=' + self.userName).then(res => {
-          if (res.data.success) {
-            weui.alert('注册成功', function () {
-              self.$router.push({path: '/'});
-              return
-            });
+            window.alert("注册成功");
+            self.$router.push({path: "/"});
           }
-          console.log(res);
-        });*/
+        });
       },
       // 获取短信验证码
       getCode() {
@@ -142,37 +127,37 @@
         _.SMS({
           mobile: self.mobile,
           iCreateCode: self.iCreateCode,
-          createCode: self.createCode
+          createCode: self.createCode,
         }, res => {
           // console.log(_.locationHref);
           self.code = res;
-          if (_.locationHref.indexOf('common.yiguanjia.me') == -1) {
-            this.iCode = this.code // 系统调试时开启
+          if (_.locationHref.indexOf("common.yiguanjia.me") == -1 || this.test) {
+            this.iCode = this.code; // 系统调试时开启
           }
           // this.iCreateCode = '';// 清空已输入验证码
           // this.createCode = createCode(); // 重置验证码
         });
       },
-      getCreateCode(){
+      getCreateCode() {
         this.createCode = createCode();
-        this.iCreateCode = '';// 清空已输入验证码
+        this.iCreateCode = "";// 清空已输入验证码
       },
       back() {
         // this.$router ? this.$router.back() : window.history.back()
-        this.$router.push({path: '/'});
-      }
-    }
-  }
+        this.$router.push({path: "/"});
+      },
+    },
+  };
 
   // 验证码
   function createCode(Number) {
-    let code = '';
+    let code = "";
     let random = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; // 随机数
     for (let i = 0; i < 4; i++) { // 循环操作
       let charIndex = Math.floor(Math.random() * random.length); // 取得随机数的索引
-      code += random[charIndex] // 根据索引取得随机数加到code上
+      code += random[charIndex]; // 根据索引取得随机数加到code上
     }
-    return code // 把code值赋给验证码
+    return code; // 把code值赋给验证码
   }
 </script>
 
@@ -180,6 +165,7 @@
   .user-info {
 
     padding: 0 15px;
+
     title {
       display: block;
       font-size: 1rem;
@@ -187,6 +173,7 @@
       text-align: center;
       position: relative;
       /*border-bottom: 2px solid #dddddd;*/
+
       span {
         content: "";
         width: 20px;
@@ -200,29 +187,35 @@
         background-position: center;
       }
     }
+
     h3 {
       width: 100%;
       text-align: center;
       margin: 5% 0;
     }
+
     /*验证码*/
 
     .select-time {
       text-align: left;
       color: #848484;
     }
+
     .service-time {
       float: left;
       display: inline-block;
       width: 50%;
     }
+
     input {
       font-size: 16px;
     }
+
     .title {
       text-align: center;
       font-weight: 500;
     }
+
     .checkCodeBtn {
       font-family: Arial;
       font-style: italic;
@@ -235,27 +228,33 @@
       margin-top: 5px;
       text-align: center;
     }
+
     .getCreateCode {
       border: 0;
       height: 35px;
       padding: 0 18px;
       margin-top: 5px;
     }
+
     /*服务形式*/
+
     .service-form {
       transition: all .1s;
       cursor: pointer;
       color: #000;
       text-align: left;
       padding-left: 0;
+
       &:after {
         width: 0;
         height: 0;
       }
+
       &:active {
         background-color: #dddddd;
       }
     }
+
     .submit {
       background: #ffb433;
       color: rgb(255, 255, 255);
@@ -269,6 +268,7 @@
       display: block;
       text-align: center;
       transition: all .1s;
+
       &:active {
         font-size: 20px;
         background: rgba(97, 144, 74, 0.8);
@@ -280,6 +280,7 @@
       height: 44px;
       color: black;
     }
+
     .weui-cell {
       padding: 15px;
     }

+ 72 - 72
www/webapp/housekeeping/src/config/method.js

@@ -1,26 +1,26 @@
-import axios from 'axios';
-import qs from 'qs';
-import globalVariables from './globalVariables';
+import axios from "axios";
+import qs from "qs";
+import globalVariables from "./globalVariables";
 
 let locationHref = location.href;
-let apiPath = '';
+let apiPath = "";
 
 // 时间戳 => 正常日期
-let timetrans = function(d) {
+let timetrans = function (d) {
   var date = new Date(d * 1000); //如果date为13位不需要乘1000
-  var Y = date.getFullYear() + '年';
+  var Y = date.getFullYear() + "年";
   var M =
     (date.getMonth() + 1 < 10
-      ? '0' + (date.getMonth() + 1)
-      : date.getMonth() + 1) + '月';
+      ? "0" + (date.getMonth() + 1)
+      : date.getMonth() + 1) + "月";
   var D =
-    (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '日' + ' ';
+    (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + "日" + " ";
   var h =
-    (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+    (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
   var m =
-    (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) +
-    ':';
-  var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
+    (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
+    ":";
+  var s = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
   return `${Y}${M}${D}${h}${m}${s}`;
 };
 
@@ -31,18 +31,18 @@ function systemDetection(factor) {
     app = navigator.appVersion;
   //android终端或者uc浏览器
   let isAndroid =
-    (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) &&
-    (app.indexOf('Android') > -1 || app.indexOf('Linux') > -1);
+    (u.indexOf("Android") > -1 || u.indexOf("Linux") > -1) &&
+    (app.indexOf("Android") > -1 || app.indexOf("Linux") > -1);
   //ios终端
   let isiOS =
     !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) &&
     !!app.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
   if (isAndroid) {
-    return 'Android';
+    return "Android";
   } else if (isiOS) {
-    return 'iOS';
+    return "iOS";
   } else {
-    return 'other';
+    return "other";
   }
 }
 
@@ -52,8 +52,8 @@ axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
 axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';*/
 function $http(url, params, callback) {
   if (
-    locationHref.indexOf('commontest.yiguanjia.me') > -1 ||
-    locationHref.indexOf('common.yiguanjia.me') > -1
+    locationHref.indexOf("commontest.yiguanjia.me") > -1 ||
+    locationHref.indexOf("common.yiguanjia.me") > -1
   ) {
   } else {
     // apiPath = 'http://common.yiguanjia.me/index.php?r=';
@@ -83,19 +83,19 @@ function SMS(params, callback) {
   */
   // 检验手机号码
   if (!/^1[34578]\d{9}$/.test(params.mobile) || params.mobile === 0) {
-    weui.alert('输入的手机号码有误,请重新输入');
+    window.alert("输入的手机号码有误,请重新输入");
     return;
   }
   if (params.iCreateCode === params.createCode) {
     $http(
-      '/moonclub/reserve/code',
+      "/moonclub/reserve/code",
       {
         type: 2,
         mobile: params.mobile,
       },
       (res) => {
         if (res.data.success) {
-          weui.alert('短信已发送,请留意查收!');
+          window.alert("短信已发送,请留意查收!");
           // 绑定短信验证码
           callback(res.data.data.code);
           // this.code = res.data.data.code;
@@ -103,86 +103,86 @@ function SMS(params, callback) {
           // this.iCreateCode = '';// 清空已输入验证码
           // this.createCode = createCode(); // 重置验证码
         } else {
-          weui.alert('短信发送发送失败,请稍后再试!');
+          window.alert("短信发送发送失败,请稍后再试!");
         }
       },
     );
   } else {
-    weui.alert('您输入验证码有误,请重新输入');
+    window.alert("您输入验证码有误,请重新输入");
   }
 }
 
 // 身份证检验
-let checkID = function(ID) {
-  if (typeof ID !== 'string') return '您输入的身份证包含其他文字';
-  if (ID === '') return '身份证号不为空';
+let checkID = function (ID) {
+  if (typeof ID !== "string") return "您输入的身份证包含其他文字";
+  if (ID === "") return "身份证号不为空";
   let city = {
-    11: '北京',
-    12: '天津',
-    13: '河北',
-    14: '山西',
-    15: '内蒙古',
-    21: '辽宁',
-    22: '吉林',
-    23: '黑龙江 ',
-    31: '上海',
-    32: '江苏',
-    33: '浙江',
-    34: '安徽',
-    35: '福建',
-    36: '江西',
-    37: '山东',
-    41: '河南',
-    42: '湖北 ',
-    43: '湖南',
-    44: '广东',
-    45: '广西',
-    46: '海南',
-    50: '重庆',
-    51: '四川',
-    52: '贵州',
-    53: '云南',
-    54: '西藏 ',
-    61: '陕西',
-    62: '甘肃',
-    63: '青海',
-    64: '宁夏',
-    65: '新疆',
-    71: '台湾',
-    81: '香港',
-    82: '澳门',
-    91: '国外',
+    11: "北京",
+    12: "天津",
+    13: "河北",
+    14: "山西",
+    15: "内蒙古",
+    21: "辽宁",
+    22: "吉林",
+    23: "黑龙江 ",
+    31: "上海",
+    32: "江苏",
+    33: "浙江",
+    34: "安徽",
+    35: "福建",
+    36: "江西",
+    37: "山东",
+    41: "河南",
+    42: "湖北 ",
+    43: "湖南",
+    44: "广东",
+    45: "广西",
+    46: "海南",
+    50: "重庆",
+    51: "四川",
+    52: "贵州",
+    53: "云南",
+    54: "西藏 ",
+    61: "陕西",
+    62: "甘肃",
+    63: "青海",
+    64: "宁夏",
+    65: "新疆",
+    71: "台湾",
+    81: "香港",
+    82: "澳门",
+    91: "国外",
   };
   let birthday =
     ID.substr(6, 4) +
-    '/' +
+    "/" +
     Number(ID.substr(10, 2)) +
-    '/' +
+    "/" +
     Number(ID.substr(12, 2));
   let d = new Date(birthday);
   let newBirthday =
     d.getFullYear() +
-    '/' +
+    "/" +
     Number(d.getMonth() + 1) +
-    '/' +
+    "/" +
     Number(d.getDate());
   let currentTime = new Date().getTime();
   let time = d.getTime();
   let arrInt = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
-  let arrCh = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];
+  let arrCh = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
   let sum = 0,
     i,
     residue;
 
-  if (!/^\d{17}(\d|x)$/i.test(ID)) return '身份证格式有误';
-  if (city[ID.substr(0, 2)] === undefined) return '身份证所在地区不属于中国!';
+  if (!/^\d{17}(\d|x)$/i.test(ID)) return "身份证格式有误";
+  if (city[ID.substr(0, 2)] === undefined) return "身份证所在地区不属于中国!";
   if (time >= currentTime || birthday !== newBirthday)
-    return '身份证中的出生日期,不属于当代!';
+    return "身份证中的出生日期,不属于当代!";
   for (i = 0; i < 17; i++) {
     sum += ID.substr(i, 1) * arrInt[i];
   }
   residue = arrCh[sum % 11];
-  if (residue !== ID.substr(17, 1)) return '身份证格式有误';
+  if (residue !== ID.substr(17, 1)) return "身份证格式有误";
 
   // return city[ID.substr(0, 2)] + "," + birthday + "," + (ID.substr(16, 1) % 2 ? " 男" : "女") //浙江,1994/7/26, 男
   return true;

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff