weekly.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="model-item-container">
  3. <br />
  4. <el-form label-width="100px" :model="form" label-position="top">
  5. <el-form-item label="请简单描述您的工作内容*">
  6. <el-input
  7. v-model="form.title"
  8. type="textarea"
  9. :rows="5"
  10. maxlength="1000"
  11. show-word-limit
  12. placeholder="制作「AI模板」原型,撰写需求文档,与开发沟通相关细节"
  13. />
  14. </el-form-item>
  15. </el-form>
  16. <el-form>
  17. <el-form-item label="文章长度">
  18. <div style="text-align: right; width: 100%">
  19. <el-button @click="form.type = '日报'" plain :class="{ act: form.type === '日报' }">
  20. 日报
  21. </el-button>
  22. <el-button @click="form.type = '周报'" plain :class="{ act: form.type === '周报' }">
  23. 周报
  24. </el-button>
  25. <el-button @click="form.type = '月报'" plain :class="{ act: form.type === '月报' }">
  26. 月报
  27. </el-button>
  28. </div>
  29. </el-form-item>
  30. <el-form-item label="职业">
  31. <div style="text-align: right; width: 100%">
  32. <el-input style="width: 8em" v-model="form.career" />
  33. </div>
  34. </el-form-item>
  35. <el-form-item label="文案长度">
  36. <div style="text-align: right; width: 100%">
  37. <el-button
  38. @click="form.long = 'short'"
  39. plain
  40. :class="{ act: form.long === 'short' }"
  41. >
  42. </el-button>
  43. <el-button
  44. @click="form.long = 'default'"
  45. plain
  46. :class="{ act: form.long === 'default' }"
  47. >
  48. </el-button>
  49. <el-button
  50. @click="form.long = 'long'"
  51. plain
  52. :class="{ act: form.long === 'long' }"
  53. >
  54. </el-button>
  55. </div>
  56. </el-form-item>
  57. <el-form-item label="文案条数">
  58. <div style="text-align: right; width: 100%">
  59. <el-input-number v-model="form.num" :min="1" />
  60. </div>
  61. </el-form-item>
  62. </el-form>
  63. <div class="btn_group">
  64. <el-button
  65. type="primary"
  66. style="width: 100%"
  67. @click="create"
  68. :loading="load"
  69. >生成文案</el-button
  70. >
  71. <div class="bottom-content-safe-tip">
  72. <img :src="image_base64.tanhao" class="content-safe-tip-icon" />
  73. <div class="content-safe-tip-text">
  74. 声明:内容为概率模型生成,可能会产生不正确的信息,不代表我司的观点和立场
  75. </div>
  76. </div>
  77. </div>
  78. <template v-if="form.list.length">
  79. <div class="item" v-for="(item, i) in form.list" :key="i">
  80. <div class="content" v-text="item.text"></div>
  81. <div class="btn_div">
  82. <el-tooltip effect="dark" content="左侧导入" placement="top">
  83. <el-icon
  84. @click="() => inputText(item.text)"
  85. style="
  86. left: 50;
  87. top: 50%;
  88. transform: translate(-50%, -50%);
  89. cursor: pointer;
  90. "
  91. color="#cacaca"
  92. ><DArrowLeft
  93. /></el-icon>
  94. </el-tooltip>
  95. </div>
  96. <div class="btn_div">
  97. <el-tooltip effect="dark" content="复制" placement="top">
  98. <el-icon
  99. style="
  100. left: 50;
  101. top: 50%;
  102. transform: translate(-50%, -50%);
  103. cursor: pointer;
  104. "
  105. @click="() => copyurl(item.text)"
  106. color="#cacaca"
  107. ><CopyDocument
  108. /></el-icon>
  109. </el-tooltip>
  110. </div>
  111. </div>
  112. </template>
  113. </div>
  114. </template>
  115. <script setup>
  116. import { copyurl } from '@/utils/tool.js';
  117. import { ref, defineEmits } from 'vue';
  118. import { image_base64 } from './data.js';
  119. import { advertisement, generate_pc_get } from '@/api/aleditor.js';
  120. const emits = defineEmits(['closeType', 'setHtml', 'getImage']);
  121. const load = ref(false);
  122. const form = ref({
  123. title: '',
  124. long: 'short',
  125. type: '日报',
  126. career: '',
  127. list: [],
  128. num: 1,
  129. });
  130. const inputText = text => {
  131. emits('setHtml', text);
  132. };
  133. const create = () => {
  134. load.value = true;
  135. const p = {
  136. count: form.value.num,
  137. data: {
  138. content: form.value.title,
  139. occupation: form.value.career,
  140. type: form.value.type,
  141. },
  142. generateType: 27,
  143. length:
  144. form.value.long === 'short'
  145. ? 200
  146. : form.value.long === 'default'
  147. ? 400
  148. : 800,
  149. noblock: true,
  150. query_type: 'dialog',
  151. };
  152. advertisement({
  153. data: p,
  154. noload: true,
  155. }).then(r => {
  156. if (r.errCode !== 0) return (load.value = false);
  157. p.req = { doc_id: r.data.doc_id };
  158. get(p);
  159. });
  160. };
  161. const get = p => {
  162. generate_pc_get({
  163. data: p,
  164. noload: true,
  165. })
  166. .then(res => {
  167. load.value = false;
  168. if (res.errCode !== 0 && res.data.status === 'RUNNING') {
  169. let t = setTimeout(() => {
  170. get(p);
  171. clearTimeout(t);
  172. }, 200);
  173. return;
  174. }
  175. const list = res.data.result.content;
  176. const l = [];
  177. for (let i = 0; i < list.length; i++) {
  178. const v = list[i];
  179. l.push({
  180. text: v,
  181. });
  182. }
  183. form.value.list.push(...l);
  184. })
  185. .catch(() => {
  186. load.value = false;
  187. });
  188. };
  189. </script>
  190. <style scoped>
  191. .model-item-container {
  192. text-align: center;
  193. -webkit-box-flex: 1;
  194. -ms-flex: 1;
  195. flex: 1;
  196. display: -webkit-box;
  197. display: -ms-flexbox;
  198. display: flex;
  199. -webkit-box-orient: vertical;
  200. -webkit-box-direction: normal;
  201. -ms-flex-direction: column;
  202. flex-direction: column;
  203. min-height: 0;
  204. width: 95%;
  205. height: 100%;
  206. }
  207. .act {
  208. color: var(--el-button-hover-text-color);
  209. border-color: var(--el-button-hover-border-color);
  210. background-color: var(--el-button-hover-bg-color);
  211. outline: 0;
  212. }
  213. .btn_group {
  214. padding-right: 1em;
  215. }
  216. .bottom-content-safe-tip {
  217. display: -webkit-box;
  218. display: -ms-flexbox;
  219. display: flex;
  220. padding: 15px 0;
  221. -webkit-box-pack: center;
  222. -ms-flex-pack: center;
  223. justify-content: center;
  224. width: 100%;
  225. zoom: 0.83;
  226. }
  227. .bottom-content-safe-tip .content-safe-tip-icon {
  228. width: 15px;
  229. height: 15px;
  230. margin-right: 10px;
  231. }
  232. .bottom-content-safe-tip .content-safe-tip-text {
  233. font-size: 12px;
  234. line-height: 15px;
  235. color: #cacaca;
  236. }
  237. .item {
  238. width: 100%;
  239. -webkit-box-sizing: border-box;
  240. box-sizing: border-box;
  241. margin-bottom: 20px;
  242. text-align: left;
  243. position: relative;
  244. padding: 10px 10px 10px 0;
  245. display: flex;
  246. -webkit-box-align: center;
  247. -ms-flex-align: center;
  248. align-items: center;
  249. border-bottom: 1px solid #eee;
  250. }
  251. .content {
  252. -webkit-box-flex: 1;
  253. -ms-flex: 1;
  254. flex: 1;
  255. outline: none;
  256. line-height: 28px;
  257. text-align: justify;
  258. overflow-y: auto;
  259. }
  260. .hover_class,
  261. .item:hover {
  262. background-color: #f5f5f5;
  263. border-bottom: 1px solid #f8f8f8;
  264. }
  265. .btn_div {
  266. height: 30px;
  267. width: 30px;
  268. position: relative;
  269. }
  270. </style>