call.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="call-box" @click.stop="sayHi">
  3. <view class="call-icon">
  4. <image class="call-img" src="/static/img/circle/Group-100243@2x.png" mode="aspectFill"></image>
  5. </view>
  6. <view class="call-text sys-weight-600 sys-color-black">打招呼</view>
  7. </view>
  8. </template>
  9. <script>
  10. import {
  11. sayHi
  12. } from "@/api/utility";
  13. import tools from "@/service/tools";
  14. export default {
  15. name: "call",
  16. components: {},
  17. props: {
  18. userId: {
  19. default: ''
  20. }
  21. },
  22. data() {
  23. return {
  24. isAjax: false
  25. }
  26. },
  27. watch: {},
  28. mounted() {
  29. },
  30. methods: {
  31. sayHi() {
  32. if (this.isAjax) {
  33. return false
  34. }
  35. this.isAjax = true
  36. sayHi(this.userId).then((res) => {
  37. this.isAjax = false
  38. if (res.code === 0) {
  39. tools.success('打招呼成功')
  40. } else {
  41. tools.error(res.msg)
  42. }
  43. })
  44. }
  45. }
  46. }
  47. </script>
  48. <style scoped lang="scss">
  49. .call-box {
  50. height: 40rpx;
  51. border-radius: 200rpx;
  52. border: 2rpx solid #141414;
  53. padding: 4rpx 16rpx;
  54. display: flex;
  55. justify-content: space-between;
  56. .call-img {
  57. width: 40rpx;
  58. height: 40rpx;
  59. margin-right: 8rpx;
  60. }
  61. .call-text {
  62. font-size: 28rpx;
  63. line-height: 40rpx;
  64. }
  65. }
  66. </style>