global.webpackJsonp([2],{ /***/ 348: /***/ (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__(349); 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: '工作台' } }; /***/ }), /***/ 349: /***/ (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__(351); /* 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_5d355032_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__(352); var disposed = false function injectStyle (ssrContext) { if (disposed) return __webpack_require__(350) } var normalizeComponent = __webpack_require__(0) /* script */ /* template */ /* styles */ var __vue_styles__ = injectStyle /* scopeId */ var __vue_scopeId__ = "data-v-5d355032" /* 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_5d355032_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\\workspace\\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-5d355032", Component.options) } else { hotAPI.reload("data-v-5d355032", Component.options) } module.hot.dispose(function (data) { disposed = true }) })()} /* harmony default export */ __webpack_exports__["default"] = (Component.exports); /***/ }), /***/ 350: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 351: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _promise = __webpack_require__(12); var _promise2 = _interopRequireDefault(_promise); var _stringify = __webpack_require__(35); var _stringify2 = _interopRequireDefault(_stringify); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // var isFirstLoad = true; exports.default = { data: function data() { return { photo: '', name: '', scheduleState: '', morning: true, canICheckIn: false, warning: '', punchTime: [], navArray: [{ num: 0, title: '待回复' }, { num: 0, title: '已回复' }, { num: 0, title: '总咨询' }], footArray: [{ img: '/static/imgs/analyse.png', title: '案例分析' }, { img: '/static/imgs/templet.png', title: '文书模板' }, { img: '/static/imgs/law_lecture.png', title: '法制讲座' }, { img: '/static/imgs/law.png', title: '普法动态' }], ToolArray: [{ img: '/static/imgs/lawicon.png', title: '法律法规' }], moveToOne: false, moveToThree: false, hasHandleAuth: false, noticeTitle: '', hasLeaveMessage: false }; }, methods: { moveSlide: function moveSlide(num) { switch (num) { case 1: { this.moveToOne = true; this.moveToThree = false; break; } case 2: { this.moveToOne = false; this.moveToThree = false; break; } case 3: { this.moveToThree = true; this.moveToOne = false; break; } } }, getLocation: function getLocation(comm_Name, targetPos, LSID) { var _this = this; wx.showLoading({ title: '正在打卡' }); var lat = void 0, lng = void 0; wx.getLocation({ type: 'gcj02', success: function success(res) { lat = res.latitude; lng = res.longitude; var content = ''; var success = true; if (targetPos.lng != 0) { var dis = _this.getDistance({ lat: lat, lng: lng }, targetPos); content = '\u60A8\u4E0E' + comm_Name + '\u7684\u8DDD\u79BB\u4E3A:' + dis + '\u7C73\n\u6709\u6548\u6253\u5361\u8303\u56F4\uFF1A800\u7C73'; success = dis < 800; } if (success) { wx.request({ url: 'https://api.map.baidu.com/geocoder/v2/', data: { ak: 'AnWpq9Kc3C8cq5CCGAzsq3NxpBkxRnl0', location: lat + ',' + lng, coordtype: 'gcj02ll', output: 'json' }, success: function success(res) { console.log(res); var address = res.data.result.sematic_description; content = '\u60A8\u5F53\u524D\u7684\u4F4D\u7F6E:\n' + address + '\n' + content; wx.request({ url: _this.rootUrl + '/TSheet/punch', header: { 'content-type': 'application/x-www-form-urlencoded' }, method: 'POST', data: { sessionID: wx.getStorageSync('sessionID'), latit: lat, longi: lng, address: address, LSID: LSID, pType: _this.morning ? 'first' : 'second' }, success: function success(res) { if (res.statusCode == '500') { _this.service.getUnionId(_this.rootAvatar, _this.rootUrl).then(function (res) { _this.getLocation(comm_Name, targetPos, LSID); }); } else if (res.data == 1) { wx.hideLoading(); wx.showModal({ title: '打卡成功', content: content, showCancel: false }); _this.refreshDuty(); } } }); } }); } else { wx.hideLoading(); wx.showModal({ title: '打卡失败', content: content, showCancel: false }); } }, fail: function fail(err) { var authSetting = void 0; wx.getSetting({ success: function success(res) { authSetting = res.authSetting['scope.userLocation']; console.log(authSetting); }, complete: function complete() { if (authSetting) { if (_this.hasHandleAuth) { console.log('nuhu'); _this.getLocation(comm_Name, targetPos, LSID); } else { var realName = wx.getStorageSync('userInfo').nickName; _this.service.UploadBug(_this.rootUrl, 'test/getLocation/' + realName, (0, _stringify2.default)(err)); wx.showModal({ title: '打卡失败', content: '微信未获得位置权限\n请在您手机的系统设置-权限管理中,打开微信的位置信息获取权限', showCancel: false, success: function success(res) { if (res.confirm) { wx.hideLoading(); } } }); } } else { wx.hideLoading(); wx.showModal({ title: '授权请求', content: '您已拒绝小程序获取地理位置,若要使用打卡功能,请重新授权', showCancel: false, success: function success(res) { if (res.confirm) { wx.openSetting({ success: function success(res) { if (res.authSetting['scope.userLocation']) { _this.hasHandleAuth = true; _this.getLocation(comm_Name, targetPos, LSID); } } }); } } }); } } }); } }); }, canICheckin: function canICheckin() { var _this2 = this; wx.showLoading({ title: '正在加载' }); this.refreshDuty().then(function (res) { if (res.allowed) { wx.showModal({ title: '', content: '确定要打卡吗?', success: function success(res1) { if (res1.confirm) { _this2.getLocation(res.obj.comm_Name, res.obj.pos, res.obj.lsid); } } }); } else { wx.showModal({ title: '打卡失败', content: _this2.warning, showCancel: false }); } }); }, getDistance: function getDistance(point1, point2) { var degreeToRad = function degreeToRad(degree) { return Math.PI * degree / 180; }; //将度转化为弧度 var getRange = function getRange(v, a, b) { //将v值限定在a,b之间,纬度使用 if (a != null) { v = Math.max(v, a); } if (b != null) { v = Math.min(v, b); } return v; }; var getLoop = function getLoop(v, a, b) { //将v值限定在a,b之间,经度使用 while (v > b) { v -= b - a; } while (v < a) { v += b - a; } return v; }; point1.lng = getLoop(point1.lng, -180, 180); point1.lat = getRange(point1.lat, -74, 74); point2.lng = getLoop(point2.lng, -180, 180); point2.lat = getRange(point2.lat, -74, 74); var x1 = void 0, x2 = void 0, y1 = void 0, y2 = void 0; x1 = degreeToRad(point1.lng); y1 = degreeToRad(point1.lat); x2 = degreeToRad(point2.lng); y2 = degreeToRad(point2.lat); return parseInt(6370996.81 * Math.acos(Math.sin(y1) * Math.sin(y2) + Math.cos(y1) * Math.cos(y2) * Math.cos(x2 - x1))); }, refreshInfo: function refreshInfo() { var info = wx.getStorageSync('userInfo'); if (info) { this.name = info.nickName; this.photo = info.avatarUrl; wx.hideLoading(); } }, refreshDuty: function refreshDuty() { var _this3 = this; return new _promise2.default(function (resolve) { _this3.morning = new Date().getHours() < 12; _this3.warning = ''; wx.request({ url: _this3.rootUrl + '/sch/infobyliid', method: 'POST', header: { 'content-type': 'application/x-www-form-urlencoded' }, data: { sessionID: wx.getStorageSync('sessionID') }, success: function success(res) { if (res.statusCode == '500') { _this3.service.getUnionId(_this3.rootAvatar, _this3.rootUrl).then(function (res) { _this3.refreshDuty(); }); } else { var scheduleArr = res.data; console.log(scheduleArr); if (scheduleArr.length == 0) { _this3.checkInSetter('非值班日', '非值班日不能打卡'); _this3.canICheckIn = false; resolve({ allowed: false }); wx.hideLoading(); } else { var first = scheduleArr[0].first_tsid > 0; var second = scheduleArr[0].second_tsid > 0; var canICheckIn = _this3.StateMachine(_this3.morning, first, second); if (canICheckIn) { _this3.punchTimeCheck().then(function (res) { if (!res) { _this3.canICheckIn = false; resolve({ allowed: false }); } else { var obj = { comm_Name: scheduleArr[0].comm_Name, pos: { lat: scheduleArr[0].latit > 0 ? scheduleArr[0].latit : 0, lng: scheduleArr[0].longi > 0 ? scheduleArr[0].longi : 0 }, lsid: scheduleArr[0].lsid }; _this3.canICheckIn = true; resolve({ allowed: true, obj: obj }); } wx.hideLoading(); }); } else { _this3.canICheckIn = false; resolve({ allowed: false }); wx.hideLoading(); } } } } }); }); }, punchHelp: function punchHelp() { if (this.scheduleState && this.punchTime.length) wx.showModal({ title: '考勤说明', content: '\u503C\u73ED\u65E5\u6253\u5361\u65F6\u95F4\u6BB5\u4E3A:\n\n\u4E0A\u5348/\u4E0A\u73ED\u6253\u5361: ' + this.punchTime[0] + '\n\u4E0B\u5348/\u4E0B\u73ED\u6253\u5361: ' + this.punchTime[1] + '\n\n\u975E\u503C\u73ED\u65E5\u4E0D\u80FD\u6253\u5361', showCancel: false }); }, getPunchTime: function getPunchTime() { var _this4 = this; return new _promise2.default(function (resolve) { wx.request({ url: _this4.rootUrl + '/ptime/all', success: function success(res) { _this4.punchTime = res.data.map(function (v) { var clockIn = _this4.service.correctTime(v.clockIn, 'full').slice(-5); var knockOff = _this4.service.correctTime(v.knockOff, 'full').slice(-5); return clockIn + ' - ' + knockOff; }); resolve(res.data); } }); }); }, punchTimeCheck: function punchTimeCheck() { var _this5 = this; return new _promise2.default(function (resolve) { _this5.getPunchTime().then(function (timeArr) { var time = timeArr[_this5.morning ? 0 : 1]; time.clockIn = _this5.service.correctTime(time.clockIn, 'DateObj'); time.knockOff = _this5.service.correctTime(time.knockOff, 'DateObj'); var hourStart = time.clockIn.getHours(); var hourEnd = time.knockOff.getHours(); var minuteStart = time.clockIn.getMinutes(); var minuteEnd = time.knockOff.getMinutes(); var hour = new Date().getHours(); var minute = new Date().getMinutes(); if (hour > hourStart && hour < hourEnd || hour == hourStart && minute > minuteStart || hour == hourEnd && minute < minuteEnd) { console.log(hourStart, minuteStart, hourEnd, minuteEnd); resolve(true); } else { if (_this5.warning == '') { _this5.warning = (_this5.morning ? '上' : '下') + '\u73ED\u6253\u5361\u65F6\u95F4\u6BB5\u4E3A\n' + hourStart + ':' + ('0' + minuteStart).slice(-2) + ' - ' + hourEnd + ':' + ('0' + minuteEnd).slice(-2) + '\n\u8BF7\u5728\u89C4\u5B9A\u65F6\u95F4\u6BB5\u6253\u5361'; } resolve(false); } }); }); }, checkInSetter: function checkInSetter(scheduleState, warning) { this.scheduleState = scheduleState; this.warning = warning; }, StateMachine: function StateMachine(morning, first, second) { var Arr2Str = [morning ? 1 : 0, first ? 1 : 0, second ? 1 : 0].join(''); switch (Arr2Str) { case '110': this.checkInSetter('值班中', '上午只可进行一次打卡');return false; case '100': this.checkInSetter('未上班', '');return true; case '011': this.checkInSetter('已下班', '今日上下班打卡已完成\n不需要再打卡');return false; case '010': this.checkInSetter('值班中', '');return true; case '001': this.checkInSetter('已下班', '下午只可进行一次打卡');return false; case '000': this.checkInSetter('未上班', '');return true; } }, getUnionId: function getUnionId() { var _this6 = this; this.service.getUnionId(this.rootAvatar, this.rootUrl).then(function (res) { if (res === 'unverified') { wx.setStorageSync('isVerify', false); wx.redirectTo({ url: '../verify/main' }); } else _this6.replyNum(); }); }, replyNum: function replyNum() { var _this7 = this; if (this.name === '') wx.showLoading({ title: '正在加载信息' }); wx.request({ url: this.rootUrl + '/conwx/lawcountun', //待回复 data: { sessionID: wx.getStorageSync('sessionID') }, success: function success(res) { if (res.statusCode == '500') { _this7.getUnionId(); } else { _this7.refreshInfo(); _this7.refreshDuty(); wx.request({ url: _this7.rootUrl + '/conwx/lawcount', //已回复 data: { sessionID: wx.getStorageSync('sessionID') }, success: function success(res1) { var navArray = [{ num: parseInt(res.data), title: '待回复' }, { num: parseInt(res1.data), title: '已回复' }, { num: parseInt(res.data) + parseInt(res1.data), title: '总咨询' }]; _this7.navArray = navArray; } }); } }, fail: function fail(res) { if (res.errMsg == 'request:fail url not in domain list') { wx.hideLoading(); wx.showModal({ title: '非法域名', content: '当前为测试服务器,请开启调试模式', showCancel: false }); } } }); }, //取最新通知公告 getNewNotice: function getNewNotice() { var _this8 = this; wx.request({ url: this.rootUrl + '/notice/getNewNotice', data: { sendType: "1" }, success: function success(res) { _this8.noticeTitle = res.data.messageTitle; } }); } }, onShow: function onShow() { this.getNewNotice(); this.replyNum(); this.getPunchTime(); }, onUnload: function onUnload() { this.hasLeaveMessage = false; this.loaded = false; } }; /***/ }), /***/ 352: /***/ (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: "workplace" }, [_c('div', { staticClass: "head" }, [_c('img', { staticClass: "photo", attrs: { "src": _vm.photo, "mode": "aspectFill" } }), _vm._v(" "), _c('div', { staticClass: "info", attrs: { "eventid": '0' }, on: { "tap": _vm.punchHelp } }, [_c('div', { staticClass: "name_vip" }, [_c('div', { staticClass: "name" }, [_vm._v(_vm._s(_vm.name))]), _vm._v(" "), _c('img', { staticClass: "vip", attrs: { "src": "/static/imgs/verified.png", "mode": "widthFix" } })]), _vm._v(" "), _c('div', { staticClass: "status" }, [(_vm.scheduleState === '') ? _c('img', { staticClass: "loading", attrs: { "src": "/static/imgs/refresh.png" } }) : _vm._e(), _vm._v("\n " + _vm._s(_vm.scheduleState) + "\n "), (_vm.scheduleState && _vm.punchTime.length) ? _c('img', { staticClass: "help", attrs: { "src": "/static/imgs/help.png" } }) : _vm._e()])]), _vm._v(" "), _c('div', { staticClass: "schedule", class: { _fade: !_vm.canICheckIn }, attrs: { "hover-class": "fade", "eventid": '1' }, on: { "tap": _vm.canICheckin } }, [_vm._v(_vm._s(_vm.morning ? '上班' : '下班'))]), _vm._v(" "), _c('navigator', { attrs: { "url": "../leaveList/main" } }, [_c('div', { staticClass: "leave" }, [_vm._v("\n 请假记录\n ")])])], 1), _vm._v(" "), _c('div', { staticClass: "nav" }, [_vm._l((_vm.navArray), function(item, i) { return _c('div', { key: i, staticClass: "nav-item", attrs: { "eventid": '2-' + i }, on: { "tap": function($event) { _vm.moveSlide(i + 1) } } }, [_c('div', { staticClass: "num" }, [_c('span', { staticStyle: { "color": "#AA001A" } }, [_vm._v(_vm._s(item.num + ' '))]), _vm._v(" "), _c('span', [_vm._v("件")])]), _vm._v(" "), _c('div', { staticClass: "title" }, [_vm._v(_vm._s(item.title))])]) }), _vm._v(" "), _c('div', { staticClass: "slide", class: { 'moveToOne': _vm.moveToOne, 'moveToThree': _vm.moveToThree } })], 2), _vm._v(" "), _c('navigator', { attrs: { "url": "../noticeList/main" } }, [_c('div', { staticClass: "notice" }, [_c('div', { staticClass: "titicon" }, [_c('img', { attrs: { "src": "/static/imgs/notice.png" } })]), _vm._v(" "), _c('div', { staticClass: "list" }, [_c('p', [_vm._v(_vm._s(_vm.noticeTitle))])], 1)])]), _vm._v(" "), _c('navigator', { staticClass: "report border-right", attrs: { "url": "../affairs/main", "hover-class": "hover" } }, [_c('img', { attrs: { "src": "/static/imgs/handle.png" } }), _c('div', [_vm._v("事务处理汇报")])]), _vm._v(" "), _c('navigator', { staticClass: "report", attrs: { "url": "../releaselecture/main", "hover-class": "hover" } }, [_c('img', { attrs: { "src": "/static/imgs/lecture.png" } }), _c('div', [_vm._v("讲座汇报")])]), _vm._v(" "), _c('div', { staticClass: "foot-title" }, [_vm._v("我的信息发布")]), _vm._v(" "), _vm._l((_vm.footArray), function(v, i) { return _c('navigator', { key: i, staticClass: "foot", attrs: { "hover-class": "hover", "url": '../myrelease/main?type=' + v.title } }, [_c('img', { attrs: { "src": v.img } }), _vm._v(" "), _c('div', { staticClass: "title" }, [_vm._v(_vm._s(v.title))])]) }), _vm._v(" "), _c('div', { staticClass: "foot-title" }, [_vm._v("工具")]), _vm._v(" "), _c('navigator', { staticClass: "foot", attrs: { "url": "../LawsRegulations/main", "hover-class": "hover" } }, [_c('img', { attrs: { "src": "/static/imgs/lawicon.png" } }), _c('div', { staticClass: "title" }, [_vm._v("法律法规")])]), _vm._v(" "), _c('div', { staticClass: "red-background" })], 2) } 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-5d355032", esExports) } } /***/ }) },[348]); //# sourceMappingURL=main.js.map