From 6d9652287b1aaf1fbb2423921b4ea036839c5a74 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Tue, 31 Oct 2023 14:26:06 +0800
Subject: [PATCH] fix:小程序分享功能
---
pages/actionChange/workOrderDetails/index.vue | 1 +
pages/login/login.vue | 1 -
main.js | 4 +++-
utils/share.js | 39 +++++++++++++++++++++++++++++++++++++++
App.vue | 1 +
pages/index/index.vue | 4 ++++
6 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/App.vue b/App.vue
index 2dbd4d1..1e09fad 100644
--- a/App.vue
+++ b/App.vue
@@ -25,6 +25,7 @@
uni.clearStorageSync()
uni.setStorageSync('userInfor', JSON.stringify(result.data))
uni.setStorageSync('tonken', result.data.token)
+ uni.setStorageSync('openId', result.data.openId)
getDic()
this.$isResolve()
} else {
diff --git a/main.js b/main.js
index 5470a1f..f4ec32e 100644
--- a/main.js
+++ b/main.js
@@ -6,6 +6,7 @@
// import * as common from './utils/common' // ������������
import store from './store/index.js'
import storage from './utils/storage' // ������������
+import share from './utils/share.js' // ������������������������������������
import '.env.js'
// ������������
Vue.prototype.$store = store
@@ -24,4 +25,5 @@
})
app.$mount()
import uView from '@/uni_modules/uview-ui'
-Vue.use(uView)
\ No newline at end of file
+Vue.use(uView)
+Vue.mixin(share)
\ No newline at end of file
diff --git a/pages/actionChange/workOrderDetails/index.vue b/pages/actionChange/workOrderDetails/index.vue
index 9feaf22..2520f8d 100644
--- a/pages/actionChange/workOrderDetails/index.vue
+++ b/pages/actionChange/workOrderDetails/index.vue
@@ -40,6 +40,7 @@
console.log('option', option)
//option���object������������������������������������������������
this.basicInfor = JSON.parse(option.infor)
+ this.share.title = '���������������'
},
onBackPress(e) {
uni.navigateBack({
diff --git a/pages/index/index.vue b/pages/index/index.vue
index bc74e39..76ce2ed 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -46,6 +46,7 @@
this.showTabBar = data.data.showTabBar
this.$refs.agencyPage.getContaminateList()
})
+ this.share.title = this.title
},
methods: {
getData() {
@@ -56,9 +57,12 @@
if (index === 2) {
this.isShow = false
this.title = '������'
+ this.share.title = this.title
}
if (index === 0) {
this.isShow = true
+ this.title = '������'
+ this.share.title = this.title
this.$nextTick(() => {
this.getData()
})
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 97bcf15..4a89982 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -108,7 +108,6 @@
console.log('openId', value)
if (value) {
this.logining(value)
- console.log('openId', openId)
}
},
logining(openId) {
diff --git a/utils/share.js b/utils/share.js
new file mode 100644
index 0000000..721afd2
--- /dev/null
+++ b/utils/share.js
@@ -0,0 +1,39 @@
+export default {
+ data() {
+ return {
+ // ������������������������������������������
+ share: {
+ title: '������',
+ path: '/pages/index/index', // ���������������������
+ imageUrl: '', // ���������������������(������������������)
+ }
+ }
+ },
+ // ������������������
+ // 1.���������������
+ onShareAppMessage(res) {
+ // ���������������������
+ let pages = getCurrentPages(),
+ // ���������������������������
+ page = pages[pages.length - 1]
+ // console.log("���������������������", pages);
+ this.share.path = `/${page.route}`
+ if (page.options.infor) {
+ this.share.path = `/${page.route}?infor=${page.options.infor}`
+ }
+ console.log('page.options', page.options)
+ return {
+ title: this.share.title,
+ path: this.share.path,
+ imageUrl: this.share.imageUrl,
+ }
+ },
+ // //2.������������������
+ // onShareTimeline(res) {
+ // return {
+ // title: this.share.title,
+ // path: this.share.path,
+ // imageUrl: this.share.imageUrl,
+ // }
+ // },
+}
\ No newline at end of file
--
Gitblit v1.8.0