Jelajahi Sumber

app 增加不可约课程样式显示

Changpeng Duan 4 tahun lalu
induk
melakukan
956b51f92e
3 mengubah file dengan 1249 tambahan dan 1244 penghapusan
  1. 677 667
      app/src/page/appoint.vue
  2. 571 577
      app/src/page/login.vue
  3. 1 0
      app/vue.config.js

+ 677 - 667
app/src/page/appoint.vue

@@ -2,7 +2,7 @@
   <div class="pages">
 
     <div class="as">
-      <img src="../static/images/main/banner.png" height="121" width="414"/>
+      <img src="../static/images/main/banner.png" height="121" width="414" />
       <!--<mu-tabs :value.sync="active" color="#F2F2F2" indicator-color="#ffffff" @change="getIndex" v-if="reFresh">-->
       <!--<mu-tab v-for="day in weeks">{{ day.data }} <br> <em>{{ day.name }}</em></mu-tab>-->
       <!--</mu-tabs>-->
@@ -16,22 +16,26 @@
         <em class="green" v-if="num > 0">{{ num }}</em>
         <em class="red" v-else>{{ num }}</em>
-    </span>
+      </span>
     </div>
     <div class="context">
       <ul class="list">
-        <li v-for="l in list"
-            v-show="l.WxVisible == 1"
-            :class="[{'greenLi':l.remain > 0},{'redLi':l.Status == 1},{'yellowLi':l.remain == 0},{'whiteLi':l.WxOrder == 0}]">
+        <li v-for="l in list" v-show="l.WxVisible == 1"
+          :class="[{'greenLi':l.remain > 0},{'redLi':l.Status == 1},{'yellowLi':l.remain == 0},{'whiteLi':l.WxOrder == 0},{'whiteLi':l.IsAllowSelect == 0}]">
           <div class="dotContainer">
-            <!--                        正常-->
-            <i class="dot" v-if="l.remain>0 && l.WxOrder != 0"></i>
-
-            <i class="cubes" v-if="l.Status==1"></i>
-            <!--                        已满-->
-            <i class="tri" v-if="l.remain == 0 && l.remain == 0"></i>
-            <!--                        不可约-->
-            <i class="x" v-if="l.WxOrder==0"></i>
+            <div v-if="l.IsAllowSelect > 0">
+              <!--正常-->
+              <i class="dot" v-if="l.remain>0 && l.WxOrder != 0"></i>
+              <i class="cubes" v-if="l.Status==1"></i>
+              <!--已满-->
+              <i class="tri" v-if="l.remain == 0 && l.remain == 0"></i>
+              <!--不可约-->
+              <i class="x" v-if="l.WxOrder==0"></i>
+            </div>
+            <!-- 不可匹配课程 -->
+            <div v-else>
+              <i class="x"></i>
+            </div>
           </div>
           <div class="title">
             <h5><span class="lessons" :style="{ background:l.ClassColor }">{{ l.ClassName }}</span></h5>
@@ -41,17 +45,25 @@
             <h5>剩余
               <em class="green" v-if="l.remain > 0">{{ l.remain }}</em>
               <em class="red" v-else>{{ l.remain }}</em>
-              人</h5>
+              人
+            </h5>
             <span>总名额 {{ l.OrderToplimit }} 人</span>
           </div>
-          <mu-button class="appointBtn greenBtn" v-if="l.remain > 0 && l.OrderId == 0 && l.WxOrder != 0"
-                     @click="appointNow(l)">
-            预约
-          </mu-button>
-          <mu-button class="appointBtn redBtn" v-if="l.remain == 0 && l.OrderId == 0" @click="isFulled">已满
-          </mu-button>
-          <mu-button class="appointBtn yellowBtn" v-if="l.OrderId != 0" @click="isAppointed(l)">已约</mu-button>
-          <mu-button class="appointBtn disableBtn" v-if="l.WxOrder == 0" @click="isDisable">不可约</mu-button>
+          <!-- 可匹配课程 -->
+          <div v-if="l.IsAllowSelect > 0">
+            <mu-button class="appointBtn greenBtn" v-if="l.remain > 0 && l.OrderId == 0 && l.WxOrder != 0"
+              @click="appointNow(l)">
+              预约
+            </mu-button>
+            <mu-button class="appointBtn redBtn" v-if="l.remain == 0 && l.OrderId == 0" @click="isFulled">已满
+            </mu-button>
+            <mu-button class="appointBtn yellowBtn" v-if="l.OrderId != 0" @click="isAppointed(l)">已约</mu-button>
+            <mu-button class="appointBtn disableBtn" v-if="l.WxOrder == 0" @click="isDisable">不可约</mu-button>
+          </div>
+          <!-- 不可匹配课程 -->
+          <div v-else>
+            <mu-button class="appointBtn disableBtn" @click="isDisable">不可约</mu-button>
+          </div>
         </li>
         <div class="tips" v-if="list == ''">
           <p style="text-align: center">
@@ -65,8 +77,8 @@
     </div>
     <bottomTab :curTab="thisTab"></bottomTab>
     <div class="doalog">
-      <mu-dialog title="预约课程" width="600" max-width="80%" :esc-press-close="false"
-                 :overlay-close="false" :open.sync="openAlert">
+      <mu-dialog title="预约课程" width="600" max-width="80%" :esc-press-close="false" :overlay-close="false"
+        :open.sync="openAlert">
         <p>
           是否预约 课程:{{ dialog.ClassName }} ,时间:{{ dialog.BeginStr }} - {{ dialog.EndStr }}
           <br>
@@ -80,703 +92,701 @@
 </template>
 
 <script>
-import axios from 'axios';
-import bottomTab from '../components/bottomTab'
-import {
-  CanOrderSchoolTimeTableListQuery,
-  OderAddByVipUser,
-  OderCancelByVipUser,
-  QueryNextWeek,
-  testSelect,
-  testTable,
-} from '../api/getApiRes.js'
-
-import alert from '../components/alert'
-
-let qs = require('qs');
-import Global from '../Global.js'
-
-export default {
-  data() {
-    return {
-      num: 0,
-      thisTab: '预约课程',
-      active: 0,
-      sum: 0,
-      HaveDays: 0,
-      openAlert: false,
-      reFresh: true,
-      list: [],
-      weeks: [],
-      today: '',
-      dialog: {
-        id: '',
-        name: '',
-        timeLong: '',
-      },
-    }
-  },
-  mounted() {
-    this.getQueryNextWeek();
-    // this.alertInfo(document.body.clientWidth);
-    // this.alertInfo( window.screen.height);
-  },
-  watch: {
-    '$route'(to) {
-      if (to.name == 'appoint') {
-        this.getList();
+  import axios from 'axios';
+  import bottomTab from '../components/bottomTab'
+  import {
+    CanOrderSchoolTimeTableListQuery,
+    OderAddByVipUser,
+    OderCancelByVipUser,
+    QueryNextWeek,
+    testSelect,
+    testTable,
+  } from '../api/getApiRes.js'
+
+  import alert from '../components/alert'
+
+  let qs = require('qs');
+  import Global from '../Global.js'
+
+  export default {
+    data() {
+      return {
+        num: 0,
+        thisTab: '预约课程',
+        active: 0,
+        sum: 0,
+        HaveDays: 0,
+        openAlert: false,
+        reFresh: true,
+        list: [],
+        weeks: [],
+        today: '',
+        dialog: {
+          id: '',
+          name: '',
+          timeLong: '',
+        },
       }
     },
-    'active'(to) {
-      this.getList();
-    }
-  },
-  activated() {
-    this.active = 0;
-    this.reFresh = false;
-    this.$nextTick(() => {
-      this.reFresh = true;
+    mounted() {
       this.getQueryNextWeek();
-    });
-
-  },
-  methods: {
-    changeActive(i) {
-      this.active = i;
-    },
-    getIndex(val) {
-      console.log(val);
-    },
-    getQueryNextWeek() {
-      let that = this;
-      let param = {
-        token: localStorage.token,
-        shopId: this.$route.query.shopId,
-      };
-      let postdata = qs.stringify(param);
-      this.weeks = [];
-      QueryNextWeek(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          this.HaveDays = json.Rs;
-          this.getFurtherDays(this.HaveDays);
-        } else {
-          that.list = [];
-          that.$message.error(json.Memo);
-        }
-      })
-    },
-    alertInfo(info) {
-      this.$refs.alertPart.openSimpleDialog(info);
+      // this.alertInfo(document.body.clientWidth);
+      // this.alertInfo( window.screen.height);
     },
-    goPage(url) {
-      this.$router.push({
-        path: '/' + url, query: {
-          shopId: this.$route.query.shopId
+    watch: {
+      '$route'(to) {
+        if (to.name == 'appoint') {
+          this.getList();
         }
-      });
-    },
-    // 获取未来7天的
-    getFurtherDays(HaveDays) {
-      let now = new Date();
-      let nowTime = now.getTime();
-      let oneDayTime = 24 * 60 * 60 * 1000;
-      let days = '';
-      let item = [];
-      let month = 0;
-      let day = 0;
-      this.weeks = [];
-      for (let i = 0; i < HaveDays; i++) {
-        days = new Date(nowTime + (i) * oneDayTime);//显示周日
-        month = days.getMonth() + 1;
-        day = days.getDate();
-        month = month < 10 ? '0' + month : month;
-        day = day < 10 ? '0' + day : day;
-        item = {
-          name: this.numberToWeek(days.getDay()),
-          data: days.getMonth() + 1 + '月' + days.getDate() + '日',
-          orderDate: days.getFullYear() + '-' + month + '-' + day
-        };
-        this.weeks.push(item);
-      }
-      this.today = this.weeks[0].name;
-      this.getList();
-    },
-    numberToWeek(val) {
-      switch (parseInt(val)) {
-        case 1:
-          return '星期一';
-          break;
-        case 2:
-          return '星期二';
-          break;
-        case 3:
-          return '星期三';
-          break;
-        case 4:
-          return '星期四';
-          break;
-        case 5:
-          return '星期五';
-          break;
-        case 6:
-          return '星期六';
-          break;
-        case 0:
-          return '星期天';
-          break;
+      },
+      'active'(to) {
+        this.getList();
       }
     },
-    confirmAppoint() {
-      let that = this;
-      that.openAlert = false;
-      let param = {
-        token: localStorage.token,
-        stdId: that.dialog.StdId
-      };
-      let postdata = qs.stringify(param);
-      OderAddByVipUser(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          that.alertInfo('已成功预约', 'success');
-          that.getList();
-        } else {
-          that.alertInfo(json.Memo + ', 错误码:' + json.Code);
-        }
-      })
-    },
-    closeAlertDialog() {
-      this.openAlert = false;
-    },
-    appointNow(row) {
-      this.dialog = row;
-      this.openAlert = true;
-    },
-    isFulled() {
-      let that = this;
-      that.$alert('当前课程已满,请选择其他课程或其他时间预约', '提示', {
-        okLabel: '知道了'
-      }).then(() => {
-        that.getList();
+    activated() {
+      this.active = 0;
+      this.reFresh = false;
+      this.$nextTick(() => {
+        this.reFresh = true;
+        this.getQueryNextWeek();
       });
+
     },
-    isAppointed(row) {
-      let that = this;
-      this.$confirm('是否取消前课程预约?', '提示', {
-        type: 'warning'
-      }).then(({result}) => {
-        if (result) {
-          let param = {
-            token: localStorage.token,
-            orderId: row.OrderId,
+    methods: {
+      changeActive(i) {
+        this.active = i;
+      },
+      getIndex(val) {
+        console.log(val);
+      },
+      getQueryNextWeek() {
+        let that = this;
+        let param = {
+          token: localStorage.token,
+          shopId: this.$route.query.shopId,
+        };
+        let postdata = qs.stringify(param);
+        this.weeks = [];
+        QueryNextWeek(postdata).then(res => {
+          let json = res;
+          if (json.Code == 0) {
+            this.HaveDays = json.Rs;
+            this.getFurtherDays(this.HaveDays);
+          } else {
+            that.list = [];
+            that.$message.error(json.Memo);
+          }
+        })
+      },
+      alertInfo(info) {
+        this.$refs.alertPart.openSimpleDialog(info);
+      },
+      goPage(url) {
+        this.$router.push({
+          path: '/' + url, query: {
+            shopId: this.$route.query.shopId
+          }
+        });
+      },
+      // 获取未来7天的
+      getFurtherDays(HaveDays) {
+        let now = new Date();
+        let nowTime = now.getTime();
+        let oneDayTime = 24 * 60 * 60 * 1000;
+        let days = '';
+        let item = [];
+        let month = 0;
+        let day = 0;
+        this.weeks = [];
+        for (let i = 0; i < HaveDays; i++) {
+          days = new Date(nowTime + (i) * oneDayTime);//显示周日
+          month = days.getMonth() + 1;
+          day = days.getDate();
+          month = month < 10 ? '0' + month : month;
+          day = day < 10 ? '0' + day : day;
+          item = {
+            name: this.numberToWeek(days.getDay()),
+            data: days.getMonth() + 1 + '月' + days.getDate() + '日',
+            orderDate: days.getFullYear() + '-' + month + '-' + day
           };
-          let postdata = qs.stringify(param);
-          OderCancelByVipUser(postdata).then(res => {
-            let json = res;
-            if (json.Code == 0) {
-              that.alertInfo('当前课程已取消预约', 'success');
-              that.getList();
-            } else {
-              that.alertInfo(json.Memo + ', 错误码:' + json.Code);
-            }
-          })
-        } else {
-          this.alertInfo('点击了取消');
+          this.weeks.push(item);
         }
-      });
-    },
-    isDisable(row) {
-      this.alertInfo('课程不可预约,请选择其他课程或其他时间预约', 'info');
-    },
-    getList() {
-      let that = this;
-      this.today = this.weeks[this.active].name;
-      let curDay = this.weeks[this.active].orderDate;
-      let param = {
-        token: localStorage.token,
-        orderDate: curDay,
-        shopId: this.$route.query.shopId,
-      };
-      let postdata = qs.stringify(param);
-      that.list = [];
-      that.num = 0;
-      CanOrderSchoolTimeTableListQuery(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          that.list = json.Rs;
-          if (that.list) {
-            // 计算剩余
-            that.num = 0;
-            that.list.map(function (item) {
-              item.remain = parseInt(item.OrderToplimit) - parseInt(item.OrderCount);
-              that.num = that.num + item.remain
-              console.log( that.num);
+        this.today = this.weeks[0].name;
+        this.getList();
+      },
+      numberToWeek(val) {
+        switch (parseInt(val)) {
+          case 1:
+            return '星期一';
+            break;
+          case 2:
+            return '星期二';
+            break;
+          case 3:
+            return '星期三';
+            break;
+          case 4:
+            return '星期四';
+            break;
+          case 5:
+            return '星期五';
+            break;
+          case 6:
+            return '星期六';
+            break;
+          case 0:
+            return '星期天';
+            break;
+        }
+      },
+      confirmAppoint() {
+        let that = this;
+        that.openAlert = false;
+        let param = {
+          token: localStorage.token,
+          stdId: that.dialog.StdId
+        };
+        let postdata = qs.stringify(param);
+        OderAddByVipUser(postdata).then(res => {
+          let json = res;
+          if (json.Code == 0) {
+            that.alertInfo('已成功预约', 'success');
+            that.getList();
+          } else {
+            that.alertInfo(json.Memo + ', 错误码:' + json.Code);
+          }
+        })
+      },
+      closeAlertDialog() {
+        this.openAlert = false;
+      },
+      appointNow(row) {
+        this.dialog = row;
+        this.openAlert = true;
+      },
+      isFulled() {
+        let that = this;
+        that.$alert('当前课程已满,请选择其他课程或其他时间预约', '提示', {
+          okLabel: '知道了'
+        }).then(() => {
+          that.getList();
+        });
+      },
+      isAppointed(row) {
+        let that = this;
+        this.$confirm('是否取消前课程预约?', '提示', {
+          type: 'warning'
+        }).then(({ result }) => {
+          if (result) {
+            let param = {
+              token: localStorage.token,
+              orderId: row.OrderId,
+            };
+            let postdata = qs.stringify(param);
+            OderCancelByVipUser(postdata).then(res => {
+              let json = res;
+              if (json.Code == 0) {
+                that.alertInfo('当前课程已取消预约', 'success');
+                that.getList();
+              } else {
+                that.alertInfo(json.Memo + ', 错误码:' + json.Code);
+              }
             })
+          } else {
+            this.alertInfo('点击了取消');
           }
-        } else {
-          that.alertInfo(json.Memo + ', 错误码:' + json.Code);
-        }
-      })
+        });
+      },
+      isDisable(row) {
+        this.alertInfo('课程不可预约,请选择其他课程或其他时间预约', 'info');
+      },
+      getList() {
+        let that = this;
+        this.today = this.weeks[this.active].name;
+        let curDay = this.weeks[this.active].orderDate;
+        let param = {
+          token: localStorage.token,
+          orderDate: curDay,
+          shopId: this.$route.query.shopId,
+        };
+        let postdata = qs.stringify(param);
+        that.list = [];
+        that.num = 0;
+        CanOrderSchoolTimeTableListQuery(postdata).then(res => {
+          let json = res;
+          if (json.Code == 0) {
+            that.list = json.Rs;
+            if (that.list) {
+              // 计算剩余
+              that.num = 0;
+              that.list.map(function (item) {
+                item.remain = parseInt(item.OrderToplimit) - parseInt(item.OrderCount);
+                that.num = that.num + item.remain
+                console.log(that.num);
+              })
+            }
+          } else {
+            that.alertInfo(json.Memo + ', 错误码:' + json.Code);
+          }
+        })
+      },
     },
-  },
-  components: {
-    bottomTab, alert
+    components: {
+      bottomTab, alert
+    }
   }
-}
 </script>
 
 <style scoped>
-.pages {
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-}
-
-/*mu-header*/
-.mu-primary-color {
-  line-height: 60px;
-  height: 60px;
-  background: url("../static/images/comm/headerBg.png") top center no-repeat;
-  background-size: 100%;
-}
-
-/deep/ .mu-appbar-left {
-  padding-top: 15px;
-}
-
-/deep/ .material-icons {
-  color: #fff;
-}
-
-/deep/ .mu-appbar-title {
-  text-align: center;
-}
-
-/deep/ .mu-tabs {
-  /*display: flex;*/
-  /*width: 414px;*/
-  overflow-x: scroll;
-  overflow-y: hidden;
-  /*display:inline;*/
-  /*float: left;*/
-}
-
-/deep/ .mu-tab {
-  width: 85px;
-  min-width: 85px;
-  float: left;
-  height: 51px;
-  margin-right: 6px;
-}
-
-/*/deep/ .mu-tab:nth-child(5) {*/
-/*    margin-right: 0px;*/
-/*}*/
-
-/deep/ .mu-tab-wrapper {
-  height: 51px;
-  background: #f4f4f4;
-  color: #363636;
-  box-shadow: 1px 0px 6px rgba(0, 0, 0, 0.16);
-  border-radius: 8px 8px 0px 0px;
-  font-size: 14px;
-}
-
-/deep/ .mu-tab-active .mu-tab-wrapper {
-  height: 56px;
-  border-radius: 8px 8px 0px 0px;
-  background: #ffffff;
-  box-shadow: 1px 0px 6px rgba(0, 0, 0, 0.16);
-  color: #000;
-}
-
-/deep/ .mu-tab-wrapper em {
-  font-size: 12px;
-}
-
-.sum {
-  width: 100%;
-  height: 55px;
-  line-height: 55px;
-  background: #fff;
-  font-family: "PingFang SC";
-  font-weight: 300;
-  font-size: 16px;
-  text-align: center;
-  color: #909090;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-}
-
-.green {
-  color: #37CB00;
-}
-
-.red {
-  color: #F8847F;
-}
-
-.list {
-  width: 100%;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  margin-top: 8px;
-  padding-bottom: 30px;
-}
-
-.list li {
-  width: 100%;
-  height: 70px;
-  margin-bottom: 8px;
-  padding-top: 16px;
-  padding-bottom: 16px;
-}
-
-.list .dotContainer {
-  width: 50px;
-  float: left;
-  height: 60px;
-  padding-left: 22px;
-  padding-top: 10px;
-}
-
-.dotContainer .dot {
-  width: 12px;
-  height: 12px;
-  background: #37cb00;
-  border-radius: 250px;
-  float: left;
-}
-
-.cubes {
-  width: 12px;
-  height: 12px;
-  background: #f8847f;
-  float: left;
-}
-
-.tri {
-  width: 12px;
-  height: 12px;
-  background: url("../static/images/appoint/tri.png") top center no-repeat;
-  background-size: 100% 100%;
-  float: left;
-}
-
-.x {
-  width: 12px;
-  height: 12px;
-  background: url("../static/images/appoint/x.png") top center no-repeat;
-  background-size: 100% 100%;
-  float: left;
-}
-
-
-.yellowLi {
-  background: #FFFBED;
-}
-
-.redLi {
-  background: #FFF7F7;
-}
-
-.greenLi {
-  background: #F7FFF4;
-}
-
-.whiteLi {
-  background: #fff;
-}
-
-.list li .title {
-  /*width: 90px;*/
-  width: 27%;
-  height: 60px;
-  float: left;
-}
-
-li .title h5 {
-  width: 100%;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  font-weight: normal;
-  font-size: 14px;
-  text-align: left;
-  color: #3b3b3b;
-}
-
-li .title span {
-  width: 100%;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  font-weight: normal;
-  font-size: 12px;
-  text-align: left;
-  color: #909090;
-}
-
-.list li .current {
-  width: 120px;
-  height: 60px;
-  float: left;
-}
-
-li .current h5 {
-  width: 100%;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  font-family: "PingFang SC";
-  font-weight: normal;
-  font-size: 14px;
-  text-align: left;
-  color: #3b3b3b;
-}
-
-.current h5 em {
-  font-family: "PingFang SC";
-  font-weight: normal;
-  font-size: 14px;
-  text-align: left;
-}
-
-.current span {
-  font-family: "PingFang SC";
-  font-weight: normal;
-  font-size: 12px;
-  text-align: left;
-  color: #909090;
-}
-
-.appointBtn {
-  width: 79px;
-  height: 37px;
-  border-radius: 18.5px;
-  background: #fff;
-  float: right;
-  font-family: "PingFang SC";
-  font-weight: normal;
-  font-size: 18px;
-  margin-right: 2%;
-}
-
-.greenBtn {
-  border: 1px solid #37cb00;
-  color: #37cb00;
-}
-
-.redBtn {
-  border: 1px solid #F8847F;
-  color: #F8847F;
-}
-
-.yellowBtn {
-  border: 1px solid #FFB43C;
-  color: #fff;
-  background: #FFB43C;
-}
-
-.disableBtn {
-  border: 1px solid #C9C9C9;
-  color: #C9C9C9;
-}
-
-/deep/ .mu-tabs-center {
-  display: flex;
-  overflow-x: auto;
-  overflow-y: hidden;
-  white-space: nowrap;
-}
-
-/deep/ .mu-tabs-center::-webkit-scrollbar {
-  display: none;
-}
-
-/deep/ .mu-modal-inner {
-  width: 90%;
-  float: left;
-}
-
-/deep/ .mu-tab-link-highlight {
-  display: none !important;
-}
-
-li .title span.lessons {
-  width: auto;
-  padding: 1px 11px;
-  border-radius: 250px;
-  float: left;
-  text-align: center;
-  color: #000;
-  font-size: 14px;
-}
-
-/deep/ .mu-avatar {
-  position: fixed;
-  bottom: 9%;
-  float: left;
-  left: 1%;
-}
-
-.context {
-  position: absolute;
-  left: 0;
-  right: 0;
-  top: 30%;
-  bottom: 0;
-  overflow-y: scroll;
-  padding-bottom: 50px;
-}
-
-.as {
-  position: fixed;
-  width: 100%;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  z-index: 222;
-  background: #F2F2F2;
-}
-
-/deep/ .mu-raised-button {
-  box-shadow: none;
-}
-
-.tabs {
-  width: 100%;
-  justify-content: space-between;
-  white-space: nowrap;
-  overflow-y: hidden;
-  overflow-x: scroll;
-  display: flex;
-  border-bottom: 1px solid #ccc;
-}
-
-.tab {
-  font-size: 14px;
-  min-width: 72px;
-  max-width: 264px;
-  background: none;
-  -webkit-appearance: none;
-  -moz-appearance: none;
-  appearance: none;
-  text-decoration: none;
-  border: none;
-  outline: none;
-  color: inherit;
-  position: relative;
-  line-height: normal;
-  -webkit-transition: all .45s cubic-bezier(.445, .05, .55, .95);
-  transition: all .45s cubic-bezier(.445, .05, .55, .95);
-  width: 85px;
-  float: left;
-  height: 51px;
-  margin-right: 6px;
-  cursor: pointer;
-  line-height: 20px;
-  padding-top: 4px;
-  text-align: center;
-  border-top-left-radius: 5px;
-  border-top-right-radius: 5px;
-  border: 1px solid #ccc;
-  border-bottom: 0;
-}
-
-.tab.activeTab {
-  color: #fff;
-  background-color: #2196f3;
-  color: hsla(0, 0%, 100%, .7);
-}
-
-/*响应式调整*/
-@media only screen and (max-width: 320px) {
+  .pages {
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+  }
+
+  /*mu-header*/
+  .mu-primary-color {
+    line-height: 60px;
+    height: 60px;
+    background: url("../static/images/comm/headerBg.png") top center no-repeat;
+    background-size: 100%;
+  }
+
+  /deep/ .mu-appbar-left {
+    padding-top: 15px;
+  }
+
+  /deep/ .material-icons {
+    color: #fff;
+  }
+
+  /deep/ .mu-appbar-title {
+    text-align: center;
+  }
+
+  /deep/ .mu-tabs {
+    /*display: flex;*/
+    /*width: 414px;*/
+    overflow-x: scroll;
+    overflow-y: hidden;
+    /*display:inline;*/
+    /*float: left;*/
+  }
+
+  /deep/ .mu-tab {
+    width: 85px;
+    min-width: 85px;
+    float: left;
+    height: 51px;
+    margin-right: 6px;
+  }
+
+  /*/deep/ .mu-tab:nth-child(5) {*/
+  /*    margin-right: 0px;*/
+  /*}*/
+
+  /deep/ .mu-tab-wrapper {
+    height: 51px;
+    background: #f4f4f4;
+    color: #363636;
+    box-shadow: 1px 0px 6px rgba(0, 0, 0, 0.16);
+    border-radius: 8px 8px 0px 0px;
+    font-size: 14px;
+  }
+
+  /deep/ .mu-tab-active .mu-tab-wrapper {
+    height: 56px;
+    border-radius: 8px 8px 0px 0px;
+    background: #ffffff;
+    box-shadow: 1px 0px 6px rgba(0, 0, 0, 0.16);
+    color: #000;
+  }
+
+  /deep/ .mu-tab-wrapper em {
+    font-size: 12px;
+  }
+
+  .sum {
+    width: 100%;
+    height: 55px;
+    line-height: 55px;
+    background: #fff;
+    font-family: "PingFang SC";
+    font-weight: 300;
+    font-size: 16px;
+    text-align: center;
+    color: #909090;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+  }
+
+  .green {
+    color: #37CB00;
+  }
+
+  .red {
+    color: #F8847F;
+  }
+
+  .list {
+    width: 100%;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    margin-top: 8px;
+    padding-bottom: 30px;
+  }
+
+  .list li {
+    width: 100%;
+    height: 70px;
+    margin-bottom: 8px;
+    padding-top: 16px;
+    padding-bottom: 16px;
+  }
+
   .list .dotContainer {
-    width: 20px;
-    padding-left: 5px;
+    width: 50px;
+    float: left;
+    height: 60px;
+    padding-left: 22px;
+    padding-top: 10px;
+  }
+
+  .dotContainer .dot {
+    width: 12px;
+    height: 12px;
+    background: #37cb00;
+    border-radius: 250px;
+    float: left;
+  }
+
+  .cubes {
+    width: 12px;
+    height: 12px;
+    background: #f8847f;
+    float: left;
+  }
+
+  .tri {
+    width: 12px;
+    height: 12px;
+    background: url("../static/images/appoint/tri.png") top center no-repeat;
+    background-size: 100% 100%;
+    float: left;
+  }
+
+  .x {
+    width: 12px;
+    height: 12px;
+    background: url("../static/images/appoint/x.png") top center no-repeat;
+    background-size: 100% 100%;
+    float: left;
+  }
+
+
+  .yellowLi {
+    background: #FFFBED;
+  }
+
+  .redLi {
+    background: #FFF7F7;
+  }
+
+  .greenLi {
+    background: #F7FFF4;
+  }
+
+  .whiteLi {
+    background: #fff;
   }
 
   .list li .title {
-    width: 30%;
+    /*width: 90px;*/
+    width: 27%;
+    height: 60px;
+    float: left;
   }
 
-  .list li .current {
-    width: 29%;
+  li .title h5 {
+    width: 100%;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    font-weight: normal;
+    font-size: 14px;
+    text-align: left;
+    color: #3b3b3b;
   }
 
-  .context {
-    top: 227px;
+  li .title span {
+    width: 100%;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    font-weight: normal;
+    font-size: 12px;
+    text-align: left;
+    color: #909090;
   }
-}
 
-@media (min-width: 321px) and (max-width: 344px) {
   .list li .current {
-    width: 28%;
+    width: 120px;
+    height: 60px;
+    float: left;
   }
 
-  .context {
-    top: 227px;
+  li .current h5 {
+    width: 100%;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    font-family: "PingFang SC";
+    font-weight: normal;
+    font-size: 14px;
+    text-align: left;
+    color: #3b3b3b;
   }
-}
 
-@media (min-width: 345px) and (max-width: 360px) {
-  .list li .current {
-    width: 30%;
+  .current h5 em {
+    font-family: "PingFang SC";
+    font-weight: normal;
+    font-size: 14px;
+    text-align: left;
   }
 
-  .context {
-    top: 230px;
+  .current span {
+    font-family: "PingFang SC";
+    font-weight: normal;
+    font-size: 12px;
+    text-align: left;
+    color: #909090;
   }
-}
 
-@media (min-width: 361px) and (max-width: 375px) {
-  .list li .current {
-    width: 30%;
+  .appointBtn {
+    width: 79px;
+    height: 37px;
+    border-radius: 18.5px;
+    background: #fff;
+    float: right;
+    font-family: "PingFang SC";
+    font-weight: normal;
+    font-size: 18px;
+    margin-right: 2%;
   }
 
-  .context {
-    top: 230px;
+  .greenBtn {
+    border: 1px solid #37cb00;
+    color: #37cb00;
   }
-}
 
-@media (min-width: 376px) and (max-width: 396px) {
-  .list li .current {
-    width: 30%;
+  .redBtn {
+    border: 1px solid #F8847F;
+    color: #F8847F;
   }
 
-  .context {
-    top: 230px;
+  .yellowBtn {
+    border: 1px solid #FFB43C;
+    color: #fff;
+    background: #FFB43C;
   }
-}
 
-@media (min-width: 397px) and (max-width: 414px) {
-  .list li .current {
-    width: 30%;
+  .disableBtn {
+    border: 1px solid #C9C9C9;
+    color: #C9C9C9;
   }
 
-  .context {
-    top: 230px;
+  /deep/ .mu-tabs-center {
+    display: flex;
+    overflow-x: auto;
+    overflow-y: hidden;
+    white-space: nowrap;
   }
-}
 
-@media (min-width: 415px) and (max-width: 480px) {
-  .list li .current {
-    width: 30%;
+  /deep/ .mu-tabs-center::-webkit-scrollbar {
+    display: none;
   }
 
-  .context {
-    top: 230px;
+  /deep/ .mu-modal-inner {
+    width: 90%;
+    float: left;
+  }
+
+  /deep/ .mu-tab-link-highlight {
+    display: none !important;
+  }
+
+  li .title span.lessons {
+    width: auto;
+    padding: 1px 11px;
+    border-radius: 250px;
+    float: left;
+    text-align: center;
+    color: #000;
+    font-size: 14px;
+  }
+
+  /deep/ .mu-avatar {
+    position: fixed;
+    bottom: 9%;
+    float: left;
+    left: 1%;
   }
-}
 
-@media (min-width: 481px) and (max-width: 640px) {
   .context {
-    top: 230px;
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 30%;
+    bottom: 0;
+    overflow-y: scroll;
+    padding-bottom: 50px;
+  }
+
+  .as {
+    position: fixed;
+    width: 100%;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    z-index: 222;
+    background: #F2F2F2;
+  }
+
+  /deep/ .mu-raised-button {
+    box-shadow: none;
   }
-}
 
+  .tabs {
+    width: 100%;
+    justify-content: space-between;
+    white-space: nowrap;
+    overflow-y: hidden;
+    overflow-x: scroll;
+    display: flex;
+    border-bottom: 1px solid #ccc;
+  }
 
-</style>
+  .tab {
+    font-size: 14px;
+    min-width: 72px;
+    max-width: 264px;
+    background: none;
+    -webkit-appearance: none;
+    -moz-appearance: none;
+    appearance: none;
+    text-decoration: none;
+    border: none;
+    outline: none;
+    color: inherit;
+    position: relative;
+    line-height: normal;
+    -webkit-transition: all .45s cubic-bezier(.445, .05, .55, .95);
+    transition: all .45s cubic-bezier(.445, .05, .55, .95);
+    width: 85px;
+    float: left;
+    height: 51px;
+    margin-right: 6px;
+    cursor: pointer;
+    line-height: 20px;
+    padding-top: 4px;
+    text-align: center;
+    border-top-left-radius: 5px;
+    border-top-right-radius: 5px;
+    border: 1px solid #ccc;
+    border-bottom: 0;
+  }
+
+  .tab.activeTab {
+    color: #fff;
+    background-color: #2196f3;
+    color: hsla(0, 0%, 100%, .7);
+  }
+
+  /*响应式调整*/
+  @media only screen and (max-width: 320px) {
+    .list .dotContainer {
+      width: 20px;
+      padding-left: 5px;
+    }
+
+    .list li .title {
+      width: 30%;
+    }
+
+    .list li .current {
+      width: 29%;
+    }
+
+    .context {
+      top: 227px;
+    }
+  }
+
+  @media (min-width: 321px) and (max-width: 344px) {
+    .list li .current {
+      width: 28%;
+    }
+
+    .context {
+      top: 227px;
+    }
+  }
+
+  @media (min-width: 345px) and (max-width: 360px) {
+    .list li .current {
+      width: 30%;
+    }
+
+    .context {
+      top: 230px;
+    }
+  }
+
+  @media (min-width: 361px) and (max-width: 375px) {
+    .list li .current {
+      width: 30%;
+    }
+
+    .context {
+      top: 230px;
+    }
+  }
+
+  @media (min-width: 376px) and (max-width: 396px) {
+    .list li .current {
+      width: 30%;
+    }
+
+    .context {
+      top: 230px;
+    }
+  }
+
+  @media (min-width: 397px) and (max-width: 414px) {
+    .list li .current {
+      width: 30%;
+    }
+
+    .context {
+      top: 230px;
+    }
+  }
+
+  @media (min-width: 415px) and (max-width: 480px) {
+    .list li .current {
+      width: 30%;
+    }
+
+    .context {
+      top: 230px;
+    }
+  }
+
+  @media (min-width: 481px) and (max-width: 640px) {
+    .context {
+      top: 230px;
+    }
+  }
+</style>

+ 571 - 577
app/src/page/login.vue

@@ -2,31 +2,29 @@
   <div id="skin-blur-violate">
     <section id="login">
       <header>
-        <img src="../static/images/login/logo.png" height="109" width="109" id="logo"/>
-        <img src="../static/images/login/title.png" height="100%" width="274px"/>
+        <img src="../static/images/login/logo.png" height="109" width="109" id="logo" />
+        <img src="../static/images/login/title.png" height="100%" width="274px" />
       </header>
       <div class="clearfix"></div>
       <!-- Login -->
       <form class="box tile animated active" id="box-login">
         <h2 class="m-t-0 m-b-15"></h2>
         <div class="rowHeight">
-          <input type="text" class="login-control login_account" placeholder="输入手机号"
-                 v-model="login.phone">
+          <input type="text" class="login-control login_account" placeholder="输入手机号" v-model="login.phone">
         </div>
         <div class="rowHeight">
-          <input type="number" class="login-control login_valid" placeholder="输入右侧图形码"
-                 v-model="login.uservalid">
+          <input type="number" class="login-control login_valid" placeholder="输入右侧图形码" v-model="login.uservalid">
           <img id="imgValidcode" :src="valImgSrc" :title="InvisibilityGiveitatry" @click="getValImgSrc">
         </div>
         <div class="rowHeight">
           <input type="number" class="login-control login_pwd" placeholder="输入验证码" v-model="login.userpwd"
-                 @keyup.enter="pwdLoginBtn">
+            @keyup.enter="pwdLoginBtn">
           <mu-button id="getValidSms" :disabled="getValidSmsState" color="success" @click="getValidSmsBtn">
             {{ btnText }}
           </mu-button>
         </div>
         <div class="btn_center">
-          <span class="btn btn-md login_btn" @click="pwdLoginBtn">登    录</span>
+          <span class="btn btn-md login_btn" @click="pwdLoginBtn">登 录</span>
         </div>
       </form>
     </section>
@@ -38,629 +36,625 @@
 </template>
 
 <script>
-import {
-  SignIn,
-  GenVerifyPic,
-  GetPhoneVFCode,
-  PhoneSignIn,
-  WXBind,
-  testSelect
-} from '../api/getApiRes.js'
-
-let qs = require('qs');
-
-export default {
-  data() {
-    let samepass = (rule, value, callback) => {
-      if (value !== this.form.newpwd) {
-        callback(new Error('两次输入密码不一致!'));
-      } else {
-        callback();
-      }
-    };
-    let pwdPass = (rule, value, callback) => {
-      let re = /^[0-9a-zA-Z_]{1,}$/;
-      if (value.search(re) == -1) {
-        callback(new Error('错了哦,密码只能由字母、数字及下划线组成'));
-      } else {
-        callback()
-      }
-    };
-    let phonetest = (rule, value, callback) => {
-      let re = /^1[3|4|5|7|8|9][0-9]\d{8}$/;
-      if (value.search(re) == -1) {
-        callback(new Error('错了哦,手机号码格式不正确'));
-      } else {
-        callback()
-      }
-    };
-    return {
-      Password: "Password",
-      VerificationCode: "Verification Code",
-      InvisibilityGiveitatry: "无效?再点一下试试吧!",
-      valImgSrc: '',//
-      picId: '',//
-      getValidSmsState: false,//
-      overtime: '',
-      btnText: '获取验证码',
-      normal: normal,
-      login: {
-        phone: '',
-        userpwd: '',
-        uservalid: '',
-      },
-      rules: {
-        username: [
-          {required: true, message: '请输入用户名', trigger: 'blur'},
-          {min: 6, max: 32, message: '长度在 6 到 32 个字符', trigger: 'blur'},
-        ],
-        phone: [
-          {required: true, message: '请输入手机号', trigger: 'blur'},
-          {min: 11, max: 12, message: '手机号长度是11位', trigger: 'blur'},
-          {validator: phonetest, trigger: 'blur'}
-        ],
-        re_phonevalid: [
-          {required: true, message: '请输入验证码', trigger: 'blur'},
-          {min: 4, max: 4, message: '长度在 4 个字符', trigger: 'blur'},
-        ],
-        newpwd: [
-          {required: true, message: '请输入新密码', trigger: 'blur'},
-          {min: 6, max: 32, message: '长度在 6 到 32 个字符', trigger: 'blur'},
-          {validator: pwdPass, trigger: 'blur'}
-        ],
-        again: [
-          {required: true, message: '请输入确认密码', trigger: 'blur'},
-          {min: 6, max: 32, message: '长度在 6 到 32 个字符', trigger: 'blur'},
-          {validator: pwdPass, trigger: 'blur'},
-          {validator: samepass, trigger: 'blur'},
-        ],
-      }
-    }
-  },
-  mounted() {
-    // 入口状态有 3 种
-    // 1.全新登入,拿weixinId 拿验证码 ,绑定 ,登陆
-    // 2.token 未失效用户,直接进入内页,继续凭token使用
-    // 3.token 已失效用户,删掉本地token ,重新按照1的模式登陆
-    if (localStorage.token) {
-      // 凭借旧token直接登陆
-      this.$router.push({path: '/'});
-    } else {
-      // 获取图形验证码
-      this.getValImgSrc();
-      this.overtime = new Date();
-      let from = this.$route.query.from;//获取来源
-      let userAgent = navigator.userAgent;
-      let host = window.location.host;
-      console.log(host);
-      if (from == 'app' || host == '192.168.0.162:8080') {//判断是否微信浏览器
-        // 浏览器测试
-        console.log('from app & brower');
-      } else {
-        console.log('form wx');
-        this.checkcode();
-      }
-    }
-  },
-  methods: {
-    // 获取CODE
-    checkcode() {
-      // 0213tIFa1fBjAz0OVDIa1LfXwc03tIFK
-      if (this.getUrlKey('state') == 123) {
-        // 取到值了
-        localStorage.code = this.getUrlKey('code');
-        // console.log('code:' + localStorage.code);
-      } else {
-        // 第一次加载
-        this.GetOpenId();
-      }
-    },
-    // 获取公众号ID
-    GetOpenId() {
-      let origin = location.href;
-      // let origin = 'http://wx.xfeilong.com';
-      let urlNow = encodeURIComponent(origin);
-      let scope = 'snsapi_userinfo';    //snsapi_userinfo   //静默授权 用户无感知
-      let appid = 'wx36cb8b6661d71811';//正式
-      let state = '123';
-      let url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appid + '&redirect_uri=' + urlNow + '&response_type=code&scope=' + scope + '&state=' + state + '#wechat_redirect';
-      self.location = url;
-    },
-    getUrlKey(name) {
-      return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null;
-    },
-    // 获取验证码
-    getValidSmsBtn() {
-      let that = this;
-      let phone = that.login.phone;
-      let uservalid = that.login.uservalid;
-      if (!phone) {
-        that.Toast('手机号不能为空');
-        return false
-      }
-      if (phone.length != 11) {
-        that.Toast('手机号只能是11位');
-        return false
-      }
-      if (!globalCheckPhone(phone)) {
-        that.Toast('手机号格式不正确');
-        return false
-      }
-      if (!uservalid) {
-        that.Toast('图形验证码不能为空');
-        return false
-      }
-      if (uservalid.length != 4) {
-        that.Toast('图形验证码只能是4位');
-        return false
-      }
-      let param = {
-        token: localStorage.token,
-        phone: phone,
-        codeType: 1,
-        picId: this.valImgId,
-        picCode: uservalid,
+  import {
+    SignIn,
+    GenVerifyPic,
+    GetPhoneVFCode,
+    PhoneSignIn,
+    WXBind,
+    testSelect
+  } from '../api/getApiRes.js'
+
+  let qs = require('qs');
+
+  export default {
+    data() {
+      let samepass = (rule, value, callback) => {
+        if (value !== this.form.newpwd) {
+          callback(new Error('两次输入密码不一致!'));
+        } else {
+          callback();
+        }
       };
-      let postdata = qs.stringify(param);
-      GetPhoneVFCode(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          that.Toast('短信验证码已发送', 'success');
-          that.calcTime();
+      let pwdPass = (rule, value, callback) => {
+        let re = /^[0-9a-zA-Z_]{1,}$/;
+        if (value.search(re) == -1) {
+          callback(new Error('错了哦,密码只能由字母、数字及下划线组成'));
         } else {
-          that.Toast(json.Memo);
+          callback()
         }
-      })
-    },
-    calcTime() {
-      // 短信倒数计时
-      let countdown = 60;
-      let that = this;
-      //设置button效果,开始计时
-      that.getValidSmsState = true;
-      that.btnText = countdown + "S"
-      //启动计时器,1秒执行一次
-      let timer = setInterval(function () {
-        if (countdown == 0) {
-          clearInterval(timer);//停止计时器
-          that.getValidSmsState = false;
-          that.btnText = "重新发送"
+      };
+      let phonetest = (rule, value, callback) => {
+        let re = /^1[3|4|5|7|8|9][0-9]\d{8}$/;
+        if (value.search(re) == -1) {
+          callback(new Error('错了哦,手机号码格式不正确'));
         } else {
-          countdown--;
-          that.btnText = countdown + "S"
+          callback()
         }
-      }, 1000);
-    },
-    clearLogin() {
-      this.login.username = '';
-      this.login.userpwd = '';
-      this.login.uservalid = '';
-      this.getValImgSrc();
-    },
-    // 点击验证码切换
-    getValImgSrc() {
-      let that = this;
-      let param = {
-        token: localStorage.token,
-        width: 100,
-        height: 30,
-        noiseCount: 1,
-        length: 4,
-        source: 123456789,
       };
-      let postdata = qs.stringify(param);
-      GenVerifyPic(postdata).then(res => {
-        let json = res;
-        that.valImgSrc = json.Pic;
-        that.valImgId = json.Id;
-      })
-    },
-    // pwd登录
-    pwdLoginBtn() {
-      let that = this;
-      let phone = this.login.phone;
-      let userpwd = this.login.userpwd;
-      // 重置验证码超时
-      that.overtime = new Date();
-      if (!that.globalValid(phone, 10, 12, '手机号', that)) return;
-      if (!that.globalValid(userpwd, 5, 7, '短信验证码', that)) return;
-      this.loginInfo();
+      return {
+        Password: "Password",
+        VerificationCode: "Verification Code",
+        InvisibilityGiveitatry: "无效?再点一下试试吧!",
+        valImgSrc: '',//
+        picId: '',//
+        getValidSmsState: false,//
+        overtime: '',
+        btnText: '获取验证码',
+        normal: normal,
+        login: {
+          phone: '',
+          userpwd: '',
+          uservalid: '',
+        },
+        rules: {
+          username: [
+            { required: true, message: '请输入用户名', trigger: 'blur' },
+            { min: 6, max: 32, message: '长度在 6 到 32 个字符', trigger: 'blur' },
+          ],
+          phone: [
+            { required: true, message: '请输入手机号', trigger: 'blur' },
+            { min: 11, max: 12, message: '手机号长度是11位', trigger: 'blur' },
+            { validator: phonetest, trigger: 'blur' }
+          ],
+          re_phonevalid: [
+            { required: true, message: '请输入验证码', trigger: 'blur' },
+            { min: 4, max: 4, message: '长度在 4 个字符', trigger: 'blur' },
+          ],
+          newpwd: [
+            { required: true, message: '请输入新密码', trigger: 'blur' },
+            { min: 6, max: 32, message: '长度在 6 到 32 个字符', trigger: 'blur' },
+            { validator: pwdPass, trigger: 'blur' }
+          ],
+          again: [
+            { required: true, message: '请输入确认密码', trigger: 'blur' },
+            { min: 6, max: 32, message: '长度在 6 到 32 个字符', trigger: 'blur' },
+            { validator: pwdPass, trigger: 'blur' },
+            { validator: samepass, trigger: 'blur' },
+          ],
+        }
+      }
     },
-    // 校验内容长度
-    globalValid(data, mins, maxs, text, that) {
-      let thisVal = data;
-      let thisLeng = thisVal.length;
-      let min = parseInt(mins);
-      let max = parseInt(maxs);
-      let dispalyMin = min + 1;
-      if (thisVal == '') {
-        this.Toast(text + ' ' + '不能为空');
-        return false
-      } else if (thisLeng <= min) {
-        this.Toast(text + '最少' + dispalyMin + '字符');
-        return false
-      } else if (thisLeng > max) {
-        this.Toast(text + '超过限制长度');
-        return false
+    mounted() {
+      // 入口状态有 3 种
+      // 1.全新登入,拿weixinId 拿验证码 ,绑定 ,登陆
+      // 2.token 未失效用户,直接进入内页,继续凭token使用
+      // 3.token 已失效用户,删掉本地token ,重新按照1的模式登陆
+      if (localStorage.token) {
+        // 凭借旧token直接登陆
+        this.$router.push({ path: '/' });
       } else {
-        return true
+        // 获取图形验证码
+        this.getValImgSrc();
+        this.overtime = new Date();
+        let from = this.$route.query.from;//获取来源
+        let userAgent = navigator.userAgent;
+        let host = window.location.host;
+        console.log(host);
+        if (from == 'app' || host == '192.168.0.162:8184') {//判断是否微信浏览器
+          // 浏览器测试
+          console.log('from app & brower');
+        } else {
+          console.log('form wx');
+          this.checkcode();
+        }
       }
     },
-    // pwd登陆
-    loginInfo: function () {
-      const that = this;
-      let current = new Date();
-      let betweenTime = current - that.overtime;
-      let s = 120;
-      if (betweenTime > s * 1000) {
-        that.changeValImg();
-        that.$toast.message('验证码已超时,请重新输入');
-        return false
-      }
-      let param = {
-        phone: that.login.phone,
-        code: that.login.userpwd,
-        channel: 3
-      };
-      let postdata = qs.stringify(param);
-      PhoneSignIn(postdata).then(res => {
-        if (res.Code == 0) {
-          that.res = res.Rs;
-          // 使用token做免校验登陆
-          localStorage.token = res.Rs.token;
-          // 如果是wx登陆就执行绑定操作
-          let from = this.$route.query.from;//获取来源
-          if (from != 'app') {
-            that.bindWx();
-          }
-
-          // 607862e8828013be90c2ccb78468b43a
-          // test
-          that.$router.push({path: '/'});
+    methods: {
+      // 获取CODE
+      checkcode() {
+        // 0213tIFa1fBjAz0OVDIa1LfXwc03tIFK
+        if (this.getUrlKey('state') == 123) {
+          // 取到值了
+          localStorage.code = this.getUrlKey('code');
+          // console.log('code:' + localStorage.code);
         } else {
-          this.getValImgSrc();
-          if (res.Code == 10005) {
-            that.$refs.userpwd.value = '';
-            that.Toast('密码错误,请重新输入');
+          // 第一次加载
+          this.GetOpenId();
+        }
+      },
+      // 获取公众号ID
+      GetOpenId() {
+        let origin = location.href;
+        // let origin = 'http://wx.xfeilong.com';
+        let urlNow = encodeURIComponent(origin);
+        let scope = 'snsapi_userinfo';    //snsapi_userinfo   //静默授权 用户无感知
+        let appid = 'wx36cb8b6661d71811';//正式
+        let state = '123';
+        let url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appid + '&redirect_uri=' + urlNow + '&response_type=code&scope=' + scope + '&state=' + state + '#wechat_redirect';
+        self.location = url;
+      },
+      getUrlKey(name) {
+        return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null;
+      },
+      // 获取验证码
+      getValidSmsBtn() {
+        let that = this;
+        let phone = that.login.phone;
+        let uservalid = that.login.uservalid;
+        if (!phone) {
+          that.Toast('手机号不能为空');
+          return false
+        }
+        if (phone.length != 11) {
+          that.Toast('手机号只能是11位');
+          return false
+        }
+        if (!globalCheckPhone(phone)) {
+          that.Toast('手机号格式不正确');
+          return false
+        }
+        if (!uservalid) {
+          that.Toast('图形验证码不能为空');
+          return false
+        }
+        if (uservalid.length != 4) {
+          that.Toast('图形验证码只能是4位');
+          return false
+        }
+        let param = {
+          token: localStorage.token,
+          phone: phone,
+          codeType: 1,
+          picId: this.valImgId,
+          picCode: uservalid,
+        };
+        let postdata = qs.stringify(param);
+        GetPhoneVFCode(postdata).then(res => {
+          let json = res;
+          if (json.Code == 0) {
+            that.Toast('短信验证码已发送', 'success');
+            that.calcTime();
           } else {
-            that.Toast(res.Memo + ',错误代码:' + res.Code);
-            that.form.valid = '';
+            that.Toast(json.Memo);
           }
-        }
-      })
-    },
-    bindWx() {
-      let that = this;
-      let param = {
-        token: localStorage.token,
-        code: localStorage.code,
-      };
-      let postdata = qs.stringify(param);
-      WXBind(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          // that.$router.push({path: '/'});
+        })
+      },
+      calcTime() {
+        // 短信倒数计时
+        let countdown = 60;
+        let that = this;
+        //设置button效果,开始计时
+        that.getValidSmsState = true;
+        that.btnText = countdown + "S"
+        //启动计时器,1秒执行一次
+        let timer = setInterval(function () {
+          if (countdown == 0) {
+            clearInterval(timer);//停止计时器
+            that.getValidSmsState = false;
+            that.btnText = "重新发送"
+          } else {
+            countdown--;
+            that.btnText = countdown + "S"
+          }
+        }, 1000);
+      },
+      clearLogin() {
+        this.login.username = '';
+        this.login.userpwd = '';
+        this.login.uservalid = '';
+        this.getValImgSrc();
+      },
+      // 点击验证码切换
+      getValImgSrc() {
+        let that = this;
+        let param = {
+          token: localStorage.token,
+          width: 100,
+          height: 30,
+          noiseCount: 1,
+          length: 4,
+          source: 123456789,
+        };
+        let postdata = qs.stringify(param);
+        GenVerifyPic(postdata).then(res => {
+          let json = res;
+          that.valImgSrc = json.Pic;
+          that.valImgId = json.Id;
+        })
+      },
+      // pwd登录
+      pwdLoginBtn() {
+        let that = this;
+        let phone = this.login.phone;
+        let userpwd = this.login.userpwd;
+        // 重置验证码超时
+        that.overtime = new Date();
+        if (!that.globalValid(phone, 10, 12, '手机号', that)) return;
+        if (!that.globalValid(userpwd, 5, 7, '短信验证码', that)) return;
+        this.loginInfo();
+      },
+      // 校验内容长度
+      globalValid(data, mins, maxs, text, that) {
+        let thisVal = data;
+        let thisLeng = thisVal.length;
+        let min = parseInt(mins);
+        let max = parseInt(maxs);
+        let dispalyMin = min + 1;
+        if (thisVal == '') {
+          this.Toast(text + ' ' + '不能为空');
+          return false
+        } else if (thisLeng <= min) {
+          this.Toast(text + '最少' + dispalyMin + '字符');
+          return false
+        } else if (thisLeng > max) {
+          this.Toast(text + '超过限制长度');
+          return false
         } else {
-          // that.Toast(res.Memo + ',错误代码:' + res.Code);
+          return true
         }
-      })
-    },
-    getUserInfo(token) {
-      let that = this;
-      let param = {
-        token: token,
-      };
-      let postdata = qs.stringify(param);
-      testSelect(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          var userLevel = json.Rs.Rolesname;
-          localStorage.userLevel = userLevel;
-          localStorage.comId = json.Rs.Comid;
-          localStorage.Insname = json.Rs.Insname;
-          that.$router.push({path: '/'});
-        } else {
-          that.$toast.message(json.Memo);
+      },
+      // pwd登陆
+      loginInfo: function () {
+        const that = this;
+        let current = new Date();
+        let betweenTime = current - that.overtime;
+        let s = 120;
+        if (betweenTime > s * 1000) {
+          that.changeValImg();
+          that.$toast.message('验证码已超时,请重新输入');
+          return false
         }
-      })
-    }
-  },
-  components: {}
-}
+        let param = {
+          phone: that.login.phone,
+          code: that.login.userpwd,
+          channel: 3
+        };
+        let postdata = qs.stringify(param);
+        PhoneSignIn(postdata).then(res => {
+          if (res.Code == 0) {
+            that.res = res.Rs;
+            // 使用token做免校验登陆
+            localStorage.token = res.Rs.token;
+            // 如果是wx登陆就执行绑定操作
+            let from = this.$route.query.from;//获取来源
+            if (from != 'app') {
+              that.bindWx();
+            }
+
+            // 607862e8828013be90c2ccb78468b43a
+            // test
+            that.$router.push({ path: '/' });
+          } else {
+            this.getValImgSrc();
+            if (res.Code == 10005) {
+              that.$refs.userpwd.value = '';
+              that.Toast('密码错误,请重新输入');
+            } else {
+              that.Toast(res.Memo + ',错误代码:' + res.Code);
+              that.form.valid = '';
+            }
+          }
+        })
+      },
+      bindWx() {
+        let that = this;
+        let param = {
+          token: localStorage.token,
+          code: localStorage.code,
+        };
+        let postdata = qs.stringify(param);
+        WXBind(postdata).then(res => {
+          let json = res;
+          if (json.Code == 0) {
+            // that.$router.push({path: '/'});
+          } else {
+            // that.Toast(res.Memo + ',错误代码:' + res.Code);
+          }
+        })
+      },
+      getUserInfo(token) {
+        let that = this;
+        let param = {
+          token: token,
+        };
+        let postdata = qs.stringify(param);
+        testSelect(postdata).then(res => {
+          let json = res;
+          if (json.Code == 0) {
+            var userLevel = json.Rs.Rolesname;
+            localStorage.userLevel = userLevel;
+            localStorage.comId = json.Rs.Comid;
+            localStorage.Insname = json.Rs.Insname;
+            that.$router.push({ path: '/' });
+          } else {
+            that.$toast.message(json.Memo);
+          }
+        })
+      }
+    },
+    components: {}
+  }
 </script>
 
 <style scoped>
-#skin-blur-violate {
-  position: relative;
-  top: 0;
-  left: 0;
-  right: 0;
-  bottom: 0;
-  width: 100%;
-  height: 100%;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  background: #3B3B3B;
-  background: url("../static/images/login/bg.png") top center no-repeat;
-  background-size: 100% 100%;
-}
-
-#login {
-  width: 90%;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-}
-
-#login .box {
-  margin: 0 auto;
-  position: inherit;
-  margin-top: 20px;
-  border-radius: 9px;
-  padding: 20px 20px;
-}
-
-h1 {
-  color: #FFA200;
-  font-size: 30px;
-}
-
-header p {
-  font-size: 14px;
-  color: #7B7B7B;
-}
-
-#login header {
-  text-align: center;
-  margin-top: 15%;
-}
-
-#box-login h2 {
-  width: 100%;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  margin-bottom: 20px;
-  text-align: center;
-  font-size: 24px;
-  color: #fff;
-}
-
-#tableBordered {
-  margin: 0;
-  padding: 0;
-}
-
-#tableBordered h5 {
-  margin: 0;
-  text-align: center;
-  padding: 0;
-}
-
-#login .box {
-  margin: 0 auto;
-  position: inherit;
-  margin-top: 20px;
-  border-radius: 9px !important;
-}
-
-#login header {
-  text-align: center;
-  margin-top: 15%;
-}
-
-#tableBordered {
-  margin: 0;
-  padding: 0;
-}
-
-#tableBordered h5 {
-  margin: 0;
-  text-align: center;
-  padding: 0;
-}
-
-#imgValidcode {
-  position: relative;
-  float: right;
-  /*bottom: 54px;*/
-  /*width: 100px;*/
-  width: 30%;
-  height: 50px;
-  background: #eee;
-}
-
-.login_btn {
-  width: 100%;
-  height: 50px;
-  line-height: 50px;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  margin-top: 42px;
-  background: #E75296;
-  color: #fff;
-  font-size: 14px;
-  text-align: center;
-  border: none;
-  padding: 0;
-  font-size: 24px;
-  margin-bottom: 3%;
-}
-
-.clear_btn {
-  width: 100%;
-  height: 40px;
-  line-height: 40px;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  background: rgba(255, 255, 255, 0.32);
-  color: #FFCC00;
-  font-size: 14px;
-  text-align: center;
-  border: none;
-  padding: 0;
-}
-
-header p {
-  margin-top: 10px;
-}
-
-#login .login-control {
-  width: 100%;
-  height: 50px;
-  line-height: 50px;
-  background: rgba(255, 255, 255, 0.4);
-  margin-bottom: 3px;
-  text-indent: 10px;
-  border: none;
-
-}
-
-#login .login-control::placeholder {
-  color: #000000;
-  font-size: 16px;
-}
-
-#logo {
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  margin-top: 10%;
-  margin-bottom: 10px;
-}
-
-.rowHeight {
-  width: 100%;
-  overflow: hidden;
-  display: block;
-  margin: 0 auto;
-  height: 50px;
-  margin-bottom: 3px;
-}
-
-#getValidSms {
-  /*width: 100px;*/
-  width: 30%;
-  height: 50px;
-  background: #fff;
-  border: 1px solid #fff;
-  opacity: 0.6;
-  position: relative;
-  /*bottom: 55px;*/
-  float: right;
-  text-align: center;
-  color: #E75296;
-  line-height: 20px;
-  font-size: 12px;
-  min-width: 30px;
-}
-
-#login .login_valid {
-  /*width: 173px;*/
-  width:65%;
-  float: left;
-}
-
-#login .login_pwd {
-  width: 173px;
-  float: left;
-}
-
-@media only screen and (max-width: 640px) {
-
-}
-
-@media only screen and (max-width: 480px) {
-  #login .login_valid {
-    /*width: 195px;*/
-    width:65%;
+  #skin-blur-violate {
+    position: relative;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    width: 100%;
+    height: 100%;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    background: #3B3B3B;
+    background: url("../static/images/login/bg.png") top center no-repeat;
+    background-size: 100% 100%;
   }
 
-  #login .login_pwd {
-    /*width: 195px;*/
-    width:65%;
+  #login {
+    width: 90%;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
   }
-}
 
-@media only screen and (max-width: 414px) {
-  #login .login_valid {
-    width:65%;
-    /*width: 223px;*/
+  #login .box {
+    margin: 0 auto;
+    position: inherit;
+    margin-top: 20px;
+    border-radius: 9px;
+    padding: 20px 20px;
   }
 
-  #login .login_pwd {
-    /*width: 223px;*/
-    width:65%;
+  h1 {
+    color: #FFA200;
+    font-size: 30px;
   }
-}
 
-@media only screen and (max-width: 400px) {
+  header p {
+    font-size: 14px;
+    color: #7B7B7B;
+  }
 
-  #login .login_valid {
-    width:65%;
-    /*width: 218px;*/
+  #login header {
+    text-align: center;
+    margin-top: 15%;
   }
 
-  #login .login_pwd {
-    /*width: 218px;*/
-    width:65%;
+  #box-login h2 {
+    width: 100%;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    margin-bottom: 20px;
+    text-align: center;
+    font-size: 24px;
+    color: #fff;
   }
 
-  #getValidSms {
-    font-size: 13px;
+  #tableBordered {
+    margin: 0;
+    padding: 0;
   }
-}
 
-@media only screen and (max-width: 375px) {
-  #login .login_valid {
-    /*width: 190px;*/
-    width:65%;
+  #tableBordered h5 {
+    margin: 0;
+    text-align: center;
+    padding: 0;
   }
 
-  #login .login_pwd {
-    /*width: 190px;*/
-    width:65%;
+  #login .box {
+    margin: 0 auto;
+    position: inherit;
+    margin-top: 20px;
+    border-radius: 9px !important;
   }
 
-  #getValidSms {
+  #login header {
+    text-align: center;
+    margin-top: 15%;
+  }
+
+  #tableBordered {
+    margin: 0;
+    padding: 0;
+  }
+
+  #tableBordered h5 {
+    margin: 0;
+    text-align: center;
+    padding: 0;
+  }
+
+  #imgValidcode {
+    position: relative;
+    float: right;
+    /*bottom: 54px;*/
+    /*width: 100px;*/
+    width: 30%;
+    height: 50px;
+    background: #eee;
+  }
+
+  .login_btn {
+    width: 100%;
+    height: 50px;
+    line-height: 50px;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    margin-top: 42px;
+    background: #E75296;
+    color: #fff;
     font-size: 14px;
+    text-align: center;
+    border: none;
+    padding: 0;
+    font-size: 24px;
+    margin-bottom: 3%;
   }
-}
 
-@media only screen and (max-width: 360px) {
-  #login .login_valid {
-    /*width: 160px;*/
-    width:65%;
+  .clear_btn {
+    width: 100%;
+    height: 40px;
+    line-height: 40px;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    background: rgba(255, 255, 255, 0.32);
+    color: #FFCC00;
+    font-size: 14px;
+    text-align: center;
+    border: none;
+    padding: 0;
   }
 
-  #login .login_pwd {
-    /*width: 160px;*/
-    width:65%;
+  header p {
+    margin-top: 10px;
+  }
+
+  #login .login-control {
+    width: 100%;
+    height: 50px;
+    line-height: 50px;
+    background: rgba(255, 255, 255, 0.4);
+    margin-bottom: 3px;
+    text-indent: 10px;
+    border: none;
+
+  }
+
+  #login .login-control::placeholder {
+    color: #000000;
+    font-size: 16px;
+  }
+
+  #logo {
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    margin-top: 10%;
+    margin-bottom: 10px;
+  }
+
+  .rowHeight {
+    width: 100%;
+    overflow: hidden;
+    display: block;
+    margin: 0 auto;
+    height: 50px;
+    margin-bottom: 3px;
   }
 
   #getValidSms {
-    font-size: 14px;
+    /*width: 100px;*/
+    width: 30%;
+    height: 50px;
+    background: #fff;
+    border: 1px solid #fff;
+    opacity: 0.6;
+    position: relative;
+    /*bottom: 55px;*/
+    float: right;
+    text-align: center;
+    color: #E75296;
+    line-height: 20px;
+    font-size: 12px;
+    min-width: 30px;
   }
-}
 
-@media only screen and (max-width: 320px) {
   #login .login_valid {
-    /*width: 144px;*/
-    width:65%;
+    /*width: 173px;*/
+    width: 65%;
+    float: left;
   }
 
   #login .login_pwd {
-    width:65%;
-    /*width: 144px;*/
+    width: 173px;
+    float: left;
   }
 
-  #getValidSms {
-    font-size: 12px;
+  @media only screen and (max-width: 640px) {}
+
+  @media only screen and (max-width: 480px) {
+    #login .login_valid {
+      /*width: 195px;*/
+      width: 65%;
+    }
+
+    #login .login_pwd {
+      /*width: 195px;*/
+      width: 65%;
+    }
+  }
+
+  @media only screen and (max-width: 414px) {
+    #login .login_valid {
+      width: 65%;
+      /*width: 223px;*/
+    }
+
+    #login .login_pwd {
+      /*width: 223px;*/
+      width: 65%;
+    }
+  }
+
+  @media only screen and (max-width: 400px) {
+
+    #login .login_valid {
+      width: 65%;
+      /*width: 218px;*/
+    }
+
+    #login .login_pwd {
+      /*width: 218px;*/
+      width: 65%;
+    }
+
+    #getValidSms {
+      font-size: 13px;
+    }
+  }
+
+  @media only screen and (max-width: 375px) {
+    #login .login_valid {
+      /*width: 190px;*/
+      width: 65%;
+    }
+
+    #login .login_pwd {
+      /*width: 190px;*/
+      width: 65%;
+    }
+
+    #getValidSms {
+      font-size: 14px;
+    }
+  }
+
+  @media only screen and (max-width: 360px) {
+    #login .login_valid {
+      /*width: 160px;*/
+      width: 65%;
+    }
+
+    #login .login_pwd {
+      /*width: 160px;*/
+      width: 65%;
+    }
+
+    #getValidSms {
+      font-size: 14px;
+    }
   }
-}
 
+  @media only screen and (max-width: 320px) {
+    #login .login_valid {
+      /*width: 144px;*/
+      width: 65%;
+    }
 
-</style>
+    #login .login_pwd {
+      width: 65%;
+      /*width: 144px;*/
+    }
+
+    #getValidSms {
+      font-size: 12px;
+    }
+  }
+</style>

+ 1 - 0
app/vue.config.js

@@ -2,6 +2,7 @@ const Timestamp = new Date().getTime();
 module.exports = {
     lintOnSave: false,
     devServer: {
+        port: 8184, // 端口
         proxy: {
             '/api': {
                 target: 'http://192.168.0.3:19095/',