摘要:消息鈴抖動同步請求這里的就是你請求回來的結(jié)果了解碼解碼彈窗樹結(jié)構(gòu)請選擇核心文件取消確定彈窗樹結(jié)構(gòu)的處理這里使用數(shù)組存儲只是為了存儲值。
消息鈴抖動
Axios同步請求.shaking{ display: absolute; animation:myfirst .4s; transform-origin:center center; animation-iteration-count:infinite; } @keyframes myfirst{ 0%{ transform: rotate(20deg)} 50%{ transform: rotate(-20deg) } 100%{ transform: rotate(20deg) } }
methods: { async funA(){ var res = await axios.post("")//這里的res就是你axios請求回來的結(jié)果了 } }js utf-8解碼
// 解碼 utf8Decode (inputStr) { var outputStr = "" var code1, code2, code3, code4 for (var i = 0; i < inputStr.length; i++) { code1 = inputStr.charCodeAt(i) if (code1 < 128) { outputStr += String.fromCharCode(code1) } else if (code1 < 224) { code2 = inputStr.charCodeAt(++i) outputStr += String.fromCharCode(((code1 & 31) << 6) | (code2 & 63)) } else if (code1 < 240) { code2 = inputStr.charCodeAt(++i) code3 = inputStr.charCodeAt(++i) outputStr += String.fromCharCode(((code1 & 15) << 12) | ((code2 & 63) << 6) | (code3 & 63)) } else { code2 = inputStr.charCodeAt(++i) code3 = inputStr.charCodeAt(++i) code4 = inputStr.charCodeAt(++i) outputStr += String.fromCharCode(((code1 & 7) << 18) | ((code2 & 63) << 12) | ((code3 & 63) << 6) | (code2 & 63)) } } return outputStr },彈窗樹結(jié)構(gòu)
利用jsZip解析zip包 并將數(shù)據(jù)轉(zhuǎn)換成樹結(jié)構(gòu)defaultProps: { children: "children", label: "label" }, // 彈窗樹結(jié)構(gòu)的處理 filterNode (value, data, node) { if (!value) { return true } let _array = []// 這里使用數(shù)組存儲 只是為了存儲值。 this.getNode(node, _array, value) let result = false _array.forEach((item) => { result = result || item }) return result },
// 解析核心文件 beforeCore (f) { if (!this.form.publishForm) { this.$message.error("請先選擇上傳類型") return false } else { let self = this self.$refs.uploadSdk.clearFiles() let types = ((f.type).split("/"))[1] if (types == "zip") { self.files = f let newZip = new JSZip() newZip.loadAsync(f).then(function (zip) { self.zipFileArry = [] let i = 0 zip.forEach(function (relativePath, zipEntry) { if (zipEntry.name) { if (zipEntry.name.endsWith(".zip") || zipEntry.name.endsWith(".jar") || zipEntry.name.endsWith(".png") || zipEntry.name.endsWith(".so") || zipEntry.name.endsWith(".aar")) { self.zipFileArry.push({ "label": zipEntry.name, "KeyId": i }) i++ } } }) // self.zipFileArry = self.parseStrings(self.zipFileArry) console.log(self.zipFileArry) }) this.dialogCoreVisible = true } else { self.$refs.uploadSdk.clearFiles() // 清除文件對象 self.sdkList = [{ name: f.name, url: f.url }] // 重新手動賦值filstList, 免得自定義上傳成功了, 而fileList并沒有動態(tài)改變, 這樣每次都是上傳一個對象 let formData = new FormData() formData.append("componentId", self.id) formData.append("coreFiles", f.name) formData.append("file", f) let config = { headers: { "Content-Type": "multipart/form-data" } } self.axios.post(self.publicPath + "/file/uploadsdk", formData, config).then(res => { let retData = res.data.data self.form.sdkPath = retData.sdkPath self.form.sdkCoreFiles = retData.sdkCoreFiles self.form.sdkFileSize = retData.sdkFileSize self.sdkList[0].name = self.sdkList[0].name + "xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0 " + parseInt(self.form.sdkFileSize) + "kb" }) } } }, // 解析數(shù)數(shù)據(jù) getElemStr (arr, index) { let c = [] for (let i = 0; i < index; i++) { c.push(arr[i]) } return c.join("/") }, parseStrings (array) { let temp = [] for (let i = 0; i < array.length; i++) { if (array[i].endsWith("/")) { continue } temp.push(array[i]) } array = temp let mapIndex = {} let indexArr = [] for (let i = 0; i < array.length; i++) { let arr = array[i].split("/") for (let n = 0; n < arr.length; n++) { let parent = this.getElemStr(arr, n) let itemIndex = this.getElemStr(arr, n + 1) if (!mapIndex[itemIndex]) { mapIndex[itemIndex] = { "p": parent } indexArr.push(itemIndex) } } } let nodeMap = {} let rootList = [] for (let i = 0; i < indexArr.length; i++) { let index = indexArr[i] let map = mapIndex[index] let node = nodeMap[index] if (!node) { node = { "label": index, "children": [] } nodeMap[index] = node } if (!map.p) { rootList.push(node) } else { let pIndex = "" let pNode = [] pIndex = map.p pNode = nodeMap[pIndex] if (!pNode) { pNode = { "label": pIndex, "children": [] } nodeMap[pIndex] = pNode } pNode.children.push(node) } } return rootList }, uploadThird (response, file, fileList) { if (fileList.length == 1) { fileList[0].name = fileList[0].name + "xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0xa0 " + parseInt(fileList[0].size / 1024) + "kb" } if (response.code == 1) { this.form.sdkPath = response.data this.form.publishForm = this.form.sdkPath.endsWith(".jar") ? "jar" : this.form.sdkPath.endsWith(".zip") ? "zip" : "aar" } else { this.$message.error(response.msg ? response.msg : "上傳失敗") this.form.sdkPath = null this.$refs.uploadThird.clearFiles() } }, 點擊上傳
未完待續(xù)。。。
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://m.hztianpu.com/yun/106952.html
摘要:最近一直在找前端工作,前前后后面了幾家公司,雖然不太順利,但是收獲還是有的,就過程中遇到的面試題總結(jié)一下標準盒模型盒模型自適應(yīng)三欄布局移動端自適應(yīng)方案布局有沒有用做過入場動畫閉包的作用筆試題作用域指向筆試題原型原型鏈筆試題數(shù)組對象中常用的方 最近一直在找前端工作,前前后后面了幾家公司,雖然不太順利,但是收獲還是有的,就過程中遇到的面試題總結(jié)一下 CSS1:標準盒模型/IE盒模型2:自適...
摘要:背景個人背景就讀于東北某普通二本院校計算機軟件工程專業(yè),現(xiàn)大四,北京實習前端方向,自學,技術(shù)棧時間背景大概是在月日準備好簡歷開始投遞秋招差不多已經(jīng)結(jié)束招聘崗位不多,投遞對象為大一些的互聯(lián)網(wǎng)公司事件背景第一個入職的是好未來的前端實習崗,待遇工 背景 個人背景 就讀于東北某普通二本院校計算機軟件工程專業(yè),現(xiàn)大四,北京實習 前端方向,自學,vue技術(shù)棧 時間背景 大概是在11月9日準備...
摘要:背景個人背景就讀于東北某普通二本院校計算機軟件工程專業(yè),現(xiàn)大四,北京實習前端方向,自學,技術(shù)棧時間背景大概是在月日準備好簡歷開始投遞秋招差不多已經(jīng)結(jié)束招聘崗位不多,投遞對象為大一些的互聯(lián)網(wǎng)公司事件背景第一個入職的是好未來的前端實習崗,待遇工 背景 個人背景 就讀于東北某普通二本院校計算機軟件工程專業(yè),現(xiàn)大四,北京實習 前端方向,自學,vue技術(shù)棧 時間背景 大概是在11月9日準備...
摘要:為了避免它,只需分配將要使用的必要構(gòu)造函數(shù)。示例對于此示例,就需要保持父構(gòu)造函數(shù)繼續(xù)正常工作。結(jié)論手動設(shè)置或更新構(gòu)造函數(shù)可能會導致不同且有時令人困惑的后果。為了防止它,只需在每個特定情況下定義構(gòu)造函數(shù)的角色。 hr小姐姐說一共有1輪筆試 + 3輪技術(shù)面 + 1輪hr面,面試地點在中關(guān)村天使大廈,崗位是1-3年前端 筆試 筆試分為多選 簡答 判斷 手寫代碼四部分,下面只寫了印象比較深的幾...
閱讀 3494·2021-11-25 09:43
閱讀 1470·2021-11-23 09:51
閱讀 3727·2021-10-11 11:06
閱讀 3941·2021-08-31 09:41
閱讀 3690·2019-08-30 15:53
閱讀 3601·2019-08-30 15:53
閱讀 1044·2019-08-30 15:43
閱讀 3424·2019-08-29 14:02