makeDetail.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  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.avatar" 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. <!-- 内容头图区域 -->
  25. <view class="topUser">
  26. <image :src="home_image" class="home_image" mode="aspectFill"></image>
  27. <!-- 图片指示器 -->
  28. <!-- <view class="image-indicator" v-if="image_list.length > 1">
  29. <text>{{ selImg + 1 }}/{{ image_list.length }}</text>
  30. </view> -->
  31. <!-- 音乐类型时显示歌词 -->
  32. <view class="lyrics-overlay" v-if="queueDetail.task_type == 2" @mousedown="startDrag" @mouseup="stopDrag"
  33. @mousemove="drag">
  34. <text class="lyrics-text" ref="lyricsText"
  35. :style="{ transform: `translateY(${offsetY}px)` }">{{ queueDetail.description }}</text>
  36. </view>
  37. <!-- 音乐类型且状态为9时显示播放按钮 -->
  38. <view class="play-button" v-if="queueDetail.task_type == 2 && queueDetail.status >= 9" @click="toggleAudio">
  39. <text class="fa" :class="isPlaying ? 'fa-pause' : 'fa-play'"></text>
  40. </view>
  41. </view>
  42. <view class="body">
  43. <view class="article-header">
  44. <text class="title">{{ queueDetail.title }}</text>
  45. <!-- 显示第一个像素的颜色 -->
  46. <view class="pixel-color" v-if="pixelColor">
  47. <view class="color-box"
  48. :style="{backgroundColor: `rgb(${pixelColor.r}, ${pixelColor.g}, ${pixelColor.b})`}"></view>
  49. <view class="color-info">
  50. <text class="color-text">左上角像素RGB值:</text>
  51. <text class="color-value">R:{{pixelColor.r}} G:{{pixelColor.g}} B:{{pixelColor.b}}</text>
  52. <text class="color-hex">HEX: {{rgbToHex(pixelColor.r, pixelColor.g, pixelColor.b)}}</text>
  53. </view>
  54. </view>
  55. <!-- 颜色加载中状态 -->
  56. <view class="pixel-color loading"
  57. v-else-if="home_image && home_image !== '../../static/home/avator.png'">
  58. <view class="color-box loading"></view>
  59. <!-- <text class="color-text">正在获取像素颜色...</text> -->
  60. </view>
  61. <view class="meta-info">
  62. <view class="meta-item">
  63. <text class="fa fa-clock-o"></text>
  64. <text class="meta-text">{{ queueDetail.create_time }}</text>
  65. </view>
  66. <view class="meta-item">
  67. <text class="fa fa-tag"></text>
  68. <text class="meta-text">{{ queueDetail.task_type == 1 ? '灵感创作' : '音乐创作' }}</text>
  69. </view>
  70. <view class="meta-item">
  71. <text class="fa fa-circle" :style="getStatusStyle(queueDetail.status)"></text>
  72. <text class="meta-text">{{ getStatusText(queueDetail.status) }}</text>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="divider"></view>
  77. <view class="article-content">
  78. <!-- 灵感创作显示description -->
  79. <view v-if="queueDetail.task_type == 1">
  80. <text class="content">{{ queueDetail.description }}</text>
  81. </view>
  82. <!-- 音乐创作显示lyrics -->
  83. <view v-if="queueDetail.task_type == 2">
  84. <text class="content">{{ queueDetail.lyrics }}</text>
  85. </view>
  86. <!-- 显示创作详情 -->
  87. <view class="creation-details" v-if="queueDetail.task_type == 1">
  88. <view class="detail-item" v-if="queueDetail.action">
  89. <text class="detail-label">行为动作:</text>
  90. <text class="detail-value">{{ queueDetail.action }}</text>
  91. </view>
  92. <view class="detail-item" v-if="queueDetail.environment">
  93. <text class="detail-label">主体环境:</text>
  94. <text class="detail-value">{{ queueDetail.environment }}</text>
  95. </view>
  96. <view class="detail-item" v-if="queueDetail.subject">
  97. <text class="detail-label">主体形象:</text>
  98. <text class="detail-value">{{ queueDetail.subject }}</text>
  99. </view>
  100. <view class="detail-item" v-if="queueDetail.style">
  101. <text class="detail-label">参考风格:</text>
  102. <text class="detail-value">{{ queueDetail.style }}</text>
  103. </view>
  104. </view>
  105. <!-- 音乐创作显示歌曲名称 -->
  106. <view class="creation-details" v-if="queueDetail.task_type == 2">
  107. <view class="detail-item" v-if="queueDetail.song_name">
  108. <text class="detail-label">歌曲名称:</text>
  109. <text class="detail-value">{{ queueDetail.song_name }}</text>
  110. </view>
  111. </view>
  112. <!-- 显示状态信息 -->
  113. <view class="status-info" v-if="queueDetail.status < 4">
  114. <view class="queue-info">
  115. <text class="queue-text">队列位置:
  116. {{ queueDetail.queue_position }}/{{ queueDetail.all_position }}</text>
  117. <view class="progress-bar">
  118. <view class="progress-fill" :style="{ width: getProgressWidth() }"></view>
  119. </view>
  120. </view>
  121. </view>
  122. <!-- 显示错误信息 -->
  123. <view class="error-message" v-if="queueDetail.status == 3">
  124. <text class="error-text">{{ queueDetail.error_msg }}</text>
  125. </view>
  126. </view>
  127. </view>
  128. <view class="thread2"></view>
  129. <!-- 音频元素 -->
  130. <audio id="audioPlayer" :src="queueDetail.result_audio" style="display:none;"></audio>
  131. <!-- 用于处理图片像素的隐藏canvas -->
  132. <canvas canvas-id="pixelCanvas"
  133. style="width: 10px; height: 10px; position: absolute; left: -100px; top: -100px;"></canvas>
  134. <!-- 底部漂浮栏 -->
  135. <view class="floating-bar" v-if="queueDetail.status == 9">
  136. <view class="floating-bar-content">
  137. <view class="add-note-btn" @click="showAddNotePopup">
  138. <text>添加说明</text>
  139. </view>
  140. <view class="publish-btn" @click="publishWork">
  141. <text>公布作品</text>
  142. </view>
  143. </view>
  144. </view>
  145. <!-- 添加说明弹窗 -->
  146. <view class="popup-mask" v-if="showNotePopup" @click="closeAddNotePopup"></view>
  147. <view class="note-popup" v-if="showNotePopup">
  148. <view class="popup-header">
  149. <text class="popup-title">添加说明</text>
  150. </view>
  151. <view class="popup-content">
  152. <textarea class="note-textarea" v-model="noteContent" placeholder="请描述你想添加的内容。"
  153. maxlength="500"></textarea>
  154. <view class="word-count">{{noteContent.length}}/500</view>
  155. </view>
  156. <view class="popup-footer">
  157. <view class="cancel-btn" @click="closeAddNotePopup">
  158. <text>取消</text>
  159. </view>
  160. <view class="confirm-btn" @click="confirmAddNote">
  161. <text>确认</text>
  162. </view>
  163. </view>
  164. </view>
  165. </view>
  166. </template>
  167. <script>
  168. import previewImage from '@/components/kxj-previewImage/kxj-previewImage.vue'; //引用插件
  169. export default {
  170. components: {
  171. previewImage
  172. },
  173. data() {
  174. return {
  175. title: '',
  176. arcID: 0,
  177. selImg: 0,
  178. home_image: '',
  179. myinfo: {},
  180. tag_list: [],
  181. image_list: [],
  182. imgs: [],
  183. descs: [],
  184. isPlaying: false,
  185. audioPlayer: null,
  186. showNotePopup: false,
  187. noteContent: '',
  188. pixelColor: null, // 存储像素颜色值
  189. // 队列详情数据
  190. queueDetail: {
  191. id: 0,
  192. sso_id: 0,
  193. task_type: 1,
  194. title: '',
  195. description: '',
  196. action: '',
  197. environment: '',
  198. subject: '',
  199. style: '',
  200. song_name: '',
  201. lyrics: '',
  202. generate_uuid: '',
  203. result_images: '',
  204. result_audio: '',
  205. queue_position: 0,
  206. status: 1,
  207. generate_status: 1,
  208. points_cost: 0,
  209. error_msg: '',
  210. create_time: '',
  211. update_time: '',
  212. all_position: 0
  213. },
  214. myinfo: {},
  215. offsetY: 0,
  216. isDragging: false,
  217. startY: 0,
  218. initialOffsetY: 0
  219. }
  220. },
  221. onLoad(parms) {
  222. let self = this;
  223. this.arcID = parms.id || 9;
  224. this.getMyInfo();
  225. },
  226. onShow() {
  227. this.loadData();
  228. },
  229. onReady() {
  230. // 获取音频元素
  231. this.audioPlayer = uni.createInnerAudioContext();
  232. this.audioPlayer.onEnded(() => {
  233. this.isPlaying = false;
  234. });
  235. },
  236. onUnload() {
  237. // 页面卸载时停止音频播放
  238. if (this.audioPlayer) {
  239. this.audioPlayer.stop();
  240. this.audioPlayer.destroy();
  241. }
  242. },
  243. methods: {
  244. // 获取图片第一个像素的RGB值
  245. getImagePixelColor() {
  246. console.log("图片加载完成,准备获取像素颜色");
  247. // 清空之前的颜色值,进入加载状态
  248. this.pixelColor = null;
  249. // 如果是默认图片或空图片,则直接返回
  250. if (!this.home_image || this.home_image === '../../static/home/avator.png') {
  251. console.log("无有效图片,不获取像素颜色");
  252. return;
  253. }
  254. // 使用uni.getImageInfo获取图片信息
  255. uni.getImageInfo({
  256. src: this.home_image,
  257. success: (res) => {
  258. console.log("图片信息:", res);
  259. // 创建临时canvas绘制上下文
  260. const ctx = uni.createCanvasContext('pixelCanvas', this);
  261. // 修改绘制参数,确保只绘制图片左上角的一小块区域
  262. // drawImage(图片路径, 源图片裁剪x, 源图片裁剪y, 源图片裁剪宽度, 源图片裁剪高度, canvas目标x, canvas目标y, canvas目标宽度, canvas目标高度)
  263. // 这里我们只从源图片左上角裁剪10x10的区域,绘制到canvas的左上角
  264. ctx.drawImage(res.path, 0, 0, 10, 10, 0, 0, 10, 10);
  265. ctx.draw(false, () => {
  266. // 绘制完成后,获取像素数据
  267. setTimeout(() => { // 添加短暂延迟确保绘制完成
  268. uni.canvasGetImageData({
  269. canvasId: 'pixelCanvas',
  270. x: 0, // 获取(0,0)位置的像素
  271. y: 0,
  272. width: 1,
  273. height: 1,
  274. success: (res) => {
  275. // 获取像素RGB值
  276. this.pixelColor = {
  277. r: res.data[0],
  278. g: res.data[1],
  279. b: res.data[2],
  280. a: res.data[3]
  281. };
  282. console.log("第一个像素的RGB值:", this
  283. .pixelColor);
  284. },
  285. fail: (err) => {
  286. console.error("获取像素数据失败:", err);
  287. // 显示错误提示
  288. uni.showToast({
  289. title: '获取颜色失败',
  290. icon: 'none',
  291. duration: 2000
  292. });
  293. }
  294. });
  295. }, 100);
  296. });
  297. },
  298. fail: (err) => {
  299. console.error("获取图片信息失败:", err);
  300. // 显示错误提示
  301. uni.showToast({
  302. title: '图片加载失败',
  303. icon: 'none',
  304. duration: 2000
  305. });
  306. }
  307. });
  308. },
  309. // 返回上一页
  310. goBack() {
  311. uni.navigateBack({
  312. delta: 1
  313. });
  314. },
  315. getMyInfo() {
  316. uni.request({
  317. url: this.$apiHost + '/My/getnum',
  318. method: 'GET',
  319. header: {
  320. 'content-type': 'application/json',
  321. 'sign': getApp().globalData.headerSign
  322. },
  323. data: {
  324. uuid: getApp().globalData.uuid
  325. },
  326. success: (res) => {
  327. console.log("获取用户信息:", res.data);
  328. this.myinfo = res.data
  329. }
  330. })
  331. },
  332. selPhoto(item, sel) {
  333. this.selImg = sel;
  334. this.home_image = this.image_list[sel];
  335. },
  336. toArr(imgs) {
  337. let arr = imgs.split("|");
  338. return arr;
  339. },
  340. previewOpen(imgs1, index) {
  341. this.imgs = imgs1.split("|");
  342. setTimeout(() => this.$refs.previewImage.open(index), 0)
  343. // 传入当前选中的图片地址或序号
  344. return; //如需测试和uni原生预览差别可注释这两行
  345. },
  346. // 切换音频播放状态
  347. toggleAudio() {
  348. if (!this.queueDetail.result_audio) return;
  349. if (this.isPlaying) {
  350. this.audioPlayer.pause();
  351. this.isPlaying = false;
  352. } else {
  353. this.audioPlayer.src = this.queueDetail.result_audio;
  354. this.audioPlayer.play();
  355. this.isPlaying = true;
  356. }
  357. },
  358. // 获取状态文本
  359. getStatusText(status) {
  360. const statusMap = {
  361. 1: '排队中',
  362. 2: '生成中',
  363. 3: '生成失败',
  364. 4: '已完成',
  365. 9: '已完成'
  366. };
  367. return statusMap[status] || '未知状态';
  368. },
  369. // 获取状态样式
  370. getStatusStyle(status) {
  371. const colorMap = {
  372. 1: '#ffa500', // 橙色 - 排队中
  373. 2: '#2979ff', // 蓝色 - 生成中
  374. 3: '#ff5151', // 红色 - 生成失败
  375. 4: '#4caf50', // 绿色 - 已完成
  376. 9: '#4caf50' // 绿色 - 已完成
  377. };
  378. return `color: ${colorMap[status] || '#999'}`;
  379. },
  380. // 获取进度条宽度
  381. getProgressWidth() {
  382. if (this.queueDetail.all_position === 0) return '0%';
  383. const progress = (1 - (this.queueDetail.queue_position / this.queueDetail.all_position)) * 100;
  384. return `${progress}%`;
  385. },
  386. // 加载数据
  387. loadData() {
  388. uni.showLoading({
  389. title: '加载中...'
  390. });
  391. let that = this;
  392. uni.request({
  393. url: this.$apiHost + '/WorkAI/getQueueDetail',
  394. data: {
  395. uuid: getApp().globalData.uuid,
  396. id: this.arcID
  397. },
  398. header: {
  399. "content-type": "application/json",
  400. 'sign': getApp().globalData.headerSign
  401. },
  402. success: (res) => {
  403. console.log("队列详情:", res.data);
  404. if (res.data.success === "yes") {
  405. // 更新队列详情
  406. this.queueDetail = res.data.data;
  407. this.noteContent = res.data.data.content;
  408. // 更新图片列表
  409. if (this.queueDetail.result_images && this.queueDetail.result_images !== "") {
  410. this.image_list = this.queueDetail.result_images.split(",");
  411. this.home_image = this.image_list[0];
  412. // 当图片更新后,手动触发获取像素颜色(因为图片可能从缓存加载,不会触发@load事件)
  413. // setTimeout(() => {
  414. // that.getImagePixelColor();
  415. // }, 500);
  416. } else {
  417. this.home_image = "../../static/home/avator.png";
  418. }
  419. // 如果是音频类型,设置音频源
  420. if (this.queueDetail.task_type == 2 && this.queueDetail.result_audio) {
  421. this.audioPlayer.src = this.queueDetail.result_audio;
  422. }
  423. } else {
  424. uni.showToast({
  425. title: '获取详情失败',
  426. icon: 'none'
  427. });
  428. }
  429. },
  430. complete: () => {
  431. uni.hideLoading();
  432. },
  433. fail: (e) => {
  434. console.log("请求失败:", e);
  435. uni.showToast({
  436. title: '网络请求失败',
  437. icon: 'none'
  438. });
  439. }
  440. });
  441. },
  442. showActionSheet() {
  443. // 显示操作列表
  444. uni.showActionSheet({
  445. itemList: ['修改封面', '删除作品'],
  446. success: (res) => {
  447. switch (res.tapIndex) {
  448. case 0:
  449. // 修改封面
  450. this.editCover();
  451. break;
  452. case 1:
  453. // 删除作品
  454. this.deleteWork();
  455. break;
  456. }
  457. },
  458. fail: (res) => {
  459. console.log(res.errMsg);
  460. }
  461. });
  462. },
  463. // 修改封面
  464. editCover() {
  465. var _self = this;
  466. uni.chooseImage({
  467. count: 1,
  468. sizeType: ['compressed'],
  469. sourceType: ['album', 'camera'],
  470. success: function(res) {
  471. console.log('res:', res)
  472. if (res.tempFilePaths.length > 0) {
  473. _self.imglocal = res.tempFilePaths[0]
  474. const tempFilePaths = res.tempFilePaths[0];
  475. console.log('tempFilePaths:', tempFilePaths);
  476. const uploadTask = uni.uploadFile({
  477. url: _self.$apiHost + '/Xweb/upload_img?skey=' + _self.skey,
  478. filePath: res.tempFilePaths[0],
  479. name: 'file',
  480. success: function(uploadFileRes) {
  481. let resdata = JSON.parse(uploadFileRes.data)
  482. console.log('Success11:', uploadFileRes);
  483. console.log('Success21:', resdata);
  484. if (resdata.success == 'yes') {
  485. _self.home_image = resdata.url;
  486. // 调用修改封面接口
  487. uni.request({
  488. url: _self.$apiHost + '/WorkAI/queueAction',
  489. method: 'GET',
  490. data: {
  491. uuid: getApp().globalData.uuid,
  492. act: 'editImg',
  493. result_images: resdata.url,
  494. id: _self.arcID
  495. },
  496. header: {
  497. 'content-type': 'application/json',
  498. 'sign': getApp().globalData.headerSign
  499. },
  500. success: (res) => {
  501. if (res.data.success === "yes") {
  502. uni.showToast({
  503. title: '修改封面成功',
  504. icon: 'success'
  505. });
  506. } else {
  507. uni.showToast({
  508. title: '修改封面失败',
  509. icon: 'none'
  510. });
  511. }
  512. },
  513. fail: () => {
  514. uni.showToast({
  515. title: '修改封面失败',
  516. icon: 'none'
  517. });
  518. }
  519. });
  520. }
  521. },
  522. fail: function(uploadFileFail) {
  523. console.log('Error:', uploadFileFail.data);
  524. uni.showToast({
  525. title: '图片上传失败',
  526. icon: 'none'
  527. });
  528. }
  529. });
  530. }
  531. },
  532. error: function(e) {
  533. console.log(e);
  534. uni.showToast({
  535. title: '选择图片失败',
  536. icon: 'none'
  537. });
  538. }
  539. });
  540. },
  541. // 删除作品
  542. deleteWork() {
  543. // 显示确认对话框
  544. uni.showModal({
  545. title: '确认删除',
  546. content: '确定要删除这个作品吗?',
  547. confirmColor: '#ff5151',
  548. success: (res) => {
  549. if (res.confirm) {
  550. // 用户点击确定,执行删除操作
  551. this.confirmDelete();
  552. }
  553. }
  554. });
  555. },
  556. // 确认删除
  557. confirmDelete() {
  558. uni.showLoading({
  559. title: '删除中...'
  560. });
  561. uni.request({
  562. url: this.$apiHost + '/WorkAI/queueAction',
  563. method: 'GET',
  564. data: {
  565. uuid: getApp().globalData.uuid,
  566. act: 'del',
  567. id: this.arcID
  568. },
  569. header: {
  570. 'content-type': 'application/json',
  571. 'sign': getApp().globalData.headerSign
  572. },
  573. success: (res) => {
  574. uni.hideLoading();
  575. if (res.data.success === "yes") {
  576. uni.showToast({
  577. title: '删除成功',
  578. icon: 'success'
  579. });
  580. // 删除成功后返回上一页
  581. setTimeout(() => {
  582. uni.navigateBack({
  583. delta: 1
  584. });
  585. }, 1500);
  586. } else {
  587. uni.showToast({
  588. title: '删除失败',
  589. icon: 'none'
  590. });
  591. }
  592. },
  593. fail: () => {
  594. uni.hideLoading();
  595. uni.showToast({
  596. title: '删除失败',
  597. icon: 'none'
  598. });
  599. }
  600. });
  601. },
  602. // 显示添加说明弹窗
  603. showAddNotePopup() {
  604. this.showNotePopup = true;
  605. },
  606. // 关闭添加说明弹窗
  607. closeAddNotePopup() {
  608. this.showNotePopup = false;
  609. },
  610. // 确认添加说明
  611. confirmAddNote() {
  612. if (!this.noteContent.trim()) {
  613. uni.showToast({
  614. title: '请输入说明内容',
  615. icon: 'none'
  616. });
  617. return;
  618. }
  619. uni.showLoading({
  620. title: '保存中...'
  621. });
  622. uni.request({
  623. url: this.$apiHost + '/WorkAI/queueAction',
  624. method: 'GET',
  625. data: {
  626. uuid: getApp().globalData.uuid,
  627. act: 'editContent',
  628. content: this.noteContent,
  629. id: this.arcID
  630. },
  631. header: {
  632. 'content-type': 'application/json',
  633. 'sign': getApp().globalData.headerSign
  634. },
  635. success: (res) => {
  636. uni.hideLoading();
  637. if (res.data.success === "yes") {
  638. uni.showToast({
  639. title: '添加说明成功',
  640. icon: 'success'
  641. });
  642. this.showNotePopup = false;
  643. // this.noteContent = '';
  644. // 重新加载数据
  645. this.loadData();
  646. } else {
  647. uni.showToast({
  648. title: '添加说明失败',
  649. icon: 'none'
  650. });
  651. }
  652. },
  653. fail: () => {
  654. uni.hideLoading();
  655. uni.showToast({
  656. title: '添加说明失败',
  657. icon: 'none'
  658. });
  659. }
  660. });
  661. },
  662. // 发布作品
  663. publishWork() {
  664. uni.showLoading({
  665. title: '发布中...'
  666. });
  667. uni.request({
  668. url: this.$apiHost + '/WorkAI/queueAction',
  669. method: 'GET',
  670. data: {
  671. uuid: getApp().globalData.uuid,
  672. act: 'fabu',
  673. id: this.arcID
  674. },
  675. header: {
  676. 'content-type': 'application/json',
  677. 'sign': getApp().globalData.headerSign
  678. },
  679. success: (res) => {
  680. console.log("resddd", res.data);
  681. uni.hideLoading();
  682. if (res.data.success === "yes") {
  683. uni.showToast({
  684. title: '发布成功',
  685. icon: 'success'
  686. });
  687. // 重新加载数据
  688. // this.loadData();
  689. } else {
  690. uni.showToast({
  691. title: res.data.str || '发布失败',
  692. icon: 'none'
  693. });
  694. }
  695. },
  696. fail: () => {
  697. uni.hideLoading();
  698. uni.showToast({
  699. title: '发布失败',
  700. icon: 'none'
  701. });
  702. }
  703. });
  704. },
  705. startDrag(event) {
  706. this.isDragging = true;
  707. this.startY = event.clientY;
  708. this.initialOffsetY = this.offsetY || 0;
  709. },
  710. stopDrag() {
  711. this.isDragging = false;
  712. },
  713. drag(event) {
  714. if (this.isDragging) {
  715. const deltaY = event.clientY - this.startY;
  716. const newOffsetY = this.initialOffsetY + deltaY;
  717. // Get the height of the lyrics text
  718. const lyricsTextHeight = this.$refs.lyricsText ? this.$refs.lyricsText.clientHeight : 0;
  719. // Define the threshold limits based on the height of the lyrics text
  720. const minY = -lyricsTextHeight + 20; // Allow some space above
  721. const maxY = 20; // Allow some space below
  722. // Apply the limits
  723. this.offsetY = Math.min(Math.max(newOffsetY, minY), maxY);
  724. // Log the height and current offset
  725. console.log('Lyrics Text Height:', lyricsTextHeight);
  726. console.log('Current Offset Y:', this.offsetY);
  727. }
  728. },
  729. rgbToHex(r, g, b) {
  730. return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
  731. }
  732. }
  733. }
  734. </script>
  735. <style scoped lang="scss">
  736. @import 'makeDetail.scss';
  737. </style>