推送,分享
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考勤系统",
|
||||
"appid" : "__UNI__4796942",
|
||||
"description" : "",
|
||||
"versionName" : "2.1.7",
|
||||
"versionCode" : 217,
|
||||
"versionName" : "2.2.0",
|
||||
"versionCode" : 220,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
@ -82,7 +82,20 @@
|
||||
"push" : {
|
||||
"unipush" : {
|
||||
"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" : {}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { onExit, onShow } from "@dcloudio/uni-app";
|
||||
import config from "../../config"
|
||||
onShow(() => {
|
||||
@ -17,43 +17,15 @@ onShow(() => {
|
||||
// bottom: 0,
|
||||
// });
|
||||
// }
|
||||
// const currentPages = getCurrentPages()
|
||||
// const currentWebview = currentPages[currentPages.length - 1].$getAppWebview()
|
||||
// currentWebview.append(wv)
|
||||
// var pages = getCurrentPages();
|
||||
// var page = pages[pages.length - 1];
|
||||
// var currentWebview = page.$getAppWebview();
|
||||
|
||||
|
||||
|
||||
})
|
||||
// 监听收到推送消息
|
||||
|
||||
import { Communication } from '../../utils/communication.js';
|
||||
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 = () => {
|
||||
uni.share({
|
||||
provider: 'weixin',
|
||||
@ -116,12 +88,17 @@ const shareH5 = () => {
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
const webLoad = (e) => {
|
||||
const message = e.detail.data?.[0] || '';
|
||||
commun.handleMessage(message);
|
||||
};
|
||||
function initializeWebView() {
|
||||
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
||||
commun.setWebView(currentWebview.children()[0])
|
||||
}
|
||||
//load-complete 注册函数
|
||||
commun.registerHandler('load-complete', () => {
|
||||
|
||||
initializeWebView()
|
||||
const { statusBarHeight } = uni.getSystemInfoSync()
|
||||
commun.webViewObj.setStyle({
|
||||
@ -130,6 +107,7 @@ commun.registerHandler('load-complete', () => {
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
commun.registerHandler('getLocation', (data) => {
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
@ -142,10 +120,46 @@ commun.registerHandler('getLocation', (data) => {
|
||||
},
|
||||
})
|
||||
})
|
||||
const webLoad = (e) => {
|
||||
const message = e.detail.data?.[0] || '';
|
||||
commun.handleMessage(message);
|
||||
};
|
||||
commun.registerHandler('goCard', async (data) => {
|
||||
await getCard(data.phone)
|
||||
})
|
||||
|
||||
// 获取电子名片
|
||||
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>
|
||||
|
||||
<style></style>
|
||||
|
Loading…
Reference in New Issue
Block a user