my.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. <template>
  2. <view class="page">
  3. <view class="topBody">
  4. <!-- <view class="header" :class="{ 'header-isvip': !isRecharge }"> -->
  5. <view class="header" >
  6. <view class="reserveASeat"></view>
  7. <view class="card-box">
  8. <view class="card-top">
  9. <view class="top-box">
  10. <view class="hello-box"> Hello! </view>
  11. <view class="settingBtn-box">
  12. <image @click="clickShare()" src="@/static/me/wd_icon_fenxian.png" mode=""></image>
  13. <image src="@/static/me/wd_icon_shezhi.png" mode="" @click="navigateToSettings"></image>
  14. </view>
  15. </view>
  16. <view class="userinfo-box" @click="goPage('/pages/my/editInfo')">
  17. <view class="userinfo-left">
  18. <CircleAvatar class="avator" :src="myinfo.avator"></CircleAvatar>
  19. </view>
  20. <view class="userinfo-right">
  21. <view class="nickname">
  22. <text class="one-omit">{{ myinfo.nickname }}</text>
  23. <image src="../../static/icon/wd_icon_nan.png" mode="widthFix"
  24. v-if="myinfo.sex_id == 1"></image>
  25. <image src="../../static/icon/wd_icon_nv.png" mode="widthFix"
  26. v-else-if="myinfo.sex_id == 2"></image>
  27. <view class="level">Lv{{ myinfo.my_level }}</view>
  28. </view>
  29. <view class="label">
  30. <view v-for="(item, index) in aihao_tags" :key="index + item">
  31. {{ item }}
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="intro_row">
  37. <block v-if="myinfo.content == ''">
  38. <text class="intro_text two-omit">添加简介</text>
  39. <image src="@/static/icon/wd_icon_edit.png" mode="widthFix" class="add_icon"></image>
  40. </block>
  41. <uv-text v-else :text="myinfo.content" class="intro_text two-omit">
  42. </uv-text>
  43. </view>
  44. <view class="bom">
  45. <view class="follow_info" @click="navigateToFollow">
  46. <view class="follow-box">
  47. <view class="num">{{ myinfo.num_attention }}</view>
  48. <view class="label">关注</view>
  49. </view>
  50. <view class="separator"></view>
  51. <view class="follow-box">
  52. <view class="num">{{ myinfo.num_fans }}</view>
  53. <view class="label">粉丝</view>
  54. </view>
  55. <view class="separator"></view>
  56. <view class="follow-box">
  57. <view class="num">{{ myinfo.num_like }}</view>
  58. <view class="label">获赞</view>
  59. </view>
  60. </view>
  61. <view class="points-box">
  62. <view class="points" @click="isRecharge ? goPage('/pages/vip/M_purchase') : ''">
  63. <image src="@/static/icon/wd_icon_coin.png" mode=""></image>
  64. {{ myinfo.num_gmm | formatNumberToK }}
  65. <view class="money-add" v-if="isRecharge">+</view>
  66. </view>
  67. <view class="points" @click="isRecharge ?goPage('/pages/my/job?type=recharge') : ''">
  68. <image src="@/static/icon/coin_cd.png" mode=""></image>
  69. {{ myinfo.num_gmd | formatNumberToK }}
  70. <view class="money-add" v-if="isRecharge">+</view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <!-- <view class="card-bom" v-if="isRecharge" @click="goPage('/pages/vip/index')"> -->
  76. <view class="card-bom" @click="isRecharge ? goPage('/pages/vip/index') : ''">
  77. <view class="content-box">
  78. <image v-if="false" src="@/static/me/icon-vip2.png" mode=""></image>
  79. <image v-else-if="0" src="@/static/me/icon-vip1.png" mode=""></image>
  80. <image v-else src="@/static/me/icon-vip0.png" mode=""></image>
  81. <text v-if="true">开启专属会员权益</text>
  82. <text v-else>会员权益生效中</text>
  83. </view>
  84. <image v-if="isRecharge" src="@/static/me/wd_icon_jiantou.png" mode=""></image>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="myinfo">
  89. <!-- <view class="line"></view> -->
  90. <view class="tablist">
  91. <view class="item" :class="{ active: firstLevelNavActive === 0 }"
  92. @click="firstLevelNavActiveSwitch(0)">我的作品
  93. <view class="indicator-triangle"> </view>
  94. </view>
  95. <view class="item" :class="{ active: firstLevelNavActive === 1 }"
  96. @click="firstLevelNavActiveSwitch(1)">我的帖子
  97. <view class="indicator-triangle"> </view>
  98. </view>
  99. </view>
  100. <!-- 作品列表 -->
  101. <template v-if="firstLevelNavActive == 0">
  102. <view class="line"></view>
  103. <view class="subtitle">
  104. <view class="item" :class="{ active: activeTab === 0 }" @click="switchTab(0)">
  105. 作品
  106. </view>
  107. <view class="item" :class="{ active: activeTab === 1 }" @click="switchTab(1)">
  108. 生成中
  109. </view>
  110. </view>
  111. <view class="numlist1" v-if="activeTab === 0" style="margin-top: 30rpx">
  112. <WorkItem v-for="(item, index) in worksList" :secrecy="true" :subtitle="true" :key="index"
  113. :item="item" @click="goWork(item)" />
  114. <!-- 暂无内容提示 -->
  115. <view v-if="worksList.length === 0" class="empty-state">
  116. <image src="@/static/icon/xx_img_zanwuxiaoxi.png" mode="aspectFit" class="empty-image">
  117. </image>
  118. <text class="empty-text">暂无作品</text>
  119. <text class="empty-subtext">快来创作你的第一个作品吧~</text>
  120. </view>
  121. </view>
  122. <view class="numlist2" v-if="activeTab === 1" style="margin-top: 30rpx">
  123. <view class="item" v-for="(item, index) in worksList" :key="index" style="margin-bottom: 28rpx">
  124. <view class="num" @click="goWork(item)">
  125. <WorkItem :item="item" style="margin-bottom: 12rpx" />
  126. <image class="incomplete-bg" v-if="item.status != 9"
  127. src="@/static/me/wd_bg_zhizuozhong.png"></image>
  128. <view class="maskLayer"></view>
  129. <!-- 当activeTab为1时显示队列状态 -->
  130. <view class="queue-status">
  131. <!-- 排队中 -->
  132. <view v-if="item.status === 1" class="status-text">
  133. <image class="state-img" src="@/static/me/wd_icon_paiduizhong.png"></image>
  134. </view>
  135. <!-- 生成失败 -->
  136. <view v-if="item.status === 3 || item.status === 4" class="status-text">
  137. <image class="state-img" src="@/static/me/wd_icon_zhizuoshibai.png"></image>
  138. </view>
  139. <!-- 制作中 -->
  140. <view v-else-if="item.status < 9" class="status-text">
  141. <image class="state-img" src="@/static/me/wd_icon_zhizuozhong.png"></image>
  142. </view>
  143. <!-- 创作完成 -->
  144. <view v-else-if="item.status === 9" class="status-text">
  145. <image class="state-img" src="@/static/me/wd_icon_chuangzuowancheng.png">
  146. </image>
  147. </view>
  148. </view>
  149. <view class="name" style="
  150. font-family: 'PingFang SC-Medium';
  151. font-weight: 500;
  152. font-size: 28rpx;
  153. color: #1a4d2e;
  154. ">
  155. {{ item.title || item.description || "作品" + index }}
  156. </view>
  157. <!-- 显示任务类型标签 -->
  158. <view class="task-type-tag">
  159. <image style="width: 120rpx; height: 36rpx" v-if="item.task_type === 1"
  160. src="@/static/me/wd_icon_lingganchuangzuo.png"></image>
  161. <image style="width: 82rpx; height: 36rpx" v-else-if="item.task_type === 2"
  162. src="@/static/me/wd_icon_yinyue.png"></image>
  163. <!-- <text v-if="item.task_type === 1">灵感创作</text>
  164. <text v-else-if="item.task_type === 2">音乐</text> -->
  165. </view>
  166. </view>
  167. </view>
  168. <!-- 暂无内容提示 -->
  169. <view v-if="worksList.length === 0" class="empty-state">
  170. <image src="@/static/icon/xx_img_zanwuxiaoxi.png" mode="aspectFit" class="empty-image">
  171. </image>
  172. <text class="empty-text">暂无生成中的作品</text>
  173. <text class="empty-subtext">快去创作新作品吧~</text>
  174. </view>
  175. </view>
  176. </template>
  177. <template v-else>
  178. <view class="numlist2" style="margin-top: 30rpx">
  179. <view class="item" v-for="(item, index) in worksList" :key="index" style="margin-bottom: 15rpx">
  180. <view class="num" @click="goWork2(item)">
  181. <WorkItem :item="item" style="margin-bottom: 20rpx" />
  182. <view class="incomplete-bg" style="background: #f8f9fa"></view>
  183. <image class="incomplete-bg" v-if="item.status != 1"
  184. src="@/static/me/wd_bg_zhizuozhong.png"></image>
  185. <image class="incomplete-bg2" v-else-if="item.status == 1" :src="item.image"
  186. mode="aspectFill" style="max-height: 520rpx;"></image>
  187. <view class="maskLayer" v-if="item.status != 1"></view>
  188. <!-- 当activeTab为1时显示队列状态 -->
  189. <view class="queue-status">
  190. <!-- 已发布 -->
  191. <view v-if="item.status == 1" class="status-text">
  192. <!-- <image class="state-img" src="@/static/me/wd_icon_paiduizhong.png"></image> -->
  193. <!-- ({{ item.queue_position }}/{{ item.all_position }}) -->
  194. </view>
  195. <!-- 待审核 -->
  196. <view v-if="item.status == 2 || item.status === 4" class="status-text">
  197. <image class="state-img" src="@/static/me/wd_icon_shenhezhong.png"></image>
  198. </view>
  199. <!-- 审核失败 -->
  200. <view v-else-if="item.status == 3" class="status-text">
  201. <image class="state-img" src="@/static/me/wd_icon_fabushibai.png"></image>
  202. </view>
  203. </view>
  204. <view class="name" style="
  205. font-family: 'PingFang SC-Medium';
  206. font-weight: 500;
  207. font-size: 28rpx;
  208. color: #1a4d2e;
  209. ">
  210. {{ item.title || item.description || "作品" + index }}
  211. </view>
  212. </view>
  213. </view>
  214. <!-- 暂无内容提示 -->
  215. <view v-if="worksList.length === 0" class="empty-state">
  216. <image src="@/static/icon/xx_img_zanwuxiaoxi.png" mode="aspectFit" class="empty-image">
  217. </image>
  218. <text class="empty-text">暂无帖子</text>
  219. <text class="empty-subtext">快来发布你的第一个帖子吧~</text>
  220. </view>
  221. </view>
  222. </template>
  223. <!-- 加载更多提示 -->
  224. <!-- <view class="loading-more" v-if="isLoading">加载中...</view>
  225. <view class="no-more" v-if="!hasMore && worksList.length > 0">没有更多作品了</view>
  226. <view class="no-more" v-if="!hasMore && worksList.length === 0">暂无作品</view> -->
  227. </view>
  228. <view class="blankHeight"></view>
  229. </view>
  230. <view class="reserveASeatBom"></view>
  231. <!-- 确认框 -->
  232. <CustomConfirm ref="customConfirm"></CustomConfirm>
  233. <!-- 提示框 -->
  234. <DialogBox ref="DialogBox"></DialogBox>
  235. <tabbar-view :tabbars="tabbars" :currentIndex="4" ref="tabbar"></tabbar-view>
  236. <!-- SharePopup组件 -->
  237. <SharePopup :visible="showShare" :share-url="shareUrl" :share-title="shareTitle" :share-desc="shareDesc"
  238. :share-img="shareImg" @close="showShare = false" />
  239. </view>
  240. </template>
  241. <script>
  242. import tabbarView from "@/components/tabbar/tabbar.vue";
  243. import tabbar from "@/mixins/tabbar";
  244. import CustomConfirm from "@/components/custome-confirm/customeConfirm.vue";
  245. import CircleAvatar from "@/components/CircleAvatar/CircleAvatar.vue";
  246. import meCard from "@/components/meCard/meCard.vue";
  247. import WorkItem from "@/components/WorkItem/WorkItem.vue";
  248. import { mapState } from 'vuex'
  249. export default {
  250. components: {
  251. tabbarView,
  252. CustomConfirm,
  253. CircleAvatar,
  254. meCard,
  255. WorkItem,
  256. },
  257. mixins: [tabbar],
  258. data() {
  259. return {
  260. title: "",
  261. sel: 1,
  262. firstLevelNavActive: 0,
  263. myinfo: {
  264. avator: "../../static/logo.png",
  265. nickname: "",
  266. join_name: "",
  267. num_1: 0,
  268. num_2: 0,
  269. num_3: 0,
  270. num_4: 0,
  271. is_login: "no",
  272. num_history: 0,
  273. num_collection: 0,
  274. },
  275. aihao_tags: [],
  276. menu_list: [],
  277. data_list: [],
  278. activeTab: 0,
  279. offset: 0,
  280. hasMore: true,
  281. isLoading: false,
  282. worksList: [],
  283. showShare: false,
  284. shareUrl: "https://your-share-url.com",
  285. shareTitle: "分享标题",
  286. shareDesc: "分享描述",
  287. shareImg: "https://your-share-image.com/image.jpg",
  288. };
  289. },
  290. onLoad(e) {
  291. // setTimeout(function() {
  292. // uni.setNavigationBarColor({
  293. // frontColor: '#ffffff',
  294. // backgroundColor: '#00000000',
  295. // animation: {
  296. // duration: 400,
  297. // timingFunc: 'easeIn'
  298. // }
  299. // })
  300. // }, 200);
  301. },
  302. computed: {
  303. ...mapState('switchingModule', ['isRecharge'])
  304. },
  305. onShow() {
  306. uni.$emit("check_login", () => { });
  307. // this.loadData();
  308. this.offset = 0;
  309. this.hasMore = true;
  310. this.worksList = [];
  311. this.loadInfo();
  312. // 检查全局变量,如果需要切换到生成中标签
  313. if (getApp().globalData.needSwitchToGenerating) {
  314. setTimeout(() => {
  315. this.switchTab(1);
  316. // 重置全局变量
  317. getApp().globalData.needSwitchToGenerating = false;
  318. }, 300);
  319. } else {
  320. this.loadWorksList();
  321. }
  322. },
  323. onReachBottom() {
  324. if (this.hasMore && !this.isLoading) {
  325. this.loadMoreWorks();
  326. }
  327. },
  328. methods: {
  329. clickShare(item) {
  330. this.showShare = true;
  331. },
  332. async showConfirm() {
  333. let that = this;
  334. this.$refs["customConfirm"]
  335. .confirm({
  336. title: "确认解绑",
  337. content: "解绑微信账号后将无法继续使用它登录该App账号?",
  338. DialogType: "inquiry",
  339. btn1: "再考虑一下",
  340. btn2: "确认解绑",
  341. animation: 0,
  342. })
  343. .then((res) => { });
  344. },
  345. onBack() { },
  346. chkSel() {
  347. if (this.sel == 1) {
  348. this.sel = 0;
  349. } else {
  350. this.sel = 1;
  351. }
  352. },
  353. goPage(page) {
  354. uni.navigateTo({
  355. url: page,
  356. });
  357. },
  358. loadInfo() {
  359. console.log({
  360. uuid: getApp().globalData.uuid,
  361. skey: getApp().globalData.skey,
  362. });
  363. uni.request({
  364. url: this.$apiHost + "/User/getinfo",
  365. data: {
  366. uuid: getApp().globalData.uuid,
  367. skey: getApp().globalData.skey,
  368. },
  369. header: {
  370. "content-type": "application/json",
  371. sign: getApp().globalData.headerSign,
  372. },
  373. success: (res) => {
  374. console.log("----:", JSON.parse(JSON.stringify(res.data)));
  375. if (res.data.need_login == "yes") {
  376. // getApp().globalData.skey = "";
  377. // getApp().globalData.uuid = "";
  378. uni.removeStorageSync("wapptoken");
  379. uni.redirectTo({
  380. url: "/pages/login/login",
  381. });
  382. return;
  383. }
  384. if (res.data.aihao) {
  385. this.aihao_tags = res.data.aihao.split(",");
  386. }
  387. this.myinfo = res.data;
  388. },
  389. complete: (com) => {
  390. // uni.hideLoading();
  391. },
  392. fail: (e) => {
  393. console.log("----e:", e);
  394. },
  395. });
  396. },
  397. onLogout() {
  398. let that = this;
  399. this.$refs["DialogBox"]
  400. .confirm({
  401. title: "提示",
  402. content: "确定退出吗?",
  403. DialogType: "inquiry",
  404. btn1: "取消",
  405. btn2: "退出",
  406. animation: 0,
  407. })
  408. .then((res) => {
  409. uni.request({
  410. url: that.$apiHost + "/My/logout",
  411. data: {
  412. uuid: getApp().globalData.uuid,
  413. skey: getApp().globalData.skey,
  414. },
  415. header: {
  416. "content-type": "application/json",
  417. sign: getApp().globalData.headerSign,
  418. },
  419. success: (res) => {
  420. console.log("----:", res.data);
  421. // getApp().globalData.skey = "";
  422. // getApp().globalData.uuid = "";
  423. uni.removeStorageSync("wapptoken");
  424. uni.redirectTo({
  425. url: "/pages/login/login",
  426. });
  427. },
  428. complete: (com) => {
  429. // uni.hideLoading();
  430. },
  431. fail: (e) => {
  432. console.log("----e:", e);
  433. },
  434. });
  435. });
  436. },
  437. switchTab(index) {
  438. this.activeTab = index;
  439. this.offset = 0;
  440. this.hasMore = true;
  441. this.worksList = [];
  442. this.loadWorksList();
  443. },
  444. loadWorksList() {
  445. if (this.isLoading) return;
  446. this.isLoading = true;
  447. // 根据activeTab选择不同的API
  448. let apiUrl = "";
  449. if (this.firstLevelNavActive == 0) {
  450. if (this.activeTab === 0) {
  451. apiUrl = "/Work/getlist";
  452. } else {
  453. apiUrl = "/WorkAI/getMyQueueList";
  454. }
  455. } else if (this.firstLevelNavActive == 1) {
  456. apiUrl = "/Article/getlist";
  457. }
  458. uni.request({
  459. url: this.$apiHost + apiUrl,
  460. data: {
  461. uuid: getApp().globalData.uuid,
  462. skey: getApp().globalData.skey,
  463. type: "my", // 固定为my,表示获取自己的作品
  464. offset: this.offset,
  465. status: this.activeTab === 0 ? 1 : undefined, // 只有我的作品需要status参数
  466. },
  467. header: {
  468. "content-type": "application/json",
  469. sign: getApp().globalData.headerSign,
  470. },
  471. success: (res) => {
  472. console.log("列表数据:", JSON.parse(JSON.stringify(res.data)));
  473. if (res.data.success == "yes" && res.data.list) {
  474. if (res.data.list.length > 0) {
  475. this.worksList = [...this.worksList, ...res.data.list];
  476. this.offset += res.data.list.length;
  477. }
  478. if (res.data.list.length < 20) {
  479. this.hasMore = false;
  480. }
  481. } else {
  482. this.hasMore = false;
  483. }
  484. // 只有在"我的作品"标签下才更新data_list
  485. if (this.activeTab === 0) {
  486. this.updateDataList();
  487. }
  488. console.log("作品列表数据:", this.worksList);
  489. },
  490. complete: () => {
  491. this.isLoading = false;
  492. },
  493. fail: (e) => {
  494. console.log("请求列表失败:", e);
  495. this.isLoading = false;
  496. },
  497. });
  498. },
  499. firstLevelNavActiveSwitch(n) {
  500. this.firstLevelNavActive = n;
  501. this.offset = 0;
  502. this.hasMore = true;
  503. this.worksList = [];
  504. if (this.firstLevelNavActive == 0) {
  505. this.activeTab = 0;
  506. }
  507. this.loadWorksList();
  508. },
  509. loadMoreWorks() {
  510. if (this.hasMore && !this.isLoading) {
  511. this.loadWorksList();
  512. }
  513. },
  514. updateDataList() {
  515. this.data_list = this.worksList.map((item) => {
  516. return {
  517. url: item.images || item.img_url || item.url || "../../static/logo.png",
  518. title: item.title || item.description || "作品",
  519. id: item.id,
  520. };
  521. });
  522. },
  523. goWork(item) {
  524. uni.$emit("check_login", () => { });
  525. // , //任务状态(1:排队中,3:生成失败,4:生成失败,9:创作完成)
  526. if (this.activeTab == 0) {
  527. uni.navigateTo({
  528. // url: "/pages/index/workDetail?id=" + item.id,
  529. url: "/pages/makedetail/makeDetail?id=" +
  530. item.queue_id +
  531. "&queueId=" +
  532. item.id,
  533. });
  534. } else {
  535. if (item.status >= 9) {
  536. uni.navigateTo({
  537. url: "/pages/makedetail/makeDetail?id=" + item.id,
  538. });
  539. }
  540. if (item.status < 9 && item.status != 3 && item.status != 4) {
  541. // <!-- <text v-if="item.task_type === 1">灵感创作</text>
  542. // <text v-else-if="item.task_type === 2">音乐</text> -->
  543. var url = "";
  544. if (item.task_type === 1) {
  545. url = "/makedetail/makeImgDetail";
  546. }
  547. if (item.task_type === 2) {
  548. url = "/makedetail/makeMusicDetail";
  549. }
  550. if (url) {
  551. uni.navigateTo({
  552. url: "/pages" + url + "?id=" + item.id,
  553. });
  554. }
  555. }
  556. }
  557. },
  558. goWork2(item) {
  559. uni.navigateTo({
  560. // url: "/pages/index/workDetail?id=" + item.id,
  561. url: "/pages/index/articleDetail?id=" + item.id,
  562. });
  563. },
  564. navigateToSettings() {
  565. uni.$emit("check_login", () => {
  566. uni.navigateTo({
  567. url: "/pages/my/setting",
  568. });
  569. });
  570. },
  571. navigateToFollow() {
  572. uni.navigateTo({
  573. url: "/pages/my/follow",
  574. });
  575. },
  576. },
  577. };
  578. </script>
  579. <style scoped lang="scss">
  580. @import "my.scss";
  581. .empty-state {
  582. display: flex;
  583. flex-direction: column;
  584. align-items: center;
  585. justify-content: center;
  586. padding: 60rpx 0;
  587. margin-top: 40rpx;
  588. background: #FFFFFF;
  589. border-radius: 20rpx;
  590. width: 710rpx;
  591. .empty-image {
  592. width: 240rpx;
  593. height: 240rpx;
  594. margin-bottom: 30rpx;
  595. }
  596. .empty-text {
  597. font-size: 32rpx;
  598. color: #333333;
  599. margin-bottom: 16rpx;
  600. font-weight: 500;
  601. }
  602. .empty-subtext {
  603. font-size: 28rpx;
  604. color: #999999;
  605. }
  606. }
  607. </style>