import axios from '@/libs/base/api.request'
import {request} from '@/api/base.js'
import config from '@/config/index.js'
import md5 from 'js-md5'
import {Base64} from 'js-base64'
import iView from 'view-design'
import store from '@/store'
import qs from 'qs';
import {localRead} from "@/libs/base/util";

export const login = ({userCode, userPwd}) => {

  const data = {
    // 'grant_type': 'password',
    // 'client_id': 'f3ed0d90-3fc8-4eba-b83c-a0cfe54c174d',
    // 'client_secret': '78e238b4-c199-49ad-b619-69b6a78959d8',
    // 'ftycode': ftyCode,
    'phone': userCode,
    'password': md5(userPwd),
    'lang':localRead('local_lan'),
    // 'appcode':appCode,
  }

  return new Promise(resolve => {
    // TODO 暂时注释掉
    axios.request({
      url: `oauth-server/oauth/token`,
      data: qs.stringify(data),
      method: 'post',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
    }).then(res => {
      if (res.data.code == 200) {
        let data = res.data.data;
        // console.log('menu', data)
        resolve(res.data)
      } else {
        resolve(res.data)
      }
    })
    // resolve(returnData)
  })
}


export const getMenuList = (token, id) => {
  return new Promise((resolve, reject) => {
    iView.LoadingBar.start()
    axios.request({
      url: config.dkAuthSysServerUrl + `user-server/user/menu/${id}`,
      data: null,
      method: 'post',
      headers: {Authorization: token},
    }).then(res => {
      iView.LoadingBar.finish()
      if (res.headers.version && (localStorage.getItem('VERSION') == null || localStorage.getItem('VERSION') !== res.headers.version)) {
        // console.log('update version')
        localStorage.setItem('VERSION', res.headers.version)
        iView.Message.info('系统即将自动升级')
        setTimeout(function () {
          window.location.reload(true)
        }, 1000)
      }
      return res.data
    }, err => {
      reject(err)
    }).then((res) => {
      resolve(res)
    })
  })
}
/* 不走请求的方法 */
export const getMenuListStatic = (token, id) => {
  return new Promise((resolve, reject) => {
    iView.LoadingBar.start()
    setTimeout(() => {
      let obj = {
        code: 200,
        message: '操作成功',
        data: [
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'menuName': '基础管理',
            'menuType': 0,
            'parentUuid': null,
            'funUuid': null,
            'displayNo': 1,
            'remarks': null,
            'levelName': '基础信息',
            'levelNo': 1,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'cache': false,
              'icon': 'md-settings',
              'name': 'basic'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '商品档案',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 1,
            'remarks': null,
            'levelName': '基础信息→商品档案',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/mst/goods/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'goods'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '系统参数',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 2,
            'remarks': null,
            'levelName': '基础信息→系统参数',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/basic/system-setting/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'system-setting'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': 'a0e33cda-da45-473c-9a8e-fa3e62f40916',
            'menuName': '系统参数-初始化',
            'menuType': 2,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'bc700758-1266-4b2c-8abc-bb64f3175b91',
            'displayNo': 4,
            'remarks': null,
            'levelName': '基础信息→系统参数-初始化',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#004@a0e33cda-da45-473c-9a8e-fa3e62f40916',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': null
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '往来单位',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 3,
            'remarks': null,
            'levelName': '基础信息→往来单位',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/basic/dealing-corp/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'dealing-corp'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '077a2b07-4922-4e4a-bbda-020483ebc77a',
            'menuName': '往来单位-新建',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': '83da6c74-10cc-4c58-b8b0-abdfd4920e4f',
            'displayNo': 2,
            'remarks': null,
            'levelName': '基础信息→往来单位-新建',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#002@077a2b07-4922-4e4a-bbda-020483ebc77a',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': true,
              'path': '/basic/dealing-corp/add',
              'cache': false,
              'icon': null,
              'name': 'dealing-corp-add'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '077a2b07-4922-4e4a-bbda-020483ebc77a',
            'menuName': '往来单位-编辑',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': '83da6c74-10cc-4c58-b8b0-abdfd4920e4f',
            'displayNo': 2,
            'remarks': null,
            'levelName': '基础信息→往来单位-编辑',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#002@077a2b07-4922-4e4a-bbda-020483ebc77a',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': true,
              'path': '/basic/dealing-corp/edit',
              'cache': false,
              'icon': null,
              'name': 'dealing-corp-edit'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '业务流程设置',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 3,
            'remarks': null,
            'levelName': '基础信息→业务流程设置',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/basic/operation-flow-setting/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'operation-flow-setting'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '操作日志',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 3,
            'remarks': null,
            'levelName': '基础信息→操作日志',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/apm/api-log/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'operation-log'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': 'a0e33cda-da45-473c-9a8e-fa3e62f40916',
            'menuName': '操作日志-编辑',
            'menuType': 2,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'bc700758-1266-4b2c-8abc-bb64f3175b91',
            'displayNo': 4,
            'remarks': null,
            'levelName': '基础信息→操作日志-编辑',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#004@a0e33cda-da45-473c-9a8e-fa3e62f40916',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': null
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '商品属性',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 3,
            'remarks': null,
            'levelName': '基础信息→商品属性',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/mst/goods-attribute/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'goods-attribute'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': 'a0e33cda-da45-473c-9a8e-fa3e62f40916',
            'menuName': '商品属性-启用',
            'menuType': 2,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'bc700758-1266-4b2c-8abc-bb64f3175b91',
            'displayNo': 4,
            'remarks': null,
            'levelName': '基础信息→商品属性-启用',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#004@a0e33cda-da45-473c-9a8e-fa3e62f40916',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': null
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': 'a0e33cda-da45-473c-9a8e-fa3e62f40916',
            'menuName': '商品属性-停用',
            'menuType': 2,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'bc700758-1266-4b2c-8abc-bb64f3175b91',
            'displayNo': 4,
            'remarks': null,
            'levelName': '基础信息→商品属性-停用',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#004@a0e33cda-da45-473c-9a8e-fa3e62f40916',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': null
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': 'a0e33cda-da45-473c-9a8e-fa3e62f40916',
            'menuName': '商品属性-删除',
            'menuType': 2,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'bc700758-1266-4b2c-8abc-bb64f3175b91',
            'displayNo': 4,
            'remarks': null,
            'levelName': '基础信息→商品属性-删除',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#004@a0e33cda-da45-473c-9a8e-fa3e62f40916',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': null
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '计量单位',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 4,
            'remarks': null,
            'levelName': '基础信息→计量单位',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/mst/goods-unit/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'goods-unit'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '角色管理',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 4,
            'remarks': null,
            'levelName': '基础信息→角色管理',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/basic/role/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'role'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '小区档案',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 4,
            'remarks': null,
            'levelName': '基础信息→小区档案',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/basic/address/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'address'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '077a2b07-4922-4e4a-bbda-020483ebc77a',
            'menuName': '小区档案-新建',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': '83da6c74-10cc-4c58-b8b0-abdfd4920e4f',
            'displayNo': 2,
            'remarks': null,
            'levelName': '基础信息→小区档案-新建',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#002@077a2b07-4922-4e4a-bbda-020483ebc77a',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': true,
              'path': '/basic/address/add',
              'cache': false,
              'icon': null,
              'name': 'address-add'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '077a2b07-4922-4e4a-bbda-020483ebc77a',
            'menuName': '小区档案-编辑',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': '83da6c74-10cc-4c58-b8b0-abdfd4920e4f',
            'displayNo': 2,
            'remarks': null,
            'levelName': '基础信息→小区档案-编辑',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#002@077a2b07-4922-4e4a-bbda-020483ebc77a',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': true,
              'path': '/basic/address/edit',
              'cache': false,
              'icon': null,
              'name': 'address-edit'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '费用项目',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 4,
            'remarks': null,
            'levelName': '基础信息→费用项目',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/basic/fee-item/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'fee-item'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '077a2b07-4922-4e4a-bbda-020483ebc77a',
            'menuName': '费用项目-新建',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': '83da6c74-10cc-4c58-b8b0-abdfd4920e4f',
            'displayNo': 2,
            'remarks': null,
            'levelName': '基础信息→费用项目-新建',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#002@077a2b07-4922-4e4a-bbda-020483ebc77a',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': true,
              'path': '/basic/fee-item/add',
              'cache': false,
              'icon': null,
              'name': 'fee-item-add'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '077a2b07-4922-4e4a-bbda-020483ebc77a',
            'menuName': '费用项目-编辑',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': '83da6c74-10cc-4c58-b8b0-abdfd4920e4f',
            'displayNo': 2,
            'remarks': null,
            'levelName': '基础信息→费用项目-编辑',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#002@077a2b07-4922-4e4a-bbda-020483ebc77a',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': true,
              'path': '/basic/fee-item/edit',
              'cache': false,
              'icon': null,
              'name': 'fee-item-edit'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'menuName': '测试组件',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': 'ffb0d0b1-0983-4025-a084-fa3f059c5e2c',
            'displayNo': 5,
            'remarks': null,
            'levelName': '基础信息→测试组件',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#001@3e772d4a-30df-43b4-9b76-fe50eac7b415',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': false,
              'path': '/test/index',
              'cache': true,
              'icon': 'ios-person',
              'name': 'test'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': '077a2b07-4922-4e4a-bbda-020483ebc77a',
            'menuName': '商品档案-新建',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': '83da6c74-10cc-4c58-b8b0-abdfd4920e4f',
            'displayNo': 2,
            'remarks': null,
            'levelName': '基础信息→商品档案-新建',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#002@077a2b07-4922-4e4a-bbda-020483ebc77a',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': true,
              'path': '/mst/goods/add',
              'cache': false,
              'icon': null,
              'name': 'goods-add'
            }
          },
          {
            'pageSize': null,
            'currentPage': null,
            'start': null,
            'end': null,
            'sysUuid': '00000000-0000-0000-0000-000000000000',
            'appUuid': '1d16de1d-312b-458a-a26f-78ec1931df37',
            'menuUuid': 'b9af309a-8ae1-4cb2-b238-d49ba4155542',
            'menuName': '商品档案-编辑',
            'menuType': 1,
            'parentUuid': '84e3f366-b3bb-4b6b-990a-55bf47b9b5f2',
            'funUuid': '22d10d1c-6fae-4497-ac53-55df931a2235',
            'displayNo': 3,
            'remarks': null,
            'levelName': '基础信息→商品档案-编辑',
            'levelNo': 2,
            'levelCode': '#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#003@b9af309a-8ae1-4cb2-b238-d49ba4155542',
            'flgValid': true,
            'verNo': [
              0,
              0,
              0,
              0
            ],
            'menuTag': {
              'hideInMenu': true,
              'path': '/mst/goods/edit',
              'cache': true,
              'icon': null,
              'name': 'goods-edit'
            }
          },
          // {
          //   "pageSize": null,
          //   "currentPage": null,
          //   "start": null,
          //   "end": null,
          //   "sysUuid": "00000000-0000-0000-0000-000000000000",
          //   "appUuid": "1d16de1d-312b-458a-a26f-78ec1931df37",
          //   "menuUuid": "a0e33cda-da45-473c-9a8e-fa3e62f40916",
          //   "menuName": "商品档案-启用",
          //   "menuType": 2,
          //   "parentUuid": "84e3f366-b3bb-4b6b-990a-55bf47b9b5f2",
          //   "funUuid": "bc700758-1266-4b2c-8abc-bb64f3175b91",
          //   "displayNo": 4,
          //   "remarks": null,
          //   "levelName": "基础信息→商品档案-启用",
          //   "levelNo": 2,
          //   "levelCode": "#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#004@a0e33cda-da45-473c-9a8e-fa3e62f40916",
          //   "flgValid": true,
          //   "verNo": [
          //     0,
          //     0,
          //     0,
          //     0
          //   ],
          //   "menuTag": null
          // },
          // {
          //   "pageSize": null,
          //   "currentPage": null,
          //   "start": null,
          //   "end": null,
          //   "sysUuid": "00000000-0000-0000-0000-000000000000",
          //   "appUuid": "1d16de1d-312b-458a-a26f-78ec1931df37",
          //   "menuUuid": "ba43b0d5-dde8-478a-842d-287348d8ebba",
          //   "menuName": "商品档案-停用",
          //   "menuType": 2,
          //   "parentUuid": "84e3f366-b3bb-4b6b-990a-55bf47b9b5f2",
          //   "funUuid": "ee02b1c5-7aa4-43f7-a74c-f8e0d07c595d",
          //   "displayNo": 5,
          //   "remarks": null,
          //   "levelName": "基础信息→商品档案-停用",
          //   "levelNo": 2,
          //   "levelCode": "#001@84e3f366-b3bb-4b6b-990a-55bf47b9b5f2#005@ba43b0d5-dde8-478a-842d-287348d8ebba",
          //   "flgValid": true,
          //   "verNo": [
          //     0,
          //     0,
          //     0,
          //     0
          //   ],
          //   "menuTag": null
          // }
        ]
      }
      resolve(obj)
    }, 1000)
  })
}

export const logout = () => {
  return request('/mdm-server/mst/staff/logout', {
    staffId: store.state.user.staffId
  })
  // return axios.request({
  //   url: '/mdm-server/mst/staff/logout',
  //   method: 'post',
  //   headers: {
  //     Authorization: "Bearer " + store.state.user.token
  //   },
  //   params: {
  //     staffId: store.state.user.staffId
  //   }
  // })
}

export const getUnreadCount = () => {
  return axios.request({
    url: 'message/count',
    method: 'get'
  })
}

export const getMessage = () => {
  return axios.request({
    url: 'message/init',
    method: 'get'
  })
}

export const getContentByMsgId = msg_id => {
  return axios.request({
    url: 'message/content',
    method: 'get',
    params: {
      msg_id
    }
  })
}

export const hasRead = msg_id => {
  return axios.request({
    url: 'message/has_read',
    method: 'post',
    data: {
      msg_id
    }
  })
}

export const removeReaded = msg_id => {
  return axios.request({
    url: 'message/remove_readed',
    method: 'post',
    data: {
      msg_id
    }
  })
}

export const restoreTrash = msg_id => {
  return axios.request({
    url: 'message/restore',
    method: 'post',
    data: {
      msg_id
    }
  })
}

/**
 * @desc   : 获取二维码
 * @author : 洪旭东
 * @date   : 2024-02-20 09:38
 */
export const getQrCode = uuid => {
  return request(`oauth-server/oauth/qrcode?uuid=${uuid}`)
  // return request('oauth-server/oauth/qrcode', {
  //   uuid: uuid
  // })
}

/**
 * @desc   : 验证当前扫码登录是否成功
 * @author : 洪旭东
 * @date   : 2024-02-20 10:42
 */
export const checkLoginOpenId = uuid => {
  return axios.request({
    url: `oauth-server/oauth/check?uuid=${uuid}`,
    method: 'post',
    data: {
    }
  })
}
