index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!-- 系统管理 语音管理 -->
  2. <template>
  3. <div class="app-container">
  4. <el-row :gutter="20">
  5. <el-col :span="20" :xs="24">
  6. <el-row :gutter="10" class="mb8">
  7. <el-col :span="1.5">
  8. <el-button
  9. type="primary"
  10. plain
  11. icon="el-icon-plus"
  12. size="mini"
  13. @click="handleAdd"
  14. v-hasPermi="['system:tts:add']"
  15. >新增
  16. </el-button>
  17. </el-col>
  18. </el-row>
  19. </el-col>
  20. </el-row>
  21. <!-- 对话框 -->
  22. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
  23. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  24. <el-form-item label="文本" prop="text">
  25. <el-input
  26. v-model="form.text"
  27. placeholder="请输入语音文本"
  28. maxlength="200"
  29. />
  30. </el-form-item>
  31. </el-form>
  32. <div slot="footer" class="dialog-footer">
  33. <el-button type="primary" @click="submitForm">确 定</el-button>
  34. <el-button @click="cancel">取 消</el-button>
  35. </div>
  36. </el-dialog>
  37. </div>
  38. </template>
  39. <script>
  40. export default {
  41. name:"SystemTTS",
  42. data() {
  43. return {
  44. title: "转换语音",
  45. // 遮罩层
  46. loading: true,
  47. // 是否显示弹出层
  48. open: false,
  49. // 表单参数
  50. form: {
  51. text: "",
  52. },
  53. // 表单校验
  54. rules: {
  55. text: [
  56. { required: true, message: "语音文本不能为空", trigger: "blur" },
  57. {
  58. min: 1,
  59. max: 200,
  60. message: "语音文本长度必须介于 1 和 200 之间",
  61. trigger: "blur",
  62. },
  63. ],
  64. },
  65. };
  66. },
  67. created() {},
  68. methods: {
  69. // 取消按钮
  70. cancel() {
  71. this.open = false;
  72. this.reset();
  73. },
  74. // 表单重置
  75. reset() {
  76. this.form = {
  77. text: "",
  78. };
  79. this.resetForm("form");
  80. },
  81. /** 新增按钮操作 */
  82. handleAdd() {
  83. this.reset();
  84. this.open = true;
  85. this.title = "转换语音";
  86. },
  87. /** 提交按钮 */
  88. submitForm: function () {
  89. this.$refs["form"].validate((valid) => {
  90. if (valid) {
  91. console.log(this.form);
  92. this.open = false;
  93. this.$download.zip(
  94. "/system/tts/getAudio?text=" + this.form.text,
  95. "ruoyi"
  96. );
  97. }
  98. });
  99. },
  100. },
  101. };
  102. </script>