Commit 1d877a9b by 肖康

x

parent 1a878a07
......@@ -5,12 +5,10 @@ import filters from './filters'
import directive from './directive'
import { http } from './ajax/index.js';
import axios from 'axios'
import { showLoading, hideLoading } from './ajax/loading';
import Util from "./tool";
//本地环境开启提示信息
Vue.config.productionTip = false;
......@@ -82,8 +80,10 @@ axios.interceptors.response.use(res => {
hideLoading();
if(res.data.err_code==101){
//token验证失败
var path_=window.location.hash
path_=path_.substr(1)
console.log(path_)
window.location.href = '/#/login?referer=' + encodeURI(path_);
}
return res.data;
......
......@@ -46,7 +46,6 @@
Upload,
Message
} from 'element-ui'
import {Message as tips} from 'element-ui'
Vue.use(Form).use(FormItem).use(Input).use(Upload)
export default {
name: "message",
......@@ -91,8 +90,7 @@
contacts_name: this.userinfo.contacts_name
}).then(res => {
if (res.err_code === 0) {
tips("提交成功")
//Message("提交成功");
Message("提交成功");
sessionStorage.removeItem('userInfox')
} else {
Message(res.err_msg);
......@@ -102,8 +100,7 @@
},
handleAvatarSuccess(res, file) {
if (res.err_code === 0) {
console.log(2)
tips("设置成功")
Message("设置成功")
this.userinfo.avatar = URL.createObjectURL(file.raw);
sessionStorage.removeItem('userInfox')
} else {
......@@ -116,10 +113,10 @@
const isLt2M = file.size / 1024 / 1024 < 5;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG、PNG、GIF 格式!');
Message('上传头像图片只能是 JPG、PNG、GIF 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 5MB!');
Message('上传头像图片大小不能超过 5MB!');
}
return isJPG && isLt2M;
}
......
......@@ -1197,7 +1197,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\").default;\n\nvar _vue = _interopRequireDefault(__webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.runtime.esm.js\"));\n\nvar _App = _interopRequireDefault(__webpack_require__(/*! ./App.vue */ \"./src/App.vue\"));\n\nvar _router = _interopRequireDefault(__webpack_require__(/*! ./router */ \"./src/router/index.js\"));\n\nvar _filters = _interopRequireDefault(__webpack_require__(/*! ./filters */ \"./src/filters/index.js\"));\n\nvar _directive = _interopRequireDefault(__webpack_require__(/*! ./directive */ \"./src/directive/index.js\"));\n\nvar _index = __webpack_require__(/*! ./ajax/index.js */ \"./src/ajax/index.js\");\n\nvar _axios = _interopRequireDefault(__webpack_require__(/*! axios */ \"./node_modules/axios/index.js\"));\n\nvar _loading = __webpack_require__(/*! ./ajax/loading */ \"./src/ajax/loading.js\");\n\nvar _tool = _interopRequireDefault(__webpack_require__(/*! ./tool */ \"./src/tool/index.js\"));\n\n__webpack_require__(/*! @/assets/css/public/common.min.css */ \"./src/assets/css/public/common.min.css\");\n\n__webpack_require__(/*! @/assets/css/font/iconfont.css */ \"./src/assets/css/font/iconfont.css\");\n\n//本地环境开启提示信息\n_vue.default.config.productionTip = false; //加载全局样式\n\n//加载过滤器\nObject.keys(_filters.default).forEach(key => _vue.default.filter(key, _filters.default[key])); //加载自定义指令\n\n_vue.default.use(_directive.default); //处理顶部导航TAB\n\n\n_router.default.afterEach((to, from, next) => {\n if (to.path == \"/\" || to.path == \"/login\" || to.path == '/notfound') {\n return;\n }\n\n let tabOldArr = sessionStorage.getItem('tabs');\n let tabOldJson;\n let tabNewJson = [];\n\n if (tabOldArr) {\n tabOldJson = JSON.parse(tabOldArr);\n\n for (var i = 0; i < tabOldJson.length; i++) {\n tabNewJson.push(JSON.stringify(tabOldJson[i]));\n }\n\n if (tabNewJson.indexOf(JSON.stringify({\n path: to.path,\n title: to.meta.title,\n query: to.query\n })) == -1) {\n tabOldJson.push({\n path: to.path,\n title: to.meta.title,\n query: to.query\n });\n }\n } else {\n tabOldJson = [{\n path: to.path,\n title: to.meta.title,\n query: to.query\n }];\n }\n\n if (tabOldJson) {\n sessionStorage.setItem('tabs', JSON.stringify(tabOldJson));\n }\n});\n\n_axios.default.interceptors.request.use(config => {\n if (config.loading) {\n (0, _loading.showLoading)();\n }\n\n return config;\n}, err => {\n return Promise.reject(err);\n});\n\n_axios.default.interceptors.response.use(res => {\n (0, _loading.hideLoading)();\n\n if (res.data.err_code == 101) {\n //token验证失败\n var path_ = window.location.hash;\n path_ = path_.substr(1);\n window.location.href = '/#/login?referer=' + encodeURI(path_);\n }\n\n return res.data;\n}, error => {\n // Message('网络出现问题,请检查网络');\n (0, _loading.hideLoading)();\n return Promise.reject(new Error(error));\n}); //挂载到VUE原型上封装后的http请求\n\n\n_vue.default.prototype.$http = _index.http; //路由页面回跳处理 mate里面参数 back:true 开启登录态回跳\n\n_router.default.beforeEach((to, from, next) => {\n if (to.path == \"/login\" || to.path == '/notfound') {\n next();\n } else {\n let token = _tool.default.getCookie('token') || '';\n\n if (!token) {\n var path_ = window.location.hash;\n path_ = path_.substr(1);\n window.location.href = '/#/login?referer=' + encodeURI(path_);\n history.go(0);\n } else {\n next();\n }\n }\n});\n\nnew _vue.default({\n router: _router.default,\n render: h => h(_App.default)\n}).$mount(\"#app\");\n\n//# sourceURL=webpack:///./src/main.js?");
eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\").default;\n\nvar _vue = _interopRequireDefault(__webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.runtime.esm.js\"));\n\nvar _App = _interopRequireDefault(__webpack_require__(/*! ./App.vue */ \"./src/App.vue\"));\n\nvar _router = _interopRequireDefault(__webpack_require__(/*! ./router */ \"./src/router/index.js\"));\n\nvar _filters = _interopRequireDefault(__webpack_require__(/*! ./filters */ \"./src/filters/index.js\"));\n\nvar _directive = _interopRequireDefault(__webpack_require__(/*! ./directive */ \"./src/directive/index.js\"));\n\nvar _index = __webpack_require__(/*! ./ajax/index.js */ \"./src/ajax/index.js\");\n\nvar _axios = _interopRequireDefault(__webpack_require__(/*! axios */ \"./node_modules/axios/index.js\"));\n\nvar _loading = __webpack_require__(/*! ./ajax/loading */ \"./src/ajax/loading.js\");\n\nvar _tool = _interopRequireDefault(__webpack_require__(/*! ./tool */ \"./src/tool/index.js\"));\n\n__webpack_require__(/*! @/assets/css/public/common.min.css */ \"./src/assets/css/public/common.min.css\");\n\n__webpack_require__(/*! @/assets/css/font/iconfont.css */ \"./src/assets/css/font/iconfont.css\");\n\n//本地环境开启提示信息\n_vue.default.config.productionTip = false; //加载全局样式\n\n//加载过滤器\nObject.keys(_filters.default).forEach(key => _vue.default.filter(key, _filters.default[key])); //加载自定义指令\n\n_vue.default.use(_directive.default); //处理顶部导航TAB\n\n\n_router.default.afterEach((to, from, next) => {\n if (to.path == \"/\" || to.path == \"/login\" || to.path == '/notfound') {\n return;\n }\n\n let tabOldArr = sessionStorage.getItem('tabs');\n let tabOldJson;\n let tabNewJson = [];\n\n if (tabOldArr) {\n tabOldJson = JSON.parse(tabOldArr);\n\n for (var i = 0; i < tabOldJson.length; i++) {\n tabNewJson.push(JSON.stringify(tabOldJson[i]));\n }\n\n if (tabNewJson.indexOf(JSON.stringify({\n path: to.path,\n title: to.meta.title,\n query: to.query\n })) == -1) {\n tabOldJson.push({\n path: to.path,\n title: to.meta.title,\n query: to.query\n });\n }\n } else {\n tabOldJson = [{\n path: to.path,\n title: to.meta.title,\n query: to.query\n }];\n }\n\n if (tabOldJson) {\n sessionStorage.setItem('tabs', JSON.stringify(tabOldJson));\n }\n});\n\n_axios.default.interceptors.request.use(config => {\n if (config.loading) {\n (0, _loading.showLoading)();\n }\n\n return config;\n}, err => {\n return Promise.reject(err);\n});\n\n_axios.default.interceptors.response.use(res => {\n (0, _loading.hideLoading)();\n\n if (res.data.err_code == 101) {\n //token验证失败\n var path_ = window.location.hash;\n path_ = path_.substr(1);\n console.log(path_);\n window.location.href = '/#/login?referer=' + encodeURI(path_);\n }\n\n return res.data;\n}, error => {\n // Message('网络出现问题,请检查网络');\n (0, _loading.hideLoading)();\n return Promise.reject(new Error(error));\n}); //挂载到VUE原型上封装后的http请求\n\n\n_vue.default.prototype.$http = _index.http; //路由页面回跳处理 mate里面参数 back:true 开启登录态回跳\n\n_router.default.beforeEach((to, from, next) => {\n if (to.path == \"/login\" || to.path == '/notfound') {\n next();\n } else {\n let token = _tool.default.getCookie('token') || '';\n\n if (!token) {\n var path_ = window.location.hash;\n path_ = path_.substr(1);\n window.location.href = '/#/login?referer=' + encodeURI(path_);\n history.go(0);\n } else {\n next();\n }\n }\n});\n\nnew _vue.default({\n router: _router.default,\n render: h => h(_App.default)\n}).$mount(\"#app\");\n\n//# sourceURL=webpack:///./src/main.js?");
/***/ }),
......
......@@ -6,12 +6,12 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="http://yunxin.liexindev.net/favicon.ico">
<title>cloudsystem</title>
<link href="http://yunxin.liexindev.net/js/0.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/1.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/10.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/11.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/12.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/13.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/14.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/15.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/16.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/17.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/18.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/19.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/2.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/20.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/21.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/22.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/23.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/24.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/25.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/3.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/4.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/5.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/6.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/7.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/8.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/9.js" rel="prefetch"><link href="http://yunxin.liexindev.net/app.cba3f31c6299d34b0be0.js" rel="preload" as="script"></head>
<link href="http://yunxin.liexindev.net/js/0.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/1.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/10.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/11.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/12.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/13.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/14.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/15.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/16.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/17.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/18.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/19.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/2.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/20.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/21.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/22.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/23.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/24.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/25.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/3.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/4.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/5.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/6.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/7.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/8.js" rel="prefetch"><link href="http://yunxin.liexindev.net/js/9.js" rel="prefetch"><link href="http://yunxin.liexindev.net/app.3633839a1950c0e58122.js" rel="preload" as="script"></head>
<body>
<noscript>
<strong>网络异常,请稍后加载</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="text/javascript" src="http://yunxin.liexindev.net/app.cba3f31c6299d34b0be0.js"></script></body>
<script type="text/javascript" src="http://yunxin.liexindev.net/app.3633839a1950c0e58122.js"></script></body>
</html>
......@@ -8,7 +8,7 @@
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\").default;\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _message = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/theme-chalk/message.css */ \"./node_modules/element-ui/lib/theme-chalk/message.css\"));\n\n__webpack_require__(/*! element-ui/lib/theme-chalk/base.css */ \"./node_modules/element-ui/lib/theme-chalk/base.css\");\n\nvar _message2 = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/message */ \"./node_modules/element-ui/lib/message.js\"));\n\nvar _form = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/theme-chalk/form.css */ \"./node_modules/element-ui/lib/theme-chalk/form.css\"));\n\nvar _form2 = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/form */ \"./node_modules/element-ui/lib/form.js\"));\n\nvar _formItem = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/theme-chalk/form-item.css */ \"./node_modules/element-ui/lib/theme-chalk/form-item.css\"));\n\nvar _formItem2 = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/form-item */ \"./node_modules/element-ui/lib/form-item.js\"));\n\nvar _input = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/theme-chalk/input.css */ \"./node_modules/element-ui/lib/theme-chalk/input.css\"));\n\nvar _input2 = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/input */ \"./node_modules/element-ui/lib/input.js\"));\n\nvar _upload = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/theme-chalk/upload.css */ \"./node_modules/element-ui/lib/theme-chalk/upload.css\"));\n\nvar _upload2 = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/upload */ \"./node_modules/element-ui/lib/upload.js\"));\n\nvar _vue = _interopRequireDefault(__webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.runtime.esm.js\"));\n\nvar _menu = _interopRequireDefault(__webpack_require__(/*! @/components/menu.vue */ \"./src/components/menu.vue\"));\n\nvar _ajax = __webpack_require__(/*! ../../ajax */ \"./src/ajax/index.js\");\n\nvar _tool = _interopRequireDefault(__webpack_require__(/*! ../../tool */ \"./src/tool/index.js\"));\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n_vue.default.use(_form2.default).use(_formItem2.default).use(_input2.default).use(_upload2.default);\n\nvar _default = {\n name: \"message\",\n\n data() {\n return {\n upUrl: _ajax.NODE_ENVS + '/api/user/setavatar',\n fileData: {\n token: _tool.default.getCookie('token')\n },\n userinfo: {\n company_name: '',\n contacts_name: '',\n mobile: '',\n email: '',\n avatar: 'http://img.ichunt.com/test/images/ichunt/9f/34/9f349b1400f659e5ad270412d4dbe160.jpg'\n }\n };\n },\n\n watch: {},\n\n created() {\n this.getUseInfo();\n },\n\n computed: {},\n methods: {\n getUseInfo() {\n var userInfo_ = sessionStorage.getItem('userInfox');\n\n if (userInfo_) {\n this.userinfo = JSON.parse(userInfo_);\n } else {\n this.$http('get', \"/api/user/getuserinfo\").then(res => {\n this.userinfo = res.data;\n\n if (res.data) {\n sessionStorage.setItem('userInfox', JSON.stringify(res.data));\n }\n });\n }\n },\n\n submituser() {\n this.$http('post', \"/api/user/setuserinfo\", {\n email: this.userinfo.email,\n contacts_name: this.userinfo.contacts_name\n }).then(res => {\n if (res.err_code === 0) {\n (0, _message2.default)(\"提交成功\"); //Message(\"提交成功\");\n\n sessionStorage.removeItem('userInfox');\n } else {\n _Message(res.err_msg);\n }\n });\n },\n\n handleAvatarSuccess(res, file) {\n if (res.err_code === 0) {\n console.log(2);\n\n _Message(\"设置成功\");\n\n this.userinfo.avatar = URL.createObjectURL(file.raw);\n sessionStorage.removeItem('userInfox');\n } else {\n _Message(res.err_msg);\n }\n },\n\n beforeAvatarUpload(file) {\n const isJPG = file.type === 'image/jpeg' || 'image/png' || 'image/jpg' || 'image/gif';\n const isLt2M = file.size / 1024 / 1024 < 5;\n\n if (!isJPG) {\n this.$message.error('上传头像图片只能是 JPG、PNG、GIF 格式!');\n }\n\n if (!isLt2M) {\n this.$message.error('上传头像图片大小不能超过 5MB!');\n }\n\n return isJPG && isLt2M;\n }\n\n },\n components: {\n Menu: _menu.default\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack:///./src/views/Info/message.vue?./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options");
eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\").default;\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _message = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/theme-chalk/message.css */ \"./node_modules/element-ui/lib/theme-chalk/message.css\"));\n\n__webpack_require__(/*! element-ui/lib/theme-chalk/base.css */ \"./node_modules/element-ui/lib/theme-chalk/base.css\");\n\nvar _message2 = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/message */ \"./node_modules/element-ui/lib/message.js\"));\n\nvar _form = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/theme-chalk/form.css */ \"./node_modules/element-ui/lib/theme-chalk/form.css\"));\n\nvar _form2 = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/form */ \"./node_modules/element-ui/lib/form.js\"));\n\nvar _formItem = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/theme-chalk/form-item.css */ \"./node_modules/element-ui/lib/theme-chalk/form-item.css\"));\n\nvar _formItem2 = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/form-item */ \"./node_modules/element-ui/lib/form-item.js\"));\n\nvar _input = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/theme-chalk/input.css */ \"./node_modules/element-ui/lib/theme-chalk/input.css\"));\n\nvar _input2 = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/input */ \"./node_modules/element-ui/lib/input.js\"));\n\nvar _upload = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/theme-chalk/upload.css */ \"./node_modules/element-ui/lib/theme-chalk/upload.css\"));\n\nvar _upload2 = _interopRequireDefault(__webpack_require__(/*! element-ui/lib/upload */ \"./node_modules/element-ui/lib/upload.js\"));\n\nvar _vue = _interopRequireDefault(__webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.runtime.esm.js\"));\n\nvar _menu = _interopRequireDefault(__webpack_require__(/*! @/components/menu.vue */ \"./src/components/menu.vue\"));\n\nvar _ajax = __webpack_require__(/*! ../../ajax */ \"./src/ajax/index.js\");\n\nvar _tool = _interopRequireDefault(__webpack_require__(/*! ../../tool */ \"./src/tool/index.js\"));\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n_vue.default.use(_form2.default).use(_formItem2.default).use(_input2.default).use(_upload2.default);\n\nvar _default = {\n name: \"message\",\n\n data() {\n return {\n upUrl: _ajax.NODE_ENVS + '/api/user/setavatar',\n fileData: {\n token: _tool.default.getCookie('token')\n },\n userinfo: {\n company_name: '',\n contacts_name: '',\n mobile: '',\n email: '',\n avatar: 'http://img.ichunt.com/test/images/ichunt/9f/34/9f349b1400f659e5ad270412d4dbe160.jpg'\n }\n };\n },\n\n watch: {},\n\n created() {\n this.getUseInfo();\n },\n\n computed: {},\n methods: {\n getUseInfo() {\n var userInfo_ = sessionStorage.getItem('userInfox');\n\n if (userInfo_) {\n this.userinfo = JSON.parse(userInfo_);\n } else {\n this.$http('get', \"/api/user/getuserinfo\").then(res => {\n this.userinfo = res.data;\n\n if (res.data) {\n sessionStorage.setItem('userInfox', JSON.stringify(res.data));\n }\n });\n }\n },\n\n submituser() {\n this.$http('post', \"/api/user/setuserinfo\", {\n email: this.userinfo.email,\n contacts_name: this.userinfo.contacts_name\n }).then(res => {\n if (res.err_code === 0) {\n (0, _message2.default)(\"提交成功\");\n sessionStorage.removeItem('userInfox');\n } else {\n _Message(res.err_msg);\n }\n });\n },\n\n handleAvatarSuccess(res, file) {\n if (res.err_code === 0) {\n _Message(\"设置成功\");\n\n this.userinfo.avatar = URL.createObjectURL(file.raw);\n sessionStorage.removeItem('userInfox');\n } else {\n _Message(res.err_msg);\n }\n },\n\n beforeAvatarUpload(file) {\n const isJPG = file.type === 'image/jpeg' || 'image/png' || 'image/jpg' || 'image/gif';\n const isLt2M = file.size / 1024 / 1024 < 5;\n\n if (!isJPG) {\n _Message('上传头像图片只能是 JPG、PNG、GIF 格式!');\n }\n\n if (!isLt2M) {\n _Message('上传头像图片大小不能超过 5MB!');\n }\n\n return isJPG && isLt2M;\n }\n\n },\n components: {\n Menu: _menu.default\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack:///./src/views/Info/message.vue?./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options");
/***/ }),
......
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