group_qrcode.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class="page">
  3. <view class="bode_main">
  4. <view class="qrimg">
  5. <tki-qrcode
  6. ref="qrcode"
  7. :val="qrData"
  8. :onval="true"
  9. :size="500"
  10. :icon="group_photo"
  11. :iconSize="65"
  12. unit="upx"
  13. background="#ffffff"
  14. foreground="#000000"
  15. pdground="#000000"
  16. :loadMake="true"
  17. :showLoading="true"
  18. loadingText="加载中..."
  19. @result="qrR" />
  20. <view class="qrimg-info">
  21. <text class="text_font" @tap="saveQrcode">保存到相册</text>
  22. </view>
  23. <!-- <view class="hr"></view>
  24. <uni-list class="list">
  25. <uni-list-item class="list-item" title="分享邀请链接" :showArrow="true"/>
  26. </uni-list> -->
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import tkiQrcode from '../../../components/tki-qrcode/tki-qrcode.vue';
  33. import _data from '../../../common/_data';
  34. import _hook from '../../../common/_hook';
  35. import _page from '../../../common/common';
  36. export default {
  37. components: {
  38. tkiQrcode,
  39. },
  40. data() {
  41. return {
  42. list_id: '',
  43. my_data: { id: 0 },
  44. group_photo: '',
  45. }
  46. },
  47. onShow(){
  48. _hook.routeTabBarHook();
  49. let _this = this;
  50. /** 监听新的个人数据 */
  51. uni.$on('data_user_info',function(data){
  52. _this.my_data = data;
  53. });
  54. _this.my_data = _data.data('user_info');
  55. this.group_photo = _data.data('cache')['group_photo_' + _this.list_id];
  56. },
  57. onLoad(option) {
  58. this.list_id = option.list_id;
  59. },
  60. onUnload(){
  61. uni.$off('data_user_info');
  62. },
  63. computed: {
  64. qrData(){
  65. return _page.qrAction.addGroup({user_id:this.my_data.id,list_id:this.list_id});
  66. },
  67. },
  68. methods: {
  69. qrR(ref){
  70. this.img_path = ref;
  71. },
  72. saveQrcode(){
  73. _page.saveImgToPhotos(this.img_path);
  74. }
  75. },
  76. watch: {
  77. },
  78. }
  79. </script>
  80. <style scoped>
  81. page{
  82. background-color: #ffffff;
  83. }
  84. .qrimg-info{
  85. padding: 20px 0 10px 0;
  86. }
  87. .text_font{
  88. font-size: 16px;
  89. color: #3d6db7;
  90. }
  91. .bode_main {
  92. margin: 150upx 0;
  93. border-radius: 50upx;
  94. text-align: center;
  95. }
  96. .hr{
  97. height: 18px;
  98. width: 100%;
  99. background-color: #e1e1e1;
  100. }
  101. .list-item{
  102. text-align: left;
  103. padding-left: 10px;
  104. }
  105. </style>