金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
2.4 KiB

  1. <template>
  2. <view class="count-down-box" v-if="show">
  3. <view class="mask">
  4. </view>
  5. <view class="box">
  6. <view class="title">
  7. <view>抢购的人数较多</view>
  8. <view>服务器拥挤</view>
  9. </view>
  10. <view class="img-box">
  11. <image mode="widthFix" src="https://ibrand-miniprogram.oss-cn-hangzhou.aliyuncs.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/time-bg.png" alt></image>
  12. <view class="num" :class="'num' + '-' + num">
  13. {{num}}
  14. </view>
  15. <view class="mountain">
  16. <image mode="widthFix" src="https://ibrand-miniprogram.oss-cn-hangzhou.aliyuncs.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/time-bg-mountain.png" alt></image>
  17. </view>
  18. </view>
  19. <view class="clone" @tap="close">
  20. X
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. interval: '',
  30. lodNum: ''
  31. };
  32. },
  33. components: {},
  34. props: {
  35. show: {
  36. type: Boolean,
  37. observer: '_change'
  38. },
  39. num: {
  40. type: Number,
  41. value: 10
  42. }
  43. },
  44. methods: {
  45. close() {
  46. this.setData({
  47. num: this.data.lodNum,
  48. show: false
  49. });
  50. clearInterval(this.data.interval);
  51. this.$emit('endTen');
  52. },
  53. _change(newVal, oldVal) {// if (newVal) {
  54. // var interval = setInterval(() => {
  55. // var num = this.data.num;
  56. // num--
  57. // this.setData({
  58. // num: num
  59. // });
  60. // if (this.data.num == 0) {
  61. // this.close()
  62. // }
  63. // }, 1000);
  64. // this.setData({
  65. // interval: interval
  66. // })
  67. // }
  68. }
  69. },
  70. ready() {
  71. this.setData({
  72. lodNum: this.data.num
  73. });
  74. },
  75. setData: function (obj) {
  76. let that = this;
  77. let keys = [];
  78. let val, data;
  79. Object.keys(obj).forEach(function (key) {
  80. keys = key.split('.');
  81. val = obj[key];
  82. data = that.$data;
  83. keys.forEach(function (key2, index) {
  84. if (index + 1 == keys.length) {
  85. that.$set(data, key2, val);
  86. } else {
  87. if (!data[key2]) {
  88. that.$set(data, key2, {});
  89. }
  90. }
  91. data = data[key2];
  92. });
  93. });
  94. },
  95. computed: {},
  96. watch: {}
  97. };
  98. </script>
  99. <style rel="stylesheet/less" lang="less">
  100. @import "ten";
  101. </style>