Переглянути джерело

Merge branch 'dev' of http://10.87.10.227:4000/jzyd_yyds/soc_app into dev

coys 2 роки тому
батько
коміт
a4fcbb1713

+ 11 - 0
src/api/public.js

@@ -14,6 +14,17 @@ export function login(data) {
   })
 }
 
+// 登录方法
+export function tokenLogin(token) {
+  return request({
+    url: `/auth/tokenlogin?token=${token}&loginType=0`,
+    headers: {
+      isToken: false
+    },
+    method: 'get',
+  })
+}
+
 // 注册方法
 export function register(data) {
   return request({

+ 5 - 0
src/assets/css/index.scss

@@ -14,3 +14,8 @@ body .app {
   padding-bottom: 100px;
   background-color: rgb(245, 245, 249);
 }
+
+.van-empty__image{
+  height: 223px;
+  width: 223px;
+}

+ 10 - 3
src/components/dateCell/index.vue

@@ -3,7 +3,7 @@
     <van-cell v-if="disabled" :title="title" :label="selected" />
     <van-cell v-else :title="title" is-link :label="selected" @click="clickItem">
       <template #right-icon>
-        <van-icon name="underway-o" style="font-weight: 600;line-height: inherit;color:#008cd6;" />
+        <van-icon name="underway-o" class="date-icon"/>
       </template>
     </van-cell>
     <van-popup v-model="showPicker" round  position="bottom" :close-on-popstate="true" get-container="#app">
@@ -96,6 +96,13 @@ export default {
 }
 </script>
 
-<style scoped>
-
+<style lang="scss">
+.date-icon{
+  font-weight: 500;
+  line-height: inherit;
+  width: 42px;
+  height: 42px;
+  color: #008cd6;
+  font-size: 42px;
+}
 </style>

+ 2 - 1
src/router/index.js

@@ -27,7 +27,8 @@ Router.prototype.replace = function push(location, onResolve, onReject) {
 // 路由守卫
 router.beforeEach((to, from, next) => {
   console.log('从'+from.path+'跳向'+to.path)
-  if( to.path === '/login') return next();
+  if( to.path === '/login' || to.path==='/tokenlogin') return next();
+
   let token = sessionStorage.getItem('access_token');
   if(!token) return next('/login');
   next()

+ 8 - 0
src/router/router.config.js

@@ -16,6 +16,14 @@ export let routers = [
     },
   },
   {
+    path: '/tokenlogin',
+    component: () => import('@/views/tokenlogin'),
+    meta: {
+      title: '登录',
+      keepAlive: false
+    },
+  },
+  {
     path: '/consultInfo/:id',
     name: 'consultInfo',
     component: () => import('@/views/menu/monitoringCall/components/consultInfo'),

+ 2 - 1
src/utils/globalMixins.js

@@ -45,7 +45,8 @@ export default {
         getDict( dict ).then(res => {
           let { code, data } = res;
           if (code == 200) {
-            this[dict] = data;
+            this.observers[dict] = data;
+            //this[dict] = data;
             //return  this[dict].find(v=> s == v.dictValue).dictLabel;
           }
         })

+ 3 - 3
src/views/home/menu.vue

@@ -3,9 +3,9 @@
     <top-bar></top-bar>
     <div class="menu-list">
       <div class="menu-list-item" v-for="(v,i) in menuList" :key="i">
-        <p @click="onclick">{{v.name}}</p>
+        <p @click="onclick">{{v.meta.title}}</p>
         <van-grid border :column-num="3">
-          <van-grid-item v-for="(item,index) in v.list" :key="index" icon="smile-o" :text="item.menu" :to="item.path" />
+          <van-grid-item v-for="(item,index) in v.children" :key="index" :icon="item.meta.icon" :text="item.meta.title" :to="item.path" />
         </van-grid>
 <!--          <li v-for="(item,index) in v.list" :key="index">-->
 <!--            <div></div>-->
@@ -141,7 +141,7 @@ export default {
     getMenuList(){
       getMenu().then(res=>{
         console.log(res,'res')
-        //this.menuList = res.data
+        this.menuList = res.data
       })
     },
     onclick(){

+ 2 - 1
src/views/menu/educationStatistics/index.vue

@@ -73,6 +73,7 @@ export default {
     getPlanList(){
       planList(this.query.orgId).then(res=>{
         this.planList = res.data;
+        if(res.data.length === 0) return this.$toast('暂无教育计划');
         this.query.planId = res.data[0].id;
         this.query.date = formatDate(new Date(),'YYYY-MM');
         this.getDataList();
@@ -82,7 +83,7 @@ export default {
       let data = {
         ...this.query
       }
-      data.date = `${this.query.date}-01`;
+      data.date = this.query.date && `${this.query.date}-01`;
       if(!this.query.orgId) return this.$toast('请选择机构');
       dataList(data).then(res=>{
         this.dataList = res.data;

+ 100 - 0
src/views/tokenlogin.vue

@@ -0,0 +1,100 @@
+<template>
+  <div class="login">
+    <div>
+      <div class="avatar-box">
+        <van-loading text-color="#0094ff" v-if="loading">正在跳转</van-loading>
+        <span style="color: red" v-if="type == 'error'">{{ message }}</span>
+        <span style="color: #E6A23C" v-if="type == 'warn'">{{ message }}</span>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+// 请求接口
+import { tokenLogin } from '@/api/public.js'
+import { mapGetters } from 'vuex'
+export default {
+  data() {
+    return {
+      loading: false,
+      type: '',
+      message: ''
+    }
+  },
+  computed: {
+    ...mapGetters(['userName'])
+  },
+  mounted() {
+    this.loading = true
+    let { query } = this.$route;
+    if (!query) {
+      this.loading = false
+      this.type = 'error'
+      this.message = '缺少token'
+    } else {
+      let { token } = query
+      if (!token) {
+        this.type = 'warn'
+        this.loading = false
+        this.message = '缺少token'
+      } else {
+        tokenLogin(token)
+          .then(res => {
+            console.log(res, 'res')
+            sessionStorage.setItem('access_token',res.data.access_token);
+            this.$router.replace('/home');
+          })
+          .catch(e => {
+            this.type = 'error'
+            this.message = '请求错误'
+            this.loading = false
+          })
+      }
+    }
+  },
+  methods: {}
+}
+</script>
+
+<style lang="scss">
+//.van-cell__title{
+//  align-items: center;
+//}
+//.custom-title{
+//  align-self: center;
+//}
+</style>
+<style scoped lang="scss">
+.login {
+  height: 100vh;
+  background: url('../assets/img/login-background.png') top left no-repeat #edfcff;
+  background-size: 100%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  > div {
+    width: 450px;
+    padding: 30px 0;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    background-color: #fff;
+    border-radius: 10px;
+    .avatar-box {
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      height: 150px;
+    }
+  }
+  h2 {
+    letter-spacing: 10px;
+    text-align: center;
+  }
+  .custom-title {
+    align-self: center;
+    vertical-align: middle;
+  }
+}
+</style>