2025-03-11 17:57:17 +08:00

121 lines
2.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Vue from 'vue'
import App from './App'
import uView from 'uview-ui'
// http config
import http from './common/api.js'
import MyRequest from 'common/MyRequest.js'
import { menuLimit } from './utils/utils.js'
/* import ElementUI from "element-ui";
Vue.use(ElementUI);
ElementUI.Dialog.props.closeOnClickModal.default = false; //按个人需要此项目需要设置el-dialog 默认点击遮照为不关闭
*/
Vue.prototype.$http = http//挂载到vue上
Vue.prototype.$MyRequest = MyRequest//挂载到vue上
Vue.config.productionTip = false
Vue.prototype.$menuLimit = menuLimit;
//定义的在检查更新时候的地址
Vue.prototype.$URL={
serverURL:''
}
/**
* * 用户信息
*/
Vue.prototype.$login={
appName:"ziWMS",//app名称
userid: uni.getStorageSync('userid') ,//用户id
username:uni.getStorageSync('username') ,//用户名称
sitename: uni.getStorageSync('sitename'),//账号
version: uni.getStorageSync('appVersion'),//plus.runtime.version,//app版本
tokenId: uni.getStorageSync('tokenId') ,//令牌id
}
/**
* 获取剩余高度
* @param {输入控件数量} count
* @param {微调值} fineTuning
* @param {单个控件标准高度} standardHeight
*/
Vue.prototype.$GetRemainingHeight=function(count,fineTuning,standardHeight){
let h=0;
// 设备硬件通讯
uni.getSystemInfo({
success: function (res) {
if(!standardHeight){
standardHeight=50;
}
h=res.windowHeight-(count*standardHeight+fineTuning);
}
});
return h;
}
Vue.prototype.$showMessage=function(msg,interval){
if(!msg){
console.log('弹框信息位空,不进行实际弹框操作')
return;
}
if(!interval){
interval = 6000;//6秒
}
uni.showToast({
icon: 'none',
title: msg,
duration: interval,
});
}
//提示音
Vue.prototype.$play=function(flag){
var playPath = '';
if(flag=='success'){
playPath = 'static/voice/success.wav'; // ok改为success ng改为fail
}else{
//长震动(苹果只有长震动)
uni.vibrateLong({
success: function () {
console.log('success');
}
});
playPath = 'static/voice/fail.wav';
}
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = playPath;
innerAudioContext.onPlay(() => {
console.log('开始播放');
});
innerAudioContext.onEnded(() => {
innerAudioContext.destroy();
// innerAudioContext = null;
});
// innerAudioContext.onError((res) => {
// console.log("声音播放失败:"+res);
// innerAudioContext.destroy();
// // innerAudioContext = null;
// });
}
Vue.prototype.$playFail=function()
{
Vue.prototype.$play('fail')
}
Vue.prototype.$playSuccess=function()
{
Vue.prototype.$play('success')
}
Vue.use(uView)
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()