From 6f3832725245daa6ffb7f229f0faed75f72c9895 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Mon, 31 Mar 2025 15:02:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 3 +++ mixins/myMixins.js | 42 +++++++++++++++++++++++++++++++++ pages/index/index.vue | 11 +++++---- static/js/request.js | 2 +- subPackages/order/trades.vue | 2 +- subPackages/webPage/webPage.vue | 15 ++++++++---- 6 files changed, 63 insertions(+), 12 deletions(-) create mode 100644 mixins/myMixins.js diff --git a/main.js b/main.js index 56f7689..96732c3 100644 --- a/main.js +++ b/main.js @@ -4,6 +4,9 @@ import App from './App' import store from './store' import '@/static/js/request.js' import '@/static/js/CommonFunction.js' +import {myMixins} from '@/mixins/myMixins.js' + +Vue.mixin(myMixins) Vue.config.productionTip = false diff --git a/mixins/myMixins.js b/mixins/myMixins.js new file mode 100644 index 0000000..2f412e9 --- /dev/null +++ b/mixins/myMixins.js @@ -0,0 +1,42 @@ + +export const myMixins ={ + onLoad(option) { + console.log('option',option) + if(option && option.wechat_qrcode){ + uni.setStorageSync('wechat_qrcode',option.wechat_qrcode) + } + // 分享 + uni.showShareMenu({ + withShareTicket: true, + //设置下方的Menus菜单,才能够让发送给朋友与分享到朋友圈两个按钮可以点击 + menus: ["shareAppMessage", "shareTimeline"] + }) + }, + // 分享到朋友圈 + onShareTimeline() { + return { + title: '智游常熟', + type: 0, + summary: "edewdewdewf", + imageUrl: "https://static.ticket.sz-trip.com/dongtai/images/index/share.jpg" + } + }, + onShareAppMessage() { + const pages = getCurrentPages(); // 获取加载的页面 + const view = pages[pages.length - 1]; // 获取当前页面的对象 + let url = ''; + if (view.options.url) { + url = view.options.url; + } else { + url = uni.getStorageSync('webUrl'); + } + + console.log(111,url,`${view.route}?url=${url}`) + return { + title: '智游常熟', // 分享的名称 + path: `${view.route}?url=${url}`, // 将 url 作为参数传递 + imageUrl: "https://static.ticket.sz-trip.com/dongtai/images/index/share.jpg", + mpId: 'wxb8f15afe2765976d' // 此处配置微信小程序的 AppId + }; + } +} \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index 14c2928..cdbc611 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -89,7 +89,8 @@ - + + @@ -100,7 +101,7 @@ :key="tagsIndex">{{tags}} - {{ item.begin_date }}—{{ item.end_date }} + {{ item.start_time }}—{{ item.end_time }} ¥{{ item.price / 100 }} @@ -447,10 +448,10 @@ offset: this.hotList.length, limit:this.limit, type_id: 7, - }, '/api/pbservice/Actcalendar/getActList').then(res => { + }, '/api/activity/getActivityCalendar').then(res => { if(res) { - if(res.data.rows.length < this.limit) this.isLoading = true - this.hotList = this.hotList.concat(res.data.rows) + if(res.data.length < this.limit) this.isLoading = true + this.hotList = this.hotList.concat(res.data) } }) }else if(this.typeIndex == 5) { diff --git a/static/js/request.js b/static/js/request.js index 7628d93..f9186e3 100644 --- a/static/js/request.js +++ b/static/js/request.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import store from '@/store'; // 定义 API URL -const CS_API_URL = 'http://changshu.js-dyyj.com/'; +const CS_API_URL = 'http://changshu.js-dyyj.com'; const JDSZ_API_URL = 'https://api.cloud.sz-trip.com'; const NEWAPIURL = process.env.NODE_ENV === 'development' ? CS_API_URL : CS_API_URL; diff --git a/subPackages/order/trades.vue b/subPackages/order/trades.vue index 314a68f..a5e0cee 100644 --- a/subPackages/order/trades.vue +++ b/subPackages/order/trades.vue @@ -346,7 +346,7 @@ export default { }, success: resTwo => { let data = resTwo.data.data - let httpUrl = 'https://m.cloud.sz-trip.com/' + let httpUrl = 'https://test.m.cloud.sz-trip.com/' let url = '' // 根据类型跳转到不同的订单详情页面 switch (data.order_product_list[0].product_model){ diff --git a/subPackages/webPage/webPage.vue b/subPackages/webPage/webPage.vue index 208fb2f..3b1ea06 100644 --- a/subPackages/webPage/webPage.vue +++ b/subPackages/webPage/webPage.vue @@ -10,11 +10,16 @@ export default { } }, onLoad(option) { - if (option.url) { - this.url = decodeURIComponent(option.url) - }else{ - this.url = uni.getStorageSync('webUrl') - } + if (option.url) { + try { + this.url = decodeURIComponent(option.url); + } catch (error) { + console.error('URL解码出错:', error); + this.url = uni.getStorageSync('webUrl'); + } + } else { + this.url = uni.getStorageSync('webUrl'); + } console.log(this.url) // 传入需要跳转的链接 使用web-view标签进行跳转 }