index.jsx 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import { Component } from 'react'
  2. import { View, Text, Button, Image, scrollView, Input } from '@tarojs/components'
  3. import Taro, { } from '@tarojs/taro'
  4. import tool from '../../common/tool'
  5. import * as api from '../../service/index'
  6. import './index.less'
  7. export default class Mine extends Component {
  8. state = {
  9. userInfo: {},
  10. }
  11. componentDidShow () {
  12. this.getUserInfo()
  13. }
  14. onShareAppMessage = (res) => {
  15. let shareData = {
  16. title: tool.shareTitle,
  17. path: `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`,
  18. imageUrl: tool.shareImg
  19. }
  20. return shareData;
  21. }
  22. getUserInfo () {
  23. api.getUserInfo().then(res => {
  24. if (res.code == 200) {
  25. this.setState({
  26. userInfo: res.data
  27. })
  28. }
  29. })
  30. }
  31. getEarnPoints () {
  32. Taro.navigateTo({
  33. url: `/moduleA/pages/earnPoints/index`
  34. })
  35. }
  36. wallet () {
  37. Taro.navigateTo({
  38. url: `/moduleA/pages/wallet/index`
  39. })
  40. }
  41. toDetail (index) {
  42. switch (index) {
  43. case 0:
  44. Taro.navigateTo({
  45. url: `/moduleB/pages/works/index`
  46. })
  47. break;
  48. case 1:
  49. Taro.navigateTo({
  50. url: `/moduleB/pages/like/index`
  51. })
  52. break;
  53. case 2:
  54. Taro.navigateTo({
  55. url: `/moduleA/pages/invite/index`
  56. })
  57. break;
  58. case 3:
  59. Taro.navigateTo({
  60. url: `/moduleA/pages/shareCnt/index`
  61. })
  62. break;
  63. case 4:
  64. Taro.previewImage({
  65. current: this.state.userInfo.kf_img, // 当前显示图片的http链接
  66. urls: [`${this.state.userInfo.kf_img}`] // 需要预览的图片http链接列表
  67. })
  68. break;
  69. }
  70. }
  71. componentDidMount () { }
  72. render () {
  73. return (
  74. <View className='mine'>
  75. <View className='user-info'>
  76. <View className='user-bag'>
  77. <View className='user-top'>
  78. <Image className='user-img' src={this.state.userInfo.head_img}></Image>
  79. <View className='user-info-text'>
  80. <View className='info-top'>
  81. <View className='user-name'>{this.state.userInfo.user_name}</View>
  82. </View>
  83. <View className='info-bottom' >
  84. <View className='integral'>点券:{this.state.userInfo.total_coin}</View>
  85. {/* <Image className='integral-img' src='http://video-img.fyshark.com/1680055380074%E7%A7%AF%E5%88%86%E6%98%8E%E7%BB%86.png'></Image> */}
  86. </View>
  87. </View>
  88. </View>
  89. <View className='get-integral'>
  90. <View className='inte-button' onClick={e => (this.getEarnPoints())}>获取点券</View>
  91. </View>
  92. </View>
  93. </View>
  94. <View className='work-list'>
  95. <View className='work-info' onClick={e => (this.toDetail(0))}>
  96. <Image className='work-img' src='http://video-img.fyshark.com/1680506115183icon-%E6%88%91%E7%9A%84%E4%BD%9C%E5%93%81.png'></Image>
  97. <View className='work-title'>我的作品</View>
  98. </View>
  99. <View className='work-info' onClick={e => (this.toDetail(1))}>
  100. <Image className='work-img' src='http://video-img.fyshark.com/1680506124768icon-%E9%82%80%E8%AF%B7%E5%A5%BD%E5%8F%8B.png'></Image>
  101. <View className='work-title'>我的喜欢</View>
  102. </View>
  103. <View className='work-info' onClick={e => (this.wallet())}>
  104. <Image className='work-img' src='http://video-img.fyshark.com/1680055380074%E7%A7%AF%E5%88%86%E6%98%8E%E7%BB%86.png'></Image>
  105. <View className='work-title'>点券详情</View>
  106. </View>
  107. {
  108. process.env.TARO_ENV != 'tt' &&
  109. <View className='work-info' onClick={e => (this.toDetail(2))}>
  110. <Image className='work-img' src='http://video-img.fyshark.com/1680506104131icon-%E6%88%91%E7%9A%84%E5%96%9C%E6%AC%A2.png'></Image>
  111. <View className='work-title'>邀请好友</View>
  112. </View>
  113. }
  114. <View className='work-info' onClick={e => (this.toDetail(3))}>
  115. <Image className='work-img' src='http://video-img.fyshark.com/1680505725946icon-%E5%88%86%E9%94%80%E8%AE%A1%E5%88%92.png'></Image>
  116. <View className='work-title'>分销计划</View>
  117. </View>
  118. {
  119. process.env.TARO_ENV != 'tt' &&
  120. <View className='work-info work-info-only' onClick={e => (this.toDetail(4))}>
  121. <Image className='work-img' src='http://video-img.fyshark.com/1680505998515icon-%E5%8A%A0%E5%85%A5%E4%BA%A4%E5%8F%8B%E7%BE%A4.png'></Image>
  122. <View className='work-title'>加入交友群</View>
  123. </View>
  124. }
  125. <Button className='button work-info work-info-only' type='default' open-type='contact'>
  126. <Image className='work-img' src='http://video-img.fyshark.com/1680506053680icon-%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC.png'></Image>
  127. <View className='work-title'>联系客服</View>
  128. </Button>
  129. </View>
  130. </View>
  131. )
  132. }
  133. }