四零语境前端代码仓库
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.

451 lines
11 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="user-container">
  3. <!-- 用户信息区域 -->
  4. <view class="user-info-section">
  5. <view class="page-title">我的</view>
  6. <view class="user-info">
  7. <view class="user-avatar" @click="goLogin">
  8. <image :src="isLogin ? userInfo.headImage : displayInfo.avatar" mode="aspectFill"></image>
  9. </view>
  10. <view class="user-details">
  11. <view class="user-name">{{ isLogin ? userInfo.nickName : displayInfo.name }}</view>
  12. <view class="user-phone">手机号{{ isLogin ? userInfo.phone || displayInfo.phone : displayInfo.phone }}</view>
  13. <view class="user-desc">{{ displayInfo.description }}</view>
  14. </view>
  15. </view>
  16. </view>
  17. <!-- 功能菜单列表 -->
  18. <!-- 第一组菜单 -->
  19. <!-- 会员中心 -->
  20. <view class="menu-item special-item" @click="goToMember">
  21. <view class="menu-left">
  22. <image src="/static/会员钻石.png" class="menu-icon"></image>
  23. <text class="menu-title">会员中心</text>
  24. </view>
  25. <view class="menu-right">
  26. <uv-button shape="circle" :customStyle="{
  27. width: '170rpx',
  28. height: '70rpx',
  29. fontSize: '28rpx',
  30. fontWeight: '500',
  31. lineHeight: '70rpx',
  32. letterSpacing: '0%',
  33. verticalAlign: 'middle',
  34. backgroundColor: '#06DADC',
  35. color: '#fff',
  36. }">查看会员</uv-button>
  37. </view>
  38. </view>
  39. <view class="menu-list">
  40. <!-- 推广中心 -->
  41. <view class="menu-item" @click="goToPromotion">
  42. <view class="menu-left">
  43. <image src="/static/推广图标.png" class="menu-icon"></image>
  44. <text class="menu-title">推广中心</text>
  45. </view>
  46. <view class="menu-right">
  47. <uv-icon name="arrow-right" color="#999" size="16"></uv-icon>
  48. </view>
  49. </view>
  50. <!-- 我的优惠券 -->
  51. <view class="menu-item" @click="goToCoupons">
  52. <view class="menu-left">
  53. <image src="/static/优惠卷图标.png" class="menu-icon"></image>
  54. <text class="menu-title">我的优惠券</text>
  55. </view>
  56. <view class="menu-right">
  57. <uv-icon name="arrow-right" color="#999" size="16"></uv-icon>
  58. </view>
  59. </view>
  60. <!-- 产品介绍 -->
  61. <view class="menu-item" @click="goToProduct">
  62. <view class="menu-left">
  63. <image src="/static/介绍图标.png" class="menu-icon"></image>
  64. <text class="menu-title">产品介绍</text>
  65. </view>
  66. <view class="menu-right">
  67. <uv-icon name="arrow-right" color="#999" size="16"></uv-icon>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 第二组菜单 -->
  72. <view class="menu-list">
  73. <!-- 联系我们 -->
  74. <view class="menu-item" @click="goToContact">
  75. <view class="menu-left">
  76. <image src="/static/联系我们图标.png" class="menu-icon"></image>
  77. <text class="menu-title">联系我们</text>
  78. </view>
  79. <view class="menu-right">
  80. <uv-icon name="arrow-right" color="#999" size="16"></uv-icon>
  81. </view>
  82. </view>
  83. <!-- 服务协议与隐私政策 -->
  84. <view class="menu-item" @click="goToPolicy">
  85. <view class="menu-left">
  86. <image src="/static/服务隐私图标.png" class="menu-icon"></image>
  87. <text class="menu-title">服务协议与隐私政策</text>
  88. </view>
  89. <view class="menu-right">
  90. <uv-icon name="arrow-right" color="#999" size="16"></uv-icon>
  91. </view>
  92. </view>
  93. <!-- 修改信息 -->
  94. <view class="menu-item" @click="goToBasicInfo">
  95. <view class="menu-left">
  96. <image src="/static/修改信息图标.png" class="menu-icon"></image>
  97. <text class="menu-title">修改信息</text>
  98. </view>
  99. <view class="menu-right">
  100. <uv-icon name="arrow-right" color="#999" size="16"></uv-icon>
  101. </view>
  102. </view>
  103. <view class="menu-item" @click="logout" v-if="isLogin">
  104. <view class="menu-left">
  105. <image src="/static/退出登录图标.png" class="menu-icon"></image>
  106. <text class="menu-title">退出登录</text>
  107. </view>
  108. <view class="menu-right">
  109. <uv-icon name="arrow-right" color="#999" size="16"></uv-icon>
  110. </view>
  111. </view>
  112. </view>
  113. <view>
  114. <uv-popup ref="contactModal" closeIconPos="top-left" closeable round="30rpx" :safeAreaInsetBottom="false">
  115. <view class="contact-content">
  116. <view class="title">联系我们</view>
  117. <view class="contact-item" @click="callPhone">
  118. <text class="contact-phone">0731-599327-8899</text>
  119. <image src="/static/拨号图标.png" class="contact-icon"></image>
  120. </view>
  121. </view>
  122. </uv-popup>
  123. </view>
  124. </view>
  125. </template>
  126. <script>
  127. export default {
  128. data() {
  129. return {
  130. userInfo: {
  131. headImage: '/static/默认头像.png',
  132. nickName: '请先登录',
  133. id: 'XXXXX'
  134. },
  135. isLogin: uni.getStorageSync('token'),
  136. // 用户展示信息
  137. displayInfo: {
  138. name: '战斗世界',
  139. phone: '19989674531',
  140. avatar: '/static/默认头像.png',
  141. description: '世界这么美,我想去看看~'
  142. }
  143. }
  144. },
  145. computed: {
  146. // 检查是否已登录
  147. },
  148. onShow() {
  149. this.isLogin = uni.getStorageSync('token')
  150. // 如果没登陆过 就别登了
  151. if (uni.getStorageSync('token')) {
  152. this.getUserInfo();
  153. }
  154. },
  155. methods: {
  156. // 拨打电话
  157. callPhone() {
  158. uni.makePhoneCall({
  159. phoneNumber: '0731-599327-8899'
  160. })
  161. },
  162. // 跳转登录页面
  163. goLogin() {
  164. if (!this.isLogin) {
  165. uni.navigateTo({
  166. url: '/subPages/login/login'
  167. })
  168. }else {
  169. uni.navigateTo({
  170. url: '/subPages/user/profile'
  171. })
  172. }
  173. },
  174. // 跳转到基本信息页面
  175. goToBasicInfo() {
  176. uni.navigateTo({
  177. url: '/subPages/user/profile'
  178. })
  179. },
  180. // 获取用户信息
  181. async getUserInfo() {
  182. const res = await this.$api.user.queryUser();
  183. if (res.code === 200) {
  184. this.userInfo = res.result;
  185. }
  186. },
  187. // 显示隐私政策弹窗
  188. showPrivacyPolicy() {
  189. this.$refs.privacyModal.open()
  190. },
  191. // 跳转到会员页面
  192. goToMember() {
  193. uni.switchTab({
  194. url: '/pages/index/member'
  195. })
  196. },
  197. // 跳转到推广中心
  198. goToPromotion() {
  199. uni.navigateTo({
  200. url: '/subPages/user/promote'
  201. })
  202. },
  203. // 跳转到我的优惠券
  204. goToCoupons() {
  205. uni.navigateTo({
  206. url: '/subPages/user/discount'
  207. })
  208. },
  209. // 跳转到产品介绍
  210. goToProduct() {
  211. uni.navigateTo({ url: '/subPages/user/introduce' })
  212. },
  213. //// 跳转到联系我们
  214. goToContact() {
  215. this.$refs.contactModal.open('bottom')
  216. },
  217. // 跳转到隐私政策页面
  218. goToPolicy() {
  219. uni.navigateTo({
  220. url: '/subPages/user/policy'
  221. })
  222. },
  223. // 退出登录
  224. logout() {
  225. uni.showModal({
  226. title: '提示',
  227. content: '确定要退出登录吗?',
  228. confirmColor: '#C70019',
  229. success: (res) => {
  230. if (res.confirm) {
  231. // 清除本地存储的用户信息
  232. uni.removeStorageSync('token')
  233. // 重置用户信息
  234. this.userInfo = {
  235. headImage: '/static/默认头像.png',
  236. nickName: '请先登录',
  237. id: 'XXXXX'
  238. }
  239. this.isLogin = false;
  240. // 显示退出成功提示
  241. uni.showToast({
  242. title: '退出成功',
  243. icon: 'success'
  244. })
  245. }
  246. }
  247. })
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang="scss" scoped>
  253. .user-container {
  254. min-height: 100vh;
  255. background: #fff;
  256. /* 用户信息区域 */
  257. .user-info-section {
  258. background: linear-gradient(180deg, #ABFFFF 0%, #FFFFFF 100%);
  259. height: 300rpx;
  260. // display: flex;
  261. // align-items: center;
  262. padding: 60rpx 32rpx 0rpx;
  263. gap: 40rpx;
  264. .user-info {
  265. display: flex;
  266. align-items: center;
  267. }
  268. .page-title {
  269. text-align: center;
  270. margin: 0 auto;
  271. margin-top: 60rpx;
  272. margin-bottom: 40rpx;
  273. font-size: 32rpx;
  274. font-weight: 500;
  275. }
  276. }
  277. .user-avatar {
  278. width: 120rpx;
  279. height: 120rpx;
  280. border-radius: 50%;
  281. overflow: hidden;
  282. margin-right: 30rpx;
  283. border: 2px solid #FFFFFF;
  284. image {
  285. width: 100%;
  286. height: 100%;
  287. }
  288. }
  289. .user-details {
  290. flex: 1;
  291. }
  292. .user-name {
  293. font-size: 36rpx;
  294. line-height: 44rpx;
  295. font-weight: bold;
  296. color: #333;
  297. margin-bottom: 10rpx;
  298. }
  299. .user-phone {
  300. font-size: 24rpx;
  301. color: #252545;
  302. margin-bottom: 8rpx;
  303. }
  304. .user-desc {
  305. font-size: 24rpx;
  306. color: #252545;
  307. }
  308. /* 菜单列表 */
  309. .menu-list {
  310. background: #F8F8F8;
  311. border-radius: 32rpx;
  312. overflow: hidden;
  313. margin: 0 32rpx;
  314. margin-bottom: 32rpx;
  315. &:last-child {
  316. margin-bottom: 0;
  317. }
  318. }
  319. .menu-item {
  320. display: flex;
  321. align-items: center;
  322. justify-content: space-between;
  323. padding: 40rpx 30rpx;
  324. border: 2rpx solid #F2F2F2;
  325. &:last-child {
  326. border-bottom: none;
  327. }
  328. &.special-item {
  329. background: linear-gradient(180deg, #DEFFFF 0%, #FBFEFF 22.65%, #F0FBFF 100%);
  330. border: 1px solid #06DADC12;
  331. height: 98rpx;
  332. border-radius: 32rpx;
  333. border-width: 2rpx;
  334. padding-top: 12rpx;
  335. padding-right: 40rpx;
  336. padding-bottom: 12rpx;
  337. padding-left: 40rpx;
  338. gap: 24rpx;
  339. margin: 0 32rpx;
  340. margin-bottom: 32rpx;
  341. .menu-icon{
  342. width: 60rpx;
  343. height: 60rpx;
  344. }
  345. .menu-title{
  346. font-size: 36rpx;
  347. font-weight: 600;
  348. }
  349. }
  350. }
  351. .menu-left {
  352. display: flex;
  353. align-items: center;
  354. }
  355. .menu-icon {
  356. width: 40rpx;
  357. height: 40rpx;
  358. margin-right: 20rpx;
  359. }
  360. .menu-title {
  361. font-size: 32rpx;
  362. color: #333;
  363. }
  364. .menu-right {
  365. display: flex;
  366. align-items: center;
  367. }
  368. /* 联系我们弹窗样式 */
  369. .contact-content {
  370. // padding: 40rpx 0;
  371. .title{
  372. height: 90rpx;
  373. text-align: center;
  374. line-height: 90rpx;
  375. font-size: 34rpx;
  376. font-weight: 500;
  377. border-bottom: 2rpx solid #EEEEEE
  378. }
  379. // text-align: center;
  380. }
  381. .contact-item {
  382. // background: red;
  383. height: 240rpx;
  384. display: flex;
  385. align-items: center;
  386. justify-content: center;
  387. gap: 20rpx;
  388. }
  389. .contact-icon {
  390. width: 72rpx;
  391. height: 72rpx;
  392. }
  393. .contact-phone {
  394. font-size: 36rpx;
  395. color: #181818;
  396. }
  397. }
  398. </style>