my.vue 18 KB

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