|
|
- webpackJsonp([32],{
-
- /***/ "4fo2":
- /***/ (function(module, exports) {
-
- // removed by extract-text-webpack-plugin
-
- /***/ }),
-
- /***/ "lmfZ":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
-
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
-
- // EXTERNAL MODULE: ./node_modules/babel-runtime/core-js/json/stringify.js
- var stringify = __webpack_require__("mvHQ");
- var stringify_default = /*#__PURE__*/__webpack_require__.n(stringify);
-
- // EXTERNAL MODULE: ./src/api/index.js + 5 modules
- var api = __webpack_require__("gyMJ");
-
- // EXTERNAL MODULE: ./node_modules/axios/index.js
- var axios = __webpack_require__("mtWM");
- var axios_default = /*#__PURE__*/__webpack_require__.n(axios);
-
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/Login.vue
-
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
-
-
-
- /* harmony default export */ var Login = ({
- data: function data() {
- return {
- param: {
- username: "",
- password: "",
- code: ""
- },
- signature: "",
- rules: {
- username: [{
- required: true,
- message: "请输入用户名",
- trigger: "blur"
- }],
- password: [{
- required: true,
- message: "请输入密码",
- trigger: "blur"
- }],
- code: [{
- required: true,
- message: "请输入验证码",
- trigger: "blur"
- }]
- },
- code: "",
- checkCode: "",
- options: [],
- value: '',
- tenantId: ''
- };
- },
- created: function created() {
- var _this2 = this;
-
- this.$store.commit("clearTags");
- Object(api["e" /* httpGet1 */])("", "/oauth/key").then(function (res) {
- _this2.code = res.data;
- });
- var data = {
- signature: this.signature
- };
- Object(api["e" /* httpGet1 */])(data, this.$api.getCheckCode).then(function (res) {
- _this2.checkCode = res.data;
- _this2.signature = res.data.signature;
- });
- },
- mounted: function mounted() {
- document.addEventListener('keydown', this.keyDown);
- },
-
- methods: {
- getuserid: function getuserid() {
- Object(api["d" /* httpGet */])('', this.$api.getUserid).then(function (res) {});
- },
- getConfig: function getConfig() {
- var _this3 = this;
-
- Object(api["e" /* httpGet1 */])('', this.$api.getConfig).then(function (res) {
- if (res.success) {
- _this3.options = res.data.list;
- } else {
- _this3.$message.error("获取失败");
- }
- });
- },
- selectTenantId: function selectTenantId(e) {
- this.tenantId = e;
- localStorage.setItem('tenantId', this.tenantId);
- this.$tenantId = e;
- },
- keyDown: function keyDown(e) {
- //如果是回车则执行登录方法
- if (e.keyCode == 13) {
- if (this.$route.name == 'Login') {
- this.submitForm();
- }
- }
- },
-
- // 刷新验证码
- codesx: function codesx() {
- var _this4 = this;
-
- var data = {
- signature: this.signature
- };
- Object(api["e" /* httpGet1 */])(data, this.$api.getCheckCode).then(function (res) {
- _this4.checkCode = res.data;
- _this4.signature = res.data.signature;
- });
- },
-
- // 回调-页面权限
- backfun: function backfun(i18n, callback) {
- if (i18n.subs) {
- callback(i18n.subs[0], callback);
- } else {
- return i18n.index;
- }
- },
- getChidlren: function getChidlren(data, key, value) {
- var hasFound = false,
- // 表示是否有找到id值
- result = null;
- var fn = function fn(data) {
- if (!hasFound) {
- // 判断是否是数组并且没有的情况下,
- data.forEach(function (item) {
- if (item[key] === value) {
- // 数据循环每个子项,并且判断子项下边是否有id值
- result = item; // 返回的结果等于每一项
- hasFound = true; // 并且找到id值
- } else if (item.subs) {
- fn(item.subs); // 递归调用下边的子项
- }
- });
- }
- };
- fn(data); // 调用一下
- return result;
- },
- submitForm: function submitForm() {
- var _this5 = this;
-
- localStorage.setItem('tenantId', '');
- // if (this.tenantId == '') {
- // this.$message.success("请选择客户");
- // return
- // }
- var loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)"
- });
- var _this = this;
- var fd = new FormData();
- fd.append("client_id", "iot-client");
- fd.append("client_secret", Object(api["j" /* setCode */])(this.code, "iot-client"));
- fd.append("grant_type", "password");
- fd.append("scope", "all");
- fd.append("username", this.param.username);
- fd.append("password", Object(api["j" /* setCode */])(this.code, this.param.password));
- if (this.param.code == '' || this.signature == '') {
- loading.close();
- this.$message.error("请输入验证码");
- return;
- }
- var datacode = {
- code: this.param.code.toUpperCase(),
- signature: this.signature
- };
- var info = JSON.parse(localStorage.getItem('info'));
- // localStorage.setItem("ms_username", 'zw001');
- // _this.$router.push("/");
- Object(api["h" /* httpPost1 */])(datacode, this.$api.checkCodeMatches).then(function (res) {
- if (res.data.pass) {
- Object(api["g" /* httpPost */])(fd, _this5.$api.postLogin).then(function (res1) {
- if (res1.access_token) {
- // httpGet({}, '/oauth/revoke').then(res4 => { })
- _this.$message.success("登录成功");
- _this5.param.code = '';
- _this5.signature = '';
- localStorage.setItem("tokenkey", stringify_default()(res1));
- localStorage.setItem("ms_username", _this.param.username);
- Object(api["d" /* httpGet */])('', _this5.$api.userInfo).then(function (res3) {
- var tenantId = res3.data.tenantId.split(',');
- // localStorage.setItem('tenantId',tenantId[0])
- localStorage.setItem('info', stringify_default()(res3.data));
- // this.$store.commit("getselectoption")
- _this5.$store.commit('updateTenantId', tenantId[0]);
- if (res3.data.type == 0) {
- _this.$router.push("/home");
- } else {
- // if (tenantId[0] == '300' || tenantId[0] == '200') {
- var i18n = _this5.$language.cn.i18n;
- var data = '';
- var authoritiesList = res3.data.authorities.filter(function (item) {
- return item != 'BLUETOOTH_INPUT' && item != 'NORMALLY_OPEN_PERMISSION' && item != 'FREEZE_PERMISSION' && item != 'REMOTE_CONTROL_PERMISSION';
- });
- console.log(authoritiesList);
- if (authoritiesList[0] == 'BLUETOOTH_INPUT') {
- data = _this5.getChidlren(i18n.items, 'key', authoritiesList[1]);
- } else {
- data = _this5.getChidlren(i18n.items, 'key', authoritiesList[0]);
- }
- console.log(data);
- _this.$router.push("/" + data.index);
- }
- });
- loading.close();
- } else {
- _this.$message.error("登录失败");
- }
- });
- } else {
- loading.close();
- _this.$message.error("请输入正确验证码");
- _this5.checkCode = res.data;
- _this5.signature = res.data.signature;
- }
- });
- }
- }
- });
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-33d9f35b","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/views/Login.vue
- var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"login-wrap"},[_c('div',{staticClass:"ms-login"},[_c('el-form',{ref:"login",staticClass:"ms-content",attrs:{"model":_vm.param,"rules":_vm.rules,"label-width":"0px"}},[_c('div',{staticClass:"title"},[_c('div',[_c('img',{attrs:{"src":__webpack_require__("qvJq")}})]),_vm._v(" "),_c('p',[_vm._v("智慧公寓管理系统")])]),_vm._v(" "),_c('el-form-item',{attrs:{"prop":"username"}},[_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.param.username),expression:"param.username"}],staticClass:"dlinput",attrs:{"type":"text","placeholder":"请输入用户名"},domProps:{"value":(_vm.param.username)},on:{"input":function($event){if($event.target.composing){ return; }_vm.$set(_vm.param, "username", $event.target.value)}}}),_vm._v(" "),_c('i',{staticClass:"iconfont httpicon-zhanghao"})]),_vm._v(" "),_c('el-form-item',{attrs:{"prop":"password"}},[_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.param.password),expression:"param.password"}],staticClass:"dlinput",attrs:{"type":"password","placeholder":"请输入密码"},domProps:{"value":(_vm.param.password)},on:{"keyup":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.submitForm()},"input":function($event){if($event.target.composing){ return; }_vm.$set(_vm.param, "password", $event.target.value)}}}),_vm._v(" "),_c('i',{staticClass:"iconfont httpicon-mima"})]),_vm._v(" "),_c('el-form-item',{staticClass:"fromprop",attrs:{"prop":"code"}},[_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.param.code),expression:"param.code"}],staticClass:"dlinput",attrs:{"type":"txt","placeholder":"验证码"},domProps:{"value":(_vm.param.code)},on:{"input":function($event){if($event.target.composing){ return; }_vm.$set(_vm.param, "code", $event.target.value)}}}),_vm._v(" "),_c('i',{staticClass:"iconfont httpicon-yanzhengma"}),_vm._v(" "),(_vm.checkCode.image)?_c('img',{staticClass:"codeimg",attrs:{"src":'data:image/png;base64,' + _vm.checkCode.image,"alt":""},on:{"click":_vm.codesx}}):_vm._e()]),_vm._v(" "),_c('div',{staticClass:"login-btn"},[_c('el-button',{staticClass:"dlbtn",attrs:{"type":"primary"},on:{"click":function($event){return _vm.submitForm()}}},[_vm._v("登录")])],1),_vm._v(" "),_c('p',{staticClass:"login-tips"})],1)],1)])}
- var staticRenderFns = []
- var esExports = { render: render, staticRenderFns: staticRenderFns }
- /* harmony default export */ var views_Login = (esExports);
- // CONCATENATED MODULE: ./src/views/Login.vue
- function injectStyle (ssrContext) {
- __webpack_require__("4fo2")
- }
- var normalizeComponent = __webpack_require__("VU/8")
- /* script */
-
-
- /* template */
-
- /* template functional */
- var __vue_template_functional__ = false
- /* styles */
- var __vue_styles__ = injectStyle
- /* scopeId */
- var __vue_scopeId__ = "data-v-33d9f35b"
- /* moduleIdentifier (server only) */
- var __vue_module_identifier__ = null
- var Component = normalizeComponent(
- Login,
- views_Login,
- __vue_template_functional__,
- __vue_styles__,
- __vue_scopeId__,
- __vue_module_identifier__
- )
-
- /* harmony default export */ var src_views_Login = __webpack_exports__["default"] = (Component.exports);
-
-
- /***/ }),
-
- /***/ "qvJq":
- /***/ (function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__.p + "static/img/logo2.0754d14.png";
-
- /***/ })
-
- });
|