Commit 286e42b9 authored by 张伯涛's avatar 张伯涛

修改

parent ba189262
......@@ -16,6 +16,8 @@ import permission from './directive/permission'
import '@/icons' // icon
import '@/assets/icons' // icon
// import '@/permission' // permission control
// 千分位转换
import thousand from "@/utils/thousand";
/**
* If you don't want to use mock-server
......@@ -46,6 +48,7 @@ Viewer.setDefaults({
})
// 全局方法挂载
Vue.prototype.thousand = thousand;
Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime
......
......@@ -7,6 +7,7 @@ export class userAuth {
}
getInfo = () => {
return new Promise((resolve, reject) => {
console.log('getToken', getToken())
if (!getToken()) {
// this.MessageTipsForLogin()
this.router.next({ path: '/login/index', query: { redirect: this.router.to.fullPath }})
......
const thousand = {
// 千分位格式化:10000转为10,000 n=0,不允许有小数
fmoney(s, n) {
if (s == '' || s == null || (s == undefined) | isNaN(Number(s))) {
return s
}
s = Number(s) ? Number(s) : s
// n = (n || n == 0) && n > -1 && n <= 20 ? n : 2;
n = 0
s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(n) + ''
var l = s.split('.')[0].split('').reverse()
var r = s.split('.')[1]
var t = ''
for (var i = 0; i < l.length; i++) {
t += l[i] + ((i + 1) % 3 == 0 && i + 1 != l.length ? ',' : '')
}
if (n > 0) {
r = '.' + r
} else if (n == 0) {
r = ''
}
let returnT = t.split('').reverse().join('') + r
// 负数处理
if (returnT[0] == '-' && returnT[1] == ',') {
returnT = '-' + returnT.substring(2)
}
return returnT
},
// 千分位反格式化:10,000.00转为10000
rmoney(s) {
let str = ''
if (s) {
str = String(s).replace(/,/g, '')
}
if (s && (s + '').indexOf('.') > -1 && Number(str)) {
return String(s).replace(/[^\d\.-]/g, '')
} else if (s && Number(str)) {
return str
} else {
return s
}
}
}
export default thousand
......@@ -217,6 +217,7 @@ export default {
},
/** 获取用户信息*/
getLocalInfo() {
console.log('headerCookies', Cookies.get('userInfo'))
if (Cookies.get('userInfo')) {
const list = JSON.parse(Cookies.get('userInfo'))
myMessage(list.userId).then(res => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment