index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <view class="mine-container">
  3. <!-- 顶部标题 -->
  4. <view class="header-title">
  5. <text class="title-text">我的</text>
  6. </view>
  7. <!-- 用户登录/注册卡片 -->
  8. <view class="login-card" @click="handleLoginCardClick">
  9. <view class="login-card-content">
  10. <view class="avatar-section">
  11. <view v-if="!avatar" class="avatar-placeholder">
  12. <view class="iconfont icon-people avatar-icon"></view>
  13. </view>
  14. <image v-if="avatar" :src="avatar" class="avatar-image" mode="aspectFill"></image>
  15. </view>
  16. <view class="login-info">
  17. <view v-if="!name" class="login-text">点击登录/注册</view>
  18. <view v-else class="user-name">{{ name }}</view>
  19. <view v-if="!name" class="login-desc">登录后获取更多功能信息</view>
  20. </view>
  21. </view>
  22. <view class="login-card-bg">
  23. <!-- 背景装饰图案 -->
  24. </view>
  25. </view>
  26. <!-- 第一个菜单卡片 -->
  27. <view class="menu-card">
  28. <view class="menu-item" @click="handleToInfo">
  29. <view class="menu-item-left">
  30. <view class="menu-icon-wrapper account-icon">
  31. <view class="iconfont icon-user menu-icon"></view>
  32. </view>
  33. <text class="menu-text">账号信息</text>
  34. </view>
  35. <view class="iconfont icon-right arrow-icon"></view>
  36. </view>
  37. <view class="menu-divider"></view>
  38. <view class="menu-item" @click="handleToOrderRevenue">
  39. <view class="menu-item-left">
  40. <view class="menu-icon-wrapper revenue-icon">
  41. <text class="revenue-symbol">¥</text>
  42. </view>
  43. <text class="menu-text">订单收益</text>
  44. </view>
  45. <view class="iconfont icon-right arrow-icon"></view>
  46. </view>
  47. </view>
  48. <!-- 第二个菜单卡片 -->
  49. <view class="menu-card">
  50. <view class="menu-item" @click="handleClearCache">
  51. <view class="menu-item-left">
  52. <view class="menu-icon-wrapper cache-icon">
  53. <view class="iconfont icon-clean menu-icon"></view>
  54. </view>
  55. <text class="menu-text">本地缓存</text>
  56. </view>
  57. </view>
  58. <view class="menu-divider"></view>
  59. <view class="menu-item" @click="handleAbout">
  60. <view class="menu-item-left">
  61. <view class="menu-icon-wrapper about-icon">
  62. <view class="iconfont icon-help menu-icon"></view>
  63. </view>
  64. <text class="menu-text">关于我们</text>
  65. </view>
  66. <view class="iconfont icon-right arrow-icon"></view>
  67. </view>
  68. <view class="menu-divider"></view>
  69. <view class="menu-item" @click="handleLogout">
  70. <view class="menu-item-left">
  71. <view class="menu-icon-wrapper logout-icon">
  72. <view class="iconfont icon-logout menu-icon"></view>
  73. </view>
  74. <text class="menu-text">退出登录</text>
  75. </view>
  76. </view>
  77. </view>
  78. <!-- 底部导航栏 -->
  79. <bar-navigasi-handap></bar-navigasi-handap>
  80. </view>
  81. </template>
  82. <script>
  83. import BarNavigasiHandap from "@/components/barNavigasiHandap.vue"
  84. export default {
  85. components: {
  86. BarNavigasiHandap
  87. },
  88. data() {
  89. return {
  90. name: this.$store.state.user.name
  91. }
  92. },
  93. computed: {
  94. avatar() {
  95. return this.$store.state.user.avatar
  96. }
  97. },
  98. methods: {
  99. handleLoginCardClick() {
  100. if (!this.name) {
  101. this.$tab.reLaunch('/pages/login')
  102. } else {
  103. this.$tab.navigateTo('/pages/mine/info/index')
  104. }
  105. },
  106. handleToInfo() {
  107. if (!this.name) {
  108. this.$tab.reLaunch('/pages/login')
  109. return
  110. }
  111. this.$tab.navigateTo('/pages/mine/info/index')
  112. },
  113. handleToOrderRevenue() {
  114. if (!this.name) {
  115. this.$tab.reLaunch('/pages/login')
  116. return
  117. }
  118. this.$modal.showToast('模块建设中~')
  119. },
  120. handleClearCache() {
  121. this.$modal.confirm('确定要清理本地缓存吗?').then(() => {
  122. // 清理缓存的逻辑
  123. uni.clearStorageSync()
  124. this.$modal.msgSuccess('缓存清理成功')
  125. })
  126. },
  127. handleAbout() {
  128. this.$tab.navigateTo('/pages/mine/about/index')
  129. },
  130. handleLogout() {
  131. if (!this.name) {
  132. this.$tab.reLaunch('/pages/login')
  133. return
  134. }
  135. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  136. this.$store.dispatch('LogOut').then(() => {}).finally(() => {
  137. this.$tab.reLaunch('/pages/index')
  138. })
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. page {
  146. background-color: #f5f5f5;
  147. }
  148. .mine-container {
  149. width: 100%;
  150. min-height: 100vh;
  151. padding-bottom: 120rpx;
  152. background-color: #f5f5f5;
  153. // 顶部标题
  154. .header-title {
  155. padding: 20rpx 0;
  156. text-align: center;
  157. background-color: #ffffff;
  158. .title-text {
  159. font-size: 36rpx;
  160. font-weight: 500;
  161. color: #000000;
  162. }
  163. }
  164. // 登录卡片
  165. .login-card {
  166. position: relative;
  167. margin: 30rpx 30rpx 40rpx 30rpx;
  168. padding: 40rpx 30rpx;
  169. background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  170. border-radius: 24rpx;
  171. overflow: hidden;
  172. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
  173. .login-card-content {
  174. display: flex;
  175. align-items: center;
  176. position: relative;
  177. z-index: 2;
  178. .avatar-section {
  179. .avatar-placeholder {
  180. width: 120rpx;
  181. height: 120rpx;
  182. border-radius: 50%;
  183. background-color: #e0e0e0;
  184. display: flex;
  185. align-items: center;
  186. justify-content: center;
  187. .avatar-icon {
  188. font-size: 60rpx;
  189. color: #999999;
  190. }
  191. }
  192. .avatar-image {
  193. width: 120rpx;
  194. height: 120rpx;
  195. border-radius: 50%;
  196. }
  197. }
  198. .login-info {
  199. margin-left: 30rpx;
  200. flex: 1;
  201. .login-text {
  202. font-size: 36rpx;
  203. font-weight: 600;
  204. color: #000000;
  205. margin-bottom: 12rpx;
  206. }
  207. .user-name {
  208. font-size: 36rpx;
  209. font-weight: 600;
  210. color: #000000;
  211. margin-bottom: 12rpx;
  212. }
  213. .login-desc {
  214. font-size: 26rpx;
  215. color: #999999;
  216. }
  217. }
  218. }
  219. .login-card-bg {
  220. position: absolute;
  221. right: -60rpx;
  222. top: -60rpx;
  223. width: 240rpx;
  224. height: 240rpx;
  225. background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(147, 197, 253, 0.15) 100%);
  226. border-radius: 50%;
  227. z-index: 1;
  228. opacity: 0.6;
  229. }
  230. }
  231. // 菜单卡片
  232. .menu-card {
  233. margin: 0 30rpx 30rpx 30rpx;
  234. background-color: #ffffff;
  235. border-radius: 24rpx;
  236. overflow: hidden;
  237. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
  238. .menu-item {
  239. display: flex;
  240. align-items: center;
  241. justify-content: space-between;
  242. padding: 32rpx 30rpx;
  243. background-color: #ffffff;
  244. .menu-item-left {
  245. display: flex;
  246. align-items: center;
  247. flex: 1;
  248. .menu-icon-wrapper {
  249. width: 64rpx;
  250. height: 64rpx;
  251. border-radius: 16rpx;
  252. display: flex;
  253. align-items: center;
  254. justify-content: center;
  255. margin-right: 24rpx;
  256. &.account-icon {
  257. background-color: #e3f2fd;
  258. .menu-icon {
  259. color: #1976d2;
  260. }
  261. }
  262. &.revenue-icon {
  263. background-color: #fff3e0;
  264. position: relative;
  265. .revenue-symbol {
  266. font-size: 32rpx;
  267. font-weight: 600;
  268. color: #ff9800;
  269. }
  270. }
  271. &.cache-icon {
  272. background-color: #f3e5f5;
  273. .menu-icon {
  274. color: #9c27b0;
  275. }
  276. }
  277. &.about-icon {
  278. background-color: #e8f5e9;
  279. .menu-icon {
  280. color: #4caf50;
  281. }
  282. }
  283. &.logout-icon {
  284. background-color: #ffebee;
  285. .menu-icon {
  286. color: #f44336;
  287. }
  288. }
  289. .menu-icon {
  290. font-size: 36rpx;
  291. color: #333333;
  292. }
  293. }
  294. .menu-text {
  295. font-size: 32rpx;
  296. color: #000000;
  297. }
  298. }
  299. .arrow-icon {
  300. font-size: 28rpx;
  301. color: #cccccc;
  302. }
  303. }
  304. .menu-divider {
  305. height: 1rpx;
  306. background-color: #f0f0f0;
  307. margin: 0 30rpx;
  308. }
  309. }
  310. }
  311. </style>