Commit dd5df6e2 by hank

tinymce 汉化

parent e64119dc
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
list-type="picture-card" list-type="picture-card"
> >
<el-button size="small" type="primary"> <el-button size="small" type="primary">
Click upload 点击上传
</el-button> </el-button>
</el-upload> </el-upload>
<el-button @click="dialogVisible = false"> <el-button @click="dialogVisible = false">
Cancel 取消
</el-button> </el-button>
<el-button type="primary" @click="handleSubmit"> <el-button type="primary" @click="handleSubmit">
Confirm 确认
</el-button> </el-button>
</el-dialog> </el-dialog>
</div> </div>
......
...@@ -115,7 +115,7 @@ export default { ...@@ -115,7 +115,7 @@ export default {
const _this = this const _this = this
window.tinymce.init({ window.tinymce.init({
selector: `#${this.tinymceId}`, selector: `#${this.tinymceId}`,
language: this.languageTypeList['en'], language: this.languageTypeList['zh'],
height: this.height, height: this.height,
body_class: 'panel-body ', body_class: 'panel-body ',
object_resizing: false, object_resizing: false,
......
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- <div class="filter-container"> <!-- <div class="filter-container">
</div> --> </div>-->
<div> <div>
<el-form <el-form
ref="dataForm" ref="dataForm"
...@@ -11,19 +11,10 @@ ...@@ -11,19 +11,10 @@
label-width="100px" label-width="100px"
style="width: 400px; margin-left:50px;" style="width: 400px; margin-left:50px;"
> >
<el-form-item <el-form-item label="设备名称" prop="equipmentName">
label="设备名称" <el-input v-model="temp.equipmentName" placeholder="请输入设备名称" />
prop="equipmentName"
>
<el-input
v-model="temp.equipmentName"
placeholder="请输入设备名称"
/>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="设备金额" prop="equipmentIntro">
label="设备金额"
prop="equipmentIntro"
>
<el-input-number <el-input-number
v-model="temp.equipmentPrice" v-model="temp.equipmentPrice"
controls-position="right" controls-position="right"
...@@ -32,20 +23,17 @@ ...@@ -32,20 +23,17 @@
placeholder="请输入设备金额" placeholder="请输入设备金额"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="设备摘要" prop="equipmentIntro">
label="设备摘要"
prop="equipmentIntro"
>
<el-input <el-input
v-model="temp.equipmentIntro" v-model="temp.equipmentIntro"
maxlength="10"
placeholder="请输入设备摘要不超过10个字" placeholder="请输入设备摘要不超过10个字"
type="text"
show-word-limit
/> />
<div>最多填写10个字</div> <div>最多填写10个字</div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="上传设备封面" prop="equipmentUrl">
label="上传设备封面"
prop="equipmentUrl"
>
<el-upload <el-upload
class="upload-demo" class="upload-demo"
drag drag
...@@ -56,43 +44,31 @@ ...@@ -56,43 +44,31 @@
:action="templateUploadZipUrl" :action="templateUploadZipUrl"
> >
<i class="el-icon-upload" /> <i class="el-icon-upload" />
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> <div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
</el-upload> </el-upload>
<img style="width: 200px;" :src="temp.equipmentUrl" alt=""> <img style="width: 200px;" :src="temp.equipmentUrl" alt />
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="设备详情" prop="equipmentDetails">
label="设备详情"
prop="equipmentDetails"
>
<Tinymce v-model="temp.equipmentDetails" style="width: 600px" /> <Tinymce v-model="temp.equipmentDetails" style="width: 600px" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div> <div>
<el-button <el-button style="margin-left: 10px;" type="primary" @click="createData">保存</el-button>
style="margin-left: 10px;"
type="primary"
@click="createData"
>
保存
</el-button>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { import { addDevice, updateDevice, getDetail, uploadUrl } from "@/api/device";
addDevice, import Tinymce from "@/components/Tinymce";
updateDevice, import waves from "@/directive/waves"; // waves directive
getDetail,
uploadUrl
} from '@/api/device'
import Tinymce from '@/components/Tinymce'
import waves from '@/directive/waves' // waves directive
export default { export default {
name: 'ComplexTable', name: "ComplexTable",
directives: { waves }, directives: { waves },
components: { components: {
Tinymce Tinymce
...@@ -100,11 +76,11 @@ export default { ...@@ -100,11 +76,11 @@ export default {
filters: { filters: {
statusFilter(status) { statusFilter(status) {
const statusMap = { const statusMap = {
published: 'success', published: "success",
draft: 'info', draft: "info",
deleted: 'danger' deleted: "danger"
} };
return statusMap[status] return statusMap[status];
} }
}, },
data() { data() {
...@@ -122,30 +98,30 @@ export default { ...@@ -122,30 +98,30 @@ export default {
page: 1, page: 1,
limit: 20, limit: 20,
typeId: undefined, typeId: undefined,
title: '', title: "",
tagId: undefined, tagId: undefined,
sort: '+id' sort: "+id"
}, },
templateId: '', templateId: "",
sortOptions: [ sortOptions: [
{ label: 'ID Ascending', key: '+id' }, { label: "ID Ascending", key: "+id" },
{ label: 'ID Descending', key: '-id' } { label: "ID Descending", key: "-id" }
], ],
statusOptions: ['published', 'draft', 'deleted'], statusOptions: ["published", "draft", "deleted"],
showReviewer: false, showReviewer: false,
temp: { temp: {
equipmentName: '', equipmentName: "",
equipmentIntro: '', equipmentIntro: "",
equipmentShopId: '', equipmentShopId: "",
equipmentUrl: '', equipmentUrl: "",
equipmentPrice: '', equipmentPrice: "",
equipmentDetails: '' equipmentDetails: ""
}, },
dialogFormVisible: true, dialogFormVisible: true,
dialogStatus: '', dialogStatus: "",
textMap: { textMap: {
update: 'Edit', update: "Edit",
create: 'Create' create: "Create"
}, },
dialogPvVisible: false, dialogPvVisible: false,
pvData: [], pvData: [],
...@@ -153,111 +129,111 @@ export default { ...@@ -153,111 +129,111 @@ export default {
equipmentName: [ equipmentName: [
{ {
required: true, required: true,
message: 'equipmentName is required', message: "equipmentName is required",
trigger: 'change' trigger: "change"
} }
], ],
equipmentIntro: [ equipmentIntro: [
{ {
required: true, required: true,
message: 'equipmentIntro is required', message: "equipmentIntro is required",
trigger: 'change' trigger: "change"
} }
], ],
equipmentDetails: [ equipmentDetails: [
{ {
required: true, required: true,
message: 'equipmentDetails is required', message: "equipmentDetails is required",
trigger: 'change' trigger: "change"
} }
], ],
equipmentPrice: [ equipmentPrice: [
{ {
required: true, required: true,
message: 'equipmentPrice is required', message: "equipmentPrice is required",
trigger: 'change' trigger: "change"
} }
] ]
}, },
downloadLoading: false downloadLoading: false
} };
}, },
created() { created() {
this.equipmentShopId = this.$route.query.equipmentShopId this.equipmentShopId = this.$route.query.equipmentShopId;
this.getTempalteDetail() this.getTempalteDetail();
}, },
methods: { methods: {
getTempalteDetail() { getTempalteDetail() {
const id = this.$route.query.equipmentShopId const id = this.$route.query.equipmentShopId;
if (id) { if (id) {
getDetail(this.$route.query.equipmentShopId).then(response => { getDetail(this.$route.query.equipmentShopId).then(response => {
const tempData = JSON.parse(JSON.stringify(response)) const tempData = JSON.parse(JSON.stringify(response));
this.temp = Object.assign(this.temp, tempData) this.temp = Object.assign(this.temp, tempData);
console.log(response) console.log(response);
}) });
} }
}, },
uploadZipSuccess(e) { uploadZipSuccess(e) {
if (e.code && e.code !== '0') { if (e.code && e.code !== "0") {
this.$message.error(e.msg) this.$message.error(e.msg);
} else { } else {
this.$message('上传成功') this.$message("上传成功");
this.temp.equipmentUrl = e.data this.temp.equipmentUrl = e.data;
console.log(this.temp) console.log(this.temp);
} }
console.log(e) console.log(e);
}, },
resetTemp() { resetTemp() {
this.temp = { this.temp = {
id: undefined, id: undefined,
importance: 1, importance: 1,
remark: '', remark: "",
timestamp: new Date(), timestamp: new Date(),
title: '', title: "",
status: 'published', status: "published",
type: '' type: ""
} };
}, },
handleCreate() { handleCreate() {
this.resetTemp() this.resetTemp();
this.dialogStatus = 'create' this.dialogStatus = "create";
this.dialogFormVisible = true this.dialogFormVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].clearValidate() this.$refs["dataForm"].clearValidate();
}) });
}, },
createData() { createData() {
this.$refs['dataForm'].validate(valid => { this.$refs["dataForm"].validate(valid => {
if (valid) { if (valid) {
const uploadTemp = Object.assign({}, this.temp) const uploadTemp = Object.assign({}, this.temp);
if (this.equipmentShopId) { if (this.equipmentShopId) {
updateDevice(uploadTemp).then(res => { updateDevice(uploadTemp).then(res => {
this.$notify({ this.$notify({
title: 'Success', title: "Success",
message: 'Update Successfully', message: "Update Successfully",
type: 'success', type: "success",
duration: 2000 duration: 2000
}) });
this.getTempalteDetail() this.getTempalteDetail();
this.$router.back() this.$router.back();
}) });
} else { } else {
addDevice(uploadTemp).then(() => { addDevice(uploadTemp).then(() => {
this.$notify({ this.$notify({
title: 'Success', title: "Success",
message: 'Created Successfully', message: "Created Successfully",
type: 'success', type: "success",
duration: 2000 duration: 2000
}) });
this.$router.back() this.$router.back();
}) });
} }
} }
}) });
} }
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
</style> </style>
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