💎
@@ -87,19 +87,38 @@ export default {
Swiper,
SwiperSlide
},
- setup() {
+ methods:{
+ async startMatching(type = 'small', amount = null) {
+ // 先导航到匹配页面
+ await this.$router.push('/matching')
+
+ // 等待页面加载完成后触发匹配
+ setTimeout(() => {
+ // 通过全局事件总线触发匹配页面的匹配方法
+ window.dispatchEvent(new CustomEvent('autoStartMatching', {
+ detail: {
+ type,
+ amount
+ }
+ }))
+ }, 500)
+ }
+ },
+ setup(){
+
+
// 响应式数据
const userPoints = ref(0)
const carouselItems = ref([
- { image: '/imgs/top/1.jpg', title: '限时优惠活动' },
- { image: '/imgs/top/2.jpg', title: '新用户专享' },
- { image: '/imgs/top/3.jpg', title: '积分兑换' }
+ { image: '../..../../imgs/top/1.jpg', title: '限时优惠活动' },
+ { image: '../../imgs/top/2.jpg', title: '新用户专享' },
+ { image: '../../imgs/top/3.jpg', title: '积分兑换' }
])
const headerItems = ref([
- { image: "/imgs/mainpage/交易记录.png", text: "交易记录", path: "/transfers" },
- { image: "/imgs/mainpage/订单查询.png", text: "订单查询", path: "/points-history" },
- { image: "/imgs/mainpage/客服中心.png", text: "客服中心", path: "/support" },
- { image: "/imgs/mainpage/系统公告.png", text: "系统公告", path: "/announcements" }
+ { image: "../../imgs/mainpage/交易记录.png", text: "交易记录", path: "/transfers" },
+ { image: "../../imgs/mainpage/订单查询.png", text: "订单查询", path: "/points-history" },
+ { image: "../../imgs/mainpage/客服中心.png", text: "客服中心", path: "/support" },
+ { image: "../../imgs/mainpage/系统公告.png", text: "系统公告", path: "/announcements" }
])
const newsItems = ref([
"最新活动:双十一特惠",
@@ -145,7 +164,7 @@ export default {
carouselItems,
headerItems,
newsItems,
- getUserPoints // 如果需要外部调用可以暴露
+ getUserPoints// 如果需要外部调用可以暴露
}
}
}
diff --git a/src/views/MyMatching.vue b/src/views/MyMatching.vue
index 82944ed..b95b4a7 100644
--- a/src/views/MyMatching.vue
+++ b/src/views/MyMatching.vue
@@ -207,6 +207,25 @@ export default {
},
async mounted() {
await this.loadData()
+
+ // 监听自动开始匹配事件
+ const handleAutoStartMatching = async (event) => {
+ const { type, amount } = event.detail
+
+ // 如果有指定匹配类型则切换
+ if (type === 'large' && amount) {
+ this.matchingType = 'large'
+ this.customAmount = amount
+ } else {
+ this.matchingType = 'small'
+ }
+
+ // 触发匹配
+ await this.createOrder()
+ }
+
+ window.addEventListener('autoStartMatching', handleAutoStartMatching)
+
},
methods: {
async loadData() {
diff --git a/src/views/MyShop.vue b/src/views/MyShop.vue
index f73111f..54291e7 100644
--- a/src/views/MyShop.vue
+++ b/src/views/MyShop.vue
@@ -10,7 +10,7 @@
点击查看积分明细
-

+