my.vue 21 KB

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