Commit e514108b by hank

fix bug

parent f8bfa01e
......@@ -46,7 +46,7 @@ service.interceptors.response.use(
const res = response.data
console.log(res.code, res.code !== '0', String(res.code))
// if the custom code is not 20000, it is judged as an error.
if (res.code !== '0' && res.code) {
if (res.code !== '0' && res.code && res.code !== 20000) {
Message({
message: res.msg || ' response Error',
type: 'error',
......
......@@ -130,20 +130,20 @@ import {
templateAdd,
templateUpdate,
getDetail
} from "@/api/template";
import waves from "@/directive/waves"; // waves directive
} from '@/api/template'
import waves from '@/directive/waves' // waves directive
export default {
name: "ComplexTable",
name: 'ComplexTable',
directives: { waves },
filters: {
statusFilter(status) {
const statusMap = {
published: "success",
draft: "info",
deleted: "danger"
};
return statusMap[status];
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
......@@ -162,42 +162,42 @@ export default {
page: 1,
limit: 20,
typeId: undefined,
title: "",
title: '',
tagId: undefined,
sort: "+id"
sort: '+id'
},
templateId: "",
templateId: '',
sortOptions: [
{ label: "ID Ascending", key: "+id" },
{ label: "ID Descending", key: "-id" }
{ label: 'ID Ascending', key: '+id' },
{ label: 'ID Descending', key: '-id' }
],
statusOptions: ["published", "draft", "deleted"],
statusOptions: ['published', 'draft', 'deleted'],
showReviewer: false,
temp: {
templateName: "",
templateUrl: "",
templateName: '',
templateUrl: '',
frameInfo: {
frameUrl: ""
frameUrl: ''
},
resourceInfo: {
resourceUrl: ""
resourceUrl: ''
},
templateDescribe: "",
typeId: "",
templateDescribe: '',
typeId: '',
tagIds: [],
templateEnvironment: "",
templateShow: "",
templateProportion: "",
templateProportion1: "",
templateProportion2: "",
templatePackageName: "",
templateEnvironment: '',
templateShow: '',
templateProportion: '',
templateProportion1: '',
templateProportion2: '',
templatePackageName: '',
templateCount: 0
},
dialogFormVisible: true,
dialogStatus: "",
dialogStatus: '',
textMap: {
update: "Edit",
create: "Create"
update: 'Edit',
create: 'Create'
},
dialogPvVisible: false,
pvData: [],
......@@ -205,220 +205,221 @@ export default {
templateName: [
{
required: true,
message: "templateName is required",
trigger: "change"
message: 'templateName is required',
trigger: 'change'
}
],
templateDescribe: [
{
required: true,
message: "templateDescribe is required",
trigger: "change"
message: 'templateDescribe is required',
trigger: 'change'
}
],
typeId: [
{ required: true, message: "typeId is required", trigger: "change" }
{ required: true, message: 'typeId is required', trigger: 'change' }
],
templateEnvironment: [
{
required: true,
message: "templateEnvironment is required",
trigger: "change"
message: 'templateEnvironment is required',
trigger: 'change'
}
],
templateShow: [
{
required: true,
message: "templateShow is required",
trigger: "change"
message: 'templateShow is required',
trigger: 'change'
}
],
templatePackageName: [
{
required: true,
message: "templatePackageName is required",
trigger: "change"
message: 'templatePackageName is required',
trigger: 'change'
}
],
title: [
{ required: true, message: "title is required", trigger: "blur" }
{ required: true, message: 'title is required', trigger: 'blur' }
]
},
downloadLoading: false
};
}
},
created() {
this.templateId = this.$route.query.templateId;
this.getList();
this.getTypeList();
this.getTempalteDetail();
this.templateId = this.$route.query.templateId
this.getList()
this.getTypeList()
this.getTempalteDetail()
},
methods: {
getList() {
this.listLoading = true;
this.listLoading = true
getList(this.listQuery, this.listQuery.page, this.listQuery.limit).then(
response => {
this.list = response.list;
this.total = response.count;
this.list = response.list
this.total = response.count
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.5 * 1000);
this.listLoading = false
}, 1.5 * 1000)
}
);
)
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
this.listQuery.page = 1
this.getList()
},
getTypeList() {
templateGetTypeList().then(res => {
this.typeList = res;
});
this.typeList = res
})
},
getTagsList() {
templateGetTagList(this.temp.typeId).then(res => {
this.tagsList = res;
});
this.tagsList = res
})
},
getTempalteDetail() {
const id = this.$route.query.templateId;
const id = this.$route.query.templateId
if (id) {
getDetail(this.$route.query.templateId).then(response => {
const tempData = JSON.parse(JSON.stringify(response));
const tempData = JSON.parse(JSON.stringify(response))
tempData.templateShow =
tempData.templateShow && tempData.templateShow.toUpperCase();
tempData.templateShow && tempData.templateShow.toUpperCase()
tempData.templateProportion1 =
tempData.templateProportion &&
tempData.templateProportion.split("/")[0];
tempData.templateProportion.split('/')[0]
tempData.templateProportion2 =
tempData.templateProportion &&
tempData.templateProportion.split("/")[1];
this.temp = Object.assign(this.temp, tempData);
this.getTagsList();
console.log(response);
});
tempData.templateProportion.split('/')[1]
this.temp = Object.assign(this.temp, tempData)
this.getTagsList()
console.log(response)
})
}
},
typeChange(value) {
this.listQuery.tagId = undefined;
this.temp.tagIds = [];
this.getTagsList();
this.listQuery.tagId = undefined
this.temp.tagIds = []
this.getTagsList()
},
onProgress(event) {
console.log(event);
this.fullscreenLoading = true;
if (event.percent === 100) {
this.fullscreenLoading = false;
}
console.log(event)
this.fullscreenLoading = true
// if (event.percent === 100) {
// this.fullscreenLoading = false
// }
},
uploadZipSuccess(e) {
if (e.code && e.code !== "0") {
this.$message.error(e.msg);
this.fullscreenLoading = false
if (e.code && e.code !== '0') {
this.$message.error(e.msg)
} else {
this.fullscreenLoading = false;
this.$message("上传成功");
this.temp.frameInfo.frameUrl = e.frameUrl;
this.temp.resourceInfo.resourceUrl = e.resourceUrl;
this.temp.templateCount = e.pictureUrl.length;
this.fullscreenLoading = false
this.$message('上传成功')
this.temp.frameInfo.frameUrl = e.frameUrl
this.temp.resourceInfo.resourceUrl = e.resourceUrl
this.temp.templateCount = e.pictureUrl.length
this.temp.templateUrl = e.pictureUrl
.map(item => {
if (item.indexOf("http") !== -1 || item.indexOf("https") !== -1) {
return item + "";
if (item.indexOf('http') !== -1 || item.indexOf('https') !== -1) {
return item + ''
} else {
return e.url + item + "";
return e.url + item + ''
}
})
.join(",");
console.log(this.temp);
.join(',')
console.log(this.temp)
}
console.log(e);
console.log(e)
},
resetTemp() {
this.temp = {
id: undefined,
importance: 1,
remark: "",
remark: '',
timestamp: new Date(),
title: "",
status: "published",
type: ""
};
title: '',
status: 'published',
type: ''
}
},
handleCreate() {
this.resetTemp();
this.dialogStatus = "create";
this.dialogFormVisible = true;
this.resetTemp()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs["dataForm"].clearValidate();
});
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs["dataForm"].validate(valid => {
this.$refs['dataForm'].validate(valid => {
if (valid) {
const uploadTemp = Object.assign({}, this.temp);
const uploadTemp = Object.assign({}, this.temp)
uploadTemp.templateProportion =
uploadTemp.templateProportion1 +
"/" +
uploadTemp.templateProportion2;
'/' +
uploadTemp.templateProportion2
if (this.templateId) {
templateUpdate(this.templateId, uploadTemp).then(res => {
this.$notify({
title: "Success",
message: "Update Successfully",
type: "success",
title: 'Success',
message: 'Update Successfully',
type: 'success',
duration: 2000
});
this.getTempalteDetail();
this.$router.back();
});
})
this.getTempalteDetail()
this.$router.back()
})
} else {
templateAdd(uploadTemp).then(() => {
this.$notify({
title: "Success",
message: "Created Successfully",
type: "success",
title: 'Success',
message: 'Created Successfully',
type: 'success',
duration: 2000
});
this.$router.back();
});
})
this.$router.back()
})
}
}
});
})
},
handleDelete(row) {
this.$confirm("此操作将删除该模板, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
this.$confirm('此操作将删除该模板, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
templateDel(row.templateId).then(() => {
this.$message({
type: "success",
message: "删除成功!"
});
this.getList();
});
type: 'success',
message: '删除成功!'
})
this.getList()
})
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除"
});
});
type: 'info',
message: '已取消删除'
})
})
},
getSortClass: function(key) {
const sort = this.listQuery.sort;
const sort = this.listQuery.sort
return sort === `+${key}`
? "ascending"
? 'ascending'
: sort === `-${key}`
? "descending"
: "";
? 'descending'
: ''
}
}
};
}
</script>
<style lang="scss" scoped>
</style>
......@@ -51,6 +51,11 @@
<span>{{ scope.row.templateCount }}</span>
</template>
</el-table-column>
<el-table-column label="资源路径" width="210px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.frameUrl.split('/').splice(-2, 3)[0]}}</span>
</template>
</el-table-column>
<!-- <el-table-column label="状态" class-name="status-col" width="100">
<template slot-scope="{row}">
<el-tag :type="row.templateShow | statusFilter">
......@@ -60,6 +65,9 @@
</el-table-column> -->
<el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
<template slot-scope="{row}">
<el-button type="primary" size="mini">
<a :href="row.frameUrl" target="_blank">预览</a>
</el-button>
<el-button type="primary" size="mini" @click="handleUpdate(row)">
详情
</el-button>
......
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