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
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