callAlarm.vue 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <view>
  3. <view class="call_alarm_back" @tap="callAlarm">
  4. <image mode="widthFix" src="/static/common/alarm.png" style="width: 45upx" />
  5. <view style="font-size: 22upx; color: #fff">警报</view>
  6. </view>
  7. </view>
  8. </template>
  9. <script setup>
  10. // import { ref, watch, reactive, toRefs, onMounted } from "vue";
  11. import request from '/common/request.js';
  12. const callAlarm = () => {
  13. uni.showLoading({
  14. content: '加载中',
  15. mask: true
  16. });
  17. request({
  18. url: '/api/userjs/callPost',
  19. method: 'GET',
  20. success: (res) => {
  21. console.log('警报结果', res);
  22. uni.showToast({
  23. title: res.data.msg,
  24. duration: 1500,
  25. icon: 'none'
  26. });
  27. },
  28. fail: () => {},
  29. complete: () => {
  30. setTimeout(() => {
  31. uni.hideLoading();
  32. }, 1500);
  33. }
  34. });
  35. };
  36. </script>
  37. <style lang="scss" scoped>
  38. .call_alarm_back {
  39. display: flex;
  40. flex-direction: column;
  41. align-items: center;
  42. width: 80upx;
  43. height: 80upx;
  44. border-radius: 50%;
  45. background-color: red;
  46. padding: 10upx;
  47. }
  48. </style>