invitation.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <template>
  2. <view class="container index">
  3. <view class="top">
  4. <view class="" @click="back">
  5. <image src="/static/2.png" mode="widthFix" style="width: 40rpx;margin-top: 30rpx;"></image>
  6. </view>
  7. <view class="">
  8. </view>
  9. <view class="" @click="href('/pages/my/invitation/details')" style="color: #fff;">
  10. 邀请规则
  11. </view>
  12. </view>
  13. <view class="" style="width: 170rpx;margin: 100rpx auto;text-align: center;font-weight: bold;">
  14. <image src="/static/logo.png" mode="widthFix" style="width: 170rpx;color: #fff;"></image>
  15. <view class="">
  16. 鲑鱼数藏
  17. </view>
  18. </view>
  19. <!-- <view class="">
  20. <image :src="img" mode=""></image>
  21. </view> -->
  22. <!-- 中间 -->
  23. <view class="">
  24. <view class="center_first"
  25. style="background: #1D1F1E;width: 686rpx;height: 264rpx;margin: auto;border-radius: 24rpx;">
  26. <xinyu-canvas-drawer ref="poster" :width="250" :height="264">
  27. <template v-slot="{src}">
  28. <!-- #ifdef APP-PLUS -->
  29. <image :src="src" style="width: 250rpx;height: 264rpx;"></image>
  30. <!-- #endif -->
  31. <!-- #ifdef H5 -->
  32. <img :src="src" style="width: 250rpx;height: 264rpx;"></img>
  33. <!-- #endif -->
  34. </template>
  35. </xinyu-canvas-drawer>
  36. <!-- <image :src="img" mode="" style="width: 250rpx;height: 250rpx"></image> -->
  37. <view class="" style="margin:-250rpx 0 0 250rpx;">
  38. <view class="" style="font-size: 24rpx;">
  39. 我的邀请码
  40. </view>
  41. <view class="" style="font-size: 36rpx;margin-top: 16rpx;font-weight: bold;">
  42. {{invite_code}}
  43. </view>
  44. <view @click="href('/pages/my/invitation/inv1')" class=""
  45. style=" border-radius: 8rpx;margin-top: 40rpx;
  46. background: linear-gradient(180deg, #69FF60 0%, #0C9D5B 100%);width: 220rpx;height: 68rpx;color: #fff;font-size: 28rpx;text-align: center;line-height: 68rpx;">
  47. 立即邀请
  48. </view>
  49. </view>
  50. </view>
  51. <view class="bot">
  52. <view class="bottom">
  53. <view class="top1">
  54. <view class="">
  55. </view>
  56. <view class="">
  57. <!-- 邀请记录 -->
  58. </view>
  59. <view class="">
  60. </view>
  61. </view>
  62. <view class="num">
  63. 邀请记录 <text
  64. style="font-weight: normal;font-size: 24rpx;color: #666;">(我已邀请{{team_list.length}}人)</text>
  65. </view>
  66. <view class="people">
  67. <view class="top2">
  68. <view class="">
  69. 编号
  70. </view>
  71. <view class="">
  72. 用户手机
  73. </view>
  74. <view class="">
  75. 邀请结果
  76. </view>
  77. </view>
  78. <scroll-view scroll-y="true" style="height: 40vh;">
  79. <view class="bot1" v-for="(item,index) in team_list" :key="index">
  80. <view class="">
  81. <text v-if="index<9">0</text> {{index+1}}
  82. </view>
  83. <view class="">
  84. {{item.phone}}
  85. </view>
  86. <view class="" v-if="item.is_cert ==1" style="color: #2cbf6e;">
  87. 已认证
  88. </view>
  89. <view class="" v-else style="color: #999;">
  90. 未认证
  91. </view>
  92. </view>
  93. </scroll-view>
  94. </view>
  95. </view>
  96. <view class="down">
  97. <!-- -->
  98. <view class="">
  99. <view class="" @click="copy(link)">
  100. <!-- <view class="" style="margin-top: 10rpx;">
  101. <image src="/static/my/049.png" mode="widthFix"
  102. style="width: 32rpx;margin-right: 16px;"></image>
  103. </view> -->
  104. <view class="">
  105. 复制链接
  106. </view>
  107. </view>
  108. <view class="">
  109. </view>
  110. <!-- #ifdef H5 -->
  111. <view class="" @click="save(1)">
  112. <!-- <view class="">
  113. <image src="/static/my/050.png" mode="widthFix"
  114. style="width: 32rpx;margin-right: 16px;"></image>
  115. </view> -->
  116. <view class="">
  117. 保存图片
  118. </view>
  119. </view>
  120. <!-- #endif -->
  121. <!-- #ifdef APP-PLUS -->
  122. <view class="" @click="save(2)">
  123. <!-- <view class="" style="margin-top: 10rpx;">
  124. <image src="/static/my/050.png" mode="widthFix"
  125. style="width: 32rpx;margin-right: 16px;"></image>
  126. </view> -->
  127. <view class="">
  128. 保存图片
  129. </view>
  130. </view>
  131. <!-- #endif -->
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </template>
  138. <script>
  139. import navHeader from "@/components/my/nav_header.vue"
  140. import XinyuCanvasDrawer from "@/components/xinyu-canvas-drawer/index.vue";
  141. import aQrcode from '@/uni_modules/Sansnn-uQRCode/components/u-qrcode/u-qrcode.vue';
  142. export default {
  143. components: {
  144. navHeader,
  145. aQrcode,
  146. XinyuCanvasDrawer
  147. },
  148. data() {
  149. return {
  150. show: true, //切换页面状态
  151. team_list: [],
  152. link: "", //跳转路径
  153. img: '', //海报地址
  154. coderich: "",
  155. posterRef: "",
  156. invite_code: '',
  157. userinfo: {},
  158. page: 0,
  159. showinv: false
  160. }
  161. },
  162. onLoad(e) {
  163. // uni.showLoading({
  164. // title: '海报加载中',
  165. // })
  166. this.api.get_user_info()
  167. this.userinfo = uni.getStorageSync('user_info')
  168. //获取其他路径过来的图片
  169. //获取团队列表
  170. this.get_team()
  171. this.link = uni.baseUrl + '#/pages/login/register?code=' + uni.getStorageSync("user_info")
  172. .invite_code
  173. this.invite_code = uni.getStorageSync("user_info").invite_code
  174. },
  175. onReady() {
  176. this.initcavas()
  177. },
  178. methods: {
  179. close() {
  180. this.showinv = false
  181. },
  182. //复制
  183. copy(val) {
  184. this.$api.setclip(val)
  185. },
  186. async initcavas() {
  187. var that = this;
  188. this.posterRef = this.$refs.poster;
  189. uni.showLoading({
  190. title: "渲染海报中"
  191. });
  192. // let fontFaceSet = document.fonts;
  193. var img = await this.posterRef
  194. .addQRCode(that.link, 20, 30, 200, 200)
  195. .draw();
  196. // console.log(img)
  197. this.posterRef = this.$refs.poster;
  198. uni.hideLoading();
  199. },
  200. save(val) {
  201. if (val == 1) {
  202. uni.showToast({
  203. title: "请长按二维码保存保存",
  204. icon: 'none'
  205. })
  206. } else {
  207. this.posterRef.saveImageToPhotosAlbum();
  208. uni.showToast({
  209. title: "已保存到相册"
  210. })
  211. }
  212. },
  213. complete(e, refName) {
  214. if (e.success) {
  215. console.log(refName + '生成成功');
  216. } else {
  217. console.log(refName + '生成失败');
  218. }
  219. },
  220. poster() {
  221. let platform = uni.getSystemInfoSync().platform
  222. if (platform == 'ios') {
  223. this.$api.pop("请长按电源键 + 音量上键")
  224. console.log('我是iOS')
  225. } else if (platform == 'android') {
  226. this.$api.pop("请长按电源键 + 音量下键")
  227. console.log('我是安卓')
  228. }
  229. },
  230. lower() {
  231. this.get_team()
  232. },
  233. get_team() {
  234. this.api.team(10, ++this.page).then(res => {
  235. res.data.data.forEach(ele => {
  236. this.team_list.push({
  237. nickname: ele.nickname,
  238. phone: ele.phone,
  239. is_cert: ele.is_cert,
  240. headimg: ele.headimg,
  241. create_at: ele.create_at,
  242. level: ele.level
  243. })
  244. })
  245. })
  246. }
  247. }
  248. }
  249. </script>
  250. <style scoped lang="less">
  251. .index {
  252. box-sizing: border-box;
  253. position: relative;
  254. }
  255. .top {
  256. display: flex;
  257. justify-content: space-between;
  258. padding: 0 32rpx;
  259. color: #000;
  260. font-size: 32rpx;
  261. line-height: 90rpx;
  262. width: 680rpx;
  263. z-index: 999;
  264. text-align: center;
  265. }
  266. .center_first {
  267. position: relative;
  268. }
  269. .center {
  270. position: absolute;
  271. color: #000;
  272. top: 95%;
  273. left: 42.5%;
  274. z-index: 999;
  275. }
  276. .bot {
  277. width: 750rpx;
  278. .bottom {
  279. background: #1D1F1E;
  280. width: 686rpx;
  281. margin: 32rpx auto;
  282. border-radius: 32rpx;
  283. .bsn {
  284. width: 348rpx;
  285. margin: 32rpx auto;
  286. }
  287. .top1 {
  288. display: flex;
  289. color: #FFEC01;
  290. align-items: center;
  291. justify-content: center;
  292. font-size: 40rpx;
  293. >view:first-child,
  294. >view:last-child {
  295. width: 20rpx;
  296. height: 20rpx;
  297. border-radius: 50%;
  298. margin: 0 15rpx;
  299. }
  300. }
  301. .num {
  302. color: #fff;
  303. text-align: center;
  304. font-size: 32rpx;
  305. margin-top: ;
  306. border-bottom: 1px solid #333;
  307. width: 590rpx;
  308. margin: 46rpx auto 0;
  309. padding-bottom: 20rpx;
  310. font-weight: bold;
  311. }
  312. .people {
  313. width: 690rpx;
  314. height: 622rpx;
  315. margin: 20rpx auto 0;
  316. border-radius: 24rpx;
  317. font-size: 28rpx;
  318. .top2 {
  319. display: flex;
  320. justify-content: space-between;
  321. align-items: center;
  322. height: 88rpx;
  323. border-radius: 24rpx 24rpx 0 0;
  324. padding: 0 42rpx 0 70rpx;
  325. }
  326. .bot1 {
  327. display: flex;
  328. align-items: center;
  329. justify-content: space-between;
  330. padding: 12rpx 70rpx 32rpx 84rpx;
  331. }
  332. }
  333. }
  334. .bsn {
  335. width: 348rpx;
  336. margin: 32rpx auto 48rpx;
  337. }
  338. .down {
  339. width: 645rpx;
  340. height: 96rpx;
  341. // background: linear-gradient(to right, #47372A, #0E0B08);
  342. margin: 0 auto 86rpx;
  343. display: flex;
  344. align-items: center;
  345. justify-content: center;
  346. color: #000;
  347. font-size: 28rpx;
  348. background: linear-gradient(180deg, #69FF60 0%, #0C9D5B 100%);
  349. border-radius: 24rpx;
  350. >view {
  351. // border: 1px solid #937D63;
  352. width: 500rpx;
  353. height: 108rpx;
  354. display: flex;
  355. align-items: center;
  356. justify-content: space-between;
  357. // padding: 0 32rpx;
  358. >view {
  359. display: flex;
  360. // flex-direction: column;
  361. align-items: center;
  362. }
  363. >view:nth-child(2) {
  364. border-left: 1px solid #fff;
  365. height: 40rpx;
  366. }
  367. }
  368. }
  369. }
  370. .invint {
  371. width: 670rpx;
  372. height: 1028rpx;
  373. margin: auto;
  374. }
  375. </style>