From 475970ef9a0b30f344a653dbe44892baea507748 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Thu, 10 Oct 2024 17:53:56 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B1=9E=E6=80=A7=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/diy/custom.vue | 17 ++--
components/diy/data-magic.vue | 29 ++++---
components/diy/img-magic.vue | 38 +++++----
components/diy/modules/custom/model-panel.vue | 77 +++++++++++++++++++
4 files changed, 131 insertions(+), 30 deletions(-)
create mode 100644 components/diy/modules/custom/model-panel.vue
diff --git a/components/diy/custom.vue b/components/diy/custom.vue
index 7c101043..40457fa7 100644
--- a/components/diy/custom.vue
+++ b/components/diy/custom.vue
@@ -5,20 +5,19 @@
-
+
-
+
-
+
-
+
+
+
+
@@ -33,6 +32,7 @@ import modelText from '@/components/diy/modules/custom/model-text.vue';
import modelLines from '@/components/diy/modules/custom/model-lines.vue';
import modelImage from '@/components/diy/modules/custom/model-image.vue';
import modelIcon from '@/components/diy/modules/custom/model-icon.vue';
+import modelPanel from '@/components/diy/modules/custom/model-panel.vue';
export default {
components: {
@@ -40,6 +40,7 @@ export default {
modelLines,
modelImage,
modelIcon,
+ modelPanel
},
props: {
propValue: {
diff --git a/components/diy/data-magic.vue b/components/diy/data-magic.vue
index 48f52a9d..72a59fa3 100644
--- a/components/diy/data-magic.vue
+++ b/components/diy/data-magic.vue
@@ -1,6 +1,6 @@
-
-
+
+
@@ -72,8 +72,6 @@
const app = getApp();
import magicCarousel from '@/components/diy/modules/data-magic/magic-carousel.vue';
import { background_computer, common_styles_computer, common_img_computer, gradient_computer, radius_computer, percentage_count, isEmpty, padding_computer } from '@/common/js/common/common.js';
- var system = app.globalData.get_system_info(null, null, true);
- var sys_width = app.globalData.window_width_handle(system.windowWidth);
export default {
components: {
magicCarousel,
@@ -104,6 +102,7 @@
container_size: 0,
style_container: '',
style_img_container: '',
+ div_width: 0
};
},
computed: {
@@ -125,7 +124,7 @@
this.init();
},
},
- created() {
+ mounted() {
this.init();
},
methods: {
@@ -141,12 +140,25 @@
spacing: this.new_style.image_spacing + 'rpx',
content_radius: radius_computer(this.new_style.data_radius),
content_img_radius: radius_computer(this.new_style.img_radius),
- cubeCellWidth: sys_width / density,
- container_size: sys_width * 2 + 'rpx',
data_magic_list: this.get_data_magic_list(this.form.data_magic_list),
style_container: common_styles_computer(this.new_style.common_style) + 'box-sizing: border-box;', // 用于样式显示
style_img_container: common_img_computer(this.new_style.common_style),
});
+ this.$nextTick(() => {
+ const query = uni.createSelectorQuery().in(this);
+ query
+ .select('.magic-container')
+ .boundingClientRect((res) => {
+ if ((res || null) != null) {
+ this.setData({
+ div_width: res.width,
+ cubeCellWidth: res.width / density,
+ container_size: res.width + 'px',
+ });
+ }
+ })
+ .exec();
+ });
},
get_data_magic_list(data) {
data.forEach((item) => {
@@ -216,7 +228,7 @@
},
// 计算成百分比
percentage(num) {
- return percentage_count(num, sys_width);
+ return percentage_count(num, this.div_width);
},
// 根据传递的参数,从对象中取值
trends_config(style, key) {
@@ -260,7 +272,6 @@