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

407 lines
11 KiB

3 months ago
3 months ago
3 months ago
3 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 : true,
  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.isLoggedIn = uni.getStorageSync('token')
  152. if(this.isLoggedIn){
  153. this.$store.commit('getUserInfo')
  154. this.$store.commit('getUserInfoVip')
  155. this.fetchNotice()
  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. if (!this.isLoggedIn) {
  181. this.goToLogin()
  182. return
  183. }
  184. uni.navigateTo({
  185. url: `/pages_order/mine/news?id=${id}`
  186. })
  187. },
  188. goToEditUserInfo() {
  189. if (!this.isLoggedIn) {
  190. this.goToLogin()
  191. return
  192. }
  193. uni.navigateTo({
  194. url: '/pages_order/auth/wxUserInfo?mode=edit'
  195. })
  196. },
  197. goToLogin() {
  198. uni.navigateTo({
  199. url: '/pages_order/auth/wxLogin'
  200. })
  201. },
  202. }
  203. }
  204. </script>
  205. <style scoped lang="scss">
  206. .page {
  207. background-color: #001B3C;
  208. min-height: 100vh;
  209. }
  210. image {
  211. width: 100%;
  212. height: 100%;
  213. }
  214. .head {
  215. display: flex;
  216. padding: 20rpx 26rpx 18rpx 40rpx;
  217. align-items: center;
  218. position: relative;
  219. .headImage {
  220. width: 143rpx;
  221. height: 143rpx;
  222. overflow: hidden;
  223. border-radius: 50%;
  224. margin-right: 40rpx;
  225. }
  226. .info {
  227. .name {
  228. color: #FFFFFF;
  229. font-size: 38rpx;
  230. margin-bottom: 12rpx;
  231. }
  232. .tags {}
  233. }
  234. .setting {
  235. position: absolute;
  236. right: 26rpx;
  237. top: 37rpx;
  238. }
  239. }
  240. .tag {
  241. display: inline-block;
  242. padding: 6rpx 21rpx;
  243. border: 1rpx solid #999999;
  244. color: #FFFFFF;
  245. font-size: 24rpx;
  246. border-radius: 23rpx;
  247. margin-right: 20rpx;
  248. vertical-align: top;
  249. &-label {
  250. color: #999999;
  251. }
  252. }
  253. .tools {
  254. &-box {
  255. width: 100vw;
  256. height: 406rpx;
  257. padding: 0 5rpx;
  258. box-sizing: border-box;
  259. position: relative;
  260. }
  261. position: absolute;
  262. width: calc(100vw - 69rpx*2);
  263. left: 69rpx;
  264. bottom: 64rpx;
  265. justify-content: space-between;
  266. }
  267. .activate {
  268. position: absolute;
  269. width: calc(100% - 199rpx);
  270. height: 80rpx;
  271. top: 31rpx;
  272. right: 37rpx;
  273. &-tips {
  274. flex: 1;
  275. color: #976224;
  276. font-size: 28rpx;
  277. }
  278. &-highlight {
  279. color: #FF6868;
  280. }
  281. .btn-activate {
  282. width: 172rpx;
  283. height: 80rpx;
  284. }
  285. }
  286. .tool {
  287. display: flex;
  288. flex-direction: column;
  289. justify-content: center;
  290. align-items: center;
  291. color: #57595B;
  292. font-size: 28rpx;
  293. &-icon {
  294. width: 88rpx;
  295. height: 88rpx;
  296. margin-bottom: 10rpx;
  297. }
  298. }
  299. .content {
  300. padding: 0 20rpx 20rpx 20rpx;
  301. }
  302. .notice {
  303. padding: 22rpx 21rpx;
  304. display: flex;
  305. &-icon {
  306. width: 49rpx;
  307. height: 49rpx;
  308. margin-right: 20rpx;
  309. }
  310. }
  311. .updates {
  312. margin-top: 20rpx;
  313. padding: 20rpx;
  314. &-header {
  315. position: relative;
  316. &-bg {
  317. height: 51rpx;
  318. width: 58rpx;
  319. margin-left: 40rpx;
  320. }
  321. &-content {
  322. color: #262626;
  323. font-size: 38rpx;
  324. font-weight: 900;
  325. position: absolute;
  326. top: 0;
  327. }
  328. }
  329. &-item {
  330. padding: 0;
  331. border-radius: 16rpx;
  332. box-shadow: 0 0 32rpx 0 rgba($color: #808080, $alpha: 0.16);
  333. margin-top: 20rpx;
  334. &-img {
  335. width: 100%;
  336. height: 252rpx;
  337. }
  338. &-info {
  339. padding: 15rpx 18rpx 8rpx 18rpx;
  340. }
  341. &-title {
  342. color: #474747;
  343. font-size: 32rpx;
  344. }
  345. &-desc {
  346. color: #CCCCCC;
  347. font-size: 20rpx;
  348. }
  349. }
  350. }
  351. .service {
  352. position: fixed;
  353. right: 29rpx;
  354. bottom: 312rpx;
  355. width: 149rpx;
  356. height: 158rpx;
  357. }
  358. </style>