aiDialog.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <el-dialog title="提示词设置" :visible.sync="dialogVisibleAiD" :append-to-body="true" width="650px" :before-close="handleClose"
  3. class="dialog_diy">
  4. <div style="height: 100%;padding:15px">
  5. <div class="ai_nav">
  6. <span :class="{active: type == 1}">基础创建</span>
  7. </div>
  8. <div class="ai_detail" v-if="type == 1">
  9. <span class="title">{{text2 ? '默认的提示词1' : '默认的提示词'}}</span>
  10. <textarea rows="10" class="binfo_input binfo_textarea" cols v-model="text"
  11. placeholder="请输入...."></textarea>
  12. </div>
  13. <div class="ai_detail" v-if="text2 && type == 1" style="margin-top: 10px;">
  14. <span class="title">默认的提示词2</span>
  15. <textarea rows="10" class="binfo_input binfo_textarea" cols v-model="text2"
  16. placeholder="请输入...."></textarea>
  17. </div>
  18. <div class="ai_detail" v-if="text3 && type == 1" style="margin-top: 10px;">
  19. <span class="title">默认的提示词3</span>
  20. <textarea rows="10" class="binfo_input binfo_textarea" cols v-model="text3"
  21. placeholder="请输入...."></textarea>
  22. </div>
  23. </div>
  24. <span slot="footer" class="dialog-footer">
  25. <el-button @click="confirm" type="primary">确 定</el-button>
  26. <el-button @click="close">关 闭</el-button>
  27. </span>
  28. </el-dialog>
  29. </template>
  30. <script>
  31. export default {
  32. props: {
  33. dialogVisibleAiD: {
  34. type: Boolean,
  35. default: false
  36. },
  37. aiText: {
  38. type: String,
  39. },
  40. aiText2: {
  41. type: String,
  42. },
  43. aiText3: {
  44. type: String,
  45. },
  46. clickType: {
  47. type: Number
  48. }
  49. },
  50. data() {
  51. return {
  52. type: 1,
  53. text: "",
  54. text2: "",
  55. text3: "",
  56. }
  57. },
  58. watch:{
  59. dialogVisibleAiD(newValue, oldValue) {
  60. if(newValue){
  61. this.text = JSON.parse(JSON.stringify(this.aiText))
  62. this.text2 = this.aiText2 ? JSON.parse(JSON.stringify(this.aiText2)) : ''
  63. this.text3 = this.aiText3 ? JSON.parse(JSON.stringify(this.aiText3)) : ''
  64. if(this.clickType == 2){
  65. this.confirm();
  66. }
  67. }
  68. },
  69. },
  70. methods: {
  71. handleClose(done) {
  72. this.close()
  73. done();
  74. },
  75. close() {
  76. this.$emit('update:dialogVisibleAiD', false)
  77. },
  78. confirm(){
  79. this.$emit("aiConfirm",this.text,this.text2,this.text3);
  80. this.$emit('update:dialogVisibleAiD', false)
  81. }
  82. },
  83. }
  84. </script>
  85. <style scoped>
  86. .dialog_diy>>>.el-dialog {
  87. height: auto;
  88. margin: 15vh auto 0 !important;
  89. }
  90. .dialog_diy>>>.el-dialog__header {
  91. background: #454545 !important;
  92. padding: 15px 20px;
  93. }
  94. .dialog_diy>>>.el-dialog__body {
  95. height: calc(100% - 124px);
  96. box-sizing: border-box;
  97. padding: 0px;
  98. }
  99. .dialog_diy>>>.el-dialog__title {
  100. color: #fff;
  101. }
  102. .dialog_diy>>>.el-dialog__headerbtn {
  103. top: 19px;
  104. }
  105. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
  106. color: #fff;
  107. }
  108. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
  109. color: #fff;
  110. }
  111. .dialog_diy>>>.el-dialog__body,
  112. .dialog_diy>>>.el-dialog__footer {
  113. background: #fafafa;
  114. }
  115. .ai_detail > .binfo_input {
  116. width: 100%;
  117. margin: 0;
  118. padding: 12px 14px;
  119. display: block;
  120. min-width: 0;
  121. outline: none;
  122. box-sizing: border-box;
  123. background: none;
  124. border: none;
  125. border-radius: 4px;
  126. background: #fff;
  127. font-size: 16px;
  128. resize: none;
  129. font-family: "Microsoft YaHei";
  130. min-height: 48px;
  131. /* border: 1px solid #3682fc00; */
  132. border: 1.5px solid #cad1dc;
  133. }
  134. .ai_detail > .binfo_textarea {
  135. border: 1.5px solid #cad1dc;
  136. font-size: 16px;
  137. resize: none;
  138. /* background: #f6f6f6; */
  139. font-family: "Microsoft YaHei";
  140. }
  141. .ai_detail > .binfo_input:focus-visible {
  142. border: 1.5px solid #3681fc !important;
  143. }
  144. .ai_nav{
  145. font-size: 16px;
  146. margin-bottom: 10px;
  147. display: flex;
  148. align-items: center;
  149. }
  150. .ai_nav > span{
  151. cursor: pointer;
  152. }
  153. .ai_nav > span + span{
  154. margin-left: 15px;
  155. }
  156. .ai_nav > span.active{
  157. color: #3681fc;
  158. }
  159. .ai_detail{
  160. display: flex;
  161. flex-direction: column;
  162. }
  163. .ai_detail > .title{
  164. margin-bottom: 5px;
  165. }
  166. </style>