InputIsbn.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <u-popup v-model="showPopup" @close="closePopup" @open="openPopup" mode="center" border-radius="20" width="85%">
  3. <view class="popup-content">
  4. <view class="popup-title">请输入图书ISBN编码</view>
  5. <view class="desc-text">请输入不含“-”符号的13位或10位ISBN编码</view>
  6. <image src="https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/barcode.png" alt="ISBN Barcode"
  7. style="height:200rpx;margin-bottom: 20rpx" mode="heightFix" />
  8. <u-input v-model="isbn" placeholder="在此输入ISBN编码" class="popup-input" input-align="center"
  9. :custom-style="{'border-radius': '10rpx',height:'80rpx'}" border />
  10. <view class="buttons">
  11. <button @click="cancel">取消</button>
  12. <button @click="submit">提交</button>
  13. </view>
  14. </view>
  15. </u-popup>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. showPopup: false,
  22. isbn: '',
  23. };
  24. },
  25. methods: {
  26. openPopup() {
  27. this.isbn = '';
  28. this.showPopup = true;
  29. },
  30. closePopup() {
  31. this.showPopup = false;
  32. },
  33. cancel() {
  34. this.isbn = '';
  35. this.closePopup();
  36. },
  37. submit() {
  38. if (!this.isbn) {
  39. uni.showToast({
  40. title: '请输入ISBN编码',
  41. icon: 'none'
  42. });
  43. return;
  44. }
  45. // Handle ISBN submission
  46. this.$emit('submit', this.isbn)
  47. this.closePopup();
  48. },
  49. },
  50. };
  51. </script>
  52. <style lang="scss">
  53. .popup-content {
  54. text-align: center;
  55. padding: 40rpx;
  56. .desc-text {
  57. font-family: PingFang SC;
  58. font-weight: 400;
  59. font-size: 26rpx;
  60. color: #333333;
  61. margin: 20rpx 0;
  62. }
  63. .popup-title {
  64. font-family: PingFang SC;
  65. font-weight: bold;
  66. font-size: 32rpx;
  67. color: #38C148;
  68. }
  69. .buttons {
  70. display: flex;
  71. justify-content: space-between;
  72. margin-top: 20px;
  73. gap: 30rpx;
  74. button {
  75. flex: 1;
  76. height: 80rpx;
  77. line-height: 80rpx;
  78. font-size: 32rpx;
  79. border-radius: 10rpx;
  80. border: none;
  81. &:first-child {
  82. background-color: #F5F5F5;
  83. color: #333333;
  84. }
  85. &:last-child {
  86. background-color: #38C148;
  87. color: #FFFFFF;
  88. }
  89. }
  90. }
  91. }
  92. </style>