|
|
@@ -527,6 +527,9 @@ import ProductTitle from '../../components/product/ProductTitle.vue';
|
|
|
import ProductBanner from '../../components/product/ProductBanner.vue';
|
|
|
import OrderOpen from '../../components/order/OrderOpen.vue';
|
|
|
import starPost from '../../components/star/post.vue';
|
|
|
+import { usePageVisibility } from '@vant/use';
|
|
|
+import { ref, watch } from 'vue';
|
|
|
+import store from '../../store';
|
|
|
export default {
|
|
|
components: {
|
|
|
HashCode,
|
|
|
@@ -535,6 +538,17 @@ export default {
|
|
|
OrderOpen,
|
|
|
starPost
|
|
|
},
|
|
|
+ setup(props, ctx) {
|
|
|
+ const pageVisibility = usePageVisibility();
|
|
|
+ watch(pageVisibility, value => {
|
|
|
+ store.dispatch('getTime');
|
|
|
+ });
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ netTime() {
|
|
|
+ this.getTime();
|
|
|
+ }
|
|
|
+ },
|
|
|
mixins: [asset, product],
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -568,7 +582,7 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState(['userInfo']),
|
|
|
+ ...mapState(['userInfo', 'netTime']),
|
|
|
banners() {
|
|
|
return this.info.pic || [];
|
|
|
},
|
|
|
@@ -583,6 +597,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.$store.dispatch('getTime');
|
|
|
if (this.$route.query.id) {
|
|
|
this.assetId = this.$route.query.id;
|
|
|
}
|
|
|
@@ -946,7 +961,9 @@ export default {
|
|
|
startTime = this.dayjs(this.info.createdAt).add(this.accMul(this.holdDays, 24), 'hours');
|
|
|
}
|
|
|
|
|
|
+ let subTime = parseInt(this.netTime / 1000);
|
|
|
let seconds = this.dayjs(startTime, 'YYYY-MM-DD HH:mm:ss').diff(this.dayjs(), 'second');
|
|
|
+ seconds = seconds - subTime;
|
|
|
let str = '';
|
|
|
let d = Math.floor(seconds / 24 / 3600);
|
|
|
if (abs(d) > 0) {
|
|
|
@@ -964,7 +981,7 @@ export default {
|
|
|
clearTimeout(this.timer);
|
|
|
this.timer = null;
|
|
|
}
|
|
|
- if (!this.dayjs().isBefore(this.dayjs(startTime, 'YYYY-MM-DD HH:mm:ss'))) {
|
|
|
+ if (seconds <= 0) {
|
|
|
if (this.getProduct) {
|
|
|
this.getProduct(false);
|
|
|
}
|