This commit is contained in:
zhigang.li 2017-12-04 15:59:00 +08:00
parent 372e393c58
commit cb847a669d
13 changed files with 44 additions and 45 deletions

View File

@ -1,6 +1,5 @@
{ {
"extends": "standard", "extends": "standard",
"installedESLint": true,
"root": true, "root": true,
"parserOptions": { "parserOptions": {
"ecmaVersion": 6, "ecmaVersion": 6,

View File

@ -14,8 +14,8 @@ util.title = function (title) {
const ajaxUrl = env === 'development' const ajaxUrl = env === 'development'
? 'http://127.0.0.1:8888' ? 'http://127.0.0.1:8888'
: env === 'production' : env === 'production'
? 'https://www.url.com' ? 'https://www.url.com'
: 'https://debug.url.com'; : 'https://debug.url.com';
util.ajax = axios.create({ util.ajax = axios.create({
baseURL: ajaxUrl, baseURL: ajaxUrl,
@ -190,7 +190,7 @@ util.openNewPage = function (vm, name, argu, query) {
let i = 0; let i = 0;
let tagHasOpened = false; let tagHasOpened = false;
while (i < openedPageLen) { while (i < openedPageLen) {
if (name === pageOpenedList[i].name) { // 页面已经打开 if (name === pageOpenedList[i].name) { // 页面已经打开
vm.$store.commit('pageOpenedList', { vm.$store.commit('pageOpenedList', {
index: i, index: i,
argu: argu, argu: argu,

View File

@ -18,7 +18,7 @@ export const router = new VueRouter(RouterConfig);
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
iView.LoadingBar.start(); iView.LoadingBar.start();
Util.title(to.meta.title); Util.title(to.meta.title);
if (Cookies.get('locking') === '1' && to.name !== 'locking') { // 判断当前是否是锁定状态 if (Cookies.get('locking') === '1' && to.name !== 'locking') { // 判断当前是否是锁定状态
next({ next({
replace: true, replace: true,
name: 'locking' name: 'locking'
@ -26,20 +26,20 @@ router.beforeEach((to, from, next) => {
} else if (Cookies.get('locking') === '0' && to.name === 'locking') { } else if (Cookies.get('locking') === '0' && to.name === 'locking') {
next(false); next(false);
} else { } else {
if (!Cookies.get('user') && to.name !== 'login') { // 判断是否已经登录且前往的页面不是登录页 if (!Cookies.get('user') && to.name !== 'login') { // 判断是否已经登录且前往的页面不是登录页
next({ next({
name: 'login' name: 'login'
}); });
} else if (Cookies.get('user') && to.name === 'login') { // 判断是否已经登录且前往的是登录页 } else if (Cookies.get('user') && to.name === 'login') { // 判断是否已经登录且前往的是登录页
Util.title(); Util.title();
next({ next({
name: 'home_index' name: 'home_index'
}); });
} else { } else {
const curRouterObj = Util.getRouterObjByName([otherRouter, ...appRouter], to.name); const curRouterObj = Util.getRouterObjByName([otherRouter, ...appRouter], to.name);
if (curRouterObj && curRouterObj.access !== undefined) { // 需要判断权限的路由 if (curRouterObj && curRouterObj.access !== undefined) { // 需要判断权限的路由
if (curRouterObj.access === parseInt(Cookies.get('access'))) { if (curRouterObj.access === parseInt(Cookies.get('access'))) {
Util.toDefaultPage([otherRouter, ...appRouter], to.name, router, next); // 如果在地址栏输入的是一级菜单则默认打开其第一个二级菜单的页面 Util.toDefaultPage([otherRouter, ...appRouter], to.name, router, next); // 如果在地址栏输入的是一级菜单则默认打开其第一个二级菜单的页面
} else { } else {
next({ next({
replace: true, replace: true,

View File

@ -58,8 +58,8 @@ export const otherRouter = {
children: [ children: [
{ path: 'home', title: {i18n: 'home'}, name: 'home_index', component: resolve => { require(['@/views/home/home.vue'], resolve); } }, { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: resolve => { require(['@/views/home/home.vue'], resolve); } },
{ path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: resolve => { require(['@/views/own-space/own-space.vue'], resolve); } }, { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: resolve => { require(['@/views/own-space/own-space.vue'], resolve); } },
{ path: 'order/:order_id', title: '订单详情', name: 'order_info', component: resolve => { require(['@/views/advanced-router/component/order-info.vue'], resolve); } }, // 用于展示动态路由 { path: 'order/:order_id', title: '订单详情', name: 'order_info', component: resolve => { require(['@/views/advanced-router/component/order-info.vue'], resolve); } }, // 用于展示动态路由
{ path: 'shopping', title: '购物详情', name: 'shopping', component: resolve => { require(['@/views/advanced-router/component/shopping-info.vue'], resolve); } }, // 用于展示带参路由 { path: 'shopping', title: '购物详情', name: 'shopping', component: resolve => { require(['@/views/advanced-router/component/shopping-info.vue'], resolve); } }, // 用于展示带参路由
{ path: 'message', title: '消息中心', name: 'message_index', component: resolve => { require(['@/views/message/message.vue'], resolve); } } { path: 'message', title: '消息中心', name: 'message_index', component: resolve => { require(['@/views/message/message.vue'], resolve); } }
] ]
}; };

View File

@ -8,7 +8,7 @@ const app = {
cachePage: [], cachePage: [],
lang: '', lang: '',
isFullScreen: false, isFullScreen: false,
openedSubmenuArr: [], // 要展开的菜单数组 openedSubmenuArr: [], // 要展开的菜单数组
menuTheme: 'dark', // 主题 menuTheme: 'dark', // 主题
themeColor: '', themeColor: '',
pageOpenedList: [{ pageOpenedList: [{
@ -23,7 +23,7 @@ const app = {
path: '', path: '',
name: 'home_index' name: 'home_index'
} }
], // 面包屑数组 ], // 面包屑数组
menuList: [], menuList: [],
routers: [ routers: [
otherRouter, otherRouter,
@ -31,7 +31,7 @@ const app = {
], ],
tagsList: [...otherRouter.children], tagsList: [...otherRouter.children],
messageCount: 0, messageCount: 0,
dontCache: ['text-editor', 'artical-publish'] // 在这里定义你不想要缓存的页面的name属性值(参见路由配置router.js) dontCache: ['text-editor', 'artical-publish'] // 在这里定义你不想要缓存的页面的name属性值(参见路由配置router.js)
}, },
mutations: { mutations: {
setTagsList (state, list) { setTagsList (state, list) {

View File

@ -99,10 +99,10 @@
return this.$store.state.app.menuList; return this.$store.state.app.menuList;
}, },
pageTagsList () { pageTagsList () {
return this.$store.state.app.pageOpenedList; // return this.$store.state.app.pageOpenedList; //
}, },
currentPath () { currentPath () {
return this.$store.state.app.currentPath; // return this.$store.state.app.currentPath; //
}, },
avatorPath () { avatorPath () {
return localStorage.avatorImgPath; return localStorage.avatorImgPath;
@ -157,7 +157,7 @@
return true; return true;
} }
}); });
if (!openpageHasTag) { // 退退 if (!openpageHasTag) { // 退退
util.openNewPage(this, name, this.$route.params || {}, this.$route.query || {}); util.openNewPage(this, name, this.$route.params || {}, this.$route.query || {});
} }
}, },
@ -187,7 +187,7 @@
localStorage.currentPageName = to.name; localStorage.currentPageName = to.name;
}, },
lang () { lang () {
util.setCurrentPath(this, this.$route.name); // util.setCurrentPath(this, this.$route.name); //
} }
}, },
mounted () { mounted () {

View File

@ -170,16 +170,16 @@ export default {
topArticle: false, topArticle: false,
publishTime: '', publishTime: '',
publishTimeType: 'immediately', publishTimeType: 'immediately',
editPublishTime: false, // editPublishTime: false, //
articleTagSelected: [], // articleTagSelected: [], //
articleTagList: [], // articleTagList: [], //
classificationList: [], classificationList: [],
classificationSelected: [], // classificationSelected: [], //
offenUsedClass: [], offenUsedClass: [],
offenUsedClassSelected: [], // offenUsedClassSelected: [], //
classificationFinalSelected: [], // classificationFinalSelected: [], //
publishLoading: false, publishLoading: false,
addingNewTag: false, // addingNewTag: false, //
newTagName: '' // newTagName: '' //
}; };
}, },
@ -237,7 +237,7 @@ export default {
this.classificationFinalSelected = selectedArray.map(item => { this.classificationFinalSelected = selectedArray.map(item => {
return item.title; return item.title;
}); });
localStorage.classificationSelected = JSON.stringify(this.classificationFinalSelected); // localStorage.classificationSelected = JSON.stringify(this.classificationFinalSelected); //
}, },
setClassificationInOffen (selectedArray) { setClassificationInOffen (selectedArray) {
this.classificationFinalSelected = selectedArray; this.classificationFinalSelected = selectedArray;
@ -280,7 +280,7 @@ export default {
let second = date.getSeconds(); let second = date.getSeconds();
localStorage.publishTime = year + ' 年 ' + month + ' 月 ' + day + ' 日 -- ' + hour + ' : ' + minute + ' : ' + second; localStorage.publishTime = year + ' 年 ' + month + ' 月 ' + day + ' 日 -- ' + hour + ' : ' + minute + ' : ' + second;
} else { } else {
localStorage.publishTime = this.publishTime; // localStorage.publishTime = this.publishTime; //
} }
localStorage.content = tinymce.activeEditor.getContent(); localStorage.content = tinymce.activeEditor.getContent();
this.$router.push({ this.$router.push({
@ -306,13 +306,13 @@ export default {
} }
}, },
handleSelectTag () { handleSelectTag () {
localStorage.tagsList = JSON.stringify(this.articleTagSelected); // localStorage.tagsList = JSON.stringify(this.articleTagSelected); //
} }
}, },
computed: { computed: {
completeUrl () { completeUrl () {
let finalUrl = this.fixedLink + this.articlePath; let finalUrl = this.fixedLink + this.articlePath;
localStorage.finalUrl = finalUrl; // localStorage.finalUrl = finalUrl; //
return finalUrl; return finalUrl;
} }
}, },

View File

@ -105,7 +105,7 @@ export default {
handleSwitch (lang) { handleSwitch (lang) {
this.lang = lang; this.lang = lang;
localStorage.lang = lang; localStorage.lang = lang;
this.$store.commit('switchLang', lang); // this.$store.commit('switchLang', lang); //
this.columnsI18n = [ this.columnsI18n = [
{ {
@ -116,7 +116,7 @@ export default {
key: 'company', key: 'company',
title: this.$t('company') title: this.$t('company')
} }
]; // iviewtable ]; // iviewtable
} }
}, },
computed: { computed: {

View File

@ -25,7 +25,7 @@ export default {
lockScreenBack.style.zIndex = -1; lockScreenBack.style.zIndex = -1;
lockScreenBack.style.boxShadow = '0 0 0 0 #667aa6 inset'; lockScreenBack.style.boxShadow = '0 0 0 0 #667aa6 inset';
this.$router.push({ this.$router.push({
name: Cookies.get('last_page_name') // name: Cookies.get('last_page_name') //
}); });
} }
}, },

View File

@ -51,7 +51,7 @@ export default {
}, },
methods: { methods: {
validator () { validator () {
return true; // ajaxthis.password return true; // ajaxthis.password
}, },
handleClickAvator () { handleClickAvator () {
this.avatorLeft = '-180px'; this.avatorLeft = '-180px';

View File

@ -164,7 +164,7 @@ export default {
this.moveToView(tag); this.moveToView(tag);
} }
}); });
}, 1); // bug }, 1); // bug
this.tagsCount = this.tagsList.length; this.tagsCount = this.tagsList.length;
}, },
watch: { watch: {

View File

@ -236,7 +236,7 @@ export default {
let file = e.target.files[0]; let file = e.target.files[0];
let reader = new FileReader(); let reader = new FileReader();
reader.onload = () => { reader.onload = () => {
this.cropper3.replace(reader.result, true); // truebug this.cropper3.replace(reader.result, true); // truebug
reader.onload = null; reader.onload = null;
}; };
reader.readAsDataURL(file); reader.readAsDataURL(file);

View File

@ -102,17 +102,17 @@ export default {
company: '', company: '',
department: '' department: ''
}, },
uid: '', // userId uid: '', // userId
securityCode: '', // securityCode: '', //
phoneHasChanged: false, // phoneHasChanged: false, //
save_loading: false, save_loading: false,
identifyError: '', // identifyError: '', //
editPasswordModal: false, // editPasswordModal: false, //
savePassLoading: false, savePassLoading: false,
oldPassError: '', oldPassError: '',
identifyCodeRight: false, // identifyCodeRight: false, //
hasGetIdentifyCode: false, // hasGetIdentifyCode: false, //
canGetIdentifyCode: false, // canGetIdentifyCode: false, //
checkIdentifyCodeLoading: false, checkIdentifyCodeLoading: false,
inforValidate: { inforValidate: {
name: [ name: [
@ -144,7 +144,7 @@ export default {
}, },
inputCodeVisible: false, // box inputCodeVisible: false, // box
initPhone: '', initPhone: '',
gettingIdentifyCodeBtnContent: '获取验证码' // gettingIdentifyCodeBtnContent: '获取验证码' //
}; };
}, },
methods: { methods: {
@ -188,9 +188,9 @@ export default {
saveEdit () { saveEdit () {
this.$refs['userForm'].validate((valid) => { this.$refs['userForm'].validate((valid) => {
if (valid) { if (valid) {
if (this.phoneHasChanged && this.userForm.cellphone !== this.initPhone) { // if (this.phoneHasChanged && this.userForm.cellphone !== this.initPhone) { //
if (this.hasGetIdentifyCode) { // if (this.hasGetIdentifyCode) { //
if (this.identifyCodeRight) { // if (this.identifyCodeRight) { //
this.saveInfoAjax(); this.saveInfoAjax();
} else { } else {
this.$Message.error('验证码错误,请重新输入'); this.$Message.error('验证码错误,请重新输入');