my.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <view class="page">
  3. <view class="topBody">
  4. <view class="header">
  5. <view class="topBg"></view>
  6. <view class="settingBtn" @click="navigateToSettings">
  7. <image src="/static/me/setting.png"></image>
  8. </view>
  9. <view class="top_num">
  10. <view class="num_1">
  11. <text>M币</text>
  12. <text>{{myinfo.num_gmd}}</text>
  13. </view>
  14. <view class="num_2">
  15. <text>彩豆</text>
  16. <text>{{myinfo.num_gmd}}</text>
  17. </view>
  18. </view>
  19. <view class="infoBg">
  20. <view class="top_row">
  21. <view class="left" @click="goPage('/pages/my/editInfo')">
  22. <image class="img" mode="aspectFill" :src="myinfo.avator"></image>
  23. </view>
  24. <view class="right" @click="goPage('/pages/my/editInfo')">
  25. <view class="nickname">
  26. <text>{{myinfo.nickname}}</text>
  27. <image src="../../static/icon/man.png" mode="widthFix" v-if="myinfo.sex_id == 1" />
  28. <image src="../../static/icon/man.png" mode="widthFix" v-else-if="myinfo.sex_id == 2" />
  29. <view class="level">Lv{{myinfo.my_level}}</view>
  30. </view>
  31. <view class="tags_list">
  32. <block v-for="(item,index) in aihao_tags">
  33. <uni-tag class="tag" type="primary" :inverted="false" :text="item" size="mini" />
  34. </block>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="bottom_row">
  39. <view class="intro_row">
  40. <block v-if="myinfo.content == ''">
  41. <text class="intro_text">添加简介</text>
  42. <image src="../../static/icon/add.png" mode="widthFix" class="add_icon" />
  43. </block>
  44. <block v-else>
  45. <text class="intro_text">{{myinfo.content}}</text>
  46. </block>
  47. </view>
  48. <view class="follow_info">
  49. <text class="num">{{myinfo.num_attention}}</text>
  50. <text class="label">关注</text>
  51. <text class="separator"></text>
  52. <text class="num">{{myinfo.num_fans}}</text>
  53. <text class="label">粉丝</text>
  54. <text class="separator"></text>
  55. <text class="num">{{myinfo.num_like}}</text>
  56. <text class="label">获赞</text>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="whiteItem">
  62. <view class="btn">开启专属会员权益</view>
  63. </view>
  64. <view class="myinfo">
  65. <view class="line"></view>
  66. <view class="tablist">
  67. <view class="item" :class="{ active: activeTab === 0 }" @click="switchTab(0)">
  68. <view class="name">我的作品</view>
  69. </view>
  70. <view class="item" :class="{ active: activeTab === 1 }" @click="switchTab(1)">
  71. <view class="name">生成中</view>
  72. </view>
  73. </view>
  74. <view class="numlist2" style="margin-top: 60rpx;">
  75. <view class="item" v-for="(item,index) in worksList" :key="index" v-if="index < 2">
  76. <view class="num" @click="goWork(item)">
  77. <!-- 当activeTab为0时显示图片 -->
  78. <image v-if="activeTab === 0" class="icon"
  79. :src="item.images || item.img_url || item.url || '../../static/logo.png'"
  80. mode="aspectFit" />
  81. <image v-if="activeTab === 1 && item.status == 9" class="icon"
  82. :src="item.result_images || '../../static/logo.png'" mode="aspectFit" />
  83. <!-- 当activeTab为1时显示队列状态 -->
  84. <view class="queue-status" v-if="activeTab === 1">
  85. <!-- 排队中 -->
  86. <view v-if="item.status === 1" class="status-text">
  87. 排队中({{item.queue_position}}/{{item.all_position}})</view>
  88. <!-- 排队中 -->
  89. <view v-if="item.status === 3 || item.status === 4" class="status-text">
  90. 生成失败</view>
  91. <!-- 制作中 -->
  92. <view v-else-if="item.status < 9" class="status-text">制作中</view>
  93. <!-- 创作完成 -->
  94. <view v-else-if="item.status === 9" class="status-text">创作完成</view>
  95. </view>
  96. <view class="name">{{item.title || item.description || '作品'+index}}</view>
  97. <!-- 显示任务类型标签 -->
  98. <view v-if="activeTab === 1" class="task-type-tag">
  99. <text v-if="item.task_type === 1">灵感创作</text>
  100. <text v-else-if="item.task_type === 2">音乐</text>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <!-- 加载更多提示 -->
  106. <!-- <view class="loading-more" v-if="isLoading">加载中...</view>
  107. <view class="no-more" v-if="!hasMore && worksList.length > 0">没有更多作品了</view>
  108. <view class="no-more" v-if="!hasMore && worksList.length === 0">暂无作品</view> -->
  109. </view>
  110. <view style="width:100%;text-align: center;">杭州智潮创意科技有限公司</view>
  111. <view class="blankHeight"></view>
  112. <view class="blankHeight"></view>
  113. </view>
  114. <!-- 提示框 -->
  115. <DialogBox ref="DialogBox"></DialogBox>
  116. <tabbar-view :tabbars="tabbars" :currentIndex="4" ref="tabbar"></tabbar-view>
  117. </view>
  118. </template>
  119. <script>
  120. import tabbarView from "@/components/tabbar/tabbar.vue";
  121. import tabbar from "@/mixins/tabbar";
  122. export default {
  123. components: {
  124. tabbarView,
  125. },
  126. mixins: [tabbar],
  127. data() {
  128. return {
  129. title: '',
  130. sel: 1,
  131. myinfo: {
  132. avator: '../../static/logo.png',
  133. nickname: '王思思',
  134. join_name: '注册日期:2024年5月',
  135. num_1: 0,
  136. num_2: 0,
  137. num_3: 0,
  138. num_4: 0,
  139. is_login: 'no',
  140. num_history: 0,
  141. num_collection: 0,
  142. },
  143. aihao_tags: [],
  144. menu_list: [],
  145. data_list: [{
  146. url: 'https://e.zhichao.art/AI_images/a_1112_10.png',
  147. },
  148. {
  149. url: 'https://e.zhichao.art/AI_images/a_1112_108.png',
  150. },
  151. {
  152. url: 'https://e.zhichao.art/AI_images/a_1112_113.png',
  153. },
  154. {
  155. url: 'https://e.zhichao.art/AI_images/a_1112_13.png',
  156. },
  157. {
  158. url: 'https://e.zhichao.art/AI_images/a_1112_137.png',
  159. },
  160. {
  161. url: 'https://e.zhichao.art/AI_images/a_1112_141.png',
  162. },
  163. {
  164. url: 'https://e.zhichao.art/AI_images/a_1114__562.png',
  165. },
  166. {
  167. url: 'https://e.zhichao.art/AI_images/a_1114__568.png',
  168. },
  169. {
  170. url: 'https://e.zhichao.art/AI_images/a_1114__569.png',
  171. },
  172. {
  173. url: 'https://e.zhichao.art/AI_images/a_1114__570.png',
  174. },
  175. {
  176. url: 'https://e.zhichao.art/AI_images/a_1114__571.png',
  177. },
  178. {
  179. url: 'https://e.zhichao.art/AI_images/a_1114__575.png',
  180. },
  181. ],
  182. activeTab: 0,
  183. offset: 0,
  184. hasMore: true,
  185. isLoading: false,
  186. worksList: []
  187. }
  188. },
  189. onLoad() {
  190. // setTimeout(function() {
  191. // uni.setNavigationBarColor({
  192. // frontColor: '#ffffff',
  193. // backgroundColor: '#00000000',
  194. // animation: {
  195. // duration: 400,
  196. // timingFunc: 'easeIn'
  197. // }
  198. // })
  199. // }, 200);
  200. },
  201. onShow() {
  202. uni.$emit('check_login', () => {})
  203. // this.loadData();
  204. this.offset = 0;
  205. this.hasMore = true;
  206. this.worksList = [];
  207. this.loadInfo();
  208. this.loadWorksList();
  209. },
  210. onReachBottom() {
  211. if (this.hasMore && !this.isLoading) {
  212. this.loadMoreWorks();
  213. }
  214. },
  215. methods: {
  216. onBack() {},
  217. chkSel() {
  218. if (this.sel == 1) {
  219. this.sel = 0;
  220. } else {
  221. this.sel = 1;
  222. }
  223. },
  224. goPage(page) {
  225. if (page == 'kefu') {
  226. let that = this;
  227. // #ifdef APP-PLUS
  228. plus.share.getServices(res => {
  229. const wechat = res.find(i => i.id === 'weixin')
  230. if (wechat) {
  231. wechat.openCustomerServiceChat({
  232. corpid: 'wwbc06aa8311b6ac08',
  233. // url: 'https://work.weixin.qq.com/kfid/kfc4b0bcb4038d00a50'
  234. url: that.myinfo.wxkf
  235. }, src => {
  236. console.log("success:")
  237. }, err => {
  238. console.log("error:")
  239. })
  240. } else {
  241. uni.showToast({
  242. title: '没有检测到微信,请先安装',
  243. icon: "error"
  244. });
  245. }
  246. });
  247. // #endif
  248. } else if (page != '') {
  249. uni.navigateTo({
  250. url: page,
  251. })
  252. }
  253. },
  254. loadInfo() {
  255. console.log({
  256. uuid: getApp().globalData.uuid,
  257. skey: getApp().globalData.skey
  258. });
  259. uni.request({
  260. url: this.$apiHost + '/User/getinfo',
  261. data: {
  262. uuid: getApp().globalData.uuid,
  263. skey: getApp().globalData.skey
  264. },
  265. header: {
  266. "content-type": "application/json",
  267. 'sign': getApp().globalData.headerSign
  268. },
  269. success: (res) => {
  270. console.log("----:", res.data);
  271. if (res.data.need_login == "yes") {
  272. // getApp().globalData.skey = "";
  273. // getApp().globalData.uuid = "";
  274. uni.removeStorageSync("wapptoken");
  275. uni.redirectTo({
  276. url: '/pages/login/login'
  277. });
  278. return;
  279. }
  280. if (res.data.aihao) {
  281. this.aihao_tags = res.data.aihao.split(",");
  282. }
  283. this.myinfo = res.data;
  284. },
  285. complete: (com) => {
  286. // uni.hideLoading();
  287. },
  288. fail: (e) => {
  289. console.log("----e:", e);
  290. }
  291. });
  292. },
  293. onLogout() {
  294. let that = this;
  295. this.$refs['DialogBox'].confirm({
  296. title: '提示',
  297. content: '确定退出吗?',
  298. DialogType: 'inquiry',
  299. btn1: '取消',
  300. btn2: '退出',
  301. animation: 0
  302. }).then((res) => {
  303. uni.request({
  304. url: that.$apiHost + '/My/logout',
  305. data: {
  306. uuid: getApp().globalData.uuid,
  307. skey: getApp().globalData.skey
  308. },
  309. header: {
  310. "content-type": "application/json",
  311. 'sign': getApp().globalData.headerSign
  312. },
  313. success: (res) => {
  314. console.log("----:", res.data);
  315. // getApp().globalData.skey = "";
  316. // getApp().globalData.uuid = "";
  317. uni.removeStorageSync("wapptoken");
  318. uni.redirectTo({
  319. url: '/pages/login/login'
  320. })
  321. },
  322. complete: (com) => {
  323. // uni.hideLoading();
  324. },
  325. fail: (e) => {
  326. console.log("----e:", e);
  327. }
  328. });
  329. })
  330. },
  331. switchTab(index) {
  332. this.activeTab = index;
  333. this.offset = 0;
  334. this.hasMore = true;
  335. this.worksList = [];
  336. this.loadWorksList();
  337. },
  338. loadWorksList() {
  339. if (this.isLoading) return;
  340. this.isLoading = true;
  341. // 根据activeTab选择不同的API
  342. let apiUrl = '';
  343. if (this.activeTab === 0) {
  344. apiUrl = '/Work/getlist';
  345. } else {
  346. apiUrl = '/WorkAI/getMyQueueList';
  347. }
  348. uni.request({
  349. url: this.$apiHost + apiUrl,
  350. data: {
  351. uuid: getApp().globalData.uuid,
  352. skey: getApp().globalData.skey,
  353. type: 'my', // 固定为my,表示获取自己的作品
  354. offset: this.offset,
  355. status: this.activeTab === 0 ? 1 : undefined // 只有我的作品需要status参数
  356. },
  357. header: {
  358. "content-type": "application/json",
  359. 'sign': getApp().globalData.headerSign
  360. },
  361. success: (res) => {
  362. console.log("列表数据:", res.data);
  363. if (res.data.success == 'yes' && res.data.list) {
  364. if (res.data.list.length > 0) {
  365. this.worksList = [...this.worksList, ...res.data.list];
  366. this.offset += res.data.list.length;
  367. }
  368. if (res.data.list.length < 20) {
  369. this.hasMore = false;
  370. }
  371. } else {
  372. this.hasMore = false;
  373. }
  374. // 只有在"我的作品"标签下才更新data_list
  375. if (this.activeTab === 0) {
  376. this.updateDataList();
  377. }
  378. },
  379. complete: () => {
  380. this.isLoading = false;
  381. },
  382. fail: (e) => {
  383. console.log("请求列表失败:", e);
  384. this.isLoading = false;
  385. }
  386. });
  387. },
  388. loadMoreWorks() {
  389. if (this.hasMore && !this.isLoading) {
  390. this.loadWorksList();
  391. }
  392. },
  393. updateDataList() {
  394. this.data_list = this.worksList.map(item => {
  395. return {
  396. url: item.images || item.img_url || item.url || '../../static/logo.png',
  397. title: item.title || item.description || '作品',
  398. id: item.id
  399. };
  400. });
  401. },
  402. goWork(item) {
  403. uni.$emit('check_login', () => {})
  404. if (this.activeTab == 0) {
  405. uni.navigateTo({
  406. url: '/pages/index/workDetail?id=' + item.id
  407. })
  408. } else {
  409. if (item.status >= 9) {
  410. uni.navigateTo({
  411. url: '/pages/makedetail/makeDetail?id=' + item.id
  412. })
  413. }
  414. }
  415. },
  416. navigateToSettings() {
  417. uni.$emit('check_login', () => {
  418. uni.navigateTo({
  419. url: '/pages/my/setting'
  420. });
  421. })
  422. },
  423. }
  424. }
  425. </script>
  426. <style scoped lang="scss">
  427. @import 'my.scss';
  428. </style>