makeDetail.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  1. <template>
  2. <view class="page">
  3. <!-- 引入FontAwesome -->
  4. <view>
  5. <link rel="stylesheet"
  6. href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  7. </view>
  8. <!-- 顶部导航栏 -->
  9. <view class="custom-navbar">
  10. <view class="navbar-left" @click="goBack">
  11. <text class="fa fa-angle-left"></text>
  12. </view>
  13. <view class="navbar-center">
  14. <view class="navbar-title">
  15. <image class="navbar-avatar" :src="myinfo.avator" mode="aspectFill"></image>
  16. <text class="navbar-text">{{ myinfo.nickname }}</text>
  17. <text class="navbar-badge" v-if="myinfo.is_vip > 0">VIP</text>
  18. </view>
  19. </view>
  20. <view class="navbar-right" @click="showActionSheet">
  21. <text class="fa fa-ellipsis-h"></text>
  22. </view>
  23. </view>
  24. <view class="topStatusBar inProgress" v-if="fileInformation.status == 2"
  25. :class="queueDetail.task_type == 1 ? 'mb20' : ''"> 审核中</view>
  26. <view class="topStatusBar fail" v-if="fileInformation.status == 4"
  27. :class="queueDetail.task_type == 2 ? 'mb20' : ''" @click="openConfirmationBox"> 审核未通过,点击查看原因</view>
  28. <!-- 灵感 -->
  29. <template v-if="queueDetail.task_type == 1">
  30. <view class="inspiration-content" v-if="home_image">
  31. <image v-if="home_image" src="../../static/makedetail/cz_img_zhanshi.png" mode="widthFix"></image>
  32. <image :src="home_image" class="inspirationPictures" mode="widthFix"></image>
  33. </view>
  34. </template>
  35. <!-- 音乐 -->
  36. <template v-else-if="queueDetail.task_type == 2">
  37. <view class="musicContentBox">
  38. <view class="headCard">
  39. <image :src="home_image" class="songCover"></image>
  40. <view class="songInfo">
  41. <view class="songTitle">{{ addBrackets(queueDetail.song_name) }}</view>
  42. <view class="songTag">
  43. <view class="tag" v-for="(item, index) in commaToArray(queueDetail.style)"
  44. :key="index + item">{{ item }}</view>
  45. </view>
  46. </view>
  47. <template v-if="queueDetail.task_type == 2 && queueDetail.status >= 9">
  48. <image @click="toggleAudio" v-if="isPlaying" src="@/static/makedetail/cz_icon_zanting.png"
  49. class="playerButton"></image>
  50. <image @click="toggleAudio" v-else src="@/static/makedetail/cz_icon_bofang.png"
  51. class="playerButton"></image>
  52. </template>
  53. </view>
  54. <view class="contentHeader">
  55. <view class="musicContent">
  56. <text> {{ queueDetail.description }}</text>
  57. </view>
  58. <view class="maskLayer"></view>
  59. </view>
  60. </view>
  61. </template>
  62. <!-- 作品描述 -->
  63. <view class="workDescription">
  64. <view class="workDescription-title">
  65. <view>创作描述 </view>
  66. <!-- <image class="pen" src="@/static/icon/wd_icon_bianji.png"></image> -->
  67. </view>
  68. <view class="workDescription-content">
  69. {{ queueDetail.lyrics || queueDetail.description }}
  70. </view>
  71. </view>
  72. <!-- 作品描述 -->
  73. <view class="workDescription" v-if="queueDetail.content">
  74. <view class="workDescription-title">
  75. <view>创作说明 </view>
  76. <!-- <image class="pen" src="@/static/icon/wd_icon_bianji.png"></image> -->
  77. </view>
  78. <view class="workDescription-content">
  79. {{ noteContent }}
  80. </view>
  81. </view>
  82. <view class="thread2"></view>
  83. <!-- 音频元素 -->
  84. <audio id="audioPlayer" :src="queueDetail.result_audio" style="display:none;"></audio>
  85. <!-- 用于处理图片像素的隐藏canvas -->
  86. <canvas canvas-id="pixelCanvas"
  87. style="width: 10px; height: 10px; position: absolute; left: -100px; top: -100px;"></canvas>
  88. <!-- 底部漂浮栏 -->
  89. <view class="floating-bar"
  90. v-if="queueDetail.status == 9 && (fileInformation.status == 3 || fileInformation.status == 0)">
  91. <view class="floating-bar-content">
  92. <view class="add-note-btn" @click="openContentPopUpWindow">
  93. <text>添加说明</text>
  94. </view>
  95. <view class="publish-btn" @click="publishWork">
  96. <text>公布作品</text>
  97. </view>
  98. </view>
  99. </view>
  100. <!-- 自定义 ActionSheet -->
  101. <ActionSheet ref="actionSheet" :items="[
  102. { text: '分享作品', icon: '../../static/icon/cz_icon_fenxiangzuopin.png' },
  103. { text: '修改封面', icon: '../../static/icon/cz_icon_xiugaifengmian.png' },
  104. { text: '删除作品', icon: '../../static/icon/sy_icon_shanchu.png', danger: true }
  105. ]" @select="handleActionSelect" @cancel="handleActionCancel" />
  106. <NicknamePopup title="添加说明" subtitle="" class="openContentPopUpWindow" ref="openContentPopUpWindow">
  107. <template slot="content">
  108. <uv-textarea v-model="noteContent" maxlength="500" count placeholder="请描述你添加的内容"></uv-textarea>
  109. <view class="btn-box" @click="confirmAddNote">确认</view>
  110. </template>
  111. </NicknamePopup>
  112. <CustomPopup ref="confirmationBox">
  113. <view class="failureReason">
  114. <view class="title"> 审核未通关</view>
  115. <view class="reviewContent">
  116. {{ fileInformation.reason }}
  117. </view>
  118. <view class="btn-box" @click="closeConfirmationBox">知道了</view>
  119. </view>
  120. </CustomPopup>
  121. <DialogBox ref="customConfirm"></DialogBox>
  122. </view>
  123. </template>
  124. <script>
  125. import previewImage from '@/components/kxj-previewImage/kxj-previewImage.vue'; //引用插件
  126. import NicknamePopup from '@/components//NicknamePopup/NicknamePopup.vue';
  127. import CustomPopup from '@/components/CustomPopup/CustomPopup.vue';
  128. import ActionSheet from '@/components/ActionSheet/ActionSheet.vue';
  129. export default {
  130. components: {
  131. previewImage,
  132. NicknamePopup,
  133. CustomPopup,
  134. ActionSheet,
  135. },
  136. data() {
  137. return {
  138. title: '',
  139. arcID: 0,
  140. selImg: 0,
  141. home_image: '',
  142. myinfo: {},
  143. tag_list: [],
  144. image_list: [],
  145. imgs: [],
  146. descs: [],
  147. isPlaying: false,
  148. audioPlayer: null,
  149. showNotePopup: false,
  150. noteContent: '',
  151. pixelColor: null, // 存储像素颜色值
  152. queueId: 0,
  153. // 队列详情数据
  154. queueDetail: {
  155. id: 0,
  156. sso_id: 0,
  157. task_type: 1,
  158. title: '',
  159. description: '',
  160. action: '',
  161. environment: '',
  162. subject: '',
  163. style: '',
  164. song_name: '',
  165. lyrics: '',
  166. generate_uuid: '',
  167. result_images: '',
  168. result_audio: '',
  169. queue_position: 0,
  170. status: 1,
  171. generate_status: 1,
  172. points_cost: 0,
  173. error_msg: '',
  174. create_time: '',
  175. update_time: '',
  176. all_position: 0
  177. },
  178. fileInformation: {
  179. age: 0,
  180. author: "",
  181. avator: "",
  182. city: "",
  183. content: "",
  184. create_time: "",
  185. dtime: "",
  186. id: 0,
  187. images: "",
  188. is_like: 0,
  189. is_vip: 0,
  190. like_count: 0,
  191. lyrics: "",
  192. nickname: "",
  193. num_comment: 0,
  194. num_like: 0,
  195. num_view: 0,
  196. queue_id: 0,
  197. reason: "",
  198. result_audio: "",
  199. sex: 0,
  200. sso_id: 0,
  201. status: 0, //1是成功 2是审核中 4是失败 3是未公布也就是私人状态
  202. task_type: 0,
  203. tdate: "",
  204. title: "",
  205. userID: 0,
  206. xinzuo: "",
  207. },
  208. myinfo: {},
  209. offsetY: 0,
  210. isDragging: false,
  211. startY: 0,
  212. initialOffsetY: 0,
  213. }
  214. },
  215. onLoad(parms) {
  216. let self = this;
  217. this.arcID = parms.id;
  218. this.queueId = parms.queueId;
  219. this.getMyInfo();
  220. },
  221. onShow() {
  222. this.loadData();
  223. this.getInfoData();
  224. },
  225. onReady() {
  226. // 获取音频元素
  227. this.audioPlayer = uni.createInnerAudioContext();
  228. this.audioPlayer.onEnded(() => {
  229. this.isPlaying = false;
  230. });
  231. },
  232. onUnload() {
  233. // 页面卸载时停止音频播放
  234. if (this.audioPlayer) {
  235. this.audioPlayer.stop();
  236. this.audioPlayer.destroy();
  237. }
  238. },
  239. mounted() {
  240. },
  241. methods: {
  242. openConfirmationBox() {
  243. this.$refs.confirmationBox.open();
  244. },
  245. closeConfirmationBox() {
  246. this.$refs.confirmationBox.close();
  247. },
  248. openContentPopUpWindow() {
  249. this.$refs.openContentPopUpWindow.open();
  250. },
  251. closeContentPopUpWindow() {
  252. this.$refs.openContentPopUpWindow.close();
  253. },
  254. // 获取图片第一个像素的RGB值
  255. getImagePixelColor() {
  256. console.log("图片加载完成,准备获取像素颜色");
  257. // 清空之前的颜色值,进入加载状态
  258. this.pixelColor = null;
  259. // 如果是默认图片或空图片,则直接返回
  260. if (!this.home_image || this.home_image === '../../static/home/avator.png') {
  261. console.log("无有效图片,不获取像素颜色");
  262. return;
  263. }
  264. // 使用uni.getImageInfo获取图片信息
  265. uni.getImageInfo({
  266. src: this.home_image,
  267. success: (res) => {
  268. console.log("图片信息:", res);
  269. // 创建临时canvas绘制上下文
  270. const ctx = uni.createCanvasContext('pixelCanvas', this);
  271. // 修改绘制参数,确保只绘制图片左上角的一小块区域
  272. // drawImage(图片路径, 源图片裁剪x, 源图片裁剪y, 源图片裁剪宽度, 源图片裁剪高度, canvas目标x, canvas目标y, canvas目标宽度, canvas目标高度)
  273. // 这里我们只从源图片左上角裁剪10x10的区域,绘制到canvas的左上角
  274. ctx.drawImage(res.path, 0, 0, 10, 10, 0, 0, 10, 10);
  275. ctx.draw(false, () => {
  276. // 绘制完成后,获取像素数据
  277. setTimeout(() => { // 添加短暂延迟确保绘制完成
  278. uni.canvasGetImageData({
  279. canvasId: 'pixelCanvas',
  280. x: 0, // 获取(0,0)位置的像素
  281. y: 0,
  282. width: 1,
  283. height: 1,
  284. success: (res) => {
  285. // 获取像素RGB值
  286. this.pixelColor = {
  287. r: res.data[0],
  288. g: res.data[1],
  289. b: res.data[2],
  290. a: res.data[3]
  291. };
  292. console.log("第一个像素的RGB值:", this
  293. .pixelColor);
  294. },
  295. fail: (err) => {
  296. console.error("获取像素数据失败:", err);
  297. // 显示错误提示
  298. uni.showToast({
  299. title: '获取颜色失败',
  300. icon: 'none',
  301. duration: 2000
  302. });
  303. }
  304. });
  305. }, 100);
  306. });
  307. },
  308. fail: (err) => {
  309. console.error("获取图片信息失败:", err);
  310. // 显示错误提示
  311. uni.showToast({
  312. title: '图片加载失败',
  313. icon: 'none',
  314. duration: 2000
  315. });
  316. }
  317. });
  318. },
  319. // 返回上一页
  320. goBack() {
  321. uni.navigateBack({
  322. delta: 1
  323. });
  324. },
  325. getMyInfo() {
  326. uni.request({
  327. url: this.$apiHost + '/My/getnum',
  328. method: 'GET',
  329. header: {
  330. 'content-type': 'application/json',
  331. 'sign': getApp().globalData.headerSign
  332. },
  333. data: {
  334. uuid: getApp().globalData.uuid
  335. },
  336. success: (res) => {
  337. console.log("获取用户信息:", res.data);
  338. this.myinfo = res.data
  339. }
  340. })
  341. },
  342. selPhoto(item, sel) {
  343. this.selImg = sel;
  344. this.home_image = this.image_list[sel];
  345. },
  346. toArr(imgs) {
  347. let arr = imgs.split("|");
  348. return arr;
  349. },
  350. previewOpen(imgs1, index) {
  351. this.imgs = imgs1.split("|");
  352. setTimeout(() => this.$refs.previewImage.open(index), 0)
  353. // 传入当前选中的图片地址或序号
  354. return; //如需测试和uni原生预览差别可注释这两行
  355. },
  356. // 切换音频播放状态
  357. toggleAudio() {
  358. if (!this.queueDetail.result_audio) return;
  359. if (this.isPlaying) {
  360. this.audioPlayer.pause();
  361. this.isPlaying = false;
  362. } else {
  363. this.audioPlayer.src = this.queueDetail.result_audio;
  364. this.audioPlayer.play();
  365. this.isPlaying = true;
  366. }
  367. },
  368. // 获取进度条宽度
  369. getProgressWidth() {
  370. if (this.queueDetail.all_position === 0) return '0%';
  371. const progress = (1 - (this.queueDetail.queue_position / this.queueDetail.all_position)) * 100;
  372. return `${progress}%`;
  373. },
  374. // 加载数据
  375. loadData() {
  376. uni.showLoading({
  377. title: '加载中...'
  378. });
  379. let that = this;
  380. if (this.queueId) {
  381. that.workInformation()
  382. }
  383. uni.request({
  384. url: this.$apiHost + '/WorkAI/getQueueDetail',
  385. data: {
  386. uuid: getApp().globalData.uuid,
  387. id: this.arcID
  388. },
  389. header: {
  390. "content-type": "application/json",
  391. 'sign': getApp().globalData.headerSign
  392. },
  393. success: (res) => {
  394. console.log("队列详情:", res.data);
  395. if (res.data.success === "yes") {
  396. // 更新队列详情
  397. this.queueDetail = res.data.data;
  398. this.noteContent = res.data.data.content;
  399. // 更新图片列表
  400. if (this.queueDetail.result_images && this.queueDetail.result_images !== "") {
  401. this.image_list = this.queueDetail.result_images.split(",");
  402. this.home_image = this.image_list[0];
  403. // 当图片更新后,手动触发获取像素颜色(因为图片可能从缓存加载,不会触发@load事件)
  404. // setTimeout(() => {
  405. // that.getImagePixelColor();
  406. // }, 500);
  407. } else {
  408. this.home_image = "../../static/home/avator.png";
  409. }
  410. // 如果是音频类型,设置音频源
  411. if (this.queueDetail.task_type == 2 && this.queueDetail.result_audio) {
  412. this.audioPlayer.src = this.queueDetail.result_audio;
  413. }
  414. } else {
  415. uni.showToast({
  416. title: '获取详情失败',
  417. icon: 'none'
  418. });
  419. }
  420. },
  421. complete: () => {
  422. uni.hideLoading();
  423. },
  424. fail: (e) => {
  425. console.log("请求失败:", e);
  426. uni.showToast({
  427. title: '网络请求失败',
  428. icon: 'none'
  429. });
  430. }
  431. });
  432. },
  433. // 加载作品信息
  434. workInformation() {
  435. uni.request({
  436. url: this.$apiHost + '/Work/getinfo',
  437. data: {
  438. uuid: getApp().globalData.uuid,
  439. id: this.queueId
  440. },
  441. header: {
  442. "content-type": "application/json",
  443. 'sign': getApp().globalData.headerSign
  444. },
  445. success: (res) => {
  446. console.log("文章信息:", res.data);
  447. if (res.data.success === "yes") {
  448. // 更新文章信息
  449. this.fileInformation = res.data.data;
  450. } else {
  451. }
  452. },
  453. complete: (com) => {
  454. // uni.hideLoading();
  455. },
  456. fail: (e) => {
  457. console.log("请求失败:", e);
  458. uni.showToast({
  459. title: '网络请求失败',
  460. icon: 'none'
  461. });
  462. }
  463. });
  464. },
  465. showActionSheet() {
  466. this.$refs.actionSheet.show();
  467. },
  468. handleActionSelect(index, item) {
  469. console.log('ActionSheet selected index:', item.text,);
  470. switch (item.text) {
  471. case '分享作品':
  472. break;
  473. case '修改封面':
  474. // 修改封面
  475. if (this.fileInformation.status == 3) {
  476. uni.showToast({
  477. title: '作品已完成,无法修改封面!',
  478. icon: 'success'
  479. });
  480. break;
  481. }
  482. this.editCover();
  483. break;
  484. case '删除作品':
  485. // 删除作品
  486. this.deleteWork();
  487. break;
  488. }
  489. },
  490. handleActionCancel() {
  491. console.log('ActionSheet cancelled');
  492. },
  493. // 修改封面
  494. editCover() {
  495. var _self = this;
  496. uni.chooseImage({
  497. count: 1,
  498. sizeType: ['compressed'],
  499. sourceType: ['album', 'camera'],
  500. success: function (res) {
  501. console.log('res:', res)
  502. if (res.tempFilePaths.length > 0) {
  503. _self.imglocal = res.tempFilePaths[0]
  504. const tempFilePaths = res.tempFilePaths[0];
  505. console.log('tempFilePaths:', tempFilePaths);
  506. const uploadTask = uni.uploadFile({
  507. url: _self.$apiHost + '/Xweb/upload_img?skey=' + _self.skey,
  508. filePath: res.tempFilePaths[0],
  509. name: 'file',
  510. success: function (uploadFileRes) {
  511. let resdata = JSON.parse(uploadFileRes.data)
  512. console.log('Success11:', uploadFileRes);
  513. console.log('Success21:', resdata);
  514. if (resdata.success == 'yes') {
  515. _self.home_image = resdata.url;
  516. // 调用修改封面接口
  517. uni.request({
  518. url: _self.$apiHost + '/WorkAI/queueAction',
  519. method: 'GET',
  520. data: {
  521. uuid: getApp().globalData.uuid,
  522. act: 'editImg',
  523. result_images: resdata.url,
  524. id: _self.arcID
  525. },
  526. header: {
  527. 'content-type': 'application/json',
  528. 'sign': getApp().globalData.headerSign
  529. },
  530. success: (res) => {
  531. if (res.data.success === "yes") {
  532. uni.showToast({
  533. title: '修改封面成功',
  534. icon: 'success'
  535. });
  536. } else {
  537. uni.showToast({
  538. title: '修改封面失败',
  539. icon: 'none'
  540. });
  541. }
  542. },
  543. fail: () => {
  544. uni.showToast({
  545. title: '修改封面失败',
  546. icon: 'none'
  547. });
  548. }
  549. });
  550. }
  551. },
  552. fail: function (uploadFileFail) {
  553. console.log('Error:', uploadFileFail.data);
  554. uni.showToast({
  555. title: '图片上传失败',
  556. icon: 'none'
  557. });
  558. }
  559. });
  560. }
  561. },
  562. error: function (e) {
  563. console.log(e);
  564. uni.showToast({
  565. title: '选择图片失败',
  566. icon: 'none'
  567. });
  568. }
  569. });
  570. },
  571. // 删除作品
  572. deleteWork() {
  573. this.$refs["customConfirm"]
  574. .confirm({
  575. title: "确认删除",
  576. content: "确定要删除这个作品吗?",
  577. DialogType: "inquiry",
  578. btn1: "再考虑一下",
  579. btn2: "确认解绑",
  580. animation: 0,
  581. })
  582. .then((res) => {
  583. if (res.confirm) {
  584. // 用户点击确定,执行删除操作
  585. this.confirmDelete();
  586. }
  587. });
  588. },
  589. // 确认删除
  590. confirmDelete() {
  591. uni.showLoading({
  592. title: '删除中...'
  593. });
  594. uni.request({
  595. url: this.$apiHost + '/WorkAI/queueAction',
  596. method: 'GET',
  597. data: {
  598. uuid: getApp().globalData.uuid,
  599. act: 'del',
  600. id: this.arcID
  601. },
  602. header: {
  603. 'content-type': 'application/json',
  604. 'sign': getApp().globalData.headerSign
  605. },
  606. success: (res) => {
  607. uni.hideLoading();
  608. if (res.data.success === "yes") {
  609. uni.showToast({
  610. title: '删除成功',
  611. icon: 'success'
  612. });
  613. // 删除成功后返回上一页
  614. setTimeout(() => {
  615. uni.navigateBack({
  616. delta: 1
  617. });
  618. }, 1500);
  619. } else {
  620. uni.showToast({
  621. title: '删除失败',
  622. icon: 'none'
  623. });
  624. }
  625. },
  626. fail: () => {
  627. uni.hideLoading();
  628. uni.showToast({
  629. title: '删除失败',
  630. icon: 'none'
  631. });
  632. }
  633. });
  634. },
  635. // 显示添加说明弹窗
  636. showAddNotePopup() {
  637. this.showNotePopup = true;
  638. },
  639. // 关闭添加说明弹窗
  640. closeAddNotePopup() {
  641. this.showNotePopup = false;
  642. },
  643. // 确认添加说明
  644. confirmAddNote() {
  645. if (!this.noteContent.trim()) {
  646. uni.showToast({
  647. title: '请输入说明内容',
  648. icon: 'none'
  649. });
  650. return;
  651. }
  652. uni.showLoading({
  653. title: '保存中...'
  654. });
  655. uni.request({
  656. url: this.$apiHost + '/WorkAI/queueAction',
  657. method: 'GET',
  658. data: {
  659. uuid: getApp().globalData.uuid,
  660. act: 'editContent',
  661. content: this.noteContent,
  662. id: this.arcID
  663. },
  664. header: {
  665. 'content-type': 'application/json',
  666. 'sign': getApp().globalData.headerSign
  667. },
  668. success: (res) => {
  669. uni.hideLoading();
  670. if (res.data.success === "yes") {
  671. uni.showToast({
  672. title: '添加说明成功',
  673. icon: 'success'
  674. });
  675. this.noteContent = '';
  676. this.closeContentPopUpWindow();
  677. // 重新加载数据
  678. this.loadData();
  679. } else {
  680. uni.showToast({
  681. title: '添加说明失败',
  682. icon: 'none'
  683. });
  684. }
  685. },
  686. fail: () => {
  687. uni.hideLoading();
  688. uni.showToast({
  689. title: '添加说明失败',
  690. icon: 'none'
  691. });
  692. }
  693. });
  694. },
  695. // 发布作品
  696. publishWork() {
  697. uni.showLoading({
  698. title: '发布中...'
  699. });
  700. uni.request({
  701. url: this.$apiHost + '/WorkAI/queueAction',
  702. method: 'GET',
  703. data: {
  704. uuid: getApp().globalData.uuid,
  705. act: 'fabu',
  706. id: this.arcID
  707. },
  708. header: {
  709. 'content-type': 'application/json',
  710. 'sign': getApp().globalData.headerSign
  711. },
  712. success: (res) => {
  713. console.log("resddd", res.data);
  714. uni.hideLoading();
  715. if (res.data.success === "yes") {
  716. uni.showToast({
  717. title: '发布成功',
  718. icon: 'success'
  719. });
  720. // 重新加载数据
  721. // this.loadData();
  722. } else {
  723. uni.showToast({
  724. title: res.data.str || '发布失败',
  725. icon: 'none'
  726. });
  727. }
  728. },
  729. fail: () => {
  730. uni.hideLoading();
  731. uni.showToast({
  732. title: '发布失败',
  733. icon: 'none'
  734. });
  735. },
  736. complete: () => {
  737. setTimeout(() => {
  738. uni.navigateBack({
  739. delta: 1
  740. });
  741. }, 800);
  742. }
  743. });
  744. },
  745. // 新增过滤器方法
  746. commaToArray(str) {
  747. if (!str) return '';
  748. return str.split(',');
  749. },
  750. // 新增过滤器方法
  751. addBrackets(str) {
  752. if (!str) return '';
  753. if (!str.startsWith('《')) {
  754. str = '《' + str;
  755. }
  756. if (!str.endsWith('》')) {
  757. str = str + '》';
  758. }
  759. return str;
  760. },
  761. getInfoData() {
  762. uni.request({
  763. url: this.$apiHost + '/Member/getinfoData',
  764. data: {
  765. uuid: getApp().globalData.uuid
  766. },
  767. header: {
  768. 'content-type': 'application/json'
  769. },
  770. success: (res) => {
  771. console.log('用户信息', res.data);
  772. }
  773. });
  774. },
  775. }
  776. }
  777. </script>
  778. <style scoped lang="scss">
  779. @import 'makeDetail.scss';
  780. .openContentPopUpWindow {
  781. ::v-deep.uv-textarea {
  782. width: 694rpx !important;
  783. border-radius: 20rpx !important;
  784. border: 1rpx solid #000000 !important;
  785. margin: 0 auto;
  786. margin-bottom: 44rpx;
  787. min-height: 300rpx;
  788. }
  789. }
  790. </style>