|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div :class="['writeTable']" v-if="data">
|
|
|
+ <div :class="['writeTable']" v-if="data" v-loading="loading">
|
|
|
<div class="writeTop" :class="[data.fileList ? 'writeTop-nopadding' : '']">
|
|
|
<template v-if="data.fileList">
|
|
|
<UploadDrag
|
|
@@ -276,6 +276,7 @@ export default {
|
|
|
},
|
|
|
writer: null,
|
|
|
audio_file: '',
|
|
|
+ loading: false,
|
|
|
};
|
|
|
},
|
|
|
//计算属性 类似于data概念
|
|
@@ -285,12 +286,7 @@ export default {
|
|
|
pageNumber: {
|
|
|
handler: function (val, oldVal) {
|
|
|
if (val != oldVal) {
|
|
|
- let _this = this;
|
|
|
- _this.$nextTick(() => {
|
|
|
- if (_this.data.hz_info && _this.data.hz_info.length === 1) {
|
|
|
- _this.initHanziwrite();
|
|
|
- }
|
|
|
- });
|
|
|
+ this.initHanziwrite();
|
|
|
}
|
|
|
},
|
|
|
deep: true,
|
|
@@ -337,23 +333,39 @@ export default {
|
|
|
this.infoObj[this.data.con].fileList = [];
|
|
|
},
|
|
|
initHanziwrite() {
|
|
|
- let _this = this;
|
|
|
- let node = document.getElementById(`character-target-info-div` + _this.pageNumber);
|
|
|
- if (node && node.children.length > 1) {
|
|
|
- node.removeChild(node.children[1]);
|
|
|
+ // let _this = this;
|
|
|
+ // let node = document.getElementById(`character-target-info-div` + _this.pageNumber);
|
|
|
+ // if (node && node.children.length > 1) {
|
|
|
+ // node.removeChild(node.children[1]);
|
|
|
+ // }
|
|
|
+ // _this.writer = HanziWriter.default.create(
|
|
|
+ // `character-target-info-div` + _this.pageNumber,
|
|
|
+ // _this.data.hz_info[0].con,
|
|
|
+ // {
|
|
|
+ // width: 22,
|
|
|
+ // height: 22,
|
|
|
+ // padding: 0,
|
|
|
+ // radicalColor: '#000000',
|
|
|
+ // strokeColor: '#fff',
|
|
|
+ // },
|
|
|
+ // );
|
|
|
+ this.loading = true;
|
|
|
+ if (this.data.con) {
|
|
|
+ let MethodName = 'tool-TextToVoiceFile';
|
|
|
+ let datas = {
|
|
|
+ text: this.data.con,
|
|
|
+ };
|
|
|
+ getLogin(MethodName, datas)
|
|
|
+ .then((res) => {
|
|
|
+ this.loading = false;
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.audio_file = res.file_id;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
}
|
|
|
- //var ren = require("hanzi-writer-data/国");
|
|
|
- _this.writer = HanziWriter.default.create(
|
|
|
- `character-target-info-div` + _this.pageNumber,
|
|
|
- _this.data.hz_info[0].con,
|
|
|
- {
|
|
|
- width: 22,
|
|
|
- height: 22,
|
|
|
- padding: 0,
|
|
|
- radicalColor: '#000000',
|
|
|
- strokeColor: '#fff',
|
|
|
- },
|
|
|
- );
|
|
|
},
|
|
|
changeInfoObj(param) {
|
|
|
this.infoObj[this.data.con][param] = this.data.info[param] ? this.data.info[param].trim() : '';
|
|
@@ -361,17 +373,7 @@ export default {
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
- if (this.data.con) {
|
|
|
- let MethodName = 'tool-TextToVoiceFile';
|
|
|
- let datas = {
|
|
|
- text: this.data.con,
|
|
|
- };
|
|
|
- getLogin(MethodName, datas).then((res) => {
|
|
|
- if (res.status === 1) {
|
|
|
- this.audio_file = res.file_id;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ this.initHanziwrite();
|
|
|
},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {
|