推送,分享
This commit is contained in:
parent
c2168272de
commit
446498b893
BIN
files/pushicon/18.png
Normal file
BIN
files/pushicon/18.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
files/pushicon/24.png
Normal file
BIN
files/pushicon/24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
files/pushicon/36.png
Normal file
BIN
files/pushicon/36.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.0 KiB |
BIN
files/pushicon/48.png
Normal file
BIN
files/pushicon/48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
files/pushicon/72.png
Normal file
BIN
files/pushicon/72.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
@ -2,8 +2,8 @@
|
|||||||
"name" : "oa考勤系统",
|
"name" : "oa考勤系统",
|
||||||
"appid" : "__UNI__4796942",
|
"appid" : "__UNI__4796942",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "2.1.7",
|
"versionName" : "2.2.0",
|
||||||
"versionCode" : 217,
|
"versionCode" : 220,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
@ -82,7 +82,20 @@
|
|||||||
"push" : {
|
"push" : {
|
||||||
"unipush" : {
|
"unipush" : {
|
||||||
"offline" : true,
|
"offline" : true,
|
||||||
"version" : "2"
|
"oppo" : {},
|
||||||
|
"vivo" : {},
|
||||||
|
"mi" : {},
|
||||||
|
"honor" : {},
|
||||||
|
"version" : "2",
|
||||||
|
"icons" : {
|
||||||
|
"small" : {
|
||||||
|
"ldpi" : "unpackage/pushicon/18.png",
|
||||||
|
"mdpi" : "unpackage/pushicon/24.png",
|
||||||
|
"hdpi" : "unpackage/pushicon/36.png",
|
||||||
|
"xhdpi" : "unpackage/pushicon/48.png",
|
||||||
|
"xxhdpi" : "unpackage/pushicon/72.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"maps" : {}
|
"maps" : {}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view>
|
<web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { onExit, onShow } from "@dcloudio/uni-app";
|
import { onExit, onShow } from "@dcloudio/uni-app";
|
||||||
import config from "../../config"
|
import config from "../../config"
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
@ -17,43 +17,15 @@ onShow(() => {
|
|||||||
// bottom: 0,
|
// bottom: 0,
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
// const currentPages = getCurrentPages()
|
// var pages = getCurrentPages();
|
||||||
// const currentWebview = currentPages[currentPages.length - 1].$getAppWebview()
|
// var page = pages[pages.length - 1];
|
||||||
// currentWebview.append(wv)
|
// var currentWebview = page.$getAppWebview();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
// 监听收到推送消息
|
|
||||||
|
|
||||||
import { Communication } from '../../utils/communication.js';
|
import { Communication } from '../../utils/communication.js';
|
||||||
const commun = new Communication()
|
const commun = new Communication()
|
||||||
const share = () => {
|
|
||||||
uni.getProvider({
|
|
||||||
service: "share",
|
|
||||||
success: (res) => {
|
|
||||||
console.log(res)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
uni.share({
|
|
||||||
provider: 'weixin',
|
|
||||||
scene: "WXSceneSession",
|
|
||||||
type: 5,// 5代表分享为小程序
|
|
||||||
imageUrl: 'https://th.bing.com/th?id=ORMS.41c34644e7e67f95a14620e77064b5d9&pid=Wdp&w=268&h=140&qlt=90&c=1&rs=1&dpr=1&p=0', // 必填
|
|
||||||
title: '分享的标题',
|
|
||||||
miniProgram: {
|
|
||||||
id: "gh_97094c34debd",
|
|
||||||
path: "/pages/index/index",
|
|
||||||
type: 0,
|
|
||||||
webUrl: '/#/pages/list/detail',
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
console.log("success:" + JSON.stringify(res));
|
|
||||||
},
|
|
||||||
fail: function (err) {
|
|
||||||
console.log("fail:" + JSON.stringify(err));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const shareH5 = () => {
|
const shareH5 = () => {
|
||||||
uni.share({
|
uni.share({
|
||||||
provider: 'weixin',
|
provider: 'weixin',
|
||||||
@ -116,12 +88,17 @@ const shareH5 = () => {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
|
const webLoad = (e) => {
|
||||||
|
const message = e.detail.data?.[0] || '';
|
||||||
|
commun.handleMessage(message);
|
||||||
|
};
|
||||||
function initializeWebView() {
|
function initializeWebView() {
|
||||||
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
||||||
commun.setWebView(currentWebview.children()[0])
|
commun.setWebView(currentWebview.children()[0])
|
||||||
}
|
}
|
||||||
//load-complete 注册函数
|
//load-complete 注册函数
|
||||||
commun.registerHandler('load-complete', () => {
|
commun.registerHandler('load-complete', () => {
|
||||||
|
|
||||||
initializeWebView()
|
initializeWebView()
|
||||||
const { statusBarHeight } = uni.getSystemInfoSync()
|
const { statusBarHeight } = uni.getSystemInfoSync()
|
||||||
commun.webViewObj.setStyle({
|
commun.webViewObj.setStyle({
|
||||||
@ -130,6 +107,7 @@ commun.registerHandler('load-complete', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
commun.registerHandler('getLocation', (data) => {
|
commun.registerHandler('getLocation', (data) => {
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'gcj02',
|
type: 'gcj02',
|
||||||
@ -142,10 +120,46 @@ commun.registerHandler('getLocation', (data) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
const webLoad = (e) => {
|
commun.registerHandler('goCard', async (data) => {
|
||||||
const message = e.detail.data?.[0] || '';
|
await getCard(data.phone)
|
||||||
commun.handleMessage(message);
|
})
|
||||||
};
|
|
||||||
|
// 获取电子名片
|
||||||
|
async function getCard(phone) {
|
||||||
|
uni.request({
|
||||||
|
url: 'https://blockchain.szjixun.cn/api/e_card/info-phone',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
phone: phone
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
const resData = res.data.data
|
||||||
|
uni.share({
|
||||||
|
provider: 'weixin',
|
||||||
|
scene: "WXSceneSession",
|
||||||
|
type: 5,// 5代表分享为小程序
|
||||||
|
imageUrl: 'https://e-cdn.fontree.cn/fonchain-main/prod/image/139/avatar/ababc42c-7654-47f8-b22b-29dc589c71f0.png', // 必填
|
||||||
|
title: `${resData.name}的电子名片`,
|
||||||
|
miniProgram: {
|
||||||
|
id: "gh_97094c34debd",
|
||||||
|
path: `/pages/mine/index?uid=${resData.uid}&userType=${resData.userType}`,
|
||||||
|
type: 0,
|
||||||
|
webUrl: `/pages/mine/index?uid=${resData.uid}&userType=${resData.userType}`,
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
console.log("success:" + JSON.stringify(res));
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
console.log("fail:" + JSON.stringify(err));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('getCard', err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style></style>
|
||||||
|
Loading…
Reference in New Issue
Block a user