haibao.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view>
  3. <view style="color: #fff;">
  4. <tn-nav-bar :isBack="isBack" backgroundColor="#207cf7" :bottomShadow="false">生成海报</tn-nav-bar>
  5. <view :style="{ height: tobheight + 'px' }"></view>
  6. </view>
  7. <!-- <u-button type="primary" @click="share_qrcode()">生成海报</u-button> -->
  8. <!-- <xq-generate-poster ref="draw" /> -->
  9. <!-- <button @click="authSub">授权</button> -->
  10. <view class="haibaoBox">
  11. <view class="picBox">
  12. <!-- <image class="image"
  13. src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F5d88a972-1b34-43ed-8b3a-4a7ebbb900a1%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1709774078&t=fdeadb95e331fcac8780960e7f2e1629">
  14. </image> -->
  15. <XQ-GeneratePoster ref="draw" />
  16. </view>
  17. <view class="bgList">
  18. <!-- <view class="item"> -->
  19. <image @click="handleChangeBg(item,index)" class="image2 " :class="[curBgIndex==index?'image2_a':'']"
  20. v-for="(item,index) in bgList" :src="item">
  21. </image>
  22. <!-- </view> -->
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. // import XqGeneratePoster from '@/components/XQGeneratePoster.vue';
  29. // import XqGeneratePoster from '@/uni_modules/XQ-GeneratePoster/components/XQ-GeneratePoster/XQ-GeneratePoster.vue';
  30. import wechat from '@/common/wechat/sdk.js';
  31. export default {
  32. // components: { XqGeneratePoster },
  33. data() {
  34. return {
  35. tobheight: 45,
  36. curBgIndex: 0,
  37. bgList: [
  38. 'https://pic1.zhimg.com/80/v2-2714df42147132464a71af391ed04be4_720w.jpg',
  39. 'https://pic1.zhimg.com/80/v2-2714df42147132464a71af391ed04be4_720w.jpg',
  40. 'https://pic1.zhimg.com/80/v2-2714df42147132464a71af391ed04be4_720w.jpg',
  41. 'https://pic1.zhimg.com/80/v2-2714df42147132464a71af391ed04be4_720w.jpg',
  42. 'https://pic1.zhimg.com/80/v2-2714df42147132464a71af391ed04be4_720w.jpg'
  43. ],
  44. option: {
  45. //绘制海报内容
  46. codeUrl: 'https://pic1.zhimg.com/80/v2-2714df42147132464a71af391ed04be4_720w.jpg', //小程序太阳码
  47. picUrl: 'https://pic1.zhimg.com/80/v2-2714df42147132464a71af391ed04be4_720w.jpg', //题库图片
  48. headUrl: 'https://pic1.zhimg.com/80/v2-b9df1fdfe67f2177d5c84af90dcadfc1_720w.jpg?source=1940ef5c', //头像
  49. bgUrl: require('@/static/shareBg.png'), //图片背景填充,和 fillStyle 只能传一个,bgUrl 优先级高于 fillStyle
  50. fillStyle: '#0688ff', //纯色背景填充颜色
  51. nickName: 'X艾拉', //授权登录的用户名
  52. miniName: '', //小程序名称
  53. tkName: '免费体验Al生成个人质感艺术照', //题库名称
  54. tkAuthor: '设计微信/抖音/小红书专属头像', //题库作者
  55. tkType: '考试', //题库类型
  56. cost: '免费', //是否需要收费 免费/付费
  57. isPub: '公开' //公开 还是 私有
  58. }
  59. };
  60. },
  61. onShow() {
  62. this.$nextTick(() => {
  63. this.share_qrcode()
  64. })
  65. // wechat.authSubscribe()
  66. // setTimeout(() => {
  67. // wechat.getLocation(() => {
  68. // })
  69. // }, 5000)
  70. },
  71. methods: {
  72. handleChangeBg(item, index) {
  73. this.curBgIndex = index
  74. console.log('handleChangeBg------------------', item);
  75. this.option.bgUrl = item
  76. this.share_qrcode()
  77. },
  78. authSub() {
  79. wechat.initJssdk()
  80. console.log('weichat---', wechat.authSubscribe);
  81. // wechat.authSubscribe((res) => {
  82. // uni.showToast({
  83. // title: res
  84. // })
  85. // })
  86. },
  87. share_qrcode() {
  88. this.$refs.draw.share_qrcode(this.option);
  89. }
  90. }
  91. };
  92. </script>
  93. <style lang="scss" scoped>
  94. @import url('./haibao.scss');
  95. </style>