Commit 68d84cfc by liangjianmin

Merge branch 'master' of http://119.23.72.7/xiaokang/cloudSystem

# Conflicts:
#	src/assets/css/info/message.min.css
css
parents 8cc0e0e4 1c250cc5
...@@ -28,7 +28,8 @@ switch (envs) { ...@@ -28,7 +28,8 @@ switch (envs) {
} }
export const http = (method, url, param) => { export const http = (method, url, param,loading) => {
//loading 默认加载loading 传1 不加载
param = param && typeof param === 'object' ? param : {}; param = param && typeof param === 'object' ? param : {};
let token = Util.getCookie('token') || ''; let token = Util.getCookie('token') || '';
const config = { const config = {
...@@ -39,7 +40,8 @@ export const http = (method, url, param) => { ...@@ -39,7 +40,8 @@ export const http = (method, url, param) => {
}], }],
headers: { headers: {
'Authorization': 'Bearer ' + token 'Authorization': 'Bearer ' + token
} },
loading:(loading?false:true)
}; };
// post请求时需要设定Content-Type // post请求时需要设定Content-Type
......
import Vue from 'vue';
import { Loading } from 'element-ui';
Vue.use(Loading)
let loadingCount = 0;
let loading;
const startLoading = () => {
loading = Loading.service({
lock: true,
// text: '加载中……',
background: 'rgba(255, 255, 255, 0)'
});
};
const endLoading = () => {
loading.close();
};
export const showLoading = () => {
if (loadingCount === 0) {
startLoading();
}
loadingCount += 1;
};
export const hideLoading = () => {
if (loadingCount <= 0) {
return;
}
loadingCount -= 1;
if (loadingCount === 0) {
endLoading();
}
};
\ No newline at end of file
...@@ -45,6 +45,32 @@ ...@@ -45,6 +45,32 @@
} }
} }
} }
.up-box{
position: relative;
margin-left: 90px;
padding-top: 37px;
.avatar-uploader{
width: 98px;
height: 34px;
border-radius: 2px;
border: 1px solid #BEC9DF;
overflow: hidden;
line-height: 34px;
font-size: 14px;
color:#646B78;
.iconfont{font-size: 18px;position: relative;top:-1px;margin-left: 10px;}
&:hover,.el-upload--picture-card:hover, .el-upload:focus{
color:#1969F9!important;
border-color: #1969F9!important;
}
}
.imspre{
width:100px;
height:100px;
border-radius: 50px;
margin-bottom: 16px;
}
}
} }
} }
\ No newline at end of file
.messagexk .message-box { .messagexk .message-box{background:#fff;padding:20px;height:calc(100vh - 136px)}.messagexk .message-box .h3{font-size:16px;color:#333;font-weight:bold;position:relative}.messagexk .message-box .h3::before{content:"";width:3px;height:100%;background:#1969F9;position:absolute;left:-20px;top:0px}.messagexk .message-box .el-form{float:left;padding-top:35px}.messagexk .message-box .el-form .el-form-item__label{color:#333}.messagexk .message-box .el-form .el-input{width:280px;color:#333}.messagexk .message-box .el-form .el-input.is-disabled .el-input__inner{background:#F1F4FA;border:1px solid #F1F4FA;color:#333}.messagexk .message-box .el-form .submits{margin-top:26px;cursor:pointer;width:76px;height:37px;line-height:37px;background:#1969F9;border-radius:2px;font-size:14px;color:#fff;text-align:center}.messagexk .message-box .el-form .submits:hover{background:#0050E0}.messagexk .message-box .up-box{position:relative;margin-left:90px;padding-top:37px}.messagexk .message-box .up-box .avatar-uploader{width:98px;height:34px;border-radius:2px;border:1px solid #BEC9DF;overflow:hidden;line-height:34px;font-size:14px;color:#646B78}.messagexk .message-box .up-box .avatar-uploader .iconfont{font-size:18px;position:relative;top:-1px;margin-left:10px}.messagexk .message-box .up-box .avatar-uploader:hover,.messagexk .message-box .up-box .avatar-uploader .el-upload--picture-card:hover,.messagexk .message-box .up-box .avatar-uploader .el-upload:focus{color:#1969F9 !important;border-color:#1969F9 !important}.messagexk .message-box .up-box .imspre{width:100px;height:100px;border-radius:50px;margin-bottom:16px}
background: #fff; \ No newline at end of file
padding: 20px;
height: calc(100vh - 136px);
}
.messagexk .message-box .h3 {
font-size: 16px;
color: #333;
font-weight: bold;
position: relative;
}
.messagexk .message-box .h3::before {
content: "";
width: 3px;
height: 100%;
background: #1969F9;
position: absolute;
left: -20px;
top: 0px;
}
.messagexk .message-box .el-form {
float: left;
padding-top: 35px;
}
.messagexk .message-box .el-form .el-form-item__label {
color: #333;
}
.messagexk .message-box .el-form .el-input {
width: 280px;
color: #333;
}
.messagexk .message-box .el-form .el-input.is-disabled .el-input__inner {
background: #F1F4FA;
border: 1px solid #F1F4FA;
color: #333;
}
.messagexk .message-box .el-form .submits {
margin-top: 26px;
cursor: pointer;
width: 76px;
height: 37px;
line-height: 37px;
background: #1969F9;
border-radius: 2px;
font-size: 14px;
color: #fff;
text-align: center;
}
.messagexk .message-box .el-form .submits:hover {
background: #0050E0;
}
/*# sourceMappingURL=message.min.css.map */
\ No newline at end of file
...@@ -8,13 +8,15 @@ ...@@ -8,13 +8,15 @@
<font class="fl">概况</font> <font class="fl">概况</font>
</a> </a>
<a class="item fl" :class="{'act':(JSON.stringify(item)==JSON.stringify({path: $route.path,title: $route.meta.title,query:$route.query}))}" @click="tabUrl(item)" v-for="item in tabs"> <a class="item fl"
:class="{'act':(JSON.stringify(item)==JSON.stringify({path: $route.path,title: $route.meta.title,query:$route.query}))}"
@click="tabUrl(item)" v-for="item in tabs">
<font class="fl">{{item.title}}</font> <font class="fl">{{item.title}}</font>
<span class="icon iconfont fl" @click.stop="closetab(item.path)"></span> <span class="icon iconfont fl" @click.stop="closetab(item.path)"></span>
</a> </a>
</div> </div>
<div class="user-box fr"> <div class="user-box fr">
<!-- <div class="line"></div> <!-- <div class="line"></div>
<a class="msgh fl" href="#"> <a class="msgh fl" href="#">
<span class="icon iconfont"></span> <span class="icon iconfont"></span>
<font>55</font> <font>55</font>
...@@ -45,8 +47,8 @@ ...@@ -45,8 +47,8 @@
</div> </div>
<el-menu class="el-menu-vertical-demo" @open="handleOpen" active-text-color="#1969F9" router <el-menu class="el-menu-vertical-demo" @open="handleOpen" active-text-color="#1969F9" router
:default-active="$route.path" :router="true" :unique-opened="true" @close="handleClose" :default-active="$route.path" :router="true" :unique-opened="true" @close="handleClose"
@select="handleSelect"> @select="handleSelect">
<el-menu-item :index="'/'" :class="{'indextab':isIndexTab}"> <el-menu-item :index="'/'" :class="{'indextab':isIndexTab}">
<template slot="title"> <template slot="title">
<span class="icon iconfont"></span> <span class="icon iconfont"></span>
...@@ -140,164 +142,178 @@ ...@@ -140,164 +142,178 @@
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import Util from "../tool"; import Util from "../tool";
import { import {
Form, Form,
FormItem, FormItem,
Menu, Menu,
MenuItem, MenuItem,
Submenu, Submenu,
MenuItemGroup, MenuItemGroup,
Message, Message,
Dialog, Dialog,
Button Button
} from 'element-ui' } from 'element-ui'
Vue.use(Menu).use(MenuItem).use(MenuItemGroup).use(Submenu).use(Form).use(FormItem).use(Dialog).use(Button); Vue.use(Menu).use(MenuItem).use(MenuItemGroup).use(Submenu).use(Form).use(FormItem).use(Dialog).use(Button);
export default { export default {
name: 'menus', name: 'menus',
props: {}, props: {},
created() { created() {
this.getData(); this.getData();
},
data() {
return {
userinfo: {},
collapse: false,
isIndexTab: true,
tabSure: "",
tabs: "",
dialogVisible: false,
ruleForm: {
name: ''
}, },
rules: { data() {
name: [ return {
{required: true, message: '请输入活动名称', trigger: 'blur'} userinfo: {},
] collapse: false,
} isIndexTab: true,
} tabSure: "",
}, tabs: "",
watch: { dialogVisible: false,
$route(to, from) { ruleForm: {
let tab_arr = sessionStorage.getItem('tabs') name: ''
if (tab_arr) { },
this.tabs = JSON.parse(tab_arr); rules: {
} name: [{
required: true,
message: '请输入活动名称',
trigger: 'blur'
}]
}
}
},
watch: {
$route(to, from) {
let tab_arr = sessionStorage.getItem('tabs')
if (tab_arr) {
this.tabs = JSON.parse(tab_arr);
}
let app_ = document.getElementById('app'); let app_ = document.getElementById('app');
this.collapse = false this.collapse = false
if (this.collapse) { if (this.collapse) {
app_.setAttribute('style', 'padding-left:62px'); app_.setAttribute('style', 'padding-left:62px');
} else { } else {
app_.setAttribute('style', 'padding-left:226px'); app_.setAttribute('style', 'padding-left:226px');
} }
} }
}, },
mounted() { mounted() {
this.tabss(this.$route.path) this.tabss(this.$route.path)
}, },
methods: { methods: {
getData() { getData() {
this.$http('get', "/api/user/getuserinfo").then(res => { var userInfo_ = sessionStorage.getItem('userInfox');
this.userinfo = res.data; if (userInfo_) {
}).catch(err => { this.userinfo = JSON.parse(userInfo_);
} else {
}) this.$http('get', "/api/user/getuserinfo").then(res => {
}, this.userinfo = res.data;
tabUrl(item) { if(res.data){
this.$router.push({path: item.path, query: item.query}) sessionStorage.setItem('userInfox', JSON.stringify(res.data));
}, }
changePwd() {
this.dialogVisible = true; })
}, }
tabss(lk) {
if (lk == "/") { },
this.tabSure = 1 tabUrl(item) {
}
if (lk == "/inquire" || lk == "/quote") {
this.tabSure = 2
}
if (lk == "/list" || lk == "/enter") {
this.tabSure = 3
}
if (lk == "/goods" || lk == "/brand") {
this.tabSure = 4
}
if (lk == "/message") {
this.tabSure = 5
}
let tab_arr = sessionStorage.getItem('tabs')
if (tab_arr) {
this.tabs = JSON.parse(tab_arr);
}
},
closetab(path) {
let tab_arr = JSON.parse(sessionStorage.getItem('tabs'))
for (var i = 0; i < tab_arr.length; i++) {
if (tab_arr[i].path == path) {
tab_arr.splice(i, 1);
sessionStorage.setItem('tabs', JSON.stringify(tab_arr));
this.tabs = tab_arr;
if (path == this.$route.path) {
if (i == 0) {
this.$router.push({ this.$router.push({
path: "/", path: item.path,
query: item.query
}) })
} else { },
this.$router.push({ changePwd() {
path: tab_arr[i - 1].path, this.dialogVisible = true;
},
tabss(lk) {
if (lk == "/") {
this.tabSure = 1
}
if (lk == "/inquire" || lk == "/quote") {
this.tabSure = 2
}
if (lk == "/list" || lk == "/enter") {
this.tabSure = 3
}
if (lk == "/goods" || lk == "/brand") {
this.tabSure = 4
}
if (lk == "/message") {
this.tabSure = 5
}
let tab_arr = sessionStorage.getItem('tabs')
if (tab_arr) {
this.tabs = JSON.parse(tab_arr);
}
},
closetab(path) {
let tab_arr = JSON.parse(sessionStorage.getItem('tabs'))
for (var i = 0; i < tab_arr.length; i++) {
if (tab_arr[i].path == path) {
tab_arr.splice(i, 1);
sessionStorage.setItem('tabs', JSON.stringify(tab_arr));
this.tabs = tab_arr;
if (path == this.$route.path) {
if (i == 0) {
this.$router.push({
path: "/",
})
} else {
this.$router.push({
path: tab_arr[i - 1].path,
})
}
}
break;
}
}
},
zk() {
this.collapse = !this.collapse;
let app_ = document.getElementById('app');
if (this.collapse) {
app_.setAttribute('style', 'padding-left:62px');
} else {
app_.setAttribute('style', 'padding-left:226px');
}
},
handleOpen(key, keyPath) {
if (this.$route.path == "/") {
this.isIndexTab = false
}
},
handleClose(key, keyPath) {
if (this.$route.path == "/") {
this.isIndexTab = true
}
},
handleSelect(key, keyPath) {
this.tabss(key)
},
logout() {
this.$http('POST', "/auth/logout").then(res => {
Util.delCookie('token');
if (res.err_code === 0) {
window.location.href = '/#/login';
sessionStorage.removeItem('userInfox')
history.go(0);
} else {
Message(res.err_msg);
}
}).catch(err => {
console.log(err.message);
}) })
}
} }
break;
}
}
},
zk() {
this.collapse = !this.collapse;
let app_ = document.getElementById('app');
if (this.collapse) {
app_.setAttribute('style', 'padding-left:62px');
} else {
app_.setAttribute('style', 'padding-left:226px');
}
},
handleOpen(key, keyPath) {
if (this.$route.path == "/") {
this.isIndexTab = false
}
},
handleClose(key, keyPath) {
if (this.$route.path == "/") {
this.isIndexTab = true
} }
},
handleSelect(key, keyPath) {
this.tabss(key)
},
logout() {
this.$http('POST', "/auth/logout").then(res => {
Util.delCookie('token');
if (res.err_code === 0) {
window.location.href = '/#/login';
history.go(0);
} else {
Message(res.err_msg);
}
}).catch(err => {
console.log(err.message);
})
}
} }
}
</script> </script>
<style lang="less"> <style lang="less">
......
import {dateTimeFormate,dateTimeFormate1} from './formate'; import {dateTimeFormate} from './formate';
export default { export default {
dateTimeFormate, dateTimeFormate,
dateTimeFormate1,
}; };
...@@ -3,9 +3,10 @@ import App from "./App.vue"; ...@@ -3,9 +3,10 @@ import App from "./App.vue";
import router from "./router"; import router from "./router";
import filters from './filters' import filters from './filters'
import directive from './directive' import directive from './directive'
import {http} from './ajax/index.js'; import { http } from './ajax/index.js';
import axios from 'axios' import axios from 'axios'
import {Message} from 'element-ui'; import { Message } from 'element-ui';
import { showLoading, hideLoading } from './ajax/loading';
import Util from "./tool"; import Util from "./tool";
//本地环境开启提示信息 //本地环境开启提示信息
...@@ -24,7 +25,7 @@ Vue.use(directive); ...@@ -24,7 +25,7 @@ Vue.use(directive);
//处理顶部导航TAB //处理顶部导航TAB
router.afterEach((to, from, next) => { router.afterEach((to, from, next) => {
if (to.path == "/"||to.path == "/login") { if (to.path == "/" || to.path == "/login") {
return return
} }
let tabOldArr = sessionStorage.getItem('tabs'); let tabOldArr = sessionStorage.getItem('tabs');
...@@ -38,12 +39,13 @@ router.afterEach((to, from, next) => { ...@@ -38,12 +39,13 @@ router.afterEach((to, from, next) => {
if (tabNewJson.indexOf(JSON.stringify({ if (tabNewJson.indexOf(JSON.stringify({
path: to.path, path: to.path,
title: to.meta.title, title: to.meta.title,
query:to.query query: to.query
})) == -1) { })) == -1) {
console.log(tabOldJson)
tabOldJson.push({ tabOldJson.push({
path: to.path, path: to.path,
title: to.meta.title, title: to.meta.title,
query:to.query query: to.query
}) })
} }
} else { } else {
...@@ -51,21 +53,35 @@ router.afterEach((to, from, next) => { ...@@ -51,21 +53,35 @@ router.afterEach((to, from, next) => {
{ {
path: to.path, path: to.path,
title: to.meta.title, title: to.meta.title,
query:to.query query: to.query
} }
] ]
} }
if (tabOldJson) { if (tabOldJson) {
sessionStorage.setItem('tabs', JSON.stringify(tabOldJson)); sessionStorage.setItem('tabs', JSON.stringify(tabOldJson));
} }
}); });
axios.interceptors.request.use((config) => {
if(config.loading){
showLoading();
}
return config;
}, (err) => {
return Promise.reject(err)
})
axios.interceptors.response.use(res => { axios.interceptors.response.use(res => {
hideLoading();
return res.data; return res.data;
}, error => { }, error => {
// Message('网络出现问题,请检查网络'); // Message('网络出现问题,请检查网络');
hideLoading();
return Promise.reject(new Error(error)) return Promise.reject(new Error(error))
}) })
......
<template> <template>
<div class="messagexk pagex"> <div class="messagexk pagex">
<div class="message-box"> <div class="message-box">
<div class="h3">基本信息</div> <div class="h3">基本信息</div>
<el-form :model="form" label-width="90px"> <el-form :model="userinfo" label-width="90px">
<el-form-item label="公司名称"> <el-form-item label="公司名称">
<el-input v-model="form.keyword" placeholder="" disabled></el-input> <el-input v-model="userinfo.company_name" placeholder="" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="联系人"> <el-form-item label="联系人">
<el-input v-model="form.keyword"></el-input> <el-input v-model="userinfo.contacts_name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="联系人电话"> <el-form-item label="联系人电话">
<el-input v-model="form.keyword" disabled></el-input> <el-input v-model="userinfo.mobile" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="邮箱"> <el-form-item label="邮箱">
<el-input v-model="form.keyword"></el-input> <el-input v-model="userinfo.email"></el-input>
</el-form-item> </el-form-item>
<el-form-item > <el-form-item>
<div class="submits">确认</div> <div class="submits" @click="submituser">确认</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> <div class="fl up-box">
<Menu/> <img :src="userinfo.avatar" class="imspre" />
<el-upload class="avatar-uploader" :action="upUrl" :show-file-list="false" :on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<span class="icon iconfont fl"></span>
<div class="fl">更换头像</div>
</el-upload>
</div>
</div> </div>
<Menu />
</div>
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import Menu from "@/components/menu.vue"; import Menu from "@/components/menu.vue";
import {
NODE_ENVS
} from "../../ajax";
import { import {
Form, Form,
FormItem, FormItem,
Input, Input,
Message Upload,
Message
} from 'element-ui' } from 'element-ui'
Vue.use(Form).use(FormItem).use(Input) Vue.use(Form).use(FormItem).use(Input).use(Upload)
export default { export default {
name: "message", name: "message",
data() { data() {
return { return {
form:{ upUrl: NODE_ENVS + '/api/user/setavatar',
keyword:"" userinfo: {
company_name: '',
contacts_name: '',
mobile: '',
email: '',
avatar: 'http://img.ichunt.com/test/images/ichunt/9f/34/9f349b1400f659e5ad270412d4dbe160.jpg'
} }
}; };
}, },
watch: {}, watch: {},
created() { created() {
this.getUseInfo()
}, },
computed: {}, computed: {},
methods: { methods: {
getUseInfo() {
var userInfo_ = sessionStorage.getItem('userInfox');
if (userInfo_) {
this.userinfo = JSON.parse(userInfo_);
} else {
this.$http('get', "/api/user/getuserinfo").then(res => {
this.userinfo = res.data;
if (res.data) {
sessionStorage.setItem('userInfox', JSON.stringify(res.data));
}
})
}
},
submituser() {
this.$http('post', "/api/user/setuserinfo", {
email: this.userinfo.email,
contacts_name: this.userinfo.contacts_name
}).then(res => {
if (res.err_code === 0) {
Message("提交成功");
sessionStorage.removeItem('userInfox')
} else {
Message(res.err_msg);
}
})
},
handleAvatarSuccess(res, file) {
if (res.err_code === 0) {
Message("设置成功")
this.userinfo.avatar = URL.createObjectURL(file.raw);
sessionStorage.removeItem('userInfox')
} else {
Message(res.err_msg);
}
},
beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg' || 'image/png' || 'image/jpg' || 'image/gif';
const isLt2M = file.size / 1024 / 1024 < 5;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG、PNG、GIF 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 5MB!');
}
return isJPG && isLt2M;
}
}, },
components: { components: {
...@@ -59,5 +126,5 @@ ...@@ -59,5 +126,5 @@
}; };
</script> </script>
<style scoped> <style scoped>
@import "../../assets/css/info/message.min.css"; @import "../../assets/css/info/message.min.css";
</style> </style>
\ No newline at end of file
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 sign in to comment