my.uvue.ts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. import _easycom_u_icon from '@/components/u-icon/u-icon.vue'
  2. import { ref, reactive } from 'vue';
  3. // --- 用户信息 ---
  4. type UserInfo = { __$originalPosition?: UTSSourceMapPosition<"UserInfo", "pages/index/my.uvue", 179, 7>;
  5. name : string;
  6. avatar : string;
  7. level : number;
  8. growthValue : number;
  9. nextLevel : number;
  10. nextLevelGap : number;
  11. progressPercent : number;
  12. }
  13. type ToolItem = { __$originalPosition?: UTSSourceMapPosition<"ToolItem", "pages/index/my.uvue", 204, 7>;
  14. name : string;
  15. icon : string;
  16. color : string;
  17. };
  18. // avoid generic parameter on ref which earlier triggered an "interface does not
  19. // have constructors" error; cast the initial value instead.
  20. const __sfc__ = defineComponent({
  21. __name: 'my',
  22. setup(__props) {
  23. const __ins = getCurrentInstance()!;
  24. const _ctx = __ins.proxy as InstanceType<typeof __sfc__>;
  25. const _cache = __ins.renderCache;
  26. const userInfo = reactive<UserInfo>({
  27. name: '刘大锤',
  28. avatar: 'https://via.placeholder.com/100x100/4a90e2/ffffff?text=LD', // 替换为实际头像
  29. level: 30,
  30. growthValue: 50,
  31. nextLevel: 2,
  32. nextLevelGap: 15,
  33. progressPercent: 75 // (50 / (50+15)) * 100 ≈ 75%
  34. });
  35. // computed helpers to satisfy UTS inference rules
  36. // convert percent to a fixed rpx width (assuming 750rpx full width)
  37. const progressWidth = computed(() => `${userInfo.progressPercent * 7.5}rpx`);
  38. // --- 工具列表 ---
  39. const tools = ref([
  40. { name: '学习园地', icon: 'book', color: '#ff9900' },
  41. { name: '问题反馈', icon: 'chat', color: '#52c41a' },
  42. { name: '定制优惠', icon: 'wallet', color: '#1890ff' },
  43. { name: 'VIP俱乐部', icon: 'vip', color: '#faad14' }
  44. ] as ToolItem[]);
  45. // --- 方法 ---
  46. const contactService = () => {
  47. uni.showToast({ title: '联系客服', icon: 'none' });
  48. };
  49. const openSettings = () => {
  50. uni.showToast({ title: '打开设置', icon: 'none' });
  51. };
  52. const viewLevelDetail = () => {
  53. uni.showToast({ title: '查看等级详情', icon: 'none' });
  54. };
  55. const handleToolClick = (tool : ToolItem) => {
  56. uni.showToast({ title: `点击${tool.name}`, icon: 'none' });
  57. };
  58. const inviteFriends = () => {
  59. uni.showModal({
  60. title: '邀请好友',
  61. content: '分享链接邀请好友加入,单次最高可获奖励200元!',
  62. success: (res) => {
  63. if (res.confirm) {
  64. uni.showToast({ title: '已生成邀请链接', icon: 'success' });
  65. }
  66. }
  67. });
  68. };
  69. const viewTeam = () => {
  70. uni.showToast({ title: '查看团队成员', icon: 'none' });
  71. };
  72. const joinPartner = () => {
  73. uni.showModal({
  74. title: '城市合伙人',
  75. content: '全新盈利模式助你创业,立即申请成为城市合伙人!',
  76. success: (res) => {
  77. if (res.confirm) {
  78. uni.showToast({ title: '申请已提交', icon: 'success' });
  79. }
  80. }
  81. });
  82. };
  83. return (): any | null => {
  84. const _component_u_icon = resolveEasyComponent("u-icon",_easycom_u_icon)
  85. return _cE("view", _uM({ class: "page-container" }), [
  86. _cE("view", _uM({ class: "user-header" }), [
  87. _cE("image", _uM({
  88. src: userInfo['avatar'],
  89. class: "avatar",
  90. mode: "aspectFill"
  91. }), null, 8 /* PROPS */, ["src"]),
  92. _cE("view", _uM({ class: "user-info" }), [
  93. _cE("text", _uM({ class: "username" }), _tD(userInfo['name']), 1 /* TEXT */),
  94. _cE("view", _uM({ class: "badge-row" }), [
  95. _cE("text", _uM({ class: "badge vip" }), " 王牌 ")
  96. ])
  97. ]),
  98. _cE("view", _uM({ class: "header-actions" }), [
  99. _cE("view", _uM({
  100. class: "action-item",
  101. onClick: contactService
  102. }), [
  103. _cV(_component_u_icon, _uM({
  104. type: "customer-service",
  105. size: "24",
  106. color: "#666"
  107. })),
  108. _cE("text", null, " 客服 ")
  109. ]),
  110. _cE("view", _uM({
  111. class: "action-item",
  112. onClick: openSettings
  113. }), [
  114. _cV(_component_u_icon, _uM({
  115. type: "gear",
  116. size: "24",
  117. color: "#666"
  118. })),
  119. _cE("text", null, " 设置 ")
  120. ])
  121. ])
  122. ]),
  123. _cE("view", _uM({ class: "level-card" }), [
  124. _cE("view", _uM({ class: "level-main" }), [
  125. _cE("text", _uM({ class: "level-title" }), " V" + _tD(userInfo['level']), 1 /* TEXT */),
  126. _cE("text", _uM({ class: "level-sub" }), " 成长值 " + _tD(userInfo['growthValue']), 1 /* TEXT */)
  127. ]),
  128. _cE("view", _uM({ class: "level-progress" }), [
  129. _cE("text", _uM({ class: "progress-text" }), " 还差" + _tD(userInfo['nextLevelGap']) + "成长值可升至V" + _tD(userInfo['nextLevel']), 1 /* TEXT */),
  130. _cE("view", _uM({ class: "progress-bar" }), [
  131. _cE("view", _uM({
  132. class: "progress-fill",
  133. style: _nS(_uM({ width: unref(progressWidth) }))
  134. }), null, 4 /* STYLE */)
  135. ]),
  136. _cE("view", _uM({ class: "progress-labels" }), [
  137. _cE("text", null, " V1 "),
  138. _cE("text", null, " V2 ")
  139. ])
  140. ]),
  141. _cE("view", _uM({
  142. class: "level-badge",
  143. onClick: viewLevelDetail
  144. }), [
  145. _cV(_component_u_icon, _uM({
  146. type: "vip",
  147. size: "40",
  148. color: "#ffffff"
  149. })),
  150. _cE("text", null, " 我的等级 ")
  151. ])
  152. ]),
  153. _cE("view", _uM({ class: "section-title" }), " 我的档案 "),
  154. _cE("view", _uM({ class: "profile-stats" }), [
  155. _cE("view", _uM({ class: "stat-item" }), [
  156. _cE("text", _uM({ class: "stat-value" }), " 60 "),
  157. _cE("text", _uM({ class: "stat-label" }), " 签约 ")
  158. ]),
  159. _cE("view", _uM({ class: "stat-item" }), [
  160. _cE("text", _uM({ class: "stat-value" }), " 21 "),
  161. _cE("text", _uM({ class: "stat-label" }), " 解约 ")
  162. ]),
  163. _cE("view", _uM({ class: "stat-item" }), [
  164. _cV(_component_u_icon, _uM({
  165. type: "location",
  166. size: "24",
  167. color: "#666"
  168. })),
  169. _cE("text", _uM({ class: "stat-label" }), " 异地签到 ")
  170. ]),
  171. _cE("view", _uM({ class: "stat-item" }), [
  172. _cV(_component_u_icon, _uM({
  173. type: "cart",
  174. size: "24",
  175. color: "#666"
  176. })),
  177. _cE("text", _uM({ class: "stat-label" }), " 购买物料 ")
  178. ])
  179. ]),
  180. _cE("view", _uM({ class: "section-title" }), " 我的工具 "),
  181. _cE("view", _uM({ class: "tools-grid" }), [
  182. _cE(Fragment, null, RenderHelpers.renderList(tools.value, (tool, idx, __index, _cached): any => {
  183. return _cE("view", _uM({
  184. class: "tool-item",
  185. key: idx,
  186. onClick: () => {handleToolClick(tool)}
  187. }), [
  188. _cV(_component_u_icon, _uM({
  189. type: tool.icon,
  190. size: "32",
  191. color: tool.color
  192. }), null, 8 /* PROPS */, ["type", "color"]),
  193. _cE("text", _uM({ class: "tool-name" }), _tD(tool.name), 1 /* TEXT */)
  194. ], 8 /* PROPS */, ["onClick"])
  195. }), 128 /* KEYED_FRAGMENT */)
  196. ]),
  197. _cE("view", _uM({ class: "promo-cards" }), [
  198. _cE("view", _uM({
  199. class: "promo-card invite",
  200. onClick: inviteFriends
  201. }), [
  202. _cE("view", _uM({ class: "promo-content" }), [
  203. _cE("text", _uM({ class: "promo-title" }), " 邀请好友赚钱 "),
  204. _cE("text", _uM({ class: "promo-subtitle" }), " 单次最高可奖200元 ")
  205. ]),
  206. _cV(_component_u_icon, _uM({
  207. type: "gift",
  208. size: "40",
  209. color: "#ffd700"
  210. }))
  211. ]),
  212. _cE("view", _uM({
  213. class: "promo-card team",
  214. onClick: viewTeam
  215. }), [
  216. _cE("view", _uM({ class: "promo-content" }), [
  217. _cE("text", _uM({ class: "promo-title" }), " 我的团队 "),
  218. _cE("text", _uM({ class: "promo-subtitle" }), " 团队成员100人 ")
  219. ]),
  220. _cV(_component_u_icon, _uM({
  221. type: "person",
  222. size: "40",
  223. color: "#4a90e2"
  224. }))
  225. ])
  226. ]),
  227. _cE("view", _uM({
  228. class: "partner-banner",
  229. onClick: joinPartner
  230. }), [
  231. _cE("view", _uM({ class: "partner-content" }), [
  232. _cE("text", _uM({ class: "partner-title" }), " 寻找城市合伙人 "),
  233. _cE("text", _uM({ class: "partner-subtitle" }), " 全新盈利模式助你创业 ")
  234. ]),
  235. _cE("view", _uM({ class: "partner-icon" }), [
  236. _cV(_component_u_icon, _uM({
  237. type: "person",
  238. size: "50",
  239. color: "#ffffff"
  240. })),
  241. _cV(_component_u_icon, _uM({
  242. type: "person",
  243. size: "30",
  244. color: "#ffffff",
  245. style: _nS(_uM({"margin-left":"-20rpx"}))
  246. }), null, 8 /* PROPS */, ["style"])
  247. ])
  248. ])
  249. ])
  250. }
  251. }
  252. })
  253. export default __sfc__
  254. const GenPagesIndexMyStyles = [_uM([["page-container", _pS(_uM([["backgroundColor", "#f5f6f8"], ["minHeight", "1000rpx"], ["boxSizing", "border-box"], ["paddingTop", "20rpx"], ["paddingRight", "20rpx"], ["paddingBottom", "20rpx"], ["paddingLeft", "20rpx"]]))], ["user-header", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["alignItems", "center"], ["paddingTop", "20rpx"], ["paddingRight", "20rpx"], ["paddingBottom", "20rpx"], ["paddingLeft", "20rpx"], ["backgroundImage", "none"], ["backgroundColor", "#ffffff"], ["borderTopLeftRadius", "16rpx"], ["borderTopRightRadius", "16rpx"], ["borderBottomRightRadius", "16rpx"], ["borderBottomLeftRadius", "16rpx"], ["boxShadow", "0 2rpx 8rpx rgba(0, 0, 0, 0.04)"]]))], ["avatar", _pS(_uM([["width", "100rpx"], ["height", "100rpx"], ["borderTopLeftRadius", "50rpx"], ["borderTopRightRadius", "50rpx"], ["borderBottomRightRadius", "50rpx"], ["borderBottomLeftRadius", "50rpx"], ["borderTopWidth", "2rpx"], ["borderRightWidth", "2rpx"], ["borderBottomWidth", "2rpx"], ["borderLeftWidth", "2rpx"], ["borderTopStyle", "solid"], ["borderRightStyle", "solid"], ["borderBottomStyle", "solid"], ["borderLeftStyle", "solid"], ["borderTopColor", "#eeeeee"], ["borderRightColor", "#eeeeee"], ["borderBottomColor", "#eeeeee"], ["borderLeftColor", "#eeeeee"]]))], ["user-info", _pS(_uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"], ["display", "flex"], ["flexDirection", "column"]]))], ["username", _pS(_uM([["fontSize", "32rpx"], ["fontWeight", "bold"], ["color", "#333333"]]))], ["badge-row", _pS(_uM([["display", "flex"], ["flexDirection", "row"]]))], ["badge", _uM([["", _uM([["fontSize", "22rpx"], ["paddingTop", "4rpx"], ["paddingRight", "12rpx"], ["paddingBottom", "4rpx"], ["paddingLeft", "12rpx"], ["borderTopLeftRadius", "20rpx"], ["borderTopRightRadius", "20rpx"], ["borderBottomRightRadius", "20rpx"], ["borderBottomLeftRadius", "20rpx"], ["fontWeight", "bold"]])], [".vip", _uM([["backgroundImage", "linear-gradient(90deg, #4a90e2, #67b26f)"], ["backgroundColor", "rgba(0,0,0,0)"], ["color", "#ffffff"]])]])], ["header-actions", _pS(_uM([["display", "flex"], ["flexDirection", "row"]]))], ["action-item", _pS(_uM([["display", "flex"], ["flexDirection", "column"], ["alignItems", "center"], ["fontSize", "22rpx"], ["color", "#666666"]]))], ["level-card", _pS(_uM([["backgroundImage", "linear-gradient(135deg, #667eea 0%, #764ba2 100%)"], ["backgroundColor", "rgba(0,0,0,0)"], ["borderTopLeftRadius", "16rpx"], ["borderTopRightRadius", "16rpx"], ["borderBottomRightRadius", "16rpx"], ["borderBottomLeftRadius", "16rpx"], ["paddingTop", "30rpx"], ["paddingRight", "30rpx"], ["paddingBottom", "30rpx"], ["paddingLeft", "30rpx"], ["color", "#ffffff"], ["position", "relative"], ["overflow", "hidden"]]))], ["level-main", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["alignItems", "flex-start"], ["marginBottom", "20rpx"]]))], ["level-title", _pS(_uM([["fontSize", "48rpx"], ["fontWeight", "bold"]]))], ["level-sub", _pS(_uM([["fontSize", "28rpx"], ["opacity", 0.9]]))], ["level-progress", _pS(_uM([["marginBottom", "20rpx"]]))], ["progress-text", _pS(_uM([["fontSize", "24rpx"], ["opacity", 0.8], ["marginBottom", "10rpx"]]))], ["progress-bar", _pS(_uM([["height", "12rpx"], ["backgroundImage", "none"], ["backgroundColor", "rgba(255,255,255,0.3)"], ["borderTopLeftRadius", "6rpx"], ["borderTopRightRadius", "6rpx"], ["borderBottomRightRadius", "6rpx"], ["borderBottomLeftRadius", "6rpx"], ["overflow", "hidden"], ["marginBottom", "8rpx"]]))], ["progress-fill", _pS(_uM([["height", "12rpx"], ["backgroundImage", "none"], ["backgroundColor", "#ffffff"], ["borderTopLeftRadius", "6rpx"], ["borderTopRightRadius", "6rpx"], ["borderBottomRightRadius", "6rpx"], ["borderBottomLeftRadius", "6rpx"], ["transitionProperty", "width"], ["transitionDuration", "0.3s"], ["transitionTimingFunction", "ease"]]))], ["progress-labels", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["justifyContent", "space-between"], ["fontSize", "22rpx"], ["opacity", 0.7]]))], ["level-badge", _pS(_uM([["position", "absolute"], ["top", "20rpx"], ["right", "20rpx"], ["display", "flex"], ["flexDirection", "column"], ["alignItems", "center"], ["fontSize", "24rpx"], ["opacity", 0.9]]))], ["section-title", _pS(_uM([["fontSize", "30rpx"], ["fontWeight", "bold"], ["color", "#333333"], ["marginTop", "10rpx"], ["marginBottom", "15rpx"], ["paddingLeft", "10rpx"], ["borderLeftWidth", "4rpx"], ["borderLeftStyle", "solid"], ["borderLeftColor", "#4a90e2"]]))], ["profile-stats", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["justifyContent", "space-around"], ["backgroundImage", "none"], ["backgroundColor", "#ffffff"], ["borderTopLeftRadius", "16rpx"], ["borderTopRightRadius", "16rpx"], ["borderBottomRightRadius", "16rpx"], ["borderBottomLeftRadius", "16rpx"], ["paddingTop", "30rpx"], ["paddingRight", "20rpx"], ["paddingBottom", "30rpx"], ["paddingLeft", "20rpx"], ["boxShadow", "0 2rpx 8rpx rgba(0, 0, 0, 0.04)"]]))], ["stat-item", _pS(_uM([["display", "flex"], ["flexDirection", "column"], ["alignItems", "center"]]))], ["stat-value", _pS(_uM([["fontSize", "32rpx"], ["fontWeight", "bold"], ["color", "#333333"]]))], ["stat-label", _pS(_uM([["fontSize", "24rpx"], ["color", "#666666"]]))], ["tools-grid", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["flexWrap", "wrap"], ["backgroundImage", "none"], ["backgroundColor", "#ffffff"], ["borderTopLeftRadius", "16rpx"], ["borderTopRightRadius", "16rpx"], ["borderBottomRightRadius", "16rpx"], ["borderBottomLeftRadius", "16rpx"], ["paddingTop", "30rpx"], ["paddingRight", "30rpx"], ["paddingBottom", "30rpx"], ["paddingLeft", "30rpx"], ["boxShadow", "0 2rpx 8rpx rgba(0, 0, 0, 0.04)"]]))], ["tool-item", _pS(_uM([["width", "168rpx"], ["display", "flex"], ["flexDirection", "column"], ["alignItems", "center"], ["paddingTop", "20rpx"], ["paddingRight", 0], ["paddingBottom", "20rpx"], ["paddingLeft", 0]]))], ["tool-name", _pS(_uM([["fontSize", "24rpx"], ["color", "#666666"], ["textAlign", "center"]]))], ["promo-cards", _pS(_uM([["display", "flex"], ["flexDirection", "row"]]))], ["promo-card", _uM([["", _uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"], ["borderTopLeftRadius", "16rpx"], ["borderTopRightRadius", "16rpx"], ["borderBottomRightRadius", "16rpx"], ["borderBottomLeftRadius", "16rpx"], ["paddingTop", "25rpx"], ["paddingRight", "25rpx"], ["paddingBottom", "25rpx"], ["paddingLeft", "25rpx"], ["display", "flex"], ["flexDirection", "row"], ["justifyContent", "space-between"], ["alignItems", "center"], ["boxShadow", "0 2rpx 8rpx rgba(0, 0, 0, 0.04)"]])], [".invite", _uM([["backgroundImage", "linear-gradient(135deg, #fff9e6 0%, #ffeaa7 100%)"], ["backgroundColor", "rgba(0,0,0,0)"]])], [".team", _uM([["backgroundImage", "linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%)"], ["backgroundColor", "rgba(0,0,0,0)"]])]])], ["promo-content", _pS(_uM([["display", "flex"], ["flexDirection", "column"]]))], ["promo-title", _pS(_uM([["fontSize", "28rpx"], ["fontWeight", "bold"], ["color", "#333333"]]))], ["promo-subtitle", _pS(_uM([["fontSize", "24rpx"], ["color", "#666666"]]))], ["partner-banner", _pS(_uM([["backgroundImage", "linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%)"], ["backgroundColor", "rgba(0,0,0,0)"], ["borderTopLeftRadius", "16rpx"], ["borderTopRightRadius", "16rpx"], ["borderBottomRightRadius", "16rpx"], ["borderBottomLeftRadius", "16rpx"], ["paddingTop", "30rpx"], ["paddingRight", "30rpx"], ["paddingBottom", "30rpx"], ["paddingLeft", "30rpx"], ["display", "flex"], ["flexDirection", "row"], ["justifyContent", "space-between"], ["alignItems", "center"], ["color", "#ffffff"], ["boxShadow", "0 4rpx 12rpx rgba(0, 0, 0, 0.08)"]]))], ["partner-content", _pS(_uM([["display", "flex"], ["flexDirection", "column"]]))], ["partner-title", _pS(_uM([["fontSize", "32rpx"], ["fontWeight", "bold"]]))], ["partner-subtitle", _pS(_uM([["fontSize", "26rpx"], ["opacity", 0.9]]))], ["partner-icon", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["alignItems", "center"]]))], ["@TRANSITION", _uM([["progress-fill", _uM([["property", "width"], ["duration", "0.3s"], ["timingFunction", "ease"]])]])]])]