Merge branch 'master' of http://172.16.100.91:3000/xingyy/oa-base
This commit is contained in:
commit
022aaa9109
6
App.vue
6
App.vue
@ -1,4 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -8,7 +9,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 判断是否是第一次安装APP并且打开
|
// 判断是否是第一次安装APP并且打开
|
||||||
isFirstOpen(){
|
isFirstOpen() {
|
||||||
let isFirstOpen = uni.getStorageSync('isFirstOpen')
|
let isFirstOpen = uni.getStorageSync('isFirstOpen')
|
||||||
if (!isFirstOpen) {
|
if (!isFirstOpen) {
|
||||||
uni.setStorageSync('isFirstOpen', true)
|
uni.setStorageSync('isFirstOpen', true)
|
||||||
@ -17,6 +18,7 @@ export default {
|
|||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
networkStatusChange(res) {
|
networkStatusChange(res) {
|
||||||
|
console.log(res)
|
||||||
if (res.isConnected) {
|
if (res.isConnected) {
|
||||||
// 如果是第一次安装进入,并且网络状态为有网络,则跳转到主页
|
// 如果是第一次安装进入,并且网络状态为有网络,则跳转到主页
|
||||||
if (this.isFirstOpen()) {
|
if (this.isFirstOpen()) {
|
||||||
@ -50,6 +52,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
|
console.log('onLaunch')
|
||||||
|
|
||||||
},
|
},
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
uni.onNetworkStatusChange(this.networkStatusChange);
|
uni.onNetworkStatusChange(this.networkStatusChange);
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -2,8 +2,8 @@
|
|||||||
"name" : "oa考勤系统",
|
"name" : "oa考勤系统",
|
||||||
"appid" : "__UNI__4796942",
|
"appid" : "__UNI__4796942",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "2.1.6",
|
"versionName" : "2.1.7",
|
||||||
"versionCode" : 216,
|
"versionCode" : 217,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
@ -26,7 +26,8 @@
|
|||||||
"Maps" : {},
|
"Maps" : {},
|
||||||
"LivePusher" : {},
|
"LivePusher" : {},
|
||||||
"Push" : {},
|
"Push" : {},
|
||||||
"Barcode" : {}
|
"Barcode" : {},
|
||||||
|
"Share" : {}
|
||||||
},
|
},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
@ -74,8 +75,8 @@
|
|||||||
"ad" : {},
|
"ad" : {},
|
||||||
"share" : {
|
"share" : {
|
||||||
"weixin" : {
|
"weixin" : {
|
||||||
"appid" : "",
|
"appid" : "wx3a0f78634d074b23",
|
||||||
"UniversalLinks" : ""
|
"UniversalLinks" : "https://warehouse.szjixun.cn/oa_backend/static/aretree/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"push" : {
|
"push" : {
|
||||||
|
@ -1,76 +1,121 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- <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 } from 'vue'
|
||||||
import { onExit, onShow, onLoad } from "@dcloudio/uni-app";
|
import { onExit, onShow } from "@dcloudio/uni-app";
|
||||||
import config from "../../config"
|
import config from "../../config"
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
const { statusBarHeight } = uni.getSystemInfoSync()
|
// const { statusBarHeight } = uni.getSystemInfoSync()
|
||||||
const wv1 = plus.webview.getWebviewById("custom-webview");
|
// const wv1 = plus.webview.getWebviewById("custom-webview");
|
||||||
let wv = null;
|
// let wv = null;
|
||||||
if (wv1) {
|
// if (wv1) {
|
||||||
wv = wv1;
|
// wv = wv1;
|
||||||
} else {
|
// } else {
|
||||||
wv = plus.webview.create(config.h5Url, "custom-webview", {
|
// wv = plus.webview.create(config.h5Url, "custom-webview", {
|
||||||
top: statusBarHeight,
|
// top: statusBarHeight,
|
||||||
bottom: 0,
|
// bottom: 0,
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
const currentPages = getCurrentPages()
|
// const currentPages = getCurrentPages()
|
||||||
const currentWebview = currentPages[currentPages.length - 1].$getAppWebview()
|
// const currentWebview = currentPages[currentPages.length - 1].$getAppWebview()
|
||||||
currentWebview.append(wv)
|
// currentWebview.append(wv)
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
// 监听收到推送消息
|
||||||
|
|
||||||
import { Communication } from '../../utils/communication.js';
|
import { Communication } from '../../utils/communication.js';
|
||||||
const commun = new Communication()
|
const commun = new Communication()
|
||||||
|
const share = () => {
|
||||||
import {
|
uni.getProvider({
|
||||||
registerRequestPermissionTipsListener,
|
service: "share",
|
||||||
unregisterRequestPermissionTipsListener,
|
success: (res) => {
|
||||||
setRequestPermissionTips
|
console.log(res)
|
||||||
} from "@/uni_modules/uni-registerRequestPermissionTips"
|
|
||||||
|
|
||||||
const PermissionTips = {
|
|
||||||
"android.permission.READ_PHONE_STATE": "<h4 style=\"font-size:40px;\">正在读取网络状态权限</h4><font color=#cccccc>通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意</font>",
|
|
||||||
"android.permission.CAMERA": "<h4 style=\"font-size:40px;\">正在访问相机权限</h4><font color=#cccccc>需要扫描二维码或拍照,是否允许打开相机?</font>",
|
|
||||||
"android.permission.WRITE_EXTERNAL_STORAGE": "<h4 style=\"font-size:40px;\">正在读取相册权限</h4><font color=#cccccc>我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。</font>"
|
|
||||||
}
|
|
||||||
onExit(() => {
|
|
||||||
unregisterRequestPermissionTipsListener()
|
|
||||||
})
|
|
||||||
|
|
||||||
const brand = uni.getSystemInfoSync().deviceBrand
|
|
||||||
setRequestPermissionTips(PermissionTips)
|
|
||||||
registerRequestPermissionTipsListener({
|
|
||||||
onRequest: (e) => {
|
|
||||||
console.log('onRequest', e)
|
|
||||||
},
|
|
||||||
onConfirm: (e) => {
|
|
||||||
commun.sendToH5('permission-application', { action: 'open-permission', data: e });
|
|
||||||
},
|
|
||||||
onComplete: (e) => {
|
|
||||||
commun.sendToH5('permission-application', { action: 'close-permission', data: e });
|
|
||||||
|
|
||||||
// 华为手机在权限禁止之后,再次申请权限不会出现权限申请框。此时应该引导用户去系统设置开启此权限,不应该频繁申请。
|
|
||||||
if (brand.toLowerCase() === "huawei") {
|
|
||||||
const tips = {}
|
|
||||||
let hasDeniedPermission = false
|
|
||||||
for (let k in PermissionTips) {
|
|
||||||
if (e[k] !== "denied") {
|
|
||||||
tips[k] = PermissionTips[k]
|
|
||||||
} else {
|
|
||||||
hasDeniedPermission = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setRequestPermissionTips(tips) // 更新弹框提醒,防止华为手机不出现权限申请框时权限提醒框闪烁的情况
|
|
||||||
if (hasDeniedPermission)
|
|
||||||
uni.showModal({
|
|
||||||
content: "权限已经被拒绝,请前往设置中开启"
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
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',
|
||||||
|
scene: "WXSceneSession",
|
||||||
|
type: 0,// 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: '分享的标题',
|
||||||
|
href: 'https://www.baidu.com/',
|
||||||
|
success: function (res) {
|
||||||
|
console.log("success:" + JSON.stringify(res));
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
console.log("fail:" + JSON.stringify(err));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// import {
|
||||||
|
// registerRequestPermissionTipsListener,
|
||||||
|
// unregisterRequestPermissionTipsListener,
|
||||||
|
// setRequestPermissionTips
|
||||||
|
// } from "@/uni_modules/uni-registerRequestPermissionTips"
|
||||||
|
|
||||||
|
// const PermissionTips = {
|
||||||
|
// "android.permission.READ_PHONE_STATE": "<h4 style=\"font-size:40px;\">正在读取网络状态权限</h4><font color=#cccccc>通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意</font>",
|
||||||
|
// "android.permission.CAMERA": "<h4 style=\"font-size:40px;\">正在访问相机权限</h4><font color=#cccccc>需要扫描二维码或拍照,是否允许打开相机?</font>",
|
||||||
|
// "android.permission.WRITE_EXTERNAL_STORAGE": "<h4 style=\"font-size:40px;\">正在读取相册权限</h4><font color=#cccccc>我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。</font>"
|
||||||
|
// }
|
||||||
|
// onExit(() => {
|
||||||
|
// unregisterRequestPermissionTipsListener()
|
||||||
|
// })
|
||||||
|
|
||||||
|
// const brand = uni.getSystemInfoSync().deviceBrand
|
||||||
|
// setRequestPermissionTips(PermissionTips)
|
||||||
|
// registerRequestPermissionTipsListener({
|
||||||
|
// onRequest: (e) => {
|
||||||
|
// console.log('onRequest', e)
|
||||||
|
// },
|
||||||
|
// onConfirm: (e) => {
|
||||||
|
// commun.sendToH5('permission-application', { action: 'open-permission', data: e });
|
||||||
|
// },
|
||||||
|
// onComplete: (e) => {
|
||||||
|
// commun.sendToH5('permission-application', { action: 'close-permission', data: e });
|
||||||
|
|
||||||
|
// // 华为手机在权限禁止之后,再次申请权限不会出现权限申请框。此时应该引导用户去系统设置开启此权限,不应该频繁申请。
|
||||||
|
// if (brand.toLowerCase() === "huawei") {
|
||||||
|
// const tips = {}
|
||||||
|
// let hasDeniedPermission = false
|
||||||
|
// for (let k in PermissionTips) {
|
||||||
|
// if (e[k] !== "denied") {
|
||||||
|
// tips[k] = PermissionTips[k]
|
||||||
|
// } else {
|
||||||
|
// hasDeniedPermission = true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// setRequestPermissionTips(tips) // 更新弹框提醒,防止华为手机不出现权限申请框时权限提醒框闪烁的情况
|
||||||
|
// if (hasDeniedPermission)
|
||||||
|
// uni.showModal({
|
||||||
|
// content: "权限已经被拒绝,请前往设置中开启"
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
function initializeWebView() {
|
function initializeWebView() {
|
||||||
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
||||||
commun.setWebView(currentWebview.children()[0])
|
commun.setWebView(currentWebview.children()[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user