my.vue 21 KB

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