var a;
(a = getApp()),
  Page({
    data: {
      highe: wx.getSystemInfoSync().windowHeight,
      width: wx.getSystemInfoSync().windowWidth,
      showModal: !1,
      stepList: [],
      todaystep: 0,
      imagePath: "",
      page: 1,
      topNum: 0,
      userinfo: {},
      classid: 0,
      moduleList: [
        {
          name: "打字信件",
          desc: "输入你想说的话,短信通知Ta",
          is_shield: 0,
          url: "/pages/baike/biaobai/index",
          redirect: "listen",
          is_out: 0,
        },
        {
          name: "提取信件",
          desc: "输入手机号提取你的信件",
          is_shield: 0,
          need_shield: 1,
          url: "/packageA/pages/carcx/index",
          redirect: "dubbing",
          is_out: 0,
        },
        {
          name: "文字文案",
          desc: "文字纯文字文案素材库",
          is_shield: 0,
          need_shield: 1,
          url: "/packageA/pages/cardzbd/incxjl",
          redirect: "oral",
          is_out: 0,
        },
      ],
      moduleListc: [
        {
          name: "文案背景",
          desc: "背景寻找文案配图中心",
          is_shield: 0,
          url: "/packageA/pages/carclzt/incxjl",
          redirect: "listen",
          is_out: 0,
        },
        {
          name: "特效文案",
          desc: "特殊字符组成的文案",
          is_shield: 0,
          need_shield: 1,
          url: "/packageA/pages/carjqx/incxjl",
          redirect: "oral",
          is_out: 0,
        },
        {
          name: "文案原创",
          desc: "输入你的文案变成原创",
          is_shield: 0,
          url: "/packageA/pages/carnj/incxjl",
          redirect: "listen",
          is_out: 0,
        },
      ],
    },
    onLoad: function (a) {
      this.Load(), this.getsys();
    },
    getsys: function () {
      var t = this,
        e = { uid: wx.getStorageSync("uid") };
      a.getdata(e, "Yjcax").then((a) => {
        if ((console.log("油价", a), a)) {
          var e = a.price;
          let i = [];
          for (var o in e)
            if (
              "hao0" == [o] ||
              "hao90" == [o] ||
              "hao92" == [o] ||
              "hao95" == [o] ||
              "hao98" == [o]
            ) {
              let a = { name: o.replace("hao", "汽油") + "#", value: e[o] };
              i.push(a);
            }
          t.setData({ yjcx: i, yjdata: a });
        }
      });
    },
    imgPreview: function (t) {
      console.log(t.currentTarget.dataset.id),
        this.data.jlad &&
          a.videoad(this.data.jlad, "观看视频广告获取最新金价~").then((a) => {
            console.log("回调广告:", a);
          });
    },
    chaping: function () {
      let a = null;
      wx.createInterstitialAd &&
        ((a = wx.createInterstitialAd({ adUnitId: this.data.cpad })),
        a.onLoad(() => {}),
        a.onError((a) => {}),
        a.onClose(() => {})),
        setTimeout(function () {
          a &&
            a.show().catch((a) => {
              console.error(a);
            });
        }, 3e3);
    },
    HUASHU: function (t) {
      wx.pageScrollTo({ scrollTop: 0 }),
        this.setData({ classid: t.currentTarget.dataset.classid, page: 1 });
      var e = { nodeid: t.currentTarget.dataset.classid, page: this.data.page };
      if (0 == this.data.classid) this.Load();
      else {
        var o = this,
          i = this.data.classid;
        (e = {
          model: "article",
          key: a.globalData.Key,
          tid: i,
          limit: 10,
          page: o.data.page,
        }),
          a.getdata(e, "GetData/getDataPage").then((a) => {
            console.log("回调数据:", a.data.data),
              o.setData({ xcx: a.data.data }),
              o.goTop();
          });
      }
    },
    goto: function (t) {
      console.log(t.currentTarget.dataset.id),
        this.data.jlad
          ? a.videoad(this.data.jlad, "观看视频广告解锁改素材~").then((a) => {
              console.log("回调广告:", a),
                1 == a &&
                  wx.navigateTo({
                    url: "../detail/detail?id=" + t.currentTarget.dataset.id,
                    success: (a) => {},
                    fail: (a) => {},
                  });
            })
          : wx.navigateTo({
              url: "../detail/detail?id=" + t.currentTarget.dataset.id,
              success: (a) => {},
              fail: (a) => {},
            });
    },
    bindSearch: function (a) {
      this.data.keyword
        ? wx.navigateTo({
            url: "../search/search?keyword=" + this.data.keyword,
          })
        : wx.showModal({ title: "温馨提示~", content: "请输入搜索内容" });
    },
    bindKeyword: function (a) {
      this.setData({ keyword: a.detail.value });
    },
    fabu: function (a) {
      this.data.userdata
        ? wx.navigateTo({ url: "../fabu/fabu" })
        : wx.navigateTo({ url: "../../login/login" });
    },
    pullLoad: function (t) {
      var e = this,
        o = {
          model: "article",
          key: a.globalData.Key,
          tid: 1,
          limit: 10,
          page: e.data.page + 1,
        };
      if (0 == this.data.classid)
        a.getdata(o, "GetData/getDataPage").then((a) => {
          console.log("回调数据:", a.data.data),
            e.setData({
              xcx: e.data.xcx.concat(a.data.data),
              page: e.data.page + 1,
              floorstatus: !0,
            });
        });
      else {
        t = this;
        var i = this.data.classid;
        (o = {
          model: "article",
          key: a.globalData.Key,
          tid: i,
          limit: 10,
          page: t.data.page + 1,
        }),
          a.getdata(o, "GetData/getDataPage").then((a) => {
            console.log("回调数据:", a.data.data),
              t.setData({
                xcx: e.data.xcx.concat(a.data.data),
                page: e.data.page + 1,
                floorstatus: !0,
              });
          });
      }
    },
    scrolltoupper: function (a) {
      console.log(a),
        a.detail.scrollTop > 100
          ? this.setData({ cangotop: !0 })
          : this.setData({ cangotop: !1 });
    },
    goTop: function (a) {
      this.setData({ topNum: 0 });
    },
    gohome: function (a) {
      wx.navigateToMiniProgram({
        appId: this.data.adappid,
        path: this.data.adappidpage,
        extarData: { open: "happy" },
        envVersion: "release",
        success(a) {},
      });
    },
    navto: function (a) {
      console.log(a),
        a.currentTarget.dataset.url,
        wx.navigateToMiniProgram({
          appId: this.data.appid,
          path: "",
          extarData: { open: "happy" },
          envVersion: "release",
          success(a) {},
        });
    },
    Load: function (t) {
      var e = this,
        o = {
          model: "article",
          key: a.globalData.Key,
          tid: 1,
          limit: 10,
          page: e.data.page,
        };
      a.getdata(o, "GetData/getDataPage").then((a) => {
        console.log("回调数据:", a.data.data), e.setData({ xcx: a.data.data });
      }),
        (o = { model: "classtype", key: a.globalData.Key }),
        a.getdata(o, "GetData/getDataclasstype").then((a) => {
          console.log("回调分类数据:", a.data.data),
            e.setData({ dh: a.data.data });
        });
    },
    redirectTo: function (a) {
      var t = a.currentTarget.dataset.page,
        e = a.currentTarget.dataset.id,
        o = a.currentTarget.dataset.appid;
      console.log(a),
        o
          ? wx.navigateToMiniProgram({
              appId: o,
              path: t,
              extarData: { open: "happy" },
              envVersion: "release",
              success(a) {},
            })
          : wx.navigateTo({ url: t + "?id=" + e });
    },
    tongzhi: function (t) {
      var e = this,
        o = e.data.dyId;
      o &&
        wx.requestSubscribeMessage({
          tmplIds: [o],
          success(t) {
            if ("accept" == t[o]) {
              e.setData({ sets: "0" });
              var i = e.data.userdata.openid;
              console.log(i),
                i &&
                  a.util.request({
                    url: "entry/wxapp/addtemplateid",
                    data: { templateid: o, openid: i },
                    header: { "content-type": "application/json" },
                    success: function (a) {
                      console.log(a);
                    },
                  });
            } else
              wx.showToast({ title: "订阅失败" }), e.setData({ sets: "1" });
          },
          fail(a) {
            console.log(a);
          },
          complete(a) {
            console.log(a);
          },
        });
    },
    onReady: function () {},
    onShow: function () {},
    onHide: function () {},
    onUnload: function () {},
    onPullDownRefresh: function () {},
    onReachBottom: function () {},
    onShareAppMessage: function () {
      return {
        title: "汽车查查-今日油价查询,查询你的城市油价",
        path: "/packageA/pages/yjcx/yjcx",
        success: function (a) {
          console.log(a);
        },
      };
    },
  });