爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

376 lines
8.6 KiB

1 week ago
  1. <template>
  2. <view class="my-bg">
  3. <!-- 顶部绿色渐变背景及白色渐变过渡 -->
  4. <view class="top-gradient-bg">
  5. <view class="page-title">我的</view>
  6. <view class="banner-card">
  7. <view class="banner-content">
  8. <view class="banner-texts">
  9. <text class="banner-title">旧衣换现金</text>
  10. <text class="banner-subtitle">旧衣有"金"绿色暖生活</text>
  11. </view>
  12. <image class="banner-img" src="/static/images/recycle-money.png" mode="aspectFit"></image>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="user-cards" v-if="!login_status">
  17. <view class="user-info">
  18. <image class="avatars" src="/static/logo.png" mode="aspectFill"></image>
  19. <view class="info">
  20. <text class="names">暂未登录请先登录</text>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="btns" v-if="!login_status">
  25. <uv-button
  26. class="btn"
  27. type="primary"
  28. text="立即登录"
  29. color="linear-gradient(to right, #17f261,#13d755)"
  30. shape="circle"
  31. @click="logout"
  32. ></uv-button>
  33. <text>暂未登录 请先登录</text>
  34. </view>
  35. <!-- 下半部分用户信息和功能列表 -->
  36. <view class="content-section" v-if="login_status">
  37. <view class="user-card">
  38. <image class="avatar" src="/static/images/avatar.png" mode="aspectFill"></image>
  39. <view class="user-info-text">
  40. <text class="nickname">战斗世界</text>
  41. <text class="user-id">ID: 5625354</text>
  42. </view>
  43. </view>
  44. <view class="function-card">
  45. <view class="function-item" @tap="navigateTo('/pages/component/promotion')">
  46. <uni-icons custom-prefix="custom-icon" type="layers" size="24" color="#333"></uni-icons>
  47. <text class="function-text">推广官</text>
  48. <uni-icons type="right" size="16" color="#bbb"></uni-icons>
  49. </view>
  50. <view class="divider"></view>
  51. <view class="function-item" @tap="navigateTo('/pages/component/admin_customer')">
  52. <uni-icons custom-prefix="custom-icon" type="headphones" size="24" color="#333"></uni-icons>
  53. <text class="function-text">联系客服</text>
  54. <uni-icons type="right" size="16" color="#bbb"></uni-icons>
  55. </view>
  56. <view class="divider"></view>
  57. <view class="function-item" @tap="navigateTo('/pages/component/admin_edit_profile')">
  58. <uni-icons custom-prefix="custom-icon" type="edit" size="24" color="#333"></uni-icons>
  59. <text class="function-text">修改信息</text>
  60. <uni-icons type="right" size="16" color="#bbb"></uni-icons>
  61. </view>
  62. <view class="divider"></view>
  63. <view class="function-item" @tap="handleLogout">
  64. <uni-icons custom-prefix="custom-icon" type="logout" size="24" color="#333"></uni-icons>
  65. <text class="function-text">退出登录</text>
  66. <uni-icons type="right" size="16" color="#bbb"></uni-icons>
  67. </view>
  68. </view>
  69. </view>
  70. <!-- 底部导航栏区域不做修改 -->
  71. <uv-tabbar
  72. :value="value"
  73. :fixed="true"
  74. @change="changeTo"
  75. >
  76. <uv-tabbar-item text="首页" icon="home"></uv-tabbar-item>
  77. <uv-tabbar-item text="角色管理" icon="photo"></uv-tabbar-item>
  78. <uv-tabbar-item text="个人中心" icon="account"></uv-tabbar-item>
  79. </uv-tabbar>
  80. </view>
  81. </template>
  82. <script>
  83. // import tabBarMixin from '../mixins/tabBarMixin.js'
  84. export default {
  85. // mixins: [tabBarMixin],
  86. data() {
  87. return {
  88. value:2,
  89. login_status:true,
  90. userInfo: {
  91. nickname: '战斗世界',
  92. id: '5625354',
  93. avatar: '/static/logo.png'
  94. }
  95. }
  96. },
  97. methods: {
  98. changeTo(e){
  99. this.value = e
  100. if(e==1){
  101. uni.reLaunch({
  102. url: '/pages/component/role_management'
  103. });
  104. }else if(e==0){
  105. console.log(e,'111')
  106. uni.reLaunch({
  107. url: '/pages/component/admin_home'
  108. });
  109. }
  110. },
  111. navigateTo(url) {
  112. uni.navigateTo({ url })
  113. },
  114. handleLogout() {
  115. uni.showModal({
  116. title: '提示',
  117. content: '确定要退出登录吗?',
  118. success: (res) => {
  119. if (res.confirm) {
  120. // 清除用户信息
  121. uni.removeStorageSync('userInfo');
  122. this.login_status = false;
  123. // 重置角色
  124. this.userRole = 'user'
  125. // 跳转到登录页
  126. // uni.reLaunch({
  127. // url: '/pages/component/admin_login'
  128. // })
  129. }
  130. }
  131. })
  132. }
  133. },
  134. // onLoad() {
  135. // console.log(this.isAdmin,'444')
  136. // this.checkUserRole()
  137. // },
  138. // onShow() {
  139. // this.checkUserRole()
  140. // // 如果不是管理员,跳转到首页
  141. // if (this.userRole !== 'admin') {
  142. // uni.showToast({
  143. // title: '无权限访问',
  144. // icon: 'none'
  145. // })
  146. // uni.reLaunch({
  147. // url: '/pages/index/index'
  148. // })
  149. // }
  150. // }
  151. }
  152. </script>
  153. <style lang="scss" scoped>
  154. .my-bg {
  155. min-height: 100vh;
  156. background: #f5f8fa;
  157. padding-bottom: 120rpx;
  158. box-sizing: border-box;
  159. }
  160. .top-gradient-bg {
  161. width: 100%;
  162. height: 420rpx;
  163. background: linear-gradient(135deg, #00e676 0%, #00c853 100%);
  164. position: relative;
  165. display: flex;
  166. flex-direction: column;
  167. align-items: center;
  168. justify-content: flex-start;
  169. z-index: 1;
  170. overflow: visible;
  171. }
  172. .top-gradient-bg::after {
  173. content: '';
  174. display: block;
  175. position: absolute;
  176. left: 0; right: 0; bottom: -1rpx;
  177. height: 60rpx;
  178. background: linear-gradient(to bottom, rgba(0,200,83,0.15), #f5f8fa 90%);
  179. z-index: 2;
  180. }
  181. .page-title {
  182. margin-top: 80rpx;
  183. font-size: 36rpx;
  184. color: #fff;
  185. font-weight: 500;
  186. letter-spacing: 2rpx;
  187. text-align: center;
  188. z-index: 3;
  189. }
  190. .banner-card {
  191. width: 92vw;
  192. background: rgba(255,255,255,0.08);
  193. border-radius: 32rpx;
  194. border: 2rpx solid rgba(255,255,255,0.4);
  195. box-shadow: 0 8rpx 32rpx 0 rgba(0, 200, 83, 0.10);
  196. overflow: visible;
  197. margin-top: 32rpx;
  198. z-index: 4;
  199. }
  200. .banner-content {
  201. display: flex;
  202. align-items: center;
  203. justify-content: space-between;
  204. padding: 48rpx 40rpx 48rpx 48rpx;
  205. margin-bottom: -30rpx;
  206. }
  207. .banner-texts {
  208. display: flex;
  209. flex-direction: column;
  210. justify-content: center;
  211. }
  212. .banner-title {
  213. font-size: 48rpx;
  214. color: #fff;
  215. font-weight: bold;
  216. font-style: italic;
  217. margin-bottom: 16rpx;
  218. letter-spacing: 2rpx;
  219. }
  220. .banner-subtitle {
  221. font-size: 28rpx;
  222. color: #fff;
  223. opacity: 0.85;
  224. font-style: normal;
  225. }
  226. .banner-img {
  227. width: 200rpx;
  228. height: 130rpx;
  229. margin-left: 32rpx;
  230. }
  231. .content-section {
  232. margin: -40rpx 16rpx 0 16rpx;
  233. background: #fff;
  234. border-radius: 36rpx;
  235. box-shadow: 0 8rpx 32rpx 0 rgba(0,0,0,0.04);
  236. padding-bottom: 32rpx;
  237. z-index: 10;
  238. position: relative;
  239. }
  240. .user-card {
  241. margin: 0 24rpx 32rpx 24rpx;
  242. background: #fff;
  243. border-radius: 28rpx;
  244. box-shadow: 0 4rpx 24rpx 0 rgba(0,0,0,0.06);
  245. display: flex;
  246. align-items: center;
  247. padding: 40rpx 32rpx 40rpx 32rpx;
  248. }
  249. .avatar {
  250. width: 96rpx;
  251. height: 96rpx;
  252. border-radius: 50%;
  253. margin-right: 24rpx;
  254. object-fit: cover;
  255. background: #f5f5f5;
  256. }
  257. .user-info-text {
  258. display: flex;
  259. flex-direction: column;
  260. justify-content: center;
  261. }
  262. .nickname {
  263. font-size: 32rpx;
  264. color: #222;
  265. font-weight: bold;
  266. margin-bottom: 8rpx;
  267. }
  268. .user-id {
  269. font-size: 26rpx;
  270. color: #b0b0b0;
  271. }
  272. .function-card {
  273. margin: 0 24rpx 32rpx 24rpx;
  274. background: #fff;
  275. border-radius: 28rpx;
  276. box-shadow: 0 4rpx 24rpx 0 rgba(0,0,0,0.06);
  277. padding: 0 0;
  278. }
  279. .function-item {
  280. display: flex;
  281. align-items: center;
  282. height: 96rpx;
  283. padding: 0 32rpx;
  284. position: relative;
  285. }
  286. .function-text {
  287. flex: 1;
  288. margin-left: 20rpx;
  289. font-family: PingFang SC;
  290. font-weight: 400;
  291. font-size: 14px;
  292. line-height: 100%;
  293. letter-spacing: 0%;
  294. color: #222;
  295. }
  296. .divider {
  297. height: 1rpx;
  298. background: #f0f1f3;
  299. margin: 0 32rpx;
  300. }
  301. .user-cards {
  302. margin: -50rpx 30rpx 0;
  303. background: #fff;
  304. border-radius: 24rpx;
  305. padding: 30rpx;
  306. position: relative;
  307. z-index: 2;
  308. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
  309. .user-info {
  310. display: flex;
  311. align-items: center;
  312. margin-bottom: 40rpx;
  313. .avatars {
  314. width: 110rpx;
  315. height: 110rpx;
  316. border-radius: 50%;
  317. margin-right: 24rpx;
  318. }
  319. }
  320. .info {
  321. .name {
  322. font-size: 34rpx;
  323. font-weight: 600;
  324. color: #222;
  325. margin-bottom: 12rpx;
  326. display: block;
  327. }
  328. }
  329. }
  330. .btns{
  331. width: 70%;
  332. margin: 0 auto;
  333. margin-top: 30%;
  334. display: flex;
  335. flex-direction: column;
  336. justify-content: center;
  337. align-items: center;
  338. .btn{
  339. width: 100%;
  340. }
  341. text{
  342. margin-top: 30rpx;
  343. font-family: PingFang SC;
  344. font-weight: 400;
  345. font-size: 13px;
  346. line-height: 100%;
  347. letter-spacing: 0%;
  348. text-align: center;
  349. }
  350. }
  351. </style>