my.vue 18 KB

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