裂变星小程序-25.03.04
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.

448 lines
9.6 KiB

2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="page">
  3. <navbar title="个人中心" bgColor="#001B3C" color="#FFFFFF" />
  4. <view class="head">
  5. <view class="headImage" @click="goToEditUserInfo">
  6. <image :src="userInfo.headImage || '../../static/image/default-avatar.png'" mode=""></image>
  7. </view>
  8. <view class="info">
  9. <view class="name" @click="goToEditUserInfo">
  10. {{ userInfo.nickName || '未登录' }}
  11. </view>
  12. <view class="tags">
  13. <view class="tag" v-if="userInfo.intentionCode">
  14. <text class="tag-label">ID:</text>
  15. <text>{{ userInfo.intentionCode }}</text>
  16. </view>
  17. <view v-if="role"
  18. style="display: inline-block; width: 172rpx; height: 63rpx; vertical-align: top; margin-top: -6rpx;">
  19. <image src="@/pages_order/static/center/agent-icon.png"></image>
  20. </view>
  21. <view v-else-if="userInfo.id" class="tag">
  22. 普通会员
  23. </view>
  24. <view v-else class="tag" @click="goToLogin">
  25. 点击登录
  26. </view>
  27. </view>
  28. </view>
  29. <view class="setting" @click="$utils.navigateTo('/pages_order/mine/setting')">
  30. <uv-icon name="setting" color="#FFFFFF" size="48rpx"></uv-icon>
  31. </view>
  32. </view>
  33. <view class="tools-box">
  34. <image class="tools-bg" src="@/pages_order/static/center/tools-bg.png"></image>
  35. <view class="flex activate">
  36. <template v-if="role">
  37. <view class="activate-tips" style="padding-left: 27rpx;">
  38. <view>代理商权益</view>
  39. <view>
  40. 将于<text class="activate-highlight">{{ userInfo.endTime ?
  41. $dayjs(userInfo.endTime).format('YYYY年M月D日') : '-'}}</text>到期
  42. </view>
  43. </view>
  44. <view class="btn-activate" @click="onActivate">
  45. <image src="@/pages_order/static/center/btn-activate-again.png"></image>
  46. </view>
  47. </template>
  48. <template v-else>
  49. <view class="activate-tips">
  50. 升级成为代理商享受更多权益
  51. </view>
  52. <view class="btn-activate" @click="onActivate">
  53. <image src="@/pages_order/static/center/btn-activate.png"></image>
  54. </view>
  55. </template>
  56. </view>
  57. <view class="tools flex">
  58. <view class="tool" @click="$utils.navigateTo('/pages_order/mine/sharing')">
  59. <view class="tool-icon">
  60. <image src="@/pages_order/static/center/tool-share.png"></image>
  61. </view>
  62. <text>分享好友</text>
  63. </view>
  64. <view class="tool" @click="onActivate">
  65. <view class="tool-icon">
  66. <image src="@/pages_order/static/center/tool-activate.png"></image>
  67. </view>
  68. <text>激活码</text>
  69. </view>
  70. <!-- <button open-type="contact" class="share">
  71. <view class="tool">
  72. <view class="tool-icon tool-icon-bg">
  73. <uv-icon name="server-fill" color="#05d9a2" size="56rpx" />
  74. </view>
  75. <text>联系客服</text>
  76. </view>
  77. </button> -->
  78. <view class="tool" @click="$utils.navigateTo('/pages_order/mine/service')">
  79. <view class="tool-icon tool-icon-bg">
  80. <uv-icon name="server-fill" color="#05d9a2" size="56rpx" />
  81. </view>
  82. <text>联系客服</text>
  83. </view>
  84. <view class="tool" @click="$refs.configPopup.open('user_ys')">
  85. <view class="tool-icon tool-icon-bg">
  86. <uv-icon name="question-circle" color="#05d9a2" size="56rpx" />
  87. </view>
  88. <text>隐私政策</text>
  89. </view>
  90. <!-- <view class="tool" @click="$utils.navigateTo('/pages_order/mine/wallet')">
  91. <view class="tool-icon">
  92. <image src="@/pages_order/static/center/tool-wallet.png"></image>
  93. </view>
  94. <text>我的钱包</text>
  95. </view>
  96. <view class="tool" @click="$utils.navigateTo('/pages_order/mine/team')">
  97. <view class="tool-icon">
  98. <image src="@/pages_order/static/center/tool-team.png"></image>
  99. </view>
  100. <text>我的团队</text>
  101. </view> -->
  102. </view>
  103. </view>
  104. <view class="content">
  105. <view class="card notice" v-if="notice">
  106. <view class="notice-icon">
  107. <image src="@/pages_order/static/center/notice.png"></image>
  108. </view>
  109. <uv-notice-bar :text="notice" bgColor="transparent" color="#001B3C" :icon="false" fontSize="28rpx"
  110. :customStyle="{
  111. padding: '6rpx 0',
  112. }"></uv-notice-bar>
  113. </view>
  114. <view class="card updates">
  115. <view class="updates-header">
  116. <view class="updates-header-bg">
  117. <image src="@/static/image/center/title-bg.png"></image>
  118. </view>
  119. <view class="updates-header-content">
  120. 动态更新
  121. </view>
  122. </view>
  123. <view class="updates-content">
  124. <view class="card updates-item" v-for="item in list" :key="item.id"
  125. @click="goToNewsDetail(item.id)">
  126. <view class="updates-item-img">
  127. <image :src="item.image"></image>
  128. </view>
  129. <view class="updates-item-info">
  130. <view class="updates-item-title">{{ item.title || '' }}</view>
  131. <view class="updates-item-desc text-ellipsis">{{ getDesc(item.details) }}</view>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. <!-- <view class="service" @click="$utils.navigateTo('/pages_order/mine/service')">
  138. <image src="@/pages_order/static/center/service.png" mode=""></image>
  139. </view> -->
  140. <popupActivate ref="popupActivate"></popupActivate>
  141. <popupSharing ref="popupSharing"></popupSharing>
  142. <configPopup ref="configPopup" />
  143. <tabber select="center" />
  144. </view>
  145. </template>
  146. <script>
  147. import {
  148. mapState
  149. } from 'vuex'
  150. import mixinsList from '@/mixins/list.js'
  151. import popupActivate from '@/components/center/popupActivate.vue'
  152. import tabber from '@/components/base/tabbar.vue'
  153. export default {
  154. mixins: [mixinsList],
  155. components: {
  156. tabber,
  157. popupActivate,
  158. },
  159. data() {
  160. return {
  161. notice: '',
  162. mixinsListApi: 'getNews',
  163. authApi: false,
  164. isLoggedIn: uni.getStorageSync('token'),
  165. }
  166. },
  167. computed: {
  168. ...mapState(['userInfo', 'userInfoVip']),
  169. role() {
  170. return this.userInfo.isPay
  171. },
  172. },
  173. onShow() {
  174. this.fetchNotice()
  175. this.isLoggedIn = uni.getStorageSync('token')
  176. if (this.isLoggedIn) {
  177. this.$store.commit('getUserInfo')
  178. this.$store.commit('getUserInfoVip')
  179. }
  180. },
  181. methods: {
  182. async fetchNotice() {
  183. try {
  184. // todo: check
  185. this.notice = (await this.$fetch('getNotice'))?.[0]?.title
  186. } catch (err) {
  187. }
  188. },
  189. onActivate() {
  190. if (!this.isLoggedIn) {
  191. this.goToLogin()
  192. return
  193. }
  194. this.$refs.popupActivate.open(this.role)
  195. },
  196. getDesc(str) {
  197. if (!str) {
  198. return ''
  199. }
  200. return str.replace(/<.*?>/g, '')
  201. },
  202. goToNewsDetail(id) {
  203. uni.navigateTo({
  204. url: `/pages_order/mine/news?id=${id}`
  205. })
  206. },
  207. goToEditUserInfo() {
  208. if (!this.isLoggedIn) {
  209. this.goToLogin()
  210. return
  211. }
  212. uni.navigateTo({
  213. url: '/pages_order/auth/wxUserInfo?mode=edit'
  214. })
  215. },
  216. goToLogin() {
  217. uni.navigateTo({
  218. url: '/pages_order/auth/wxLogin'
  219. })
  220. },
  221. }
  222. }
  223. </script>
  224. <style scoped lang="scss">
  225. .page {
  226. background-color: #001B3C;
  227. min-height: 100vh;
  228. }
  229. image {
  230. width: 100%;
  231. height: 100%;
  232. }
  233. .head {
  234. display: flex;
  235. padding: 20rpx 26rpx 18rpx 40rpx;
  236. align-items: center;
  237. position: relative;
  238. .headImage {
  239. width: 143rpx;
  240. height: 143rpx;
  241. overflow: hidden;
  242. border-radius: 50%;
  243. margin-right: 40rpx;
  244. }
  245. .info {
  246. .name {
  247. color: #FFFFFF;
  248. font-size: 38rpx;
  249. margin-bottom: 12rpx;
  250. }
  251. .tags {}
  252. }
  253. .setting {
  254. position: absolute;
  255. right: 26rpx;
  256. top: 37rpx;
  257. }
  258. }
  259. .tag {
  260. display: inline-block;
  261. padding: 6rpx 21rpx;
  262. border: 1rpx solid #999999;
  263. color: #FFFFFF;
  264. font-size: 24rpx;
  265. border-radius: 23rpx;
  266. margin-right: 20rpx;
  267. vertical-align: top;
  268. &-label {
  269. color: #999999;
  270. }
  271. }
  272. .tools {
  273. &-box {
  274. width: 100vw;
  275. height: 406rpx;
  276. padding: 0 5rpx;
  277. box-sizing: border-box;
  278. position: relative;
  279. }
  280. position: absolute;
  281. width: calc(100vw - 69rpx*2);
  282. left: 69rpx;
  283. bottom: 64rpx;
  284. justify-content: space-between;
  285. .tool{
  286. display: flex;
  287. justify-content: center;
  288. align-items: center;
  289. flex-direction: column;
  290. }
  291. .tool-icon-bg {
  292. width: 90rpx;
  293. height: 90rpx;
  294. background-color: #001B3C;
  295. border-radius: 15rpx;
  296. display: flex;
  297. justify-content: center;
  298. align-items: center;
  299. }
  300. }
  301. .activate {
  302. position: absolute;
  303. width: calc(100% - 199rpx);
  304. height: 80rpx;
  305. top: 31rpx;
  306. right: 37rpx;
  307. &-tips {
  308. flex: 1;
  309. color: #976224;
  310. font-size: 28rpx;
  311. }
  312. &-highlight {
  313. color: #FF6868;
  314. }
  315. .btn-activate {
  316. width: 172rpx;
  317. height: 80rpx;
  318. }
  319. }
  320. .tool {
  321. display: flex;
  322. flex-direction: column;
  323. justify-content: center;
  324. align-items: center;
  325. color: #57595B;
  326. font-size: 28rpx;
  327. &-icon {
  328. width: 88rpx;
  329. height: 88rpx;
  330. margin-bottom: 10rpx;
  331. }
  332. }
  333. .content {
  334. padding: 0 20rpx 20rpx 20rpx;
  335. }
  336. .notice {
  337. padding: 22rpx 21rpx;
  338. display: flex;
  339. &-icon {
  340. width: 49rpx;
  341. height: 49rpx;
  342. margin-right: 20rpx;
  343. }
  344. }
  345. .updates {
  346. margin-top: 20rpx;
  347. padding: 20rpx;
  348. &-header {
  349. position: relative;
  350. &-bg {
  351. height: 51rpx;
  352. width: 58rpx;
  353. margin-left: 40rpx;
  354. }
  355. &-content {
  356. color: #262626;
  357. font-size: 38rpx;
  358. font-weight: 900;
  359. position: absolute;
  360. top: 0;
  361. }
  362. }
  363. &-item {
  364. padding: 0;
  365. border-radius: 16rpx;
  366. box-shadow: 0 0 32rpx 0 rgba($color: #808080, $alpha: 0.16);
  367. margin-top: 20rpx;
  368. &-img {
  369. width: 100%;
  370. height: 252rpx;
  371. }
  372. &-info {
  373. padding: 15rpx 18rpx 8rpx 18rpx;
  374. }
  375. &-title {
  376. color: #474747;
  377. font-size: 32rpx;
  378. }
  379. &-desc {
  380. color: #CCCCCC;
  381. font-size: 20rpx;
  382. }
  383. }
  384. }
  385. .service {
  386. position: fixed;
  387. right: 29rpx;
  388. bottom: 312rpx;
  389. width: 149rpx;
  390. height: 158rpx;
  391. }
  392. </style>