ccj 2 年之前
父節點
當前提交
bc2daae5b8
共有 3 個文件被更改,包括 28 次插入15 次删除
  1. 2 2
      config/index.js
  2. 5 1
      manifest.json
  3. 21 12
      pages/clock/the_clock.vue

+ 2 - 2
config/index.js

@@ -1,12 +1,12 @@
 const dev = {
 	baseUrl: 'https://www.zthymaoyi.com',
 	// baseUrl: 'http://localhost:8080/',
-	// baseUrlNew: 'http://192.168.110.138:9100/',
+	baseUrlNew: 'http://192.168.110.67:9100/',
 	// baseUrlNew: 'http://192.168.1.118:8090/',
 	// baseUrlNew: 'http://192.168.1.114:8090/',
 	// baseUrlNew: 'http://192.168.1.122:8090/',
 	// baseUrlNew: 'http://192.168.110.138:8090/',
-	baseUrlNew: 'http://api1.eliangeyun.com/',
+	// baseUrlNew: 'http://api1.eliangeyun.com/',
 	h5Appid: 'wxb66b599f7f61b46f',
 	debug: false
 }

+ 5 - 1
manifest.json

@@ -100,6 +100,9 @@
                         "__platform__" : [ "ios", "android" ],
                         "appkey_ios" : "64541bb9b52fe4d41d8ac5c1959cf4b9",
                         "appkey_android" : "8a601d5716a812aaf65291da18dae719"
+                    },
+                    "system" : {
+                        "__platform__" : [ "ios", "android" ]
                     }
                 }
             },
@@ -189,7 +192,8 @@
             "Maps" : {},
             "LivePusher" : {},
             "VideoPlayer" : {},
-            "Bluetooth" : {}
+            "Bluetooth" : {},
+            "Geolocation" : {}
         },
         "splashscreen" : {
             "waiting" : false

+ 21 - 12
pages/clock/the_clock.vue

@@ -22,7 +22,7 @@
 			<view class="c-row">
 				<view class="title">打卡距离</view>
 				<view class="con-list">
-					<input type="number" v-model='clockDistance' placeholder="重新获取" :disabled="true"></input>
+					<view>{{clockDistance}}</view>
 				</view>
 			</view>
 		</view>
@@ -63,12 +63,13 @@
 				console.log(query)
 			},
 			getWarehouse() {
+				var that = this
 				this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouse', {
 					compId: uni.getStorageSync("pcUserInfo").compId,
 					warehouseType: '1'
 				}).then(res => {
 					if (res.data.data.length != 0) {
-						this.warehouseBaseInfoList = res.data.data
+						that.warehouseBaseInfoList = res.data.data
 						uni.getLocation({
 							type: 'gcj02',
 							geocode: true,
@@ -76,14 +77,15 @@
 								console.log('获取位置数据:', res);
 								console.log('当前位置的经度:' + res.longitude);
 								console.log('当前位置的纬度:' + res.latitude);
-								this.lat2 = res.latitude
-								this.lng2 = res.longitude
-								if (this.warehouseBaseInfoList.length > 0) {
-									this.clockDistance = this.utils.getDistance(this
+								that.lat2 = res.latitude
+								that.lng2 = res.longitude
+								if (that.warehouseBaseInfoList.length > 0) {
+									that.clockDistance = that.utils.getDistance(that
 										.warehouseBaseInfoList[0].warehousePositioning.split(',')[
-											1],
-										this.warehouseBaseInfoList[0].warehousePositioning.split(
-											',')[0], this.lat2, this.lng2)
+											0],
+										that.warehouseBaseInfoList[0].warehousePositioning.split(
+											',')[1], that.lat2, that.lng2)
+											that.detailData.targetLocation = that.warehouseBaseInfoList[0].warehouseName
 								}
 							},
 							fail: function(req) {
@@ -97,8 +99,9 @@
 			targetLPicker(e) {
 				this.detailData.targetLocation = this.warehouseBaseInfoList[e[0]].warehouseName
 				this.clockDistance = this.utils.getDistance(this.warehouseBaseInfoList[e[0]].warehousePositioning.split(
-						',')[1],
-					this.warehouseBaseInfoList[e[0]].warehousePositioning.split(',')[0], this.lat2, this.lng2)
+						',')[0],
+					this.warehouseBaseInfoList[e[0]].warehousePositioning.split(',')[1], this.lat2, this.lng2)
+					
 			},
 			submit() {
 				if (!this.typevalue) {
@@ -122,9 +125,15 @@
 							that.detailData.phone = uni.getStorageSync('pcUserInfo').userMobilePhone
 							that.detailData.empName = uni.getStorageSync('userInfo').userName
 							that.detailData.clockType = that.typevalue
-							that.detailData.clockDistance = "100"
+							if(that.clockDistance.indexOf("km") > -1){
+								that.detailData.clockDistance = that.clockDistance.replace("km","")*1000
+							}else{
+								that.detailData.clockDistance = that.clockDistance.replace("m","")
+							}
+							console.log(that.detailData)
 							that.$api.doRequest('post', '/clockInfo/api/addClock', that.detailData)
 								.then(res => {
+									console.log(res.data)
 									if (res.data.code == 200) {
 										that.$api.msg('提交成功')
 									} else {