摘要:消息铃抖动同步请求这里的就是你请求回来的结果了解码解码弹窗树结构请选择核心文件取消确定弹窗树结构的处理这里使用数组存储只是为了存储值。
消息铃抖动
</>复制代码
.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)
}
}
Axios同步请求
</>复制代码
methods: {
async funA(){
var res = await axios.post("")//这里的res就是你axios请求回来的结果了
}
}
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
},
弹窗树结构
</>复制代码
取 消
确 定
defaultProps: {
children: "children",
label: "label"
},
// 弹窗树结构的处理
filterNode (value, data, node) {
if (!value) {
return true
}
let _array = []// 这里使用数组存储 只是为了存储值。
this.getNode(node, _array, value)
let result = false
_array.forEach((item) => {
result = result || item
})
return result
},
利用jsZip解析zip包 并将数据转换成树结构
</>复制代码
点击上传
// 解析核心文件
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并没有动态改变, 这样每次都是上传一个对象
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"
})
}
}
},
// 解析数数据
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()
}
},
未完待续。。。
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/106952.html
摘要:背景个人背景就读于东北某普通二本院校计算机软件工程专业,现大四,北京实习前端方向,自学,技术栈时间背景大概是在月日准备好简历开始投递秋招差不多已经结束招聘岗位不多,投递对象为大一些的互联网公司事件背景第一个入职的是好未来的前端实习岗,待遇工 背景 个人背景 就读于东北某普通二本院校计算机软件工程专业,现大四,北京实习 前端方向,自学,vue技术栈 时间背景 大概是在11月9日准备...
摘要:背景个人背景就读于东北某普通二本院校计算机软件工程专业,现大四,北京实习前端方向,自学,技术栈时间背景大概是在月日准备好简历开始投递秋招差不多已经结束招聘岗位不多,投递对象为大一些的互联网公司事件背景第一个入职的是好未来的前端实习岗,待遇工 背景 个人背景 就读于东北某普通二本院校计算机软件工程专业,现大四,北京实习 前端方向,自学,vue技术栈 时间背景 大概是在11月9日准备...
摘要:为了避免它,只需分配将要使用的必要构造函数。示例对于此示例,就需要保持父构造函数继续正常工作。结论手动设置或更新构造函数可能会导致不同且有时令人困惑的后果。为了防止它,只需在每个特定情况下定义构造函数的角色。 hr小姐姐说一共有1轮笔试 + 3轮技术面 + 1轮hr面,面试地点在中关村天使大厦,岗位是1-3年前端 笔试 笔试分为多选 简答 判断 手写代码四部分,下面只写了印象比较深的几...
阅读 3460·2021-11-25 09:43
阅读 1435·2021-11-23 09:51
阅读 3718·2021-10-11 11:06
阅读 3917·2021-08-31 09:41
阅读 3685·2019-08-30 15:53
阅读 3595·2019-08-30 15:53
阅读 1036·2019-08-30 15:43
阅读 3420·2019-08-29 14:02