groupInvite.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view class="app">
  3. <view class="app-body fx-h fx-bc fx-ac" v-if="data != null">
  4. <view class="avatar">
  5. <image :src="data.img == '' ? '/static/chat/group_chat.png' : data.img"></image>
  6. </view>
  7. <view class="text">{{data.name}}</view>
  8. </view>
  9. <view class="fx-h fx-bc fx-ac" v-if="isSub">
  10. <view class="tips" v-if="data.is_timeout">该邀请链接已过期了,请重新获取</view>
  11. <view class="tips" v-else-if="data.is_increase">你已经加入群聊了</view>
  12. <view class="btn" v-else @tap="tapAddQl">加入群聊</view>
  13. </view>
  14. <view class="fx-h fx-bc fx-ac" v-else>提交成功</view>
  15. </view>
  16. </template>
  17. <script>
  18. import {mapState,mapMutations} from 'vuex';
  19. export default {
  20. computed: mapState(['user','sysData']),
  21. data() {
  22. return {
  23. code:"",
  24. data : {
  25. is_timeout:false,
  26. is_increase:false
  27. },
  28. isSub : true
  29. }
  30. },
  31. onLoad(options) {
  32. this.code = decodeURIComponent(options.code || "");
  33. this.initView();
  34. },
  35. methods: {
  36. initView:function(){
  37. uni.showLoading({ title:"加载中.." });
  38. this
  39. .request
  40. .post("grouptoken",{token:this.code})
  41. .then(res=>{
  42. console.log(res)
  43. uni.hideLoading();
  44. if(res.code == 200) {
  45. this.data = res.data.groupData;
  46. } else {
  47. this.utils.Tip(res.msg);
  48. }
  49. })
  50. .catch(err=>{
  51. console.log(err,'errrr')
  52. this.utils.Tip("加载失败");
  53. uni.hideLoading();
  54. });
  55. },
  56. tapAddQl:function(){
  57. uni.showLoading({ title:"提交中.." });
  58. this
  59. .request
  60. .post("chatGroup_add_code",{token:this.code})
  61. .then(res=>{
  62. uni.hideLoading();
  63. if(res.code == 200) {
  64. this.isSub = false;
  65. uni.switchTab({
  66. url:"/pages/chat/index"
  67. })
  68. uni.showToast({
  69. title:"提交成功",
  70. icon:"success"
  71. })
  72. } else {
  73. this.utils.Tip(res.msg);
  74. }
  75. })
  76. .catch(err=>{
  77. this.utils.Tip("加载失败");
  78. uni.hideLoading();
  79. });
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. .app-body{background: #fff;margin: 10px;border-radius: 8px;padding: 20px;}
  86. .app-body .avatar image{width: 80px;height: 80px;}
  87. .btn{background: $ic-appcolor;height: 40px;border-radius: 20px;width: 100px;text-align: center;line-height: 40px;color: #fff;font-size: 14px;position: fixed;bottom: 10px;}
  88. .tips{font-size: 14px;color: #787878;}
  89. </style>