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

464 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 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.avatar === 'undefined' ? displayInfo.avatar : userInfo.avatar : displayInfo.avatar" mode="aspectFill"></image>
  9. </view>
  10. <view class="user-details" @click="clickInfo">
  11. <view class="user-name">{{ isLogin ? userInfo.name : 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" v-if="userInfo.isPromote === 'Y'">
  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. avatar: '/static/默认头像.png',
  132. name: '请先登录',
  133. id: 'XXXXX'
  134. },
  135. isLogin: uni.getStorageSync('token'),
  136. // 用户展示信息
  137. displayInfo: {
  138. name: '点击登录',
  139. phone: 'xxxxxxxxx',
  140. avatar: '/static/默认头像.png'
  141. }
  142. }
  143. },
  144. computed: {
  145. // 检查是否已登录
  146. },
  147. onShow() {
  148. this.isLogin = uni.getStorageSync('token')
  149. // 如果没登陆过 就别登了
  150. if (uni.getStorageSync('token')) {
  151. this.getUserInfo();
  152. }
  153. },
  154. methods: {
  155. // 拨打电话
  156. callPhone() {
  157. uni.makePhoneCall({
  158. phoneNumber: '0731-599327-8899'
  159. })
  160. },
  161. // 跳转登录页面
  162. goLogin() {
  163. if (!this.isLogin) {
  164. uni.navigateTo({
  165. url: '/subPages/login/login'
  166. })
  167. }else {
  168. uni.navigateTo({
  169. url: '/subPages/user/profile'
  170. })
  171. }
  172. },
  173. // 跳转到基本信息页面
  174. goToBasicInfo() {
  175. uni.navigateTo({
  176. url: '/subPages/user/profile'
  177. })
  178. },
  179. // 获取用户信息
  180. async getUserInfo() {
  181. const res = await this.$api.login.getUserInfo();
  182. if (res.code === 200) {
  183. this.userInfo = res.result;
  184. }
  185. },
  186. // 显示隐私政策弹窗
  187. showPrivacyPolicy() {
  188. this.$refs.privacyModal.open()
  189. },
  190. // 跳转到会员页面
  191. goToMember() {
  192. uni.switchTab({
  193. url: '/pages/index/member'
  194. })
  195. },
  196. // 跳转到推广中心
  197. goToPromotion() {
  198. uni.navigateTo({
  199. url: '/subPages/user/promote'
  200. })
  201. },
  202. // 跳转到我的优惠券
  203. goToCoupons() {
  204. uni.navigateTo({
  205. url: '/subPages/user/discount'
  206. })
  207. },
  208. // 跳转到产品介绍
  209. goToProduct() {
  210. uni.navigateTo({ url: '/subPages/user/introduce' })
  211. },
  212. //// 跳转到联系我们
  213. goToContact() {
  214. this.$refs.contactModal.open('bottom')
  215. },
  216. // 跳转到隐私政策页面
  217. goToPolicy() {
  218. uni.navigateTo({
  219. url: '/subPages/user/policy'
  220. })
  221. },
  222. // 跳转到登陆页面
  223. clickInfo() {
  224. if (!this.isLogin){
  225. uni.navigateTo({
  226. url: '/subPages/login/login'
  227. })
  228. }else {
  229. uni.navigateTo({
  230. url: '/subPages/user/profile'
  231. })
  232. }
  233. },
  234. // 退出登录
  235. logout() {
  236. uni.showModal({
  237. title: '提示',
  238. content: '确定要退出登录吗?',
  239. confirmColor: '#C70019',
  240. success: (res) => {
  241. if (res.confirm) {
  242. // 清除本地存储的用户信息
  243. uni.removeStorageSync('token')
  244. // 重置用户信息
  245. this.userInfo = {
  246. avatar: '/static/默认头像.png',
  247. name: '请先登录',
  248. id: 'XXXXX'
  249. }
  250. this.isLogin = false;
  251. // 显示退出成功提示
  252. uni.showToast({
  253. title: '退出成功',
  254. icon: 'success'
  255. })
  256. }
  257. }
  258. })
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang="scss" scoped>
  264. .user-container {
  265. min-height: 100vh;
  266. background: #fff;
  267. /* 用户信息区域 */
  268. .user-info-section {
  269. background: linear-gradient(180deg, #ABFFFF 0%, #FFFFFF 100%);
  270. height: 300rpx;
  271. // display: flex;
  272. // align-items: center;
  273. padding: 60rpx 32rpx 0rpx;
  274. gap: 40rpx;
  275. .user-info {
  276. display: flex;
  277. align-items: center;
  278. }
  279. .page-title {
  280. text-align: center;
  281. margin: 0 auto;
  282. margin-top: 60rpx;
  283. margin-bottom: 40rpx;
  284. font-size: 32rpx;
  285. font-weight: 500;
  286. }
  287. }
  288. .user-avatar {
  289. width: 120rpx;
  290. height: 120rpx;
  291. border-radius: 50%;
  292. overflow: hidden;
  293. margin-right: 30rpx;
  294. border: 2px solid #FFFFFF;
  295. image {
  296. width: 100%;
  297. height: 100%;
  298. }
  299. }
  300. .user-details {
  301. flex: 1;
  302. }
  303. .user-name {
  304. font-size: 36rpx;
  305. line-height: 44rpx;
  306. font-weight: bold;
  307. color: #333;
  308. margin-bottom: 10rpx;
  309. }
  310. .user-phone {
  311. font-size: 24rpx;
  312. color: #252545;
  313. margin-bottom: 8rpx;
  314. }
  315. .user-desc {
  316. font-size: 24rpx;
  317. color: #252545;
  318. }
  319. /* 菜单列表 */
  320. .menu-list {
  321. background: #F8F8F8;
  322. border-radius: 32rpx;
  323. overflow: hidden;
  324. margin: 0 32rpx;
  325. margin-bottom: 32rpx;
  326. &:last-child {
  327. margin-bottom: 0;
  328. }
  329. }
  330. .menu-item {
  331. display: flex;
  332. align-items: center;
  333. justify-content: space-between;
  334. padding: 40rpx 30rpx;
  335. border: 2rpx solid #F2F2F2;
  336. &:last-child {
  337. border-bottom: none;
  338. }
  339. &.special-item {
  340. background: linear-gradient(180deg, #DEFFFF 0%, #FBFEFF 22.65%, #F0FBFF 100%);
  341. border: 1px solid #06DADC12;
  342. height: 98rpx;
  343. border-radius: 32rpx;
  344. border-width: 2rpx;
  345. padding-top: 12rpx;
  346. padding-right: 40rpx;
  347. padding-bottom: 12rpx;
  348. padding-left: 40rpx;
  349. gap: 24rpx;
  350. margin: 0 32rpx;
  351. margin-bottom: 32rpx;
  352. .menu-icon{
  353. width: 60rpx;
  354. height: 60rpx;
  355. }
  356. .menu-title{
  357. font-size: 36rpx;
  358. font-weight: 600;
  359. }
  360. }
  361. }
  362. .menu-left {
  363. display: flex;
  364. align-items: center;
  365. }
  366. .menu-icon {
  367. width: 40rpx;
  368. height: 40rpx;
  369. margin-right: 20rpx;
  370. }
  371. .menu-title {
  372. font-size: 32rpx;
  373. color: #333;
  374. }
  375. .menu-right {
  376. display: flex;
  377. align-items: center;
  378. }
  379. /* 联系我们弹窗样式 */
  380. .contact-content {
  381. // padding: 40rpx 0;
  382. .title{
  383. height: 90rpx;
  384. text-align: center;
  385. line-height: 90rpx;
  386. font-size: 34rpx;
  387. font-weight: 500;
  388. border-bottom: 2rpx solid #EEEEEE
  389. }
  390. // text-align: center;
  391. }
  392. .contact-item {
  393. // background: red;
  394. height: 240rpx;
  395. display: flex;
  396. align-items: center;
  397. justify-content: center;
  398. gap: 20rpx;
  399. }
  400. .contact-icon {
  401. width: 72rpx;
  402. height: 72rpx;
  403. }
  404. .contact-phone {
  405. font-size: 36rpx;
  406. color: #181818;
  407. }
  408. }
  409. </style>