inv1.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="container index">
  3. <u-popup :show="show" @close="close" @open="open" mode="center" round="24">
  4. <view class="top">
  5. <view class="" @click="back">
  6. <image src="/static/2.png" mode="widthFix" style="width: 40rpx;margin-top: 30rpx;"></image>
  7. </view>
  8. <view class="">
  9. </view>
  10. <view class="" @click="href('/pages/my/invitation/details')" style="color: #fff;">
  11. 邀请规则
  12. </view>
  13. </view>
  14. <view class="invint">
  15. <view class="">
  16. <view class="">
  17. <xinyu-canvas-drawer ref="poster" :width="540" :height="960">
  18. <template v-slot="{src}">
  19. <!-- #ifdef APP-PLUS -->
  20. <image :src="src" style="width: 640rpx;height: 960rpx;"></image>
  21. <!-- #endif -->
  22. <!-- #ifdef H5 -->
  23. <img :src="src" style="width: 665rpx;height: 960rpx;"></img>
  24. <!-- #endif -->
  25. </template>
  26. </xinyu-canvas-drawer>
  27. </view>
  28. </view>
  29. </view>
  30. </u-popup>
  31. </view>
  32. </template>
  33. <script>
  34. // import aQrcode from '@/uni_modules/Sansnn-uQRCode/components/u-qrcode/u-qrcode.vue';
  35. // import uQrcode from "@/uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode.vue"
  36. import navHeader from "@/components/my/nav_header.vue"
  37. import XinyuCanvasDrawer from "@/components/xinyu-canvas-drawer/index.vue";
  38. export default {
  39. components: {
  40. navHeader,
  41. // aQrcode,
  42. XinyuCanvasDrawer
  43. },
  44. data() {
  45. return {
  46. show: true, //切换页面状态
  47. team_list: [],
  48. link: "", //跳转路径
  49. img: '', //海报地址
  50. coderich: "",
  51. posterRef: "",
  52. invcode: ''
  53. }
  54. },
  55. onLoad(e) {
  56. //获取其他路径过来的图片
  57. if (e.img == null || e.img == "undefined") {
  58. this.img = uni.getStorageSync("user_info").sharBg
  59. this.img = this.img.replace("admin", "www")
  60. // alert(this.img.replace("admin.",""))
  61. } else {
  62. this.img = e.img
  63. }
  64. //获取团队列表
  65. this.invcode = uni.getStorageSync('user_info').invite_code
  66. this.get_team()
  67. this.link = uni.baseUrl + '#/pages/login/register?code=' + uni.getStorageSync("user_info")
  68. .invite_code
  69. },
  70. onReady() {
  71. this.initcavas()
  72. },
  73. methods: {
  74. copy(val) {
  75. this.$api.setclip(val)
  76. },
  77. async initcavas() {
  78. console.log(this.img)
  79. var that = this
  80. this.posterRef = this.$refs.poster;
  81. uni.showLoading({
  82. title: "渲染海报中"
  83. });
  84. var img = await this.posterRef
  85. .addImage(require("@/static/my/a15.png"), 0, 0, 540,
  86. 960) //绘制云端图片时第一个参数直接传云端图片地址即可,不需要require。注意不要跨域
  87. .addRect(35, 700, 470, 200, "#fff") //绘制矩形
  88. .addQRCode(that.link, 50, 730, 130, 130) //绘制二维码(不要太长否则会扫不出来)
  89. .addText("我的邀请码", 210, 730, 20, "#000", 453, false)
  90. .addText(that.invcode, 210, 780, 32, "#000", 453, false)
  91. .addText("扫描二维码 多重好礼在等你~", 210, 840, 20, "#000", 453, false)
  92. .draw();
  93. this.posterRef = this.$refs.poster;
  94. uni.hideLoading();
  95. },
  96. save() {
  97. this.posterRef.saveImageToPhotosAlbum();
  98. uni.showToast({
  99. title: "已保存到相册"
  100. })
  101. },
  102. complete(e, refName) {
  103. if (e.success) {
  104. console.log(refName + '生成成功');
  105. } else {
  106. console.log(refName + '生成失败');
  107. }
  108. },
  109. poster() {
  110. let platform = uni.getSystemInfoSync().platform
  111. if (platform == 'ios') {
  112. this.$api.pop("请长按电源键 + 音量上键")
  113. console.log('我是iOS')
  114. } else if (platform == 'android') {
  115. this.$api.pop("请长按电源键 + 音量下键")
  116. console.log('我是安卓')
  117. }
  118. },
  119. get_team() {
  120. this.api.team().then(res => {
  121. this.team_list = res.data.data
  122. console.log(res)
  123. })
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped lang="less">
  129. .index {
  130. box-sizing: border-box;
  131. position: relative;
  132. }
  133. .top {
  134. display: flex;
  135. justify-content: space-between;
  136. padding: 0 32rpx;
  137. color: #000;
  138. font-size: 32rpx;
  139. line-height: 90rpx;
  140. width: 680rpx;
  141. z-index: 999;
  142. text-align: center;
  143. margin-top: -100rpx;
  144. }
  145. .center_first {
  146. position: relative;
  147. }
  148. .center {
  149. position: absolute;
  150. color: #000;
  151. top: 95%;
  152. left: 42.5%;
  153. z-index: 999;
  154. }
  155. .bot {
  156. width: 750rpx;
  157. .bottom {
  158. background: #fff;
  159. width: 686rpx;
  160. margin: 32rpx auto;
  161. border-radius: 32rpx;
  162. .bsn {
  163. width: 348rpx;
  164. margin: 32rpx auto;
  165. }
  166. .top1 {
  167. display: flex;
  168. color: #FFEC01;
  169. align-items: center;
  170. justify-content: center;
  171. font-size: 40rpx;
  172. >view:first-child,
  173. >view:last-child {
  174. width: 20rpx;
  175. height: 20rpx;
  176. border-radius: 50%;
  177. margin: 0 15rpx;
  178. }
  179. }
  180. .num {
  181. color: #000;
  182. text-align: center;
  183. font-size: 32rpx;
  184. margin-top: ;
  185. border-bottom: 1px solid #F0F0F0;
  186. width: 590rpx;
  187. margin: 46rpx auto 0;
  188. padding-bottom: 20rpx;
  189. font-weight: bold;
  190. }
  191. .people {
  192. width: 590rpx;
  193. height: 622rpx;
  194. margin: 20rpx auto 0;
  195. border-radius: 24rpx;
  196. font-size: 28rpx;
  197. .top2 {
  198. display: flex;
  199. justify-content: space-between;
  200. align-items: center;
  201. height: 88rpx;
  202. // background: #F6E9C7;
  203. border-radius: 24rpx 24rpx 0 0;
  204. padding: 0 42rpx 0 70rpx;
  205. border-bottom: 1px solid #F0F0F0;
  206. }
  207. .bot1 {
  208. display: flex;
  209. align-items: center;
  210. justify-content: space-between;
  211. padding: 12rpx 70rpx 32rpx 84rpx;
  212. border-bottom: 1px solid #F0F0F0;
  213. }
  214. }
  215. }
  216. .bsn {
  217. width: 348rpx;
  218. margin: 32rpx auto 48rpx;
  219. }
  220. .down {
  221. width: 645rpx;
  222. height: 96rpx;
  223. margin: 0 auto 86rpx;
  224. display: flex;
  225. align-items: center;
  226. justify-content: center;
  227. color: #fff;
  228. font-size: 28rpx;
  229. background: url(/static/index/011.png) no-repeat;
  230. background-size: 100% 100%;
  231. >view {
  232. // border: 1px solid #937D63;
  233. width: 500rpx;
  234. height: 108rpx;
  235. display: flex;
  236. align-items: center;
  237. justify-content: space-between;
  238. // padding: 0 32rpx;
  239. >view {
  240. display: flex;
  241. // flex-direction: column;
  242. align-items: center;
  243. }
  244. >view:nth-child(2) {
  245. border-left: 1px solid #fff;
  246. height: 40rpx;
  247. }
  248. }
  249. }
  250. }
  251. .invint {
  252. width: 670rpx;
  253. height: 1028rpx;
  254. margin: 100rpx auto 0;
  255. }
  256. /deep/ .u-popup__content {
  257. background: transparent;
  258. }
  259. </style>