This commit is contained in:
jia 2023-11-18 11:02:11 +08:00
parent 286c8020a7
commit 13e188e2e8
3 changed files with 107 additions and 0 deletions

56
App.vue Normal file
View File

@ -0,0 +1,56 @@
<script>
//#ifdef APP-PLUS
const jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
export default {
onLaunch: function() {
console.log('App Launch')
// #ifdef APP-PLUS
//
plus.screen.lockOrientation('landscape-primary');
// #endif
var main = plus.android.runtimeMainActivity();
var pkName = main.getPackageName();
console.log(pkName)
},
onShow: function() {
console.log('App Show')
const audioContext = uni.createInnerAudioContext()
//
audioContext.src = '/static/mp3/order.mp3'
//
//#ifdef APP-PLUS
jpushModule.addNotificationListener(res => {
console.log(res,'111111')
if (res.notificationEventType == 'notificationOpened') return
audioContext.play()
uni.vibrateLong();
console.log("app的监听")
})
// #endif
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/*每个页面公共css */
* {
margin: 0;
padding: 0;
}
page {
background: #F3F4F8;
}
@import "static/css/base.css";
@import url('static/iconfont/iconfont.css')
</style>

21
index.html Normal file
View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css" />
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
</html>

30
main.js Normal file
View File

@ -0,0 +1,30 @@
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
import store from './store'
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
import moment from 'moment'
Vue.prototype.$moment = moment
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App,
store
})
app.$mount()
// #endif
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif