index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <app-layout>
  3. <view class="container">
  4. <view class="header">
  5. <view class="bg"></view>
  6. <view class="info main-left cross-center">
  7. <view class="head-img">
  8. <u-image
  9. width="150"
  10. height="150"
  11. src="https://xiansin.oss-cn-shenzhen.aliyuncs.com/sange-bridge/images/sample.jpg"
  12. shape="circle"></u-image>
  13. </view>
  14. <view class="share-box dir-top-wrap">
  15. <view class="nickname">{{vuex_user_data.nickname}}</view>
  16. <view class="recommend" v-if="userData.parent">推荐人:{{userData.parent.nickname}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="item-group dir-left-wrap">
  21. <view class="item-box dir-top-wrap cross-center main-center"
  22. v-for="(item,index) in shareTool"
  23. @click="handleItemClick(index)"
  24. >
  25. <u-button type="primary" open-type="share" v-if="item.share"
  26. :custom-style="{backgroundColor: 'transparent',borderColor: 'unset'}"
  27. hover-class="none"
  28. >
  29. <u-image
  30. width="90"
  31. height="90"
  32. mode="aspectFit"
  33. :src="item.icon"></u-image>
  34. </u-button>
  35. <view class="icon" v-else>
  36. <u-image
  37. width="90"
  38. height="90"
  39. mode="aspectFit"
  40. :src="item.icon"></u-image>
  41. </view>
  42. <view class="title">{{item.title}}</view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="qrcode-modal" :class="{show:qrCodeModal.show}">
  47. <view class="content">
  48. <view class="qrcode-modal-content dir-top-wrap cross-center">
  49. <view class="head-img">
  50. <u-image
  51. width="150"
  52. height="150"
  53. :src="userData.head_img"
  54. shape="circle"></u-image>
  55. </view>
  56. <view class="nickname">{{userData.nickname}}</view>
  57. <u-line class="u-line" border-style="dashed" length="90%"></u-line>
  58. <view class="qrcode">
  59. <u-image
  60. width="320"
  61. height="320"
  62. :src="userData.share_qrcode"
  63. ></u-image>
  64. </view>
  65. </view>
  66. <u-button shape="circle"
  67. @click="qrCodeModal.show = false"
  68. hover-class="none"
  69. :custom-style="{
  70. background:'linear-gradient(90deg, rgba(4,153,140,1) 0%, rgba(4,153,128,1) 100%, rgba(14,175,160,.5) 100%)',
  71. boxShadow: '0 0 20rpx rgba(13,239,250,.3)',
  72. borderColor:'none',
  73. color: '#ffffff',
  74. marginTop: '50rpx'}">确定</u-button>
  75. </view>
  76. </view>
  77. </app-layout>
  78. </template>
  79. <script>
  80. import appLayout from "@/components/app-layout"
  81. export default {
  82. components:{
  83. appLayout,
  84. },
  85. data() {
  86. return {
  87. shareTool: [
  88. {icon:'/static/images/price.png',title:'佣金',url:'/pages/price/index'},
  89. {icon:'/static/images/withdraw.png',title:'佣金提现明细',url:'/pages/withdraw/index'},
  90. {icon:'/static/images/list.png',title:'推广列表',url:'/pages/share/list'},
  91. {icon:'/static/images/income.png',title:'收益列表',url:'/pages/income/index'},
  92. {icon:'/static/images/share.png',title:'推广分享',method: this.handleShare,share: true},
  93. {icon:'/static/images/qrcode.png',title:'推广二维码',url:'',method: this.handleQrCode},
  94. ],
  95. qrCodeModal:{
  96. show: false
  97. },
  98. userData: {}
  99. }
  100. },
  101. methods: {
  102. handleItemClick(index){
  103. let item = this.shareTool[index];
  104. if(typeof item.method === "function"){
  105. item.method();
  106. }else{
  107. this.$jump({url:item.url,type:'to'});
  108. }
  109. },
  110. handleQrCode(){
  111. this.qrCodeModal.show = true
  112. },
  113. handleShare(){
  114. this.$util.share(this.vuex_user_data);
  115. // this.$u.toast('推广分享')
  116. },
  117. getUser(){
  118. this.$u.api.userGet().then(data => {
  119. this.userData = data;
  120. })
  121. },
  122. },
  123. onLoad(){
  124. this.getUser();
  125. },
  126. onShareAppMessage() {
  127. return this.$util.shareMessage(this.vuex_user_data);
  128. },
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .container{
  133. padding: 0;
  134. .header{
  135. position: relative;
  136. padding: 0 30rpx;
  137. .bg{
  138. position: absolute;
  139. background: url("@/static/images/share-bg.png") no-repeat top;
  140. background-size: 100% 120%;
  141. background-position: 0 -10rpx;
  142. height: 240rpx;
  143. left: 0;
  144. top: 0;
  145. width: 750rpx;
  146. z-index: 0;
  147. }
  148. .info{
  149. height: 240rpx;
  150. position: relative;
  151. color: #ffffff;
  152. z-index: 1;
  153. }
  154. .share-box{
  155. padding: 0 30rpx;
  156. .nickname{
  157. font-size: 36rpx;
  158. padding: 6rpx 0;
  159. }
  160. }
  161. }
  162. .item-group{
  163. margin: 30rpx 0;
  164. .item-box{
  165. width: 330rpx;
  166. background: #ffffff;
  167. border-radius: 16rpx;
  168. margin-bottom: 30rpx;
  169. margin-left: 30rpx;
  170. height: 260rpx;
  171. .title{
  172. color: #455150;
  173. font-size: 28rpx;
  174. font-weight: bold;
  175. padding: 16rpx 0;
  176. }
  177. }
  178. }
  179. }
  180. .qrcode-modal{
  181. position: fixed;
  182. top: 0;
  183. left: 0;
  184. width: 750rpx;
  185. height: 100vh;
  186. background: rgba(0,0,0,.35);
  187. z-index: 999;
  188. display: none;
  189. animation: show-modal linear .5s;
  190. &.show{
  191. display: block;
  192. }
  193. .content{
  194. position: absolute;
  195. width: 600rpx;
  196. top: 50%;
  197. left: 50%;
  198. transform: translate(-50%,-50%);
  199. .qrcode-modal-content{
  200. position: relative;
  201. width: 100%;
  202. height: 50vh;
  203. background: url("@/static/images/share-qrcode-bg.png") no-repeat center;
  204. background-size: 100% 100%;
  205. .head-img{
  206. position: absolute;
  207. top: -75rpx;
  208. }
  209. .nickname{
  210. position: absolute;
  211. color: #ffffff;
  212. top: 15%;
  213. font-size: 34rpx;
  214. }
  215. .u-line{
  216. position: absolute;
  217. top: 28.55%;
  218. }
  219. .qrcode{
  220. position: absolute;
  221. top: 35%;
  222. }
  223. }
  224. }
  225. }
  226. @keyframes show-modal {
  227. 0%{opacity: 0;}
  228. 100%{opacity: 1;}
  229. }
  230. </style>