index.jsx 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. console.log('111');
  13. this.getUserInfo()
  14. }
  15. onShareAppMessage = (res) => {
  16. let path = `/pages/index/index?c=${Taro.getStorageSync('user_id')}&s=rightTap`
  17. if (process.env.TARO_ENV == 'tt') {
  18. path = `/pages/index/index?c=channel_name&s=douyinguazai`
  19. }
  20. let shareData = {
  21. title: tool.shareTitle,
  22. path: path,
  23. imageUrl: tool.shareImg
  24. }
  25. return shareData;
  26. }
  27. getUserInfo () {
  28. api.getUserInfo().then(res => {
  29. if (res.code == 200) {
  30. this.setState({
  31. userInfo: res.data
  32. })
  33. }
  34. })
  35. }
  36. getEarnPoints () {
  37. Taro.navigateTo({
  38. url: `/pages/earnPoints/index`
  39. })
  40. }
  41. wallet () {
  42. Taro.navigateTo({
  43. url: `/pages/wallet/index`
  44. })
  45. }
  46. toDetail (index) {
  47. switch (index) {
  48. case 0:
  49. Taro.navigateTo({
  50. url: `/pages/imageWorks/index`
  51. })
  52. break;
  53. case 1:
  54. Taro.navigateTo({
  55. url: `/pages/like/index`
  56. })
  57. break;
  58. case 2:
  59. Taro.navigateTo({
  60. url: `/pages/invite/index`
  61. })
  62. break;
  63. case 3:
  64. Taro.navigateTo({
  65. url: `/pages/shareCnt/index`
  66. })
  67. break;
  68. case 4:
  69. Taro.previewImage({
  70. current: this.state.userInfo.kf_img, // 当前显示图片的http链接
  71. urls: [`${this.state.userInfo.kf_img}`] // 需要预览的图片http链接列表
  72. })
  73. break;
  74. }
  75. }
  76. componentDidMount () { }
  77. render () {
  78. return (
  79. <View className='mine'>
  80. <View className='user-info'>
  81. <View className='user-bag'>
  82. <View className='user-top'>
  83. <Image className='user-img' src={this.state.userInfo.head_img}></Image>
  84. <View className='user-info-text'>
  85. <View className='info-top'>
  86. <View className='user-name'>{this.state.userInfo.user_name}</View>
  87. </View>
  88. <View className='info-bottom' >
  89. <View className='integral'>点券:{this.state.userInfo.total_coin}</View>
  90. {/* <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> */}
  91. </View>
  92. </View>
  93. </View>
  94. <View className='get-integral'>
  95. <View className='inte-button' onClick={e => (this.getEarnPoints())}>获取点券</View>
  96. </View>
  97. </View>
  98. </View>
  99. <View className='work-list'>
  100. <View className='work-info' onClick={e => (this.toDetail(0))}>
  101. <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>
  102. <View className='work-title'>绘画作品</View>
  103. </View>
  104. <View className='work-info' onClick={e => (this.toDetail(1))}>
  105. <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>
  106. <View className='work-title'>我的喜欢</View>
  107. </View>
  108. <View className='work-info' onClick={e => (this.wallet())}>
  109. <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>
  110. <View className='work-title'>点券详情</View>
  111. </View>
  112. {/* {
  113. process.env.TARO_ENV != 'tt' &&
  114. <View className='work-info' onClick={e => (this.toDetail(2))}>
  115. <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>
  116. <View className='work-title'>邀请好友</View>
  117. </View>
  118. } */}
  119. <View className='work-info' onClick={e => (this.toDetail(3))}>
  120. <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>
  121. <View className='work-title'>分销计划</View>
  122. </View>
  123. {/* {
  124. process.env.TARO_ENV != 'tt' &&
  125. <View className='work-info work-info-only' onClick={e => (this.toDetail(4))}>
  126. <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>
  127. <View className='work-title'>加入交友群</View>
  128. </View>
  129. } */}
  130. <Button className='button work-info work-info-only' type='default' open-type='contact'>
  131. <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>
  132. <View className='work-title'>联系客服</View>
  133. </Button>
  134. </View>
  135. </View>
  136. )
  137. }
  138. }