main.js 11.8 KB
global.webpackJsonp([24],{

/***/ 223:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
      value: true
});

var _vue = __webpack_require__(1);

var _vue2 = _interopRequireDefault(_vue);

var _index = __webpack_require__(224);

var _index2 = _interopRequireDefault(_index);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var app = new _vue2.default(_index2.default);
app.$mount();

exports.default = {
      config: {
            // navigationBarTitleText: '获赞数'
            // backgroundTextStyle: 'light',
            navigationBarBackgroundColor: '#000000'
      }
};

/***/ }),

/***/ 224:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_mpvue_loader_lib_selector_type_script_index_0_index_vue__ = __webpack_require__(226);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_mpvue_loader_lib_selector_type_script_index_0_index_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_mpvue_loader_lib_selector_type_script_index_0_index_vue__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_mpvue_loader_lib_template_compiler_index_id_data_v_a9e045ca_hasScoped_true_transformToRequire_video_src_source_src_img_src_image_xlink_href_node_modules_mpvue_loader_lib_selector_type_template_index_0_index_vue__ = __webpack_require__(228);
var disposed = false
function injectStyle (ssrContext) {
  if (disposed) return
  __webpack_require__(225)
}
var normalizeComponent = __webpack_require__(0)
/* script */

/* template */

/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-a9e045ca"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_mpvue_loader_lib_selector_type_script_index_0_index_vue___default.a,
  __WEBPACK_IMPORTED_MODULE_1__node_modules_mpvue_loader_lib_template_compiler_index_id_data_v_a9e045ca_hasScoped_true_transformToRequire_video_src_source_src_img_src_image_xlink_href_node_modules_mpvue_loader_lib_selector_type_template_index_0_index_vue__["a" /* default */],
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)
Component.options.__file = "src\\pages\\like\\index.vue"
if (Component.esModule && Object.keys(Component.esModule).some(function (key) {return key !== "default" && key.substr(0, 2) !== "__"})) {console.error("named exports are not supported in *.vue files.")}
if (Component.options.functional) {console.error("[vue-loader] index.vue: functional components are not supported with templates, they should use render functions.")}

/* hot reload */
if (false) {(function () {
  var hotAPI = require("vue-hot-reload-api")
  hotAPI.install(require("vue"), false)
  if (!hotAPI.compatible) return
  module.hot.accept()
  if (!module.hot.data) {
    hotAPI.createRecord("data-v-a9e045ca", Component.options)
  } else {
    hotAPI.reload("data-v-a9e045ca", Component.options)
  }
  module.hot.dispose(function (data) {
    disposed = true
  })
})()}

/* harmony default export */ __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ 225:
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ }),

/***/ 226:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _stringify = __webpack_require__(35);

var _stringify2 = _interopRequireDefault(_stringify);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

exports.default = {
  data: function data() {
    return {
      months: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
      like: [],
      like_percent: [],
      total: -1,
      hasHandleAuth: false
    };
  },

  watch: {
    like: function like(val) {
      var arr = [];
      var total = 0;
      val.forEach(function (item) {
        var style = "width:" + Math.round(item / 100).toFixed(0) + "%;";
        arr.push(style);
        total += item;
      });
      console.log(arr);
      this.like_percent = arr;
      this.total = total;
    }
  },
  methods: {
    load: function load() {
      this.like = [1345, 1058, 2557, 3058, 4017, 5550, 8220, 8575, 7420, 5402, 4520, 6327];
    },
    confirm: function confirm() {
      var _this = this;

      var sort = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;

      wx.showModal({
        title: '',
        content: '确定要定位吗?',
        success: function success(res) {
          if (res.confirm) {
            if (sort == 1) {
              _this.getLocation();
            } else if (sort == 2) {
              _this.getLocation('wgs84');
            } else if (sort == 3) {
              _this.getLocation1();
            }
          }
        }
      });
    },
    getLocation: function getLocation() {
      var _this2 = this;

      var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'gcj02';

      wx.showLoading({ title: '正在定位' });
      var lat = void 0,
          lng = void 0;
      wx.getLocation({
        type: type,
        success: function success(res) {
          lat = res.latitude;
          lng = res.longitude;
          wx.request({
            url: 'https://api.map.baidu.com/geocoder/v2/',
            data: {
              ak: 'AnWpq9Kc3C8cq5CCGAzsq3NxpBkxRnl0',
              location: lat + "," + lng,
              coordtype: type + 'll',
              output: 'json'
            },
            success: function success(res) {
              var formatted_address = res.data.result.formatted_address;
              wx.hideLoading();
              wx.showModal({ title: '定位成功', content: formatted_address, showCancel: false });
            }
          });
        },
        fail: function fail(err) {
          console.log((0, _stringify2.default)(res));
          wx.hideLoading();
          var authSetting = void 0;
          wx.getSetting({
            success: function success(res) {
              authSetting = res.authSetting['scope.userLocation'];
              console.log(authSetting);
            },
            complete: function complete() {
              if (authSetting) {
                if (_this2.hasHandleAuth) {
                  _this2.getLocation(type);
                } else {
                  _this2.service.UploadBug(_this2.rootUrl, 'test/getLocation/', (0, _stringify2.default)(err));
                  wx.showModal({
                    title: '定位失败',
                    content: '微信未获得位置权限\n请在您手机的系统设置-权限管理中,打开微信的位置信息获取权限',
                    showCancel: false
                  });
                }
              } else {
                wx.showModal({
                  title: '授权请求',
                  content: '您已拒绝小程序获取地理位置,若要使用定位功能,请重新授权',
                  showCancel: false,
                  success: function success(res) {
                    if (res.confirm) {
                      wx.openSetting({
                        success: function success(res) {
                          if (res.authSetting['scope.userLocation']) {
                            _this2.hasHandleAuth = true;
                            _this2.getLocation(type);
                          }
                        }
                      });
                    }
                  }
                });
              }
            }
          });
        }
      });
    },
    getLocation1: function getLocation1() {
      var _this3 = this;

      var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'gcj02';

      wx.showLoading({ title: '正在定位' });
      var lat = void 0,
          lng = void 0;
      wx.getLocation({
        type: type,
        success: function success(res) {
          lat = res.latitude;
          lng = res.longitude;
          wx.request({
            url: 'https://api.map.baidu.com/geocoder/v2/',
            data: {
              ak: 'AnWpq9Kc3C8cq5CCGAzsq3NxpBkxRnl0',
              location: lat + "," + lng,
              coordtype: type + 'll',
              output: 'json'
            },
            success: function success(res) {
              var formatted_address = res.data.result.formatted_address;
              wx.hideLoading();
              wx.showModal({ title: '定位成功', content: formatted_address, showCancel: false });
            }
          });
        },
        fail: function fail(res) {
          wx.hideLoading();
          var authSetting = void 0;
          wx.getSetting({
            success: function success(res) {
              authSetting = res.authSetting['scope.userLocation'];
              console.log(authSetting);
            },
            complete: function complete() {
              if (authSetting) {
                if (_this3.hasHandleAuth) {
                  _this3.getLocation1(type);
                } else if (type == 'gcj02') {
                  _this3.getLocation1('wgs84');
                } else {
                  wx.showModal({
                    title: '定位失败',
                    content: '微信未获得位置权限\n请在您手机的系统设置-权限管理中,打开微信的位置信息获取权限',
                    showCancel: false
                  });
                }
              } else {
                wx.showModal({
                  title: '授权请求',
                  content: '您已拒绝小程序获取地理位置,若要使用定位功能,请重新授权',
                  showCancel: false,
                  success: function success(res) {
                    if (res.confirm) {
                      wx.openSetting({
                        success: function success(res) {
                          if (res.authSetting['scope.userLocation']) {
                            _this3.hasHandleAuth = true;
                            _this3.getLocation1(type);
                          }
                        }
                      });
                    }
                  }
                });
              }
            }
          });
        }
      });
    }
  }
  // onLoad() {
  //   this.load();
  //   let that = this;
  //   setTimeout(function() {
  //     that.$set(that.like, 6, 4444);
  //   }, 3000);
  // }
};

/***/ }),

/***/ 228:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  return _c('div', {
    staticClass: "like"
  }, [_c('div', {
    staticClass: "Red",
    attrs: {
      "eventid": '0'
    },
    on: {
      "tap": function($event) {
        _vm.confirm(1)
      }
    }
  }, [_vm._v("打卡")]), _vm._v(" "), _c('div', {
    staticClass: "Blue",
    attrs: {
      "eventid": '1'
    },
    on: {
      "tap": function($event) {
        _vm.confirm(2)
      }
    }
  }, [_vm._v("打卡")]), _vm._v(" "), _c('div', {
    staticClass: "Green",
    attrs: {
      "eventid": '2'
    },
    on: {
      "tap": function($event) {
        _vm.confirm(3)
      }
    }
  }, [_vm._v("打卡")])])
}
var staticRenderFns = []
render._withStripped = true
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
if (false) {
  module.hot.accept()
  if (module.hot.data) {
     require("vue-hot-reload-api").rerender("data-v-a9e045ca", esExports)
  }
}

/***/ })

},[223]);
//# sourceMappingURL=main.js.map