Your Name 1 year ago
parent
commit
ed8e601e73
9 changed files with 304 additions and 33 deletions
  1. 31 10
      package-lock.json
  2. 1 0
      package.json
  3. 61 0
      src/api.js
  4. BIN
      src/assets/images/down.png
  5. 12 2
      src/components/DocIndex.vue
  6. 106 11
      src/components/DocLogin.vue
  7. 74 9
      src/components/RegPatinfo.vue
  8. 5 1
      src/main.js
  9. 14 0
      vue.config.js

+ 31 - 10
package-lock.json

@@ -973,8 +973,7 @@
     "asynckit": {
       "version": "0.4.0",
       "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
-      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
-      "dev": true
+      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
     },
     "atob": {
       "version": "2.1.2",
@@ -1027,6 +1026,28 @@
       "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==",
       "dev": true
     },
+    "axios": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmmirror.com/axios/-/axios-1.4.0.tgz",
+      "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
+      "requires": {
+        "follow-redirects": "^1.15.0",
+        "form-data": "^4.0.0",
+        "proxy-from-env": "^1.1.0"
+      },
+      "dependencies": {
+        "form-data": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz",
+          "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+          "requires": {
+            "asynckit": "^0.4.0",
+            "combined-stream": "^1.0.8",
+            "mime-types": "^2.1.12"
+          }
+        }
+      }
+    },
     "babel-code-frame": {
       "version": "6.26.0",
       "resolved": "https://registry.npmmirror.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
@@ -3009,7 +3030,6 @@
       "version": "1.0.8",
       "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
       "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
-      "dev": true,
       "requires": {
         "delayed-stream": "~1.0.0"
       }
@@ -4621,8 +4641,7 @@
     "delayed-stream": {
       "version": "1.0.0",
       "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
-      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
-      "dev": true
+      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
     },
     "delegates": {
       "version": "1.0.0",
@@ -6210,8 +6229,7 @@
     "follow-redirects": {
       "version": "1.15.2",
       "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.2.tgz",
-      "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
-      "dev": true
+      "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
     },
     "for-each": {
       "version": "0.3.3",
@@ -9566,14 +9584,12 @@
     "mime-db": {
       "version": "1.52.0",
       "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
-      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
-      "dev": true
+      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
     },
     "mime-types": {
       "version": "2.1.35",
       "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
       "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
-      "dev": true,
       "requires": {
         "mime-db": "1.52.0"
       }
@@ -13383,6 +13399,11 @@
         }
       }
     },
+    "proxy-from-env": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+      "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+    },
     "prr": {
       "version": "1.0.1",
       "resolved": "https://registry.npmmirror.com/prr/-/prr-1.0.1.tgz",

+ 1 - 0
package.json

@@ -14,6 +14,7 @@
     "build": "node build/build.js"
   },
   "dependencies": {
+    "axios": "^1.4.0",
     "echarts": "^5.4.2",
     "mint-ui": "^2.2.13",
     "vue": "^2.5.2",

+ 61 - 0
src/api.js

@@ -0,0 +1,61 @@
+import axios from 'axios';
+var baseURL='http://118.190.145.217:8090'
+// var baseURL = '/'
+// axios.defaults.baseURL='/'
+axios.interceptors.request.use(
+  config => {
+    const token = localStorage.getItem('token')
+    if(token){
+      config.headers.Authorization = token
+    }
+    return config
+  },
+  err => {
+    return Promise.reject(err)
+  });
+axios.interceptors.response.use(function (response) {
+  // console.log(response.headers)
+  // IE 8-9 
+  if (response.data == null && response.config.responseType === 'json' && response.request.responseText != null) {
+    try {
+      // eslint-disable-next-line no-param-reassign
+      response.data = JSON.parse(response.request.responseText)
+    } catch (e) {
+      // ignored
+    }
+  }
+  // 对响应数据做点什么
+  if (response.data.code == 401) {
+    // window.location.hash = "/login";
+    // window.location.hash = "/";
+  }
+  if (response.data.code == 305) {
+    // window.location.hash = "/";
+  }
+  return response;
+}, function (error) {
+  // 对响应错误做点什么
+  if (error.request.status == 403) {
+    // window.location.hash = "/login";
+    window.location.hash = "/";
+  }
+  // console.log(Object.getOwnPropertyNames(error))
+  // console.log(error.request,error.message)
+  return Promise.reject(error)
+});
+export default {
+  // 登录
+  login: params => {
+    return axios.post(`${baseURL}/api/account/doctor/login`, params)
+  },
+  logout: params => {
+    return axios.post(`${baseURL}/api/account/logout`, params)
+  },
+  reset: params => {
+    return axios.put(`${baseURL}/api/account/pwd/reset`, params)
+  },
+  // 全局账号信息
+  getAccountInfo: params => {
+    return axios.get(`${baseURL}/api/account/doctor/authinfo`)
+  }
+}

BIN
src/assets/images/down.png


+ 12 - 2
src/components/DocIndex.vue

@@ -3,7 +3,7 @@
     <div class="bgcolor">
       <div class="docinfo">
         <img class="docavatar" src="../assets/images/doch1.jpg" width="60rem" height="60rem" />
-        <p class="docname">肖小肖 医生,您好!</p>
+        <p class="docname">{{doctorInfo.name}} 医生,您好!</p>
       </div>
     </div>
     <div class="bgimg"></div>
@@ -21,13 +21,23 @@
     name: 'Index',
     data() {
       return {
-        msg: 'Welcome to Your Vue.js App'
+        doctorInfo:{}
       }
     },
     methods: {
       goPage(path) {
         this.$router.push(path)
+      },
+      getData(){
+        this.$api.getAccountInfo().then(res=>{
+          if(!res.data.code){
+            this.doctorInfo = res.data.data
+          }
+        })
       }
+    },
+    created(){
+      this.getData()
     }
   }
 

+ 106 - 11
src/components/DocLogin.vue

@@ -4,15 +4,26 @@
     <div class="content">
       <div class="title">登录信息</div>
       <div class="loginForm">
-        <mt-field placeholder="姓 名" v-model="email"></mt-field>
-        <mt-field placeholder="手机号" v-model="email"></mt-field>
-        <mt-field placeholder="短信验证码" v-model="email"></mt-field>
+        <mt-field placeholder="姓 名" v-model="form.name"></mt-field>
+        <div style="display:flex;">
+          <div>
+            <mt-field placeholder="手机号" v-model="form.phone"></mt-field>
+          </div>
+          <div>
+            <mt-button :disabled="disable" type="primary" class="sendPhcode" @click="timeCounter">{{timeCouterText}}
+            </mt-button>
+          </div>
+        </div>
+        <mt-field placeholder="短信验证码" v-model="form.phcode"></mt-field>
       </div>
       <div class="footer">
-        <div class="jbbtn" @click="goPage('docindex')">提交</div>
+        <div class="jbbtn" @click="submit">提交</div>
         <div class="agreeInfo">
-          <input type="checkbox" />
-          <span>我已知晓<a href="/#/agreedoc">《PK程序用户隐私条款》</a></span>
+          <input type="checkbox" checked v-if="form.isagree" @change="checkOnClick" />
+          <input type="checkbox" v-else @change="checkOnClick" />
+          <!-- <mt-checklist v-model="form.isagree" :options="['选项A', '选项B', '选项C']"></mt-checklist> -->
+          <span>我已知晓<a href="/#/agreedoc" @click.native="checkOnClick">《PK程序用户隐私条款》</a></span>
+
         </div>
       </div>
     </div>
@@ -21,22 +32,96 @@
 
 <script>
   import {
-    Field
+    Field,
+    Button,
+    Toast,
+    MessageBox,
+    Checklist
   } from 'mint-ui'
 
   export default {
     name: 'Index',
     components: {
-      Field
+      Field,
+      Button,
+      Toast,
+      MessageBox,
+      Checklist
     },
     data() {
       return {
-        email: ''
+        email: '',
+        timeCouterText: '发送',
+        seconds: 6,
+        disable: false,
+        isagree: false,
+        form: {}
       }
     },
     methods: {
       goPage(path) {
         this.$router.push(path)
+      },
+      timeCounter() {
+        let _this = this
+        var timer = setInterval(function () {
+          if (_this.seconds < 2) {
+            clearInterval(timer)
+            _this.seconds = 60
+            _this.timeCouterText = '发送'
+            _this.disable = false
+            return
+          }
+          _this.seconds -= 1
+          _this.timeCouterText = _this.seconds + '秒后重新发送'
+          _this.disable = true
+        }, 1000)
+      },
+      checkOnClick(e){
+        if(e.target.checked){
+          this.form.isagree = true
+        }else{
+          this.form.isagree = false
+        }
+      },
+      submit() {
+        if (!this.form.name) {
+          MessageBox({
+            title: '提示',
+            message: '请输入姓名?'
+          })
+          return 
+        }
+        if (!this.form.phone) {
+          MessageBox({
+            title: '提示',
+            message: '请输入手机号?'
+          })
+          return
+        }
+        if (!this.form.phcode) {
+          MessageBox({
+            title: '提示',
+            message: '请输入验证码?'
+          })
+          return
+        }
+        if (!this.form.isagree) {
+          MessageBox({
+            title: '提示',
+            message: '请先同意《PK程序用户隐私条款》?'
+          })
+          return
+        }
+        let params = this.form
+        params.role = 1
+        this.$api.login(params).then(res=>{
+          if(!res.data.code){
+            console.log(res)
+            localStorage.setItem("token",res.data.data.token)
+            this.goPage("/docindex")
+          }
+        })
       }
     }
   }
@@ -48,6 +133,15 @@
     position: relative;
     z-index: 1;
 
+    .loginForm {
+      .sendPhcode {
+        width: 6rem;
+        margin-top: 1rem;
+        height: 3.0rem;
+        border-radius: 1rem;
+      }
+    }
+
     .footer {
       /* position: absolute; */
       bottom: 1rem;
@@ -55,8 +149,9 @@
       left: 0;
       right: 0;
       bottom: 1rem;
-      .agreeInfo{
-        margin:2rem 0;
+
+      .agreeInfo {
+        margin: 2rem 0;
       }
     }
   }

+ 74 - 9
src/components/RegPatinfo.vue

@@ -4,36 +4,95 @@
     <div class="content">
       <div class="title">请录入病例信息</div>
       <div class="loginForm">
-        <mt-field label="病例姓名" v-model="email"></mt-field>
-        <mt-field label="病例年龄" v-model="email"></mt-field>
-        <mt-field label="病例性别" v-model="email"></mt-field>
-        <mt-field label="病例手机" v-model="email"></mt-field>
+        <mt-field label="病例姓名" v-model="form.name"></mt-field>
+        <mt-field label="病例年龄" v-model="form.birthday" @focus.native.capture="$refs.birthdayPicker.open()">
+          <img src="../assets/images/down.png" alt="" width="16px">
+        </mt-field>
+        </mt-datetime-picker>
+        <mt-field label="病例性别" v-model="form.sex" @focus.native.capture="sexFlag=true">
+          <img src="../assets/images/down.png" alt="" width="16px">
+        </mt-field>
+        <mt-field label="病例手机" v-model="form.phone"></mt-field>
       </div>
       <div class="footer">
-        <div class="jbbtn" @click="goPage">下一页</div>
+        <div class="jbbtn" @click="submit">下一页</div>
       </div>
     </div>
+    <mt-datetime-picker ref="birthdayPicker" type="date" v-model="form.birthday">
+    </mt-datetime-picker>
+    <mt-picker v-if="sexFlag" :slots="slots" ref="sexPicker" class="sexPicker"></mt-picker>
   </div>
 </template>
 
 <script>
   import {
-    Field
+    Field,
+    MessageBox,
+    DatetimePicker,
+    Picker
   } from 'mint-ui'
 
   export default {
     name: 'Index',
     components: {
-      Field
+      Field,
+      MessageBox,
+      DatetimePicker,
+      Picker
     },
     data() {
       return {
-        msg: 'Welcome to Your Vue.js App'
+        form: {},
+        sexFlag:false,
+        slots: [
+        {
+          flex: 1,
+          values: ['男', '女'],
+          className: 'slot1',
+          textAlign: 'center'
+        }
+      ]
       }
     },
     methods: {
       goPage() {
         this.$router.push('/regpatpro')
+      },
+      submit() {
+        if (!this.form.name) {
+          MessageBox({
+            title: '提示',
+            message: '请输入姓名?'
+          })
+          return
+        }
+        if (!this.form.birthday) {
+          MessageBox({
+            title: '提示',
+            message: '请输入手机号?'
+          })
+          return
+        }
+        if (!this.form.sex) {
+          MessageBox({
+            title: '提示',
+            message: '请输入验证码?'
+          })
+          return
+        }
+        if (!this.form.phone) {
+          MessageBox({
+            title: '提示',
+            message: '请输入手机号?'
+          })
+          return
+        }
+        let params = this.form
+        this.$api.login(params).then(res => {
+          if (!res.data.code) {
+            this.goPage("/docindex")
+          }
+        })
       }
     }
   }
@@ -41,5 +100,11 @@
 </script>
 
 <style scoped lang="scss">
-
+  .sexPicker{
+    position: fixed;
+    width: 100%;
+    z-index: 10;
+    bottom:0;
+    background: #fff;
+  }
 </style>

+ 5 - 1
src/main.js

@@ -7,15 +7,19 @@ import 'mint-ui/lib/style.css'
 import App from './App'
 import 'echarts'
 import ECharts from 'vue-echarts'
+import api from './api'
 
 Vue.use(MintUI)
 Vue.component('v-chart', ECharts)
+Vue.prototype.$api = api
 Vue.config.productionTip = false
 
 /* eslint-disable no-new */
 new Vue({
   el: '#app',
   router,
-  components: { App },
+  components: {
+    App
+  },
   template: '<App/>'
 })

+ 14 - 0
vue.config.js

@@ -0,0 +1,14 @@
+module.exports = {
+    devServer: {
+        proxy: {
+            '/api': {
+                target: 'http://118.190.145.217:8090',
+                changeOrigin: true,
+                pathRewrite:{
+                    '^/api': '/api'
+                }
+            }
+        }
+    },
+    publicPath: '/'
+}