123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463 |
- <!-- -->
- <template>
- <div class="sentence-seg-temp" v-if="detail">
- <div class="seg-congfig">
- <div class="adult-book-input-item">
- <span
- class="adult-book-lable"
- style="line-height: 32px; margin-left: 10px"
- >横线长度:</span
- >
- <el-select v-model="detail.hengLeg" placeholder="请选择" size="small">
- <el-option
- v-for="item in inputLegOptions"
- :key="item.value"
- :label="item.name"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </div>
- <div class="adult-book-input-item" v-if="type!=='config_table'">
- <el-button type="primary" size="small" @click="setConfig" style="margin"
- >功能设置</el-button
- >
- <!-- <ul class="check-fn-list">
- <li v-if="items && items.fn_check_list.sent_check">
- {{ items.fn_check_list.sent_check | getFnName(fn_list) }}
- </li>
- <li v-if="items && items.fn_check_list.short_check">
- {{ items.fn_check_list.short_check | getFnName(fn_list) }}
- </li>
- <li v-if="items && items.fn_check_list.long_check">
- {{ items.fn_check_list.long_check | getFnName(fn_list) }}
- </li>
- <li v-if="items && items.fn_check_list.judge_check">
- {{ items.fn_check_list.judge_check | getFnName(fn_list) }}
- </li>
- <li v-if="items && items.fn_check_list.checkbox_check">
- {{ items.fn_check_list.checkbox_check | getFnName(fn_list) }}
- </li>
- <li v-if="items && items.fn_check_list.radio_check">
- {{ items.fn_check_list.radio_check | getFnName(fn_list) }}
- </li>
- <li v-if="items && items.fn_check_list.record_check">
- {{ items.fn_check_list.record_check | getFnName(fn_list) }}
- </li>
- </ul> -->
- </div>
- </div>
- <div class="adult-book-input-item">
- <span class="adult-book-lable">句子缩进:</span>
- <el-radio-group v-model="detail.textindent">
- <el-radio :label="true">是</el-radio>
- <el-radio :label="false">否</el-radio>
- </el-radio-group>
- </div>
- <div
- class="sentence-option"
- v-for="(dItem, dIndex) in detail.detail"
- :key="'items.detail' + dIndex"
- >
- <div class="adult-book-input-item adult-book-input-item-center">
- <span class="adult-book-lable">元素{{ dIndex + 1 }}.</span>
- <el-button size="small" @click="deleteElement(dIndex)"
- >删除元素</el-button
- >
- <el-button
- type="primary"
- size="small"
- icon="el-icon-top"
- @click="moveElement(dItem, dIndex, 'up')"
- >上移</el-button
- >
- <el-button
- type="primary"
- size="small"
- icon="el-icon-bottom"
- @click="moveElement(dItem, dIndex, 'down')"
- >下移</el-button
- >
- </div>
- <template>
- <SentenceSegwordChs :curQue="dItem" :segModel="segModel" name="元素" :type="type" />
- <div class="adult-book-input-item" style="margin-top: 10px">
- <span class="adult-book-lable">图片:</span>
- <Upload
- :changeFillId="timuchangeImage"
- :datafileList="dItem.img_list ? dItem.img_list : []"
- :filleNumber="1"
- :uploadType="'image'"
- :index="dIndex"
- />
- </div>
- </template>
- <template>
- <div class="adult-book-input-item adult-book-input-item-center">
- <span class="adult-book-lable">字体:</span>
- <el-radio-group
- v-model="dItem.config.fontFamily"
- @input="(value) => changefontFamily(value, dItem)"
- >
- <el-radio
- v-for="(item, index) in fontFamilyList"
- :key="'fontFamilyList' + index"
- :label="item.value"
- >
- <span>{{ item.name }}</span>
- </el-radio>
- </el-radio-group>
- </div>
- <div class="adult-book-input-item adult-book-input-item-center">
- <span class="adult-book-lable">字的大小:</span>
- <el-radio-group
- v-model="dItem.config.fontSize"
- @input="(value) => changefontSize(value, dItem)"
- >
- <el-radio label="12px">12px</el-radio>
- <el-radio label="16px">16px</el-radio>
- <el-radio label="20px">20px</el-radio>
- <el-radio label="24px">24px</el-radio>
- <el-radio label="28px">28px</el-radio>
- </el-radio-group>
- </div>
- <!-- <div class="adult-book-input-item adult-book-input-item-center">
- <span class="adult-book-lable">字的颜色:</span>
- <el-radio-group v-model="dItem.config.fontColor">
- <el-radio
- v-for="(item, index) in colorList"
- :key="'colorList' + index"
- :label="item.value"
- >
- <span
- :style="{
- backgroundColor: item.value == 'sub' ? '' : item.value,
- }"
- :class="item.value != 'sub' ? 'colorItem' : ''"
- >{{ item.value == "sub" ? "书的辅助色" : "" }}</span
- >
- </el-radio>
- </el-radio-group>
- </div> -->
- <div class="adult-book-input-item adult-book-input-item-center">
- <span class="adult-book-lable">设置间距:</span>
- <el-checkbox-group v-model="dItem.config.wordPadding">
- <el-checkbox
- v-for="(item, index) in paddingList"
- :key="'paddingList' + index"
- :label="item.value"
- >
- {{ item.name }}
- </el-checkbox>
- </el-checkbox-group>
- </div>
- <div class="adult-book-input-item">
- <span class="adult-book-lable">输入内容:</span>
- <el-radio-group v-model="dItem.config.conAlign"
- >
- <el-radio label="left">左对齐</el-radio>
- <el-radio label="center">居中对齐</el-radio>
- </el-radio-group>
- </div>
- </template>
- </div>
- <el-button @click="addElement()" style="margin-bottom: 10px"
- >添加元素</el-button
- >
- <!-- <div class="adult-book-input-item">
- <span class="adult-book-lable">英文:</span>
- <el-input
- v-model="detail.en"
- type="textarea"
- placeholder="请输入英文翻译"
- />
- </div> -->
- <el-dialog
- title="功能设置"
- :close-on-click-modal="false"
- :modal-append-to-body="false"
- append-to-body
- :visible.sync="configVisible"
- width="80%"
- >
- <FnConfig :items="items" :config="queConfig" />
- <span slot="footer" class="dialog-footer">
- <el-button @click="configVisible = false">取 消</el-button>
- <el-button type="primary" @click="saveConfig">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import SentenceSegwordChs from "./SentenceSegwordChs";
- import FnConfig from "./FnConfig.vue";
- import Upload from "./Upload.vue";
- export default {
- components: {
- SentenceSegwordChs,
- FnConfig,
- Upload
- },
- props: ["detail", "segModel", "type"],
- data() {
- return {
- inputLegOptions: [
- {
- name: "系统默认值",
- value: -1,
- },
- {
- name: "约1个汉字的宽度",
- value: 1,
- },
- {
- name: "约2个汉字的宽度",
- value: 2,
- },
- {
- name: "约3个汉字的宽度",
- value: 3,
- },
- {
- name: "约4个汉字的宽度",
- value: 4,
- },
- {
- name: "约5个汉字的宽度",
- value: 5,
- },
- ],
- colorList: [
- {
- value: "#000",
- name: "黑色",
- },
- {
- value: "sub",
- name: "辅助色",
- },
- {
- value: "#FF8730",
- name: "橙色",
- },
- {
- value: "#3CB4E7",
- name: "蓝色",
- },
- {
- value: "#ED5050",
- name: "浅红色",
- },
- {
- value: "#FF3F3F",
- name: "红色",
- },
- ],
- paddingList: [
- {
- value: "left",
- name: "要左边距",
- },
- {
- value: "right",
- name: "要右边距",
- },
- ],
- fontFamilyList: [
- {
- value: "FZJCGFKTK",
- name: "使用中文字体",
- },
- {
- value: "Sans-GBNPC",
- name: "使用拼音字体",
- },
- {
- value: "robot",
- name: "使用英文字体",
- },
- {
- value: "Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif",
- name: "系统字体",
- },
- ],
- configVisible: false,
- items: null,
- queConfig: {
- fn_record_list: [
- {
- type: "sentence_record_mini_chs",
- name: "录音控件-mini",
- isFn: false,
- },
- {
- type: "sentence_record_normal_chs",
- name: "录音控件-normal",
- isFn: false,
- },
- {
- type: "sentence_record_pro_chs",
- name: "录音控件-pro",
- isFn: false,
- },
- {
- type: "sentence_record_promax_chs",
- name: "录音控件-promax",
- isFn: false,
- },
- ],
- },
- };
- },
- computed: {},
- watch: {},
- //方法集合
- methods: {
- changefontFamily(value, dItem) {
- // if (value == "FZJCGFKTK") {
- // dItem.config.fontSize = "16px";
- // } else if (value == "Sans-GBNPC") {
- // dItem.config.fontSize = "16px";
- // } else if (value == "robot") {
- // dItem.config.fontSize = "16px";
- // }
- if (dItem && dItem.wordsList && dItem.wordsList.length > 0) {
- dItem.wordsList.forEach((item, index) => {
- item.fontFamily = value;
- });
- }
- },
- changefontSize(value, dItem) {
- if (dItem && dItem.wordsList && dItem.wordsList.length > 0) {
- dItem.wordsList.forEach((item, index) => {
- item.fontSize = value;
- });
- }
- },
- addElement() {
- let obj = {
- pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
- sentence: "", //句子
- segList: [], //分词结果
- seg_words: "",
- wordsList: [],
- hengList: [],
- config: {
- fontSize: "20px",
- fontColor: "#000",
- fontFamily: "FZJCGFKTK",
- wordPadding: [],
- conAlign: 'center'
- },
- };
- this.detail.detail.push(JSON.parse(JSON.stringify(obj)));
- },
- deleteElement(index) {
- this.detail.detail.splice(index, 1);
- },
- moveElement(dItem, index, type) {
- let obj = JSON.parse(JSON.stringify(dItem));
- if (type == "up" && index > 0) {
- this.detail.detail.splice(index - 1, 0, obj);
- this.detail.detail.splice(index + 1, 1);
- }
- if (type == "down" && index < this.detail.detail.length - 1) {
- this.detail.detail[index] = this.detail.detail.splice(index + 1, 1, this.detail.detail[index])[0]
- }
- },
- //功能设置
- setConfig() {
- this.configVisible = true;
- this.items = JSON.parse(JSON.stringify(this.detail));
- },
- saveConfig() {
- this.configVisible = false;
- this.$set(this.detail, "fn_check_list", this.items.fn_check_list);
- },
- timuchangeImage(fileList, duration, index) {
- const articleImgList = JSON.parse(JSON.stringify(fileList));
- const articleImgRes = [];
- articleImgList.forEach((item) => {
- if (item.response) {
- const obj = {
- name: item.name,
- url: item.response.file_info_list[0].file_url,
- id: "[FID##" + item.response.file_info_list[0].file_id + "##FID]",
- };
- articleImgRes.push(obj);
- }
- });
- this.detail.detail[index].img_list = JSON.parse(
- JSON.stringify(articleImgRes)
- );
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- console.log(this.detail);
- },
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='scss' scoped>
- //@import url(); 引入公共css类
- .sentence-option {
- border: 1px #ccc solid;
- background: #f5f5f5;
- padding: 10px;
- margin-bottom: 10px;
- }
- .adult-book-input-item {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- margin-bottom: 10px;
- &-center {
- align-items: center;
- }
- }
- .adult-book-lable {
- width: 70px;
- font-size: 14px;
- display: block;
- text-align: right;
- margin-right: 8px;
- line-height: 32px;
- &-bottom {
- margin-bottom: 10px;
- display: block;
- }
- }
- .el-radio-group {
- flex: 1;
- display: flex;
- flex-wrap: wrap;
- }
- .el-radio {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- }
- .colorItem {
- width: 20px;
- height: 20px;
- border-radius: 100%;
- display: block;
- }
- .seg-congfig {
- display: flex;
- justify-content: space-between;
- }
- </style>
|