1 line
7.3 KiB
JSON
1 line
7.3 KiB
JSON
{"remainingRequest":"E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js!E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!E:\\hz-zhhq-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!E:\\hz-zhhq-web\\src\\views\\jurisdiction\\menu\\popup\\addUpdatePop.vue?vue&type=script&lang=js","dependencies":[{"path":"E:\\hz-zhhq-web\\src\\views\\jurisdiction\\menu\\popup\\addUpdatePop.vue","mtime":1737610069430},{"path":"E:\\hz-zhhq-web\\babel.config.js","mtime":1737610069371},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1740463332762},{"path":"E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js","mtime":1740463332584},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1740463332762},{"path":"E:\\hz-zhhq-web\\node_modules\\vue-loader\\lib\\index.js","mtime":1740463340941}],"contextDependencies":[],"result":["\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nrequire(\"core-js/modules/es6.regexp.replace\");\nrequire(\"core-js/modules/es6.regexp.split\");\nrequire(\"core-js/modules/es6.function.name\");\nvar _utils = require(\"@/utils\");\nvar _getdata = require(\"@/api/getdata\");\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//\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//\nvar _default = exports.default = {\n props: [\"width\", \"dataForm\", \"title\", \"type\", \"disabled\"],\n data: function data() {\n var _this2 = this;\n var validateUrl = function validateUrl(rule, value, callback) {\n if ((_this2.dataForm.type === 1 || _this2.dataForm.type === 3) && !/\\S/.test(value)) {\n callback(new Error('菜单URL不能为空'));\n } else {\n callback();\n }\n };\n return {\n dialogVisible: true,\n typeList: ['Web目录', 'Web菜单'],\n //'APP目录', 'APP菜单',\n menuList: [],\n dialogImageUrl: '',\n isDelImg: false,\n menuListTreeProps: {\n label: 'name',\n children: 'children'\n },\n dataRule: {\n name: [{\n required: true,\n message: '菜单名称不能为空',\n trigger: 'blur'\n }],\n parentName: [{\n required: true,\n message: '上级菜单不能为空',\n trigger: 'change'\n }],\n url: [{\n validator: validateUrl,\n trigger: 'blur'\n }]\n }\n };\n },\n mounted: function mounted() {\n this.selectMenu();\n },\n methods: {\n // 查询菜单下拉框\n selectMenu: function selectMenu() {\n var _this3 = this;\n var Content = {};\n (0, _getdata.selectMenu)(Content).then(function (res) {\n if (res.returnCode == \"1\") {\n _this3.menuList = (0, _utils.treeDataTranslate)(res.returnData, 'id');\n }\n }).catch(function (err) {\n console.log(err);\n });\n },\n // 菜单树选中\n menuListTreeCurrentChangeHandle: function menuListTreeCurrentChangeHandle(data, node) {\n this.dataForm.parentId = data.id;\n this.dataForm.parentName = data.name;\n },\n // 菜单树设置当前选中节点\n menuListTreeSetCurrentNode: function menuListTreeSetCurrentNode() {\n this.$refs.menuListTree.setCurrentKey(this.dataForm.parentId);\n this.dataForm.parentName = (this.$refs.menuListTree.getCurrentNode() || {})['name'];\n },\n /*关闭弹窗 */handleClose: function handleClose() {\n var _this4 = this;\n this.dialogVisible = false;\n this.$emit(\"closeNewAlert\");\n setTimeout(function () {\n _this4.dialogVisible = true;\n });\n },\n /**提交 */submitForm: function submitForm() {\n var _this5 = this;\n this.$refs['dataForm'].validate(function (valid) {\n if (valid) {\n _this5.dataForm.isDelImg = _this5.isDelImg;\n _this5.$emit('sure', _this5.dataForm);\n }\n });\n },\n handlePictureCardPreview: function handlePictureCardPreview(file) {\n this.dialogImageUrl = file.url;\n this.dialogVisible = true;\n },\n delImg: function delImg() {\n this.dataForm.icon = '';\n this.isDelImg = true;\n },\n changeFile: function changeFile(options, fileList) {\n // console.log(1111)\n var that = this;\n // 获取文件对象\n var file = options.raw;\n //判断图片类型\n if (file.type == \"image/jpeg\" || file.type == \"image/png\" || file.type == \"image/JPG\") {\n var isJPG = true;\n } else {\n isJPG = false;\n }\n // 判断图片大小\n var isLt2M = file.size / 1024 / 1024 < 2;\n if (!isJPG) {\n this.$message.error(\"上传产品图片只能是 JPG/PNG/JPEG 格式!\");\n }\n if (!isLt2M) {\n this.$message.error(\"上传产品图片大小不能超过 2MB!\");\n }\n // 创建一个HTML5的FileReader对象\n var reader = new FileReader();\n //创建一个img对象\n var img = new Image();\n var filename = options.filename;\n if (file) {\n reader.readAsDataURL(file);\n }\n if (isJPG && isLt2M) {\n reader.onload = function (e) {\n var base64Str = reader.result.split(\",\")[1];\n var newUrl;\n img.src = e.target.result;\n if (file.size / 1024 < 20) {\n that.$set(that.dataForm, \"icon\", e.target.result);\n return;\n }\n // base64地址图片加载完毕后执行\n img.onload = function () {\n var _this = this;\n // 缩放图片需要的canvas(也可以在DOM中直接定义canvas标签,这样就能把压缩完的图片不转base64也能直接显示出来)\n var canvas = document.createElement(\"canvas\");\n var context = canvas.getContext(\"2d\");\n var wid = img.width;\n var hei = img.height;\n // 最大尺寸限制\n\n var maxWidth = 60,\n maxHeight = 60;\n if (wid > maxWidth || hei > maxHeight) {\n if (wid / hei > maxWidth / maxHeight) {\n maxHeight = Math.round(maxWidth * (hei / wid));\n } else {\n maxWidth = Math.round(maxHeight * (wid / hei));\n }\n } else {\n maxWidth = wid;\n maxHeight = hei;\n }\n\n // canvas对图片进行缩放\n canvas.width = maxWidth;\n canvas.height = maxHeight;\n context.drawImage(img, 0, 0, maxWidth, maxHeight);\n newUrl = canvas.toDataURL(\"image/jpeg\");\n var str = newUrl.replace(\"data:image/png;base64,\", \"\");\n // 找到等号,把等号也去掉\n var equalIndex = str.indexOf(\"=\");\n if (str.indexOf(\"=\") > 0) {\n str = str.substring(0, equalIndex);\n }\n var strLength = str.length;\n var fileLength = parseInt(strLength - strLength / 8 * 2);\n var size = \"\";\n size = (fileLength / 1024).toFixed(2);\n console.log(size);\n that.isDelImg = false;\n that.$set(that.dataForm, \"icon\", newUrl);\n };\n };\n }\n }\n }\n};",null]} |