Xiao_123 před 6 měsíci
rodič
revize
cf790cf275
4 změnil soubory, kde provedl 36 přidání a 25 odebrání
  1. 18 0
      App.vue
  2. 0 2
      main.js
  3. 0 22
      mixins/share.js
  4. 18 1
      pages/index/position.vue

+ 18 - 0
App.vue

@@ -1,6 +1,24 @@
 <script>
+import { onShareAppMessage,onShareTimeline } from '@dcloudio/uni-app'
 	export default {
 		onLaunch: function() {
+			
+			wx.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
+			onShareAppMessage(() => {
+				return {
+					title: '门墩儿 专注顶尖招聘',
+					path: '/pages/index/position'
+				}
+			})
+			onShareTimeline(() => {
+				return {
+					title: '门墩儿 专注顶尖招聘',
+					path: '/pages/index/position'
+				}
+			})
 			console.log('App Launch')
 			uni.setStorageSync('firstOpen', true)
 

+ 0 - 2
main.js

@@ -17,7 +17,6 @@ app.$mount()
 import { createSSRApp } from 'vue'
 import App from './App.vue'
 import { createPinia } from 'pinia'
-import share from './mixins/share'
 import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
 const pinia = createPinia()
 pinia.use(piniaPluginPersistedstate)
@@ -25,7 +24,6 @@ pinia.use(piniaPluginPersistedstate)
 export function createApp() {
   const app = createSSRApp(App)
   app.use(pinia)
-  app.mixin(share)
 
   return {
     app

+ 0 - 22
mixins/share.js

@@ -1,22 +0,0 @@
-export default {
-  created() {
-    //#ifdef MP-WEIXIN
-    wx.showShareMenu({
-      withShareTicket: true,
-      menus: ['shareAppMessage', 'shareTimeline']
-    })
-    //#endif
-  },
-  onShareAppMessage() {
-    return {
-      title: '门墩儿 专注顶尖招聘',
-      path: '/pages/index/position'
-    }
-  },
-  onShareTimeline() {
-    return {
-      title: '门墩儿 专注顶尖招聘',
-      path: '/pages/index/position'
-    }
-  }
-}

+ 18 - 1
pages/index/position.vue

@@ -62,7 +62,7 @@ import AdvertisePop from '@/components/Advertisement'
 import { dealDictObjData } from '@/utils/position'
 import { getJobAdvertisedSearch } from '@/api/position'
 import { showAuthModal } from '@/hooks/useModal'
-import { onShow, onLoad } from '@dcloudio/uni-app'
+import { onShow, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
 import layoutPage from '@/layout'
 import Navbar from '@/components/Navbar'
 import { getRewardEventList } from '@/utils/eventList'
@@ -76,6 +76,23 @@ onShow(() => {
 })
 
 onLoad(() => {
+  
+  wx.showShareMenu({
+    withShareTicket: true,
+    menus: ['shareAppMessage', 'shareTimeline']
+  })
+  onShareAppMessage(() => {
+    return {
+      title: '门墩儿 专注顶尖招聘',
+      path: '/pages/index/position'
+    }
+  })
+  onShareTimeline(() => {
+    return {
+      title: '门墩儿 专注顶尖招聘',
+      path: '/pages/index/position'
+    }
+  })
   if (!uni.getStorageSync('token')) getRewardEventList()
 })