wangting
2023-07-21 deed4fd12c523bdcd711958a845e0cbfb9b63610
路由还原
已修改5个文件
47 ■■■■■ 文件已修改
Source/UBCS-WEB/public/src/permission.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/public/src/store/modules/tags.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/page/index/index.vue 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/permission.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/router/avue-router.js 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/public/src/permission.js
@@ -36,7 +36,7 @@
          if (to.query.target) {
            window.open(value)
          } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) {
            store.commit('', {
            store.commit('ADD_TAG', {
              label: label,
              value: value,
              params: to.params,
Source/UBCS-WEB/public/src/store/modules/tags.js
@@ -47,7 +47,6 @@
      setStore({name: 'tagList', content: state.tagList})
    },
    DEL_TAG: (state, action) => {
      console.log('779',state,action)
      state.tagList = state.tagList.filter(item => {
        return !diff(item, action);
      })
Source/UBCS-WEB/src/page/index/index.vue
@@ -18,9 +18,9 @@
        <!-- 主体视图层 -->
        <div style="height:100%;overflow-y:auto;overflow-x:hidden;" id="avue-view" v-show="!isSearch">
          <keep-alive>
            <router-view class="avue-view" v-if="$route.meta.keepAlive" :key="$route.fullPath"></router-view>
            <router-view class="avue-view" v-if="$route.meta.keepAlive" :key="$route.fullPath"/>
          </keep-alive>
          <router-view class="avue-view"  v-if="!$route.meta.keepAlive" :key="$route.fullPath" ></router-view>
          <router-view class="avue-view" v-if="!$route.meta.keepAlive" :key="$route.fullPath"/>
        </div>
      </div>
    </div>
@@ -38,7 +38,7 @@
  import {validatenull} from "@/util/validate";
  import {calcDate} from "@/util/date.js";
  import {getStore} from "@/util/store.js";
  import {getRoutes} from "@/api/system/menu"
  export default {
    components: {
      top,
@@ -60,15 +60,14 @@
        refreshLock: false,
        //刷新token的时间
        refreshTime: "",
        loading:true,
        routeList:[],
        ids:[]
        loading:true
      };
    },
    created() {
      //实时检测刷新token
      this.refreshToken();
    },
    mounted() {
      this.init();
Source/UBCS-WEB/src/permission.js
@@ -7,8 +7,7 @@
import {validatenull} from '@/util/validate'
import {getToken} from '@/util/auth'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css'
import Store from "@/store"; // progress bar style
import 'nprogress/nprogress.css' // progress bar style
NProgress.configure({showSpinner: false});
const lockPage = store.getters.website.lockPage; //锁屏页
router.beforeEach((to, from, next) => {
@@ -30,16 +29,8 @@
            next({path: '/login'})
          })
        } else {
          const fullPath = to.fullPath
          const queryString = fullPath.split('?')[1];
          const value = to.query.src || to.fullPath;
          const label = queryString === 'wupin'
            ? '物品主数据'
            : (queryString === 'renyuan'
              ? '人员主数据'
              : (queryString === 'gongyingshang'
                ? '供应商主数据'
                : (to.query.name || to.name)));
          const label = to.query.name || to.name;
          const meta = to.meta || router.$avueRouter.meta || {};
          const i18n = to.query.i18n;
          if (to.query.target) {
Source/UBCS-WEB/src/router/avue-router.js
@@ -23,23 +23,18 @@
    return result.join('&');
  }
  let titileName;
  this.$router.$avueRouter = {
    //全局配置
    $website: this.$store.getters.website,
    group: '',
    meta: {},
    safe: this,
    tianyuan:'',
    // 设置标题
    setTitle: (title) => {
      titileName=title
      const defaultTitle = this.$vue.$t('title');
      this.$router.$avueRouter.tianyuan=title
      title = title ? `${title}-${defaultTitle}` : defaultTitle;
      document.title = title;
    },
    closeTag: (value) => {
      let tag = value || this.$store.getters.tag;
      if (typeof value === 'string') {
@@ -90,11 +85,13 @@
    },
    //动态路由
    // 路由是专门的一个接口获取
    /**
     * aMenu: 接受到的动态路由数据 menu的结构外层有父级path 里面有一个childen 记录页面的路由
     * first: 为了区分外界 调用formatRoutes 和 当前文件调用 formatRoutes
     */
      /**
       * aMenu: 接受到的动态路由数据 menu的结构外层有父级path 里面有一个childen 记录页面的路由
       * first: 为了区分外界 调用formatRoutes 和 当前文件调用 formatRoutes
      */
    formatRoutes: function (aMenu = [], first) {
      // window.console.log('aMenu')
      // window.console.log(aMenu)
      const aRouter = []
      // 获取到全局配置中的 props
      const propsConfig = this.$website.menu.props;
@@ -127,7 +124,7 @@
          icon = oMenu[propsDefault.icon],
          children = oMenu[propsDefault.children],
          meta = oMenu[propsDefault.meta] || {};
        // meta中 keepalive 的处理
          // meta中 keepalive 的处理
        meta = Object.assign(meta, (function () {
          if (option.keepAlive === true) {
            return {
@@ -182,12 +179,11 @@
            /**
             * 这里是重点,当有子路由的时候 会再去执行 formatRoutes 方法,然后又会有一个新的 aMenu for循环。
             * 最后返回的是一个数组 aRouter 这个数组就会作为 childen的值被 return
             */
            */
            return this.formatRoutes(children, false)
          })()
        }
        aRouter.push(oRouter)
        // console.log(aRouter)
      }
      // for循环结束
      // 这个first 卡的其实就是首路由