my.vue 20 KB

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