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

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