index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <view class="mine-container">
  3. <!-- 顶部渐变背景 -->
  4. <view class="top-gradient">
  5. <!-- 页面背景图 -->
  6. <view class="page-bg">
  7. <image src="/static/mine/minebg.png" class="bg-image" mode="aspectFit"></image>
  8. </view>
  9. </view>
  10. <!-- 自定义导航栏 -->
  11. <view class="custom-navbar" :style="{paddingTop: statusBarHeight + 'px'}">
  12. <view class="navbar-content">
  13. <text class="navbar-title">我的</text>
  14. </view>
  15. </view>
  16. <!-- 用户登录/注册卡片 -->
  17. <view class="login-card" :style="{marginTop: navbarHeight+50 + 'rpx'}" @click="handleLoginCardClick">
  18. <view class="login-card-content">
  19. <view class="avatar-section">
  20. <view v-if="!avatar" class="avatar-placeholder">
  21. <view class="iconfont icon-people avatar-icon"></view>
  22. </view>
  23. <image v-if="avatar" :src="avatar" class="avatar-image" mode="aspectFill"></image>
  24. </view>
  25. <view class="login-info">
  26. <view v-if="!name" class="login-text">点击登录/注册</view>
  27. <view v-else class="user-name">{{ name }}</view>
  28. <view v-if="!name" class="login-desc">登录后获取更多功能信息</view>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 第一个菜单卡片 -->
  33. <view class="menu-card">
  34. <view class="menu-item" @click="handleToInfo">
  35. <view class="menu-item-left">
  36. <view class="menu-icon-wrapper account-icon">
  37. <image src="/static/mine/account.png" class="menu-icon-image" mode="aspectFit"></image>
  38. </view>
  39. <text class="menu-text">账号信息</text>
  40. </view>
  41. <view class="iconfont icon-right arrow-icon"></view>
  42. </view>
  43. <view class="menu-divider"></view>
  44. <view class="menu-item" @click="handleToOrderRevenue">
  45. <view class="menu-item-left">
  46. <view class="menu-icon-wrapper revenue-icon">
  47. <image src="/static/mine/order.png" class="menu-icon-image" mode="aspectFit"></image>
  48. </view>
  49. <text class="menu-text">订单收益</text>
  50. </view>
  51. <view class="iconfont icon-right arrow-icon"></view>
  52. </view>
  53. </view>
  54. <!-- 第二个菜单卡片 -->
  55. <view class="menu-card">
  56. <view class="menu-item" @click="handleClearCache">
  57. <view class="menu-item-left">
  58. <view class="menu-icon-wrapper cache-icon">
  59. <image src="/static/mine/local.png" class="menu-icon-image" mode="aspectFit"></image>
  60. </view>
  61. <text class="menu-text">本地缓存</text>
  62. </view>
  63. </view>
  64. <view class="menu-divider"></view>
  65. <view class="menu-item" @click="handleAbout">
  66. <view class="menu-item-left">
  67. <view class="menu-icon-wrapper about-icon">
  68. <image src="/static/mine/about.png" class="menu-icon-image" mode="aspectFit"></image>
  69. </view>
  70. <text class="menu-text">关于我们</text>
  71. </view>
  72. <view class="iconfont icon-right arrow-icon"></view>
  73. </view>
  74. <view class="menu-divider"></view>
  75. <view class="menu-item" @click="handleLogout">
  76. <view class="menu-item-left">
  77. <view class="menu-icon-wrapper logout-icon">
  78. <image src="/static/mine/exit.png" class="menu-icon-image" mode="aspectFit"></image>
  79. </view>
  80. <text class="menu-text">退出登录</text>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 底部导航栏 -->
  85. <bar-navigasi-handap></bar-navigasi-handap>
  86. <!-- 退出登录确认对话框 -->
  87. <view v-if="showLogoutDialog" class="logout-dialog-mask" @click="closeLogoutDialog">
  88. <view class="logout-dialog" @click.stop>
  89. <view class="dialog-title">确认退出该账号吗?</view>
  90. <view class="dialog-buttons">
  91. <view class="dialog-btn logout-btn" @click="confirmLogout">退出登录</view>
  92. <view class="dialog-btn cancel-btn" @click="closeLogoutDialog">取消</view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. <script>
  99. import BarNavigasiHandap from "@/components/barNavigasiHandap.vue"
  100. export default {
  101. components: {
  102. BarNavigasiHandap
  103. },
  104. data() {
  105. return {
  106. name: this.$store.state.user.name,
  107. statusBarHeight: 0,
  108. showLogoutDialog: false
  109. }
  110. },
  111. onLoad() {
  112. // 获取状态栏高度
  113. const systemInfo = uni.getSystemInfoSync()
  114. this.statusBarHeight = systemInfo.statusBarHeight || 0
  115. },
  116. computed: {
  117. avatar() {
  118. return this.$store.state.user.avatar
  119. },
  120. navbarHeight() {
  121. // 状态栏高度(px转rpx) + 导航栏高度(88rpx) + 间距(30rpx)
  122. return (this.statusBarHeight * 2) + 88 + 30
  123. }
  124. },
  125. methods: {
  126. handleLoginCardClick() {
  127. if (!this.name) {
  128. this.$tab.reLaunch('/pages/login')
  129. } else {
  130. this.$tab.navigateTo('/pages/mine/info/index')
  131. }
  132. },
  133. handleToInfo() {
  134. if (!this.name) {
  135. this.$tab.reLaunch('/pages/login')
  136. return
  137. }
  138. this.$tab.navigateTo('/pages/mine/info/index')
  139. },
  140. handleToOrderRevenue() {
  141. if (!this.name) {
  142. this.$tab.reLaunch('/pages/login')
  143. return
  144. }
  145. this.$modal.showToast('模块建设中~')
  146. },
  147. handleClearCache() {
  148. this.$modal.confirm('确定要清理本地缓存吗?').then(() => {
  149. // 清理缓存的逻辑
  150. uni.clearStorageSync()
  151. this.$modal.msgSuccess('缓存清理成功')
  152. })
  153. },
  154. handleAbout() {
  155. this.$tab.navigateTo('/pages/mine/about/index')
  156. },
  157. handleLogout() {
  158. if (!this.name) {
  159. this.$tab.reLaunch('/pages/login')
  160. return
  161. }
  162. this.showLogoutDialog = true
  163. },
  164. closeLogoutDialog() {
  165. this.showLogoutDialog = false
  166. },
  167. confirmLogout() {
  168. this.showLogoutDialog = false
  169. this.$store.dispatch('LogOut').then(() => {}).finally(() => {
  170. this.$tab.reLaunch('/pages/index')
  171. })
  172. }
  173. }
  174. }
  175. </script>
  176. <style lang="scss" scoped>
  177. page {
  178. background-color: #f5f5f5;
  179. }
  180. .mine-container {
  181. width: 100%;
  182. min-height: 100vh;
  183. padding-bottom: 120rpx;
  184. background-color: #f5f5f5;
  185. position: relative;
  186. // 顶部渐变背景
  187. .top-gradient {
  188. position: fixed;
  189. top: 0;
  190. left: 0;
  191. right: 0;
  192. height: 800rpx;
  193. background: linear-gradient(180deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 197, 253, 0.05) 50%, transparent 100%);
  194. z-index: 0;
  195. pointer-events: none;
  196. }
  197. // 页面背景图
  198. .page-bg {
  199. position: fixed;
  200. right: -60rpx;
  201. pointer-events: none;
  202. width: 400rpx;
  203. height: 600rpx;
  204. z-index: 0;
  205. .bg-image {
  206. width: 100%;
  207. height: 100%;
  208. opacity: 0.6;
  209. }
  210. }
  211. // 自定义导航栏
  212. .custom-navbar {
  213. position: fixed;
  214. top: 0;
  215. left: 0;
  216. right: 0;
  217. z-index: 999;
  218. background-color: transparent;
  219. pointer-events: none;
  220. .navbar-content {
  221. display: flex;
  222. align-items: center;
  223. justify-content: center;
  224. height: 88rpx;
  225. pointer-events: auto;
  226. .navbar-title {
  227. font-size: 36rpx;
  228. font-weight: 500;
  229. color: #000000;
  230. }
  231. }
  232. }
  233. // 登录卡片
  234. .login-card {
  235. min-height: 200rpx;
  236. position: relative;
  237. margin: 0 30rpx 40rpx 30rpx;
  238. padding: 30rpx 30rpx;
  239. background-color: rgba(255, 255, 255, 0.4);
  240. border-radius: 24rpx;
  241. overflow: visible;
  242. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
  243. z-index: 10;
  244. .login-card-content {
  245. display: flex;
  246. position: relative;
  247. z-index: 2;
  248. .avatar-section {
  249. position: relative;
  250. width: 160rpx;
  251. height: 160rpx;
  252. flex-shrink: 0;
  253. .avatar-placeholder {
  254. width: 120rpx;
  255. height: 120rpx;
  256. border-radius: 50%;
  257. background-color: #e0e0e0;
  258. display: flex;
  259. align-items: center;
  260. justify-content: center;
  261. position: absolute;
  262. top: -100rpx;
  263. left: 0;
  264. .avatar-icon {
  265. font-size: 60rpx;
  266. color: #999999;
  267. }
  268. }
  269. .avatar-image {
  270. width: 160rpx;
  271. height: 160rpx;
  272. border-radius: 50%;
  273. position: absolute;
  274. top: -80rpx;
  275. left: 0;
  276. }
  277. }
  278. .login-info {
  279. margin-left: 30rpx;
  280. flex: 1;
  281. display: flex;
  282. flex-direction: column;
  283. .login-text {
  284. font-size: 36rpx;
  285. font-weight: 600;
  286. color: #000000;
  287. margin-bottom: 12rpx;
  288. }
  289. .user-name {
  290. font-size: 36rpx;
  291. font-weight: 600;
  292. color: #000000;
  293. margin-bottom: 12rpx;
  294. }
  295. .login-desc {
  296. font-size: 26rpx;
  297. color: #999999;
  298. }
  299. }
  300. }
  301. .login-card-bg {
  302. position: absolute;
  303. right: -60rpx;
  304. top: -60rpx;
  305. width:400rpx;
  306. height: 600rpx;
  307. opacity: 0.6;
  308. }
  309. }
  310. // 菜单卡片
  311. .menu-card {
  312. position: relative;
  313. margin: 0 30rpx 30rpx 30rpx;
  314. background-color: rgba(255, 255, 255, 0.4);
  315. border-radius: 24rpx;
  316. overflow: hidden;
  317. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
  318. z-index: 10;
  319. .menu-item {
  320. display: flex;
  321. align-items: center;
  322. justify-content: space-between;
  323. padding: 32rpx 30rpx;
  324. background-color: rgba(255, 255, 255, 0.4);
  325. .menu-item-left {
  326. display: flex;
  327. align-items: center;
  328. flex: 1;
  329. .menu-icon-wrapper {
  330. width: 64rpx;
  331. height: 64rpx;
  332. border-radius: 16rpx;
  333. display: flex;
  334. align-items: center;
  335. justify-content: center;
  336. margin-right: 24rpx;
  337. background-color: transparent;
  338. .menu-icon-image {
  339. width: 40rpx;
  340. height: 40rpx;
  341. }
  342. }
  343. .menu-text {
  344. font-size: 32rpx;
  345. color: #000000;
  346. }
  347. }
  348. .arrow-icon {
  349. font-size: 28rpx;
  350. color: #cccccc;
  351. }
  352. }
  353. .menu-divider {
  354. height: 1rpx;
  355. background-color: #f0f0f0;
  356. margin: 0 30rpx;
  357. }
  358. }
  359. // 退出登录对话框
  360. .logout-dialog-mask {
  361. position: fixed;
  362. top: 0;
  363. left: 0;
  364. right: 0;
  365. bottom: 0;
  366. background-color: rgba(0, 0, 0, 0.5);
  367. z-index: 9999;
  368. display: flex;
  369. align-items: flex-end;
  370. justify-content: center;
  371. }
  372. .logout-dialog {
  373. width: 100%;
  374. background-color: #ffffff;
  375. border-radius: 32rpx 32rpx 0 0;
  376. padding: 40rpx 30rpx;
  377. padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
  378. box-sizing: border-box;
  379. .dialog-title {
  380. font-size: 24rpx;
  381. font-weight: 400;
  382. color: #666666;
  383. text-align: center;
  384. margin-bottom: 60rpx;
  385. line-height: 1.5;
  386. }
  387. .dialog-buttons {
  388. display: flex;
  389. flex-direction: column;
  390. align-items: center;
  391. .dialog-btn {
  392. width: 100%;
  393. height: 100rpx;
  394. display: flex;
  395. align-items: center;
  396. justify-content: center;
  397. font-size: 34rpx;
  398. font-weight: 400;
  399. background-color: transparent;
  400. border: none;
  401. &.logout-btn {
  402. color: #EF2C54;
  403. margin-bottom: 40rpx;
  404. }
  405. &.cancel-btn {
  406. color: #333333;
  407. }
  408. }
  409. }
  410. }
  411. }
  412. </style>