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

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