var t = getApp(), a = require("../../../wxParse/wxParse.js");

Page({
    data: {
        content: {},
        catname: "",
        tid: 0,
        id:0,
        copyright: "",
        blist: {},
        hide_tabbar: "0"
    },
    onLoad: function(e) {
        var r = e.tid, i = t.siteInfo.uniacid,id = e.id;
        this.setData({
            tid: r,
            id:id
        });
        var n = this;
        t.util.request({
            url: "?action=about",
            data: {
                m: "yyf_company",
                action:"about",
                id:id
            },
            cachetime: 0,
            success: function(t) {
                t.data.errno || (n.setTabBar(r), a.wxParse("article1", "html", t.data.data.content, n, 10), 
                n.setData({
                    content: t.data.data.content,
                    catname: t.data.data.catname
                }), wx.setNavigationBarTitle({
                    title: t.data.data.catname
                }));
            }
        }), t.util.request({
            url: "?action=tabbar",
            data: {
                action: "tabbar"
            },
            cachetime: 0,
            success: function(t) {
                if (!t.data.errno) {
                    var a = wx.getStorageSync("barlist");
                    "" != a && a.uptime == t.data.data.uptime || (wx.setStorageSync("barlist", t.data.data), 
                    n.setTabBar());
                }
            }
        });
    },
    onShareAppMessage: function(t) {
        return {
            title: this.data.catname,
            path: "/yyf_company/pages/about/about?tid=" + this.data.tid
        };
    },
    setTabBar: function(t) {
        if (!(n = wx.getStorageSync("barlist"))) return !1;
        this.setData({
            blist: n,
            tcolor: n.tcolor,
            hide_tabbar: n.hide_tabbar
        });
        var a, e;
        a = "" != n.font_color ? n.font_color : "#ffffff", e = "" != n.head_color ? n.head_color : n.tcolor, 
        wx.setNavigationBarColor({
            frontColor: a,
            backgroundColor: e
        });
        var r = getCurrentPages(), i = r[r.length - 1], n = this.data.blist;
        i.options.tid == t && (n.isCurrentPage = !0);
        var o = new Array(n.m1_path, n.m2_path, n.m3_path, n.m4_path), s = 0;
        for (var c in o) o[c] == t && (s = parseInt(c) + 1);
        n.currentNum = s, this.setData({
            blist: n
        });
    },
    tel: function() {
        var t = this.data.blist.phone;
        wx.makePhoneCall({
            phoneNumber: t
        });
    },
    driver: function() {
        wx.openLocation({
            latitude: Number(this.data.blist.jing),
            longitude: Number(this.data.blist.wei),
            address: this.data.blist.address
        });
    },
    tabNav: function(t) {
        var a = t.currentTarget.dataset.url, e = t.currentTarget.dataset.tab;
        "-1" != a.indexOf("https") ? (wx.setStorageSync("navurl", a), a = "../webview/webview?op=" + e, 
        wx.navigateTo({
            url: a
        })) : wx.redirectTo({
            url: a
        });
    },
    copy_action: function() {
        var t = this.data.blist.copyright;
        if ("1" == t.copy_kind) {
            var a = t.copy_phone;
            wx.makePhoneCall({
                phoneNumber: a
            });
        }
        if ("2" == t.copy_kind) {
            var e = t.copy_appid, r = t.copy_ddress;
            wx.navigateToMiniProgram({
                appId: e,
                path: r,
                success: function(t) {}
            });
        }
    }
});