wbc
2024-09-06 8177b79722037a348b08375c63723356c07690c5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
mui.init({
 
});
 
/**
 * 过滤用户菜单
 */
mui.plusReady(function() {
    // mui.ready(function() {
    app.init();
    mui("#title")[0].innerHTML = app.APP_NAME_CN + "-"+plus.storage.getItem("FactoryName");
    GetHomeMenu();
    var currentSession = app.loadconfig(app.CONFIG_CURRENT_SESSION);
 
    mui("#userName")[0].innerHTML = currentSession.user_name; //登陆用户名
    mui("#userNumber")[0].innerHTML = "账号:" + currentSession.user_id; //登陆用户账号
    mui("#appName")[0].innerHTML = "关于" + app.APP_NAME_CN; //登陆用户账号
    console.log('1');
    plus.runtime.getProperty(plus.runtime.appid, function(inf) {
        mui("#version")[0].innerHTML = inf.version; //当前APP版本
    });
    GetLastSetPrintType();
});
//设置便携打印机的类型
$(function(){
    document.querySelector('.mui-table-view.mui-table-view-radio').addEventListener('selected',function(e){
        // console.log("以前选中的为:"+plus.storage.getItem("PrintType"));
        // console.log("当前选中的为:"+e.detail.el.id);
        plus.storage.setItem('PrintType', e.detail.el.id);
    });
});
 
function GetLastSetPrintType()
{
    var PrintType = "PrintTypeWifi";
    if (typeof plus != "undefined" && plus.storage.getItem("PrintType")!=null) {
        PrintType = plus.storage.getItem("PrintType");
    } 
    else if(typeof localStorage != "undefined" && localStorage.getItem("PrintType")!=null){
        PrintType=localStorage.getItem("PrintType");
    }
    // console.log('111111111111'+PrintType);
    if (PrintType=='PrintTypeBlueToolth') {
        if($('#PrintTypeWifi').hasClass('mui-selected'))
        {
            $('#PrintTypeWifi').removeClass('mui-selected');
        }
        if(!$('#PrintTypeBlueToolth').hasClass('mui-selected'))
        {
            $('#PrintTypeBlueToolth').addClass('mui-selected');
        }
    }
    else
    {
        if(!$('#PrintTypeBlueToolth').hasClass('mui-selected'))
        {
            $('#PrintTypeBlueToolth').removeClass('mui-selected');
        }
        if(!$('#PrintTypeWifi').hasClass('mui-selected'))
        {
            $('#PrintTypeWifi').addClass('mui-selected');
        }
    }
}
 
function GetHomeMenu() {
    var data = GetUserMenu('sys', app.APP_Sys_Number);
    // var data = GetUserMenu('sys', 'admin');
    if(data.status != 0) {
        mui.alert(JSON.stringify(data.message));
        return;
    }
    SetUserMenu_Menu(data.data, mui("#mlist")[0]);
    mui("#menu_sum")[0].innerHTML = data.data.length;
    initScrollWrapper(); //使用区域滚动组件,需手动初始化scroll控件
}
 
document.getElementById("refresh_home").addEventListener("tap",
    function(e) {
        GetHomeMenu();
        mui.toast('菜单刷新成功!');
    });
 
//返回
mui.back = function() {
    if(confirm('是否要退出系统?')) {
        plus.runtime.quit();
    }
};
element.addEventListener('touchstart',function () {
        
},{ passive: false });