makeDetail.vue 21 KB

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