my.vue 23 KB

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