my.vue 22 KB

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