show-real-text.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <text class="show-real-text" @longpress="handleLongpress">{{text}}</text>
  3. </template>
  4. <script>
  5. export default {
  6. props: {
  7. real: {
  8. type: String,
  9. required: true
  10. },
  11. type: {
  12. type: [String, Number],
  13. required: true
  14. }
  15. },
  16. data() {
  17. return {
  18. text : this.$showReal(this.type,this.real),
  19. timer: null,
  20. }
  21. },
  22. methods: {
  23. async handleLongpress() {
  24. if(this.$store.state.user.userInfo.deptId !== '369'){
  25. let timeId = undefined;
  26. this.text = this.real;
  27. const { id: belongSystemId, systemName: belongSystemName } = this.$store.state.user.belongSystem;
  28. await uni.$u.api.saveLog({ accessType : "1", belongSystemId, belongSystemName, accessBelongSystem: belongSystemName, accessContent: this.real });
  29. timeId = setTimeout(() => {
  30. clearTimeout(timeId);
  31. this.text = this.$showReal(this.type,this.real);
  32. }, 10000);
  33. uni.setClipboardData({
  34. data : this.real,
  35. showToast : false
  36. });
  37. }
  38. },
  39. },
  40. mounted() {
  41. },
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .show-real-text {
  46. user-select: none;
  47. }
  48. </style>