my.vue 22 KB

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