my.uvue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <template>
  2. <view class="page-container">
  3. <!-- 1. 用户信息头部 -->
  4. <view class="user-header">
  5. <view class="user-info">
  6. <image class="avatar" :src="coachInfo['avatar']" mode="aspectFill" />
  7. <text class="username">
  8. {{ coachInfo['name'] }}
  9. </text>
  10. <image @click="jumpStarRating()" :src="'/static/testInfo/xx-x' + coachInfo?.star_leavl + '.png'"
  11. style="width: 108rpx;height:40rpx;margin-left: 12rpx;" mode="aspectFit">
  12. </image>
  13. </view>
  14. <view class="header-actions">
  15. <view class="action-item" @click="contactService">
  16. <view class="icon-circle">
  17. <u-icon name="customerService" size="30" color="#666" />
  18. </view>
  19. <text>
  20. 客服
  21. </text>
  22. </view>
  23. <view class="action-item" style="margin-left: 20rpx;" @click="openSettings">
  24. <view class="icon-circle">
  25. <u-icon name="setting" size="22" color="#666" />
  26. </view>
  27. <text>
  28. 设置
  29. </text>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 2. 等级卡片 -->
  34. <view class="level-card">
  35. <image src="/static/testInfo/l-bg.png" class="level-bg" mode="widthFix">
  36. </image>
  37. <view class="level-content">
  38. <view class="level-main" style="width: 60%;">
  39. <text class="level-title">
  40. V{{ coachInfo['level'] }}
  41. </text>
  42. <text style="margin: 0 20rpx;">
  43. |
  44. </text>
  45. <text class="level-sub">
  46. 成长值 {{ coachInfo['growthValue'] }}
  47. </text>
  48. </view>
  49. <text class="progress-text">
  50. 还差{{ coachInfo['nextLevelGap'] }}成长值可升至V{{ coachInfo['nextLevel'] }}
  51. </text>
  52. <view class="level-progress-box">
  53. <view class="level-progress">
  54. <view class="progress-bar">
  55. <!-- <view class="progress-fill" :style="{ width: progressWidth }">
  56. </view> -->
  57. </view>
  58. <view class="progress-labels">
  59. <text>
  60. V1
  61. </text>
  62. <text>
  63. V2
  64. </text>
  65. </view>
  66. </view>
  67. <view class="level-badge" @click="viewLevelDetail">
  68. <text>
  69. 我的等级
  70. </text>
  71. </view>
  72. </view>
  73. </view>
  74. <!-- 3. 我的档案 -->
  75. <view class="bs-box">
  76. <view class="title-bg-box">
  77. <text class="texnj-box">
  78. 我的档案
  79. </text>
  80. </view>
  81. <view class="level-main">
  82. <view class="action-item" @click="jumpQy">
  83. <image src="/static/myImages/my-qy.png" style="width: 60rpx;height:60rpx;" mode="aspectFit">
  84. </image>
  85. <text class="dib-text">
  86. 签约
  87. </text>
  88. </view>
  89. <view class="action-item" style="margin-left: 25rpx;" @click="jumpJiey">
  90. <image src="/static/myImages/my-jiey.png" style="width: 60rpx;height:60rpx;" mode="aspectFit">
  91. </image>
  92. <text class="dib-text">
  93. 解约
  94. </text>
  95. </view>
  96. <view class="action-item" @click="jumpQd">
  97. <image src="/static/myImages/my-qd.png" style="width: 60rpx;height:60rpx;" mode="aspectFit">
  98. </image>
  99. <text class="dib-text">
  100. 店铺签到
  101. </text>
  102. </view>
  103. <view class="action-item" @click="jumpGoum">
  104. <image src="/static/myImages/my-goum.png" style="width: 60rpx;height:60rpx;" mode="aspectFit">
  105. </image>
  106. <text class="dib-text">
  107. 购买物料
  108. </text>
  109. </view>
  110. </view>
  111. <view class="title-bg-box">
  112. <view class="texnj-box">
  113. 我的工具
  114. </view>
  115. </view>
  116. <view class="level-main" style="justify-content: space-between; padding: 0 15rpx;">
  117. <view class="action-item" @click="jumpXuexi">
  118. <image src="/static/myImages/my-xux.png" style="width: 60rpx;height:60rpx;" mode="aspectFit">
  119. </image>
  120. <text class="dib-text">
  121. 学习园地
  122. </text>
  123. </view>
  124. <view class="action-item">
  125. <image src="/static/myImages/my-wt.png" style="width: 60rpx;height:60rpx;" mode="aspectFit">
  126. </image>
  127. <text class="dib-text">
  128. 申诉
  129. </text>
  130. </view>
  131. <view class="action-item">
  132. <image src="/static/myImages/my-yhj.png" style="width: 60rpx;height:60rpx;" mode="aspectFit">
  133. </image>
  134. <text class="dib-text">
  135. 定制优惠
  136. </text>
  137. </view>
  138. <view class="action-item">
  139. <image src="/static/myImages/vipIcon.png" style="width: 70rpx;height:70rpx;" mode="aspectFit">
  140. </image>
  141. <text class="dib-text">
  142. VIP俱乐部
  143. </text>
  144. </view>
  145. </view>
  146. <view class="level-progress-box">
  147. <view class="lef-bg-box" @click="jumpLaxin">
  148. <image src="/static/myImages/my-lax.png" class="my-lax" mode="widthFix">
  149. </image>
  150. <view class="conm-box">
  151. <text class="max-box">
  152. 邀请好友赚钱
  153. </text>
  154. <text class="min-box">
  155. 单次最高可奖200元
  156. </text>
  157. </view>
  158. </view>
  159. <view class="lef-bg-box" @click="jumpMyTeam">
  160. <image src="/static/myImages/my-td.png" class="my-lax" mode="widthFix">
  161. </image>
  162. <view class="conm-box">
  163. <text class="max-box">
  164. 我的团队
  165. </text>
  166. <text class="min-box">
  167. 团队成员数:100人
  168. </text>
  169. </view>
  170. </view>
  171. </view>
  172. <image class="hhr-image" src="/static/yaoqInfo/hhr-image.png" mode="widthFix">
  173. </image>
  174. </view>
  175. </view>
  176. </view>
  177. </template>
  178. <script setup lang="ts">
  179. import { ref, reactive } from 'vue';
  180. import { getCoachDetaile } from '@/utils/api/masterInfoApi'
  181. // --- 用户信息 ---
  182. const coachInfo = reactive<UTSJSONObject>({
  183. name: '刘大锤',
  184. avatar: '/static/testInfo/boy-nickname.png', // 替换为实际头像
  185. level: 30,
  186. growthValue: 50,
  187. star_leavl: 3,
  188. star_score: 3.0,
  189. nextLevel: 2,
  190. nextLevelGap: 15,
  191. progressPercent: 75 // (50 / (50+15)) * 100 ≈ 75%
  192. });
  193. // computed helpers to satisfy UTS inference rules
  194. // convert percent to a fixed rpx width (assuming 750rpx full width)
  195. // const progressWidth = computed(() => `${coachInfo.progressPercent * 7.5}rpx`);
  196. // --- 工具列表 ---
  197. type ToolItem = {
  198. name : string;
  199. icon : string;
  200. color : string;
  201. };
  202. // avoid generic parameter on ref which earlier triggered an "interface does not
  203. // have constructors" error; cast the initial value instead.
  204. const tools = ref([
  205. { name: '学习园地', icon: 'book', color: '#ff9900' },
  206. { name: '问题反馈', icon: 'chat', color: '#52c41a' },
  207. { name: '定制优惠', icon: 'wallet', color: '#1890ff' },
  208. { name: 'VIP俱乐部', icon: 'vip', color: '#faad14' }
  209. ] as ToolItem[]);
  210. // --- 方法 ---
  211. const httpGetCoachDetail = async () => {
  212. const response = await getCoachDetaile() as UTSJSONObject
  213. const code = response["code"] as number
  214. const dataObj = response["data"] as UTSJSONObject | null
  215. if (code != 200 || dataObj == null) {
  216. return
  217. }
  218. coachInfo.name = dataObj["nickname"] as string
  219. coachInfo.avatar = dataObj["avatar"] as string
  220. coachInfo.level = dataObj["level"] as number
  221. coachInfo.growthValue = dataObj["growthValue"] as number
  222. coachInfo.nextLevel = dataObj["nextLevel"] as number
  223. coachInfo.nextLevelGap = dataObj["nextLevelGap"] as number
  224. coachInfo.progressPercent = dataObj["progressPercent"] as number
  225. coachInfo.star_leavl = dataObj["star_leavl"] as number
  226. coachInfo.star_score = dataObj["star_score"] as number
  227. }
  228. const contactService = () => {
  229. uni.showToast({ title: '联系客服', icon: 'none' });
  230. };
  231. const openSettings = () => {
  232. uni.navigateTo({
  233. url: '/pages/myEdit/setting'
  234. });
  235. };
  236. const viewLevelDetail = () => {
  237. uni.showToast({ title: '查看等级详情', icon: 'none' });
  238. };
  239. const handleToolClick = (tool : ToolItem) => {
  240. uni.showToast({ title: `点击${tool.name}`, icon: 'none' });
  241. };
  242. // --- 跳转 ---
  243. const jumpQy = () => {
  244. uni.navigateTo({
  245. url: '/pages/myEdit/sign'
  246. });
  247. };
  248. const jumpJiey = () => {
  249. uni.navigateTo({
  250. url: '/pages/myEdit/terminate'
  251. });
  252. };
  253. const jumpQd = () => {
  254. uni.navigateTo({
  255. url: '/pages/myEdit/signIn'
  256. });
  257. };
  258. const jumpGoum = () => {
  259. uni.navigateTo({
  260. url: '/pages/myEdit/shoppingRecord'
  261. });
  262. };
  263. const jumpLaxin = () => {
  264. uni.navigateTo({
  265. url: '/pages/myEdit/inviteRecord'
  266. });
  267. };
  268. //跳转到我的团队
  269. const jumpMyTeam = () => {
  270. uni.navigateTo({
  271. url: '/pages/myEdit/team'
  272. });
  273. };
  274. const jumpYhj = () => {
  275. uni.navigateTo({
  276. url: '/pages/myEdit/setting'
  277. });
  278. };
  279. //跳转到城市合伙人
  280. const jumpPartner = async () => {
  281. uni.navigateTo({
  282. url: '/pages/masterProject/inviteInfo/partner/index'
  283. })
  284. }
  285. //跳转到用户开通VIP
  286. const goToOpenVip = async () => {
  287. uni.navigateTo({
  288. url: '/pages/masterProject/masterInfo/vipMember/index'
  289. })
  290. }
  291. //跳转到问题反馈
  292. const goToMyCourse = async () => {
  293. uni.navigateTo({
  294. url: '/pages/masterProject/masterInfo/problemFeedback/index'
  295. })
  296. }
  297. //跳转到个人信息
  298. const jumpMasterInfo = async () => {
  299. uni.navigateTo({
  300. url: '/pages/masterProject/masterInfo/index'
  301. })
  302. }
  303. //跳转到我的星级
  304. const jumpStarRating = async () => {
  305. uni.navigateTo({
  306. url: '/pages/masterProject/masterInfo/starRating/index?star_score'
  307. })
  308. }
  309. //跳转到学习园地
  310. const jumpXuexi = () => {
  311. uni.navigateTo({
  312. url: '/pages/masterProject/inviteInfo/learningCorner/index'
  313. })
  314. }
  315. const inviteFriends = () => {
  316. uni.showModal({
  317. title: '邀请好友',
  318. content: '分享链接邀请好友加入,单次最高可获奖励200元!',
  319. success: (res) => {
  320. if (res.confirm) {
  321. uni.showToast({ title: '已生成邀请链接', icon: 'success' });
  322. }
  323. }
  324. });
  325. };
  326. const viewTeam = () => {
  327. uni.showToast({ title: '查看团队成员', icon: 'none' });
  328. };
  329. const joinPartner = () => {
  330. uni.showModal({
  331. title: '城市合伙人',
  332. content: '全新盈利模式助你创业,立即申请成为城市合伙人!',
  333. success: (res) => {
  334. if (res.confirm) {
  335. uni.showToast({ title: '申请已提交', icon: 'success' });
  336. }
  337. }
  338. });
  339. };
  340. onLoad(() => {
  341. httpGetCoachDetail()
  342. })
  343. </script>
  344. <style scoped>
  345. /*
  346. UniApp X 默认 page 是 flex-direction: column
  347. 所以 .page-container 会自动垂直排列子元素
  348. */
  349. .page-container {
  350. background-color: rgba(246, 246, 244, 0.5);
  351. }
  352. /* --- 用户头部 --- */
  353. .user-header {
  354. display: flex;
  355. flex-direction: row;
  356. align-items: center;
  357. padding: 30rpx;
  358. justify-content: space-between;
  359. }
  360. .avatar {
  361. width: 124rpx;
  362. height: 124rpx;
  363. border-radius: 62rpx;
  364. border: 2rpx solid #fff;
  365. }
  366. .user-info {
  367. flex-direction: row;
  368. align-items: center;
  369. }
  370. .username {
  371. font-size: 32rpx;
  372. font-weight: bold;
  373. color: #333;
  374. margin: 0 10rpx;
  375. }
  376. .badge-row {
  377. display: flex;
  378. flex-direction: row;
  379. }
  380. .badge {
  381. font-size: 22rpx;
  382. padding: 4rpx 12rpx;
  383. border-radius: 20rpx;
  384. font-weight: bold;
  385. }
  386. .badge.vip {
  387. color: #ffffff;
  388. }
  389. .header-actions {
  390. display: flex;
  391. flex-direction: row;
  392. }
  393. .action-item {
  394. display: flex;
  395. align-items: center;
  396. }
  397. .icon-circle {
  398. width: 80rpx;
  399. height: 80rpx;
  400. border-radius: 40rpx;
  401. background-color: #ffffff;
  402. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  403. display: flex;
  404. align-items: center;
  405. justify-content: center;
  406. margin-bottom: 8rpx;
  407. }
  408. /* --- 等级卡片 --- */
  409. .level-card {
  410. /* padding:0 40rpx; */
  411. position: relative;
  412. flex-direction: column;
  413. align-items: center;
  414. }
  415. .level-bg {
  416. position: absolute;
  417. width: 90%;
  418. z-index: 1;
  419. }
  420. .level-content {
  421. position: absolute;
  422. z-index: 2;
  423. padding: 20rpx;
  424. width: 90%;
  425. }
  426. .level-main {
  427. display: flex;
  428. flex-direction: row;
  429. align-items: center;
  430. justify-content: space-around;
  431. }
  432. .level-title {
  433. font-size: 86rpx;
  434. color: #485575;
  435. }
  436. .level-sub {
  437. font-size: 36rpx;
  438. color: #424C6C;
  439. }
  440. .level-progress-box {
  441. display: flex;
  442. flex-direction: row;
  443. align-items: flex-start;
  444. justify-content: space-between;
  445. }
  446. .level-progress {
  447. margin-bottom: 20rpx;
  448. width: 70%;
  449. }
  450. .progress-text {
  451. font-size: 28rpx;
  452. opacity: 0.8;
  453. margin-bottom: 10rpx;
  454. }
  455. .progress-bar {
  456. height: 12rpx;
  457. background: rgba(255, 255, 255, 0.3);
  458. border-radius: 6rpx;
  459. overflow: hidden;
  460. margin-top: 8rpx;
  461. }
  462. .progress-fill {
  463. /* 使用与父容器相同的固定高度 */
  464. height: 12rpx;
  465. background: #ffffff;
  466. border-radius: 6rpx;
  467. transition: width 0.3s ease;
  468. }
  469. .progress-labels {
  470. display: flex;
  471. flex-direction: row;
  472. justify-content: space-between;
  473. font-size: 22rpx;
  474. opacity: 0.7;
  475. }
  476. .level-badge {
  477. background-color: #E9EEF7;
  478. border-radius: 14px;
  479. padding: 8rpx 16rpx;
  480. }
  481. /* --- 章节标题 --- */
  482. .bs-box {
  483. background-color: #ffffff;
  484. border-radius: 36rpx;
  485. padding: 30rpx;
  486. width: 100%;
  487. margin-top: 30%;
  488. }
  489. .title-bg-box {
  490. display: flex;
  491. align-items: flex-start;
  492. margin: 35rpx 0;
  493. }
  494. .texnj-box {
  495. font-size: 30rpx;
  496. font-weight: 500;
  497. background: linear-gradient(to right, #ffd95aff, #FFFFFF);
  498. border-radius: 24rpx;
  499. padding: 4rpx 10rpx;
  500. background-size: 50% 100%;
  501. background-repeat: no-repeat;
  502. background-position: 0 50%;
  503. }
  504. .lef-bg-box {
  505. width: 49%;
  506. position: relative;
  507. margin: 20rpx 0;
  508. }
  509. .my-lax {
  510. width: 100%;
  511. /* position: absolute; */
  512. }
  513. .min-box {
  514. font-size: 30rpx;
  515. color: #a8a8a8ff;
  516. }
  517. .max-box {
  518. font-size: 32rpx;
  519. color: #000000ff;
  520. font-weight: bold;
  521. }
  522. .conm-box {
  523. position: absolute;
  524. padding: 28rpx;
  525. }
  526. .hhr-image {
  527. width: 100%;
  528. }
  529. </style>