my.vue 22 KB

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