makeDetail.vue 21 KB

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