2025-03-11 17:57:17 +08:00
|
|
|
|
import Vue from 'vue'
|
|
|
|
|
import App from './App'
|
|
|
|
|
import uView from 'uview-ui'
|
2025-03-10 13:49:13 +08:00
|
|
|
|
|
2025-03-11 17:57:17 +08:00
|
|
|
|
// 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 默认点击遮照为不关闭
|
2025-03-11 09:45:29 +08:00
|
|
|
|
*/
|
2025-03-11 17:57:17 +08:00
|
|
|
|
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
|
|
|
|
|
}
|
2025-03-10 13:49:13 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取剩余高度
|
|
|
|
|
* @param {输入控件数量} count
|
|
|
|
|
* @param {微调值} fineTuning
|
|
|
|
|
* @param {单个控件标准高度} standardHeight
|
|
|
|
|
*/
|
2025-03-11 17:57:17 +08:00
|
|
|
|
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;
|
|
|
|
|
}
|
2025-03-10 13:49:13 +08:00
|
|
|
|
|
2025-03-11 17:57:17 +08:00
|
|
|
|
Vue.prototype.$showMessage=function(msg,interval){
|
|
|
|
|
if(!msg){
|
|
|
|
|
console.log('弹框信息位空,不进行实际弹框操作')
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(!interval){
|
|
|
|
|
interval = 6000;//6秒
|
|
|
|
|
}
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: msg,
|
|
|
|
|
duration: interval,
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-03-10 13:49:13 +08:00
|
|
|
|
|
2025-03-11 17:57:17 +08:00
|
|
|
|
//提示音
|
|
|
|
|
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');
|
|
|
|
|
}
|
2025-03-10 13:49:13 +08:00
|
|
|
|
});
|
2025-03-11 17:57:17 +08:00
|
|
|
|
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;
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
}
|
2025-03-10 13:49:13 +08:00
|
|
|
|
|
2025-03-11 17:57:17 +08:00
|
|
|
|
Vue.prototype.$playFail=function()
|
|
|
|
|
{
|
|
|
|
|
Vue.prototype.$play('fail')
|
|
|
|
|
}
|
|
|
|
|
Vue.prototype.$playSuccess=function()
|
|
|
|
|
{
|
|
|
|
|
Vue.prototype.$play('success')
|
|
|
|
|
}
|
2025-03-10 13:49:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-11 17:57:17 +08:00
|
|
|
|
Vue.use(uView)
|
2025-03-10 13:49:13 +08:00
|
|
|
|
|
2025-03-11 17:57:17 +08:00
|
|
|
|
App.mpType = 'app'
|
2025-03-10 13:49:13 +08:00
|
|
|
|
|
|
|
|
|
const app = new Vue({
|
2025-03-11 17:57:17 +08:00
|
|
|
|
...App
|
|
|
|
|
})
|
|
|
|
|
app.$mount()
|