my.vue 16 KB

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