Commit 71c4d2ce by 前端

Merge branch 'V1.10.0-0824' into 'develop'

V1.10.0 0824去除腾讯地图key

See merge request !4
2 parents f4cb0e7c 58e0c738
...@@ -23,10 +23,7 @@ ...@@ -23,10 +23,7 @@
"pages/freqLogSearch/freqLogSearch", "pages/freqLogSearch/freqLogSearch",
"pages/freqLogDetail/freqLogDetail", "pages/freqLogDetail/freqLogDetail",
"pages/freqLogUserDetail/freqLogUserDetail", "pages/freqLogUserDetail/freqLogUserDetail",
"pages/newFindCar/findCar", "pages/webview/index"
"pages/newFindSearch/findSearch",
"pages/newMonitor/monitor",
"pages/newTraReplay/traReplay"
], ],
"window": { "window": {
"backgroundColor": "#efeff4", "backgroundColor": "#efeff4",
...@@ -39,8 +36,7 @@ ...@@ -39,8 +36,7 @@
"color": "#666", "color": "#666",
"selectedColor": "#37c060", "selectedColor": "#37c060",
"backgroundColor": "#fff", "backgroundColor": "#fff",
"list": [ "list": [{
{
"pagePath": "pages/home/home", "pagePath": "pages/home/home",
"text": "首页", "text": "首页",
"iconPath": "images/tab-home.png", "iconPath": "images/tab-home.png",
...@@ -65,6 +61,9 @@ ...@@ -65,6 +61,9 @@
"desc": "你的位置信息将用于定位效果展示" "desc": "你的位置信息将用于定位效果展示"
} }
}, },
"requiredPrivateInfos": [
"getLocation"
],
"sitemapLocation": "sitemap.json", "sitemapLocation": "sitemap.json",
"usingComponents": { "usingComponents": {
"myMap": "components/myMap/myMap" "myMap": "components/myMap/myMap"
......
...@@ -27,6 +27,7 @@ Page({ ...@@ -27,6 +27,7 @@ Page({
loginUserId: wx.getStorageSync('loginUserId'), loginUserId: wx.getStorageSync('loginUserId'),
ifUpdate: true ifUpdate: true
}); });
console.log(encodeURI(`${WXRequest.domain}h5/dist/index.html?sessionid=${sessionid}`))
}, },
onShow(options){ onShow(options){
const carShareInfo = wx.getStorageSync('carShareInfo'); const carShareInfo = wx.getStorageSync('carShareInfo');
...@@ -37,6 +38,7 @@ Page({ ...@@ -37,6 +38,7 @@ Page({
ifUpdate: false ifUpdate: false
}) */ }) */
if(wx.getStorageSync('initFindCar')){ if(wx.getStorageSync('initFindCar')){
let _url = `${WXRequest.domain}h5/dist/index.html?sessionid=${sessionid}&sns=${carInfo.sns}&standno=${carInfo.standno}&name=${carInfo.name}&vehicleid=${carInfo.vehicleid}`; let _url = `${WXRequest.domain}h5/dist/index.html?sessionid=${sessionid}&sns=${carInfo.sns}&standno=${carInfo.standno}&name=${carInfo.name}&vehicleid=${carInfo.vehicleid}`;
if(carInfo.loginUserId){ if(carInfo.loginUserId){
_url += `&loginUserId=${carInfo.loginUserId}`; _url += `&loginUserId=${carInfo.loginUserId}`;
...@@ -44,6 +46,8 @@ Page({ ...@@ -44,6 +46,8 @@ Page({
loginUserId: carInfo.loginUserId loginUserId: carInfo.loginUserId
}); });
} }
console.log(sessionid)
console.log(_url);
this.setData({ this.setData({
url: encodeURI(_url), url: encodeURI(_url),
ifUpdate: true ifUpdate: true
......
...@@ -22,13 +22,13 @@ Page({ ...@@ -22,13 +22,13 @@ Page({
showCancel: false showCancel: false
});*/ });*/
} }
if(options.carShareInfo){ if (options.carShareInfo) {
wx.setStorageSync('carShareInfo', JSON.parse(decodeURIComponent(options.carShareInfo))); wx.setStorageSync('carShareInfo', JSON.parse(decodeURIComponent(options.carShareInfo)));
wx.setStorageSync('loginUserId', options.loginUserId); wx.setStorageSync('loginUserId', options.loginUserId);
}else{ } else {
wx.setStorageSync('carShareInfo', null) wx.setStorageSync('carShareInfo', null)
} }
if(options.sns){ // 新e盾找车 if (options.sns) { // 新e盾找车
this.setData({ this.setData({
sns: decodeURIComponent(options.sns) sns: decodeURIComponent(options.sns)
}) })
...@@ -63,56 +63,51 @@ Page({ ...@@ -63,56 +63,51 @@ Page({
onShow: function (options) { onShow: function (options) {
var that = this; var that = this;
WXRequest.login().then(()=>{ WXRequest.login().then(() => {
const userStatus = wx.getStorageSync("userStatus"); const userStatus = wx.getStorageSync("userStatus");
const scene = wx.getStorageSync('scene'); const scene = wx.getStorageSync('scene');
if(scene == '1007' || scene =='1008' || scene == '1044' ){//转发场景 if (scene == '1007' || scene == '1008' || scene == '1044') { //转发场景
if(userStatus === 2){//转发新用户 if (userStatus === 2) { //转发新用户
that.setData({ that.setData({
modalHidden: false, modalHidden: false,
userInfoAuth: false userInfoAuth: false
}); });
return; return;
wx.getSetting({ wx.getSetting({
success(res) {console.log(res) success(res) {
console.log(res)
if (!res.authSetting['scope.userInfo']) { if (!res.authSetting['scope.userInfo']) {
that.setData({ that.setData({
modalHidden: false, modalHidden: false,
userInfoAuth: false userInfoAuth: false
}); });
}else{ } else {
wx.switchTab({ wx.switchTab({
url: '../../pages/findCar/findCar' url: '../../pages/findCar/findCar'
}); });
} }
} }
}); });
}else if(userStatus === 1){ } else if (userStatus === 1) {
if (!this.data.isSharePage) { // 老e盾页面分享
wx.switchTab({ wx.switchTab({
url: '../../pages/findCar/findCar' url: '../../pages/findCar/findCar'
}); });
} else {
wx.reLaunch({
url: `../../pages/newFindCar/findCar?sns=${encodeURIComponent(this.data.sns)}&isSharePage=true`
});
}
}else if(userStatus === 0){ } else if (userStatus === 0) {
wx.setStorageSync('carShareInfo', null); wx.setStorageSync('carShareInfo', null);
wx.switchTab({ wx.switchTab({
url: '../../pages/home/home' url: '../../pages/home/home'
}); });
} }
}else{ } else {
if(userStatus === 2){ if (userStatus === 2) {
wx.redirectTo({ wx.redirectTo({
url: '../../pages/login/login' url: '../../pages/login/login'
}); });
}else{ } else {
wx.switchTab({ wx.switchTab({
url: '../../pages/home/home' url: '../../pages/home/home'
}); });
...@@ -152,7 +147,7 @@ Page({ ...@@ -152,7 +147,7 @@ Page({
}, },
onGotUserInfo(e) { onGotUserInfo(e) {
if(e.detail.errMsg === 'getUserInfo:ok'){ if (e.detail.errMsg === 'getUserInfo:ok') {
this.setData({ this.setData({
modalHidden: true, modalHidden: true,
userInfoAuth: true userInfoAuth: true
...@@ -165,37 +160,31 @@ Page({ ...@@ -165,37 +160,31 @@ Page({
...e.detail.userInfo, ...e.detail.userInfo,
code: res.code code: res.code
}, },
success: function(res) { success: function (res) {
const data = res.data; const data = res.data;
if(res.statusCode === 200){ if (res.statusCode === 200) {
const data = res.data; const data = res.data;
if(data.returnCode === '0'){ if (data.returnCode === '0') {
wx.setStorageSync("sessionid", res.header["Set-Cookie"]); wx.setStorageSync("sessionid", res.header["Set-Cookie"]);
wx.setStorageSync("userStatus", 1); wx.setStorageSync("userStatus", 1);
wx.setStorageSync("userinfo", data.data); wx.setStorageSync("userinfo", data.data);
if (!this.data.isSharePage) {
wx.switchTab({ wx.switchTab({
url: '../../pages/findCar/findCar' url: '../../pages/findCar/findCar'
}); });
} else { // 新e盾分享页 } else {
wx.reLaunch({
url: `../../pages/newFindCar/findCar?sns=${encodeURIComponent(this.data.sns)}&isSharePage=true`
});
}
}else{
wx.showModal({ wx.showModal({
content: data.message, content: data.message,
showCancel: false showCancel: false
}); });
} }
}else if(res.statusCode === 401){ } else if (res.statusCode === 401) {
wx.redirectTo({ wx.redirectTo({
url: '../../pages/login/login' url: '../../pages/login/login'
}); });
} }
}, },
fail(){ fail() {
console.log('fail') console.log('fail')
} }
}); });
......
...@@ -7,7 +7,8 @@ Page({ ...@@ -7,7 +7,8 @@ Page({
data: { data: {
username: '', username: '',
password: '', password: '',
handleDone: true handleDone: true,
isAgree: false
}, },
/** /**
...@@ -16,25 +17,37 @@ Page({ ...@@ -16,25 +17,37 @@ Page({
onLoad: function (options) { onLoad: function (options) {
}, },
formSubmit(e){console.log(e) formSubmit(e) {
console.log(e)
var that = this; var that = this;
if(!that.data.handleDone) return; if (!that.data.handleDone) return;
if(!that.data.username){ if (!that.data.username) {
wx.showModal({ wx.showModal({
content: '请输入账号', content: '请输入账号',
showCancel: false showCancel: false,
success: function (res) {
console.log(res)
}
}); });
return; return false;
} }
if(!that.data.password){ if (!that.data.password) {
wx.showModal({ wx.showModal({
content: '请输入密码', content: '请输入密码',
showCancel: false showCancel: false
}); });
return; return false;
}
if (!that.data.isAgree) {
wx.showModal({
content: '请阅读并同意隐私协议和用户协议',
showCancel: false
});
return false;
} }
that.setData({ that.setData({
handleDone: false handleDone: false
...@@ -43,23 +56,23 @@ Page({ ...@@ -43,23 +56,23 @@ Page({
WXRequest.login({ WXRequest.login({
username: that.data.username, username: that.data.username,
password: that.data.password password: that.data.password
}).then(()=>{ }).then(() => {
wx.switchTab({ wx.switchTab({
url: '../../pages/home/home' url: '../../pages/home/home'
}); });
}).catch(()=>{ }).catch(() => {
that.setData({ that.setData({
handleDone: true handleDone: true
}); });
}) })
}, },
usernameChange(e){ usernameChange(e) {
this.setData({ this.setData({
username: e.detail.value username: e.detail.value
}); });
}, },
passwordChange(e){ passwordChange(e) {
this.setData({ this.setData({
password: e.detail.value password: e.detail.value
}); });
...@@ -111,5 +124,21 @@ Page({ ...@@ -111,5 +124,21 @@ Page({
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
} },
// 协议勾选
toggleIsAgree(e) {
this.setData({
isAgree: !this.data.isAgree
})
},
// 查看用户协议、隐私协议
toAgree(e) {
console.log(e)
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: `/pages/webview/index?id=${id}`
})
},
}) })
\ No newline at end of file \ No newline at end of file
<view class="login"> <view class="login">
<view class="logo"><image src="../../images/logo.png" /></view> <view class="logo">
<form bindsubmit="formSubmit"> <image src="../../images/logo.png" />
<label> </view>
<form>
<label class="label">
<image class="username-icon" src="../../images/username.png" /> <image class="username-icon" src="../../images/username.png" />
<input type="text" name="username" bindinput="usernameChange" placeholder="请输入账号" /> <input type="text" name="username" class="a_input" bindinput="usernameChange" placeholder="请输入账号" />
</label> </label>
<label> <label class="label">
<image class="password-icon" src="../../images/password.png" /> <image class="password-icon" src="../../images/password.png" />
<input type="password" name="password" bindinput="passwordChange" placeholder="请输入密码" /> <input type="password" name="password" class="a_input" bindinput="passwordChange" placeholder="请输入密码" />
</label> </label>
<view class="agree_box">
<label class="checkbox" bindtap="toggleIsAgree">
<checkbox checked="{{isAgree}}" color="#3DA5F5" class="input_icon" />
<text class="is_agree_txt">请阅读并同意</text>
<text class="link is_agree_link" data-id="privacy" catchtap="toAgree">《隐私协议》</text>
<text>和</text>
<text class="link is_agree_link" data-id="agreement" catchtap="toAgree">《用户协议》</text>
</label>
</view>
<button formType="submit" bindtap="formSubmit" type="primary" class="submit-btn">登录<view class="weui-loading" hidden="{{handleDone}}"></view></button> <button formType="submit" bindtap="formSubmit" type="primary" class="submit-btn">登录<view class="weui-loading" hidden="{{handleDone}}"></view></button>
</form> </form>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -14,13 +14,13 @@ form{ ...@@ -14,13 +14,13 @@ form{
display: block; display: block;
margin: 0 30rpx; margin: 0 30rpx;
} }
label{ .label{
display: block; display: block;
border-bottom: 1px solid #ececec; border-bottom: 1px solid #ececec;
padding: 10rpx 0; padding: 10rpx 0;
margin: 20rpx 0; margin: 20rpx 0;
} }
input{ .a_input{
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
width: 200px; width: 200px;
...@@ -35,3 +35,13 @@ button.submit-btn{ ...@@ -35,3 +35,13 @@ button.submit-btn{
margin-top: 40rpx; margin-top: 40rpx;
background-color: #37c060; background-color: #37c060;
} }
.input_icon{
transform: scale(0.8);
}
.agree_box{
font-size:28rpx;
color:#666;
}
.is_agree_link{
color:#37c060;
}
\ No newline at end of file \ No newline at end of file
...@@ -57,12 +57,6 @@ Page({ ...@@ -57,12 +57,6 @@ Page({
}); });
} }
}, },
// 新E盾找车
NewEFindCar() {
wx.navigateTo({
url: '../../pages/newFindSearch/findSearch'
});
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
......
...@@ -33,10 +33,6 @@ ...@@ -33,10 +33,6 @@
<image src="../../images/cmd-freqlog.png"/>调频记录 <image src="../../images/cmd-freqlog.png"/>调频记录
<view class="weui-cell__ft weui-cell__ft_in-access"></view> <view class="weui-cell__ft weui-cell__ft_in-access"></view>
</view> </view>
<view class="weui-cell active" bindtap="NewEFindCar">
<image src="../../images/new-findCar.png"/>"新E盾"找车
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</view>
</view> </view>
<view class="cmd-list logout" bindtap="logout" hidden="{{false}}"> <view class="cmd-list logout" bindtap="logout" hidden="{{false}}">
退出登录 退出登录
......
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
.cmd-list .weui-cell.active{ .cmd-list .weui-cell.active{
background-color: #fff; background-color: #fff;
} }
.cmd-list .weui-cell .inn{ /* .cmd-list .weui-cell .inn{
} } */
.cmd-list .weui-cell__ft_in-access{ .cmd-list .weui-cell__ft_in-access{
position: absolute; position: absolute;
top: 50%; top: 50%;
......
const WXRequest = require('../../utils/wxrequest.js');
Page({
/**
* 页面的初始数据
*/
data: {
sns: null,
loginUserId: '',
isShareLogged: false, //是否生成被分享记录
isLoading: false,
isShareDead: true,
carInfoWindowObj: {}, // 当前点击的marker数据
carInfoArr: [], // 车辆marker数据
markers: [],
isShowCarInfoWindow: false, // 信息窗体
isShowSidebar: false, // 更多弹窗
isSharePage: false, // 是否被分享者进入
ShowShareModel: false,
includePoints: [],
isUpdate: true,
isOpenWechatMap: true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
loginUserId: wx.getStorageSync('loginUserId'),
isSharePage: options.isSharePage,
sns: decodeURIComponent(options.sns)
})
if (options.isSharePage) {
wx.hideHomeButton()
wx.hideShareMenu()
}
this.getData()
},
onShow(){
this.myMap = this.selectComponent('#findcarMap')
},
// 刷新
refresh() {
this.isLoading = true
this.setData({
markers: [],
carInfoWindowObj: {}, // 当前点击的marker数据
carInfoArr: [], // 车辆marker数据
isShowCarInfoWindow: false, // 信息窗体
includePoints: [],
})
setTimeout(() => {
this.getData()
})
},
// 获取定位
locationCallback(e) {
let data = JSON.parse(JSON.stringify(this.data.includePoints))
let isHad = data.find((item) => item.latitude === e.detail.lat && item.longitude === e.detail.lng)
if (!isHad) {
data.push({
latitude: e.detail.lat,
longitude: e.detail.lng
})
}
this.myMap.getMapCtx().includePoints({
points: data,
padding: [60, 60, 60, 60],
success: (res) => {
}
})
},
getData() {
this.getVehicleData()
},
async getVehicleData(){
if(this.data.sns){
this.setData({
isLoading: true
})
let res = await WXRequest.get('trialdrive/api/vehicle/location', {sns: decodeURIComponent(this.data.sns)}, true)
if (res) this.setData({isLoading: false})
if (res.code == 200) {
let [markers, includePoints] = [[], []]
if (res.data.length > 0 ) {
for (var i = 0; i < res.data.length; i++) {
if (res.data[i]['gpsLocation'] && res.data[i]['gpsLocation'].elat && res.data[i]['gpsLocation'].elng) {
markers.push({
id: Number(res.data[i].sn), // 设备号唯一 可作为markerid
width: 28,
height: 36,
zIndex: 1001,
latitude: Number(res.data[i]['gpsLocation'].elat), // 默认显示GPS定位位置
longitude: Number(res.data[i]['gpsLocation'].elng),
iconPath: res.data[i].source === 1 ? '../../images/oncar.png' : '../../images/offcar.png'
})
res.data[i].type = 'gpsLocation'
includePoints.push({
latitude: res.data[i]['gpsLocation'].elat,
longitude: res.data[i]['gpsLocation'].elng,
padding: [80, 80, 80, 80]
})
} else if (res.data[i]['bsLocation'] && res.data[i]['bsLocation'].elat && res.data[i]['bsLocation'].elng) {
markers.push({
id: Number(res.data[i].sn), // 设备号唯一 可作为markerid
width: 28,
height: 36,
latitude: Number(res.data[i]['bsLocation'].elat), // 无gps定位数据
longitude: Number(res.data[i]['bsLocation'].elng),
iconPath: res.data[i].source === 1 ? '../../images/oncar.png' : '../../images/offcar.png'
})
includePoints.push({
latitude: res.data[i]['bsLocation'].elat,
longitude: res.data[i]['bsLocation'].elng,
padding: [80, 80, 80, 80]
})
res.data[i].type = 'bsLocation'
}
let typeArr = ['gpsLocation', 'bsLocation']
for (var j = 0; j < typeArr.length; j++) {
if (res.data[i][typeArr[j]] && res.data[i][typeArr[j]].elat && res.data[i][typeArr[j]].elng) await this.getTransferAddress(res.data[i], typeArr[j])
}
}
this.setData({
carInfoArr: res.data,
includePoints: includePoints,
markers: markers
})
wx.getSystemInfo({
success: (res) => {
if (res.platform == 'devtools') { // 开发工具上include-points 失效
this.myMap.getMapCtx().includePoints({
points: includePoints,
padding: [80, 80, 80, 80]
})
} else {
this.myMap.setData({ // 防止页面跳转回退页面未保留用户的操作 用mapContext 会有问题
inPoints: includePoints
})
}
}
})
} else {
wx.showModal({
content: '暂无数据',
showCancel: false
})
}
}
}
},
// 显示对应marker详情
bindmarkertap(e) {
let data = this.data.carInfoArr.find(item => Number(item.sn) === e.detail.markerId)
let _this = this
_this.moveToLocation(Number(data[data['type']].elat), Number(data[data['type']].elng))
_this.setData({
isShowCarInfoWindow: true,
carInfoWindowObj: data,
})
},
findCarClick() {
wx.navigateBack({
url: `../../pages/newFindSearch/findSearch`
})
},
// 关闭详情内容
closeCarWindow(e) {
this.setData({
isShowCarInfoWindow: false
})
},
// 定位类型切换
typeChange(e) {
let data = JSON.parse(JSON.stringify(this.data.carInfoWindowObj))
let carInfoArr = JSON.parse(JSON.stringify(this.data.carInfoArr))
let includePoints = JSON.parse(JSON.stringify(this.data.includePoints))
let markers = this.data.markers
switch(Number(e.currentTarget.dataset.num)) {
case 1: // GPS
if (!this.data.carInfoWindowObj['gpsLocation'] || !this.data.carInfoWindowObj['gpsLocation'].elat || !this.data.carInfoWindowObj['gpsLocation'].elng) {
return wx.showToast({
title: '暂无GPS定位数据',
icon: 'none'
})
}
if (data['type'] === 'gpsLocation') return
data['type'] = "gpsLocation"
includePoints.push({
latitude: Number(this.data.carInfoWindowObj['gpsLocation'].elat),
longitude: Number(this.data.carInfoWindowObj['gpsLocation'].elng)
})
markers.forEach(val => {
if (val.id === Number(this.data.carInfoWindowObj.sn)){
val.latitude = Number(this.data.carInfoWindowObj['gpsLocation'].elat)
val.longitude = Number(this.data.carInfoWindowObj['gpsLocation'].elng)
}
})
this.setData({
includePoints: includePoints,
markers: markers
})
this.moveToLocation(Number(this.data.carInfoWindowObj['gpsLocation'].elat), Number(this.data.carInfoWindowObj['gpsLocation'].elng))
carInfoArr.forEach(val => {
if (val.sn === this.data.carInfoWindowObj.sn) {
val.type = 'gpsLocation'
}
})
this.setData({
carInfoWindowObj: data,
carInfoArr: carInfoArr
})
break
case 2: // bsLocation
if (!this.data.carInfoWindowObj['bsLocation'] || !this.data.carInfoWindowObj['bsLocation'].elat || !this.data.carInfoWindowObj['bsLocation'].elng) {
return wx.showToast({
title: '暂无基站定位数据',
icon: 'none'
})
}
if (data['type'] === 'bsLocation') return
data['type'] = "bsLocation"
includePoints.push({
latitude: this.data.carInfoWindowObj['bsLocation'] && Number(this.data.carInfoWindowObj['bsLocation'].elat),
longitude: this.data.carInfoWindowObj['bsLocation'] && Number(this.data.carInfoWindowObj['bsLocation'].elng)
})
this.setData({
includePoints: includePoints
})
markers.forEach(val => {
if (val.id === Number(this.data.carInfoWindowObj.sn)){
val.latitude = Number(this.data.carInfoWindowObj['bsLocation'].elat)
val.longitude = Number(this.data.carInfoWindowObj['bsLocation'].elng)
}
})
carInfoArr.forEach(val => {
if (val.sn === this.data.carInfoWindowObj.sn) {
val.type = 'bsLocation'
}
})
this.setData({
carInfoWindowObj: data,
carInfoArr: carInfoArr,
includePoints: includePoints,
markers: markers
})
this.moveToLocation(Number(this.data.carInfoWindowObj['bsLocation'].elat), Number(this.data.carInfoWindowObj['bsLocation'].elng))
break
}
},
async getTransferAddress(data, typeItem) {
new Promise(async reslove => {
wx.request({
url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ data[typeItem].elat + ',' + data[typeItem].elng,
success: res => {
if (res.statusCode === 200) {
data[typeItem].transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough)
reslove()
}
}
})
})
},
moveToLocation: function (latitude, longitude ) {
this.myMap.getMapCtx().moveToLocation({
longitude: Number(longitude),
latitude: Number(latitude)
})
},
// 车辆追踪
carInfoTrace() {
this.setData({
isOpenWechatMap: false
})
let lng = this.data.carInfoWindowObj['gpsLocation'].elng
let lat = this.data.carInfoWindowObj['gpsLocation'].elat
wx.openLocation({
latitude: Number(lat),
longitude: Number(lng),
name: this.data.carInfoWindowObj['gpsLocation'].transferAddress,
success: () => {
setTimeout(() => {
this.setData({
isOpenWechatMap: true
})
}, 1000)
}
})
},
// 轨迹回放
traReplay(e) {
this.setData({
isUpdate: false,
})
wx.navigateTo({
url: `../../pages/newTraReplay/traReplay?sn=${encodeURIComponent(this.data.carInfoWindowObj.encryptSn)}&locationType=${this.data.carInfoWindowObj.type}`
});
},
// 更多
carInfoMore() {
this.setData({
isShowSidebar: true
})
},
// 关闭更多弹窗(点击空白处)
clickSideBar() {
this.setData({
isShowSidebar: false
})
},
clickSideBarNav() {
},
// 实时监控
monitor() {
this.setData({
isUpdate: false,
})
wx.navigateTo({
url: `../../pages/newMonitor/monitor?sn=${encodeURIComponent(this.data.carInfoWindowObj.encryptSn)}`
});
},
// 分享找车
share() {
this.setData({
ShowShareModel: true
})
},
clickShareModel() {
this.setData({
ShowShareModel: false
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
this.setData({
isUpdate: false
})
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
this.setData({
isUpdate: true
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function(options) {
var that = this;
var opts = {
title: that.data.title,
path: '/pages/loading/loading',
success: function (res) {
},
fail: function (res) {
}
}
this.setData({
isUpdate: false
})
if(that.data.sns){
opts.path = `${opts.path}?sns=${encodeURIComponent(this.data.sns)}&isSharePage=true`;
}
return opts;
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
"myMap": "../../components/myMap/myMap"
},
"navigationBarTitleText": "找车"
}
\ No newline at end of file \ No newline at end of file
<view class="findCar_content">
<myMap class="my-map" id="findcarMap" mapId="findcarMap" bind:bindmarkertap="bindmarkertap" bind:refresh="refresh" markers="{{markers}}" includePoints="{{includePoints}}" bind:locationCallback="locationCallback"></myMap>
<!-- 找车按钮 -->
<view wx:if="{{!isSharePage}}" class="icon icon-findcar map-cmd-icon" bindtap="findCarClick"></view>
<!-- 信息窗体内容 -->
<view wx:if="{{isShowCarInfoWindow}}" class="customCallout {{isShowCarInfoWindow ? '' : 'hidden'}}">
<view class="car-info-window">
<view class="main-info">
<view class="info-title">
<view class="carInfoName">{{carInfoWindowObj.ownerName || ''}}</view>
<view class="carInfoStandno">{{carInfoWindowObj.vin}}</view>
<icon class="close_btn" type="cancel" size="23" color="#000" bindtap="closeCarWindow"></icon>
</view>
<view class="info-list">
<view class="battery {{carInfoWindowObj.battery < 20 ? 'empty' : ''}}" wx:if="{{carInfoWindowObj.source !== 1 && carInfoWindowObj.battery}}">
<view style="width: {{carInfoWindowObj.battery + '%'}}; margin-top: 2rpx;" class="fill"></view>
<icon class="icon {{carInfoWindowObj.battery < 20 ? 'icon-battery-empty' : 'icon-battery-enough'}}"></icon>
<view class="text">{{carInfoWindowObj.battery < 20 ? '不足' : carInfoWindowObj.battery}}</view>
</view>
<view class="flex_class device-info">
<icon class="icon icon-device"></icon>
<view class="inline-b">{{(carInfoWindowObj.source === 0 ? '无线设备' : carInfoWindowObj.source === 1 ? '有线设备' : '') + ':' + carInfoWindowObj.sn}}</view>
</view>
<view class="flex_class offline-info" wx:if="{{carInfoWindowObj[carInfoWindowObj['type']].offLineDuration}}">
<icon class="icon icon-offline"></icon>
<view class="inline-b">{{'离线:' + carInfoWindowObj[carInfoWindowObj['type']].offLineDuration}}</view>
</view>
<view class="flex_class time-info">
<icon class="icon icon-time"></icon>
<view class="inline-b">{{carInfoWindowObj[carInfoWindowObj['type']].dateTime}}</view>
</view>
<view class="flex_class locate-info">
<icon class="icon icon-locate-sm"></icon>
<view class="inline-b">{{carInfoWindowObj[carInfoWindowObj['type']].transferAddress}}</view>
</view>
<view class="flex_class list-info">
<icon class="icon icon-list"></icon>
<view>定位类型:</view>
<view class="radio-class" bindtap="typeChange" data-num="1">
<icon class="icon icon-info-radio {{carInfoWindowObj.type === 'gpsLocation' ? 'active' : ''}}"></icon>
<view data="1">GPS</view>
</view>
<view class="radio-class" bindtap="typeChange" data-num="2">
<icon class="icon icon-info-radio {{carInfoWindowObj.type === 'gpsLocation' ? '' : 'active'}}"></icon>
<view data="2">基站</view>
</view>
</view>
</view>
</view>
<view class="cmd-list">
<view bindtap="{{isOpenWechatMap ? 'carInfoTrace' : ''}}">车辆追踪</view>
<view bindtap="traReplay">轨迹回放</view>
<view bindtap="monitor">实时监控</view>
<view bindtap="share" wx:if="{{!isSharePage}}">分享找车</view>
<!-- <view bindtap="carInfoMore">更多</view> -->
</view>
</view>
</view>
<!-- 更多 -->
<!-- <view id="sidebar" class="sidebar {{isShowSidebar ? '' : 'hidden'}}" catchtap="clickSideBar">
<view class="sidebar-nav" catchtap="clickSideBarNav">
<view class="weui-cells">
<view class="weui-cell weui-cell_access {{loginUserId ? '' : 'disabled'}}" bindtap="monitor">
<view class="weui-cell__bd">
<icon class="icon icon-more-monitor"></icon><text class="more-monitor">实时监控</text>
</view>
<image src="../../images/arrow-right.png" class="arrow-right"></image>
</view>
<view class="weui-cell weui-cell_access disabled">
<view class="weui-cell__bd">
<icon class="icon icon-more-freq"></icon><text class="more-freq">设备调频</text>
</view>
<image src="../../images/arrow-right.png" class="arrow-right"></image>
</view>
<view class="weui-cell weui-cell_access disabled">
<view class="weui-cell__bd">
<icon class="icon icon-more-fence"></icon><text class="more-fence">电子围栏</text>
</view>
<image src="../../images/arrow-right.png" class="arrow-right"></image>
</view>
<view class="weui-cell weui-cell_access {{loginUserId ? '' : 'disabled'}}" bindtap="share">
<view class="weui-cell__bd">
<icon class="icon icon-more-share"></icon><text class="more-share">分享找车</text>
</view>
<image src="../../images/arrow-right.png" class="arrow-right"></image>
</view>
</view>
</view>
</view> -->
<!-- 被分享者进入提醒 -->
<!-- <view class="share-tip {{isSharePage ? 'active' : ''}}">
<view><icon class="icon-small" type="info_circle" size="23"></icon>提示:此分享功能请在有效时间内使用,详情联系分享者</view>
</view> -->
<!-- 分享 -->
<view class="share-cover {{ShowShareModel ? 'active' : ''}}" bindtap="clickShareModel">
<icon class="icon icon-share"></icon>
<view class="tip">“点击右上角转发分享”</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
.flex-wrp{
display: flex;
}
.icon-findcar {
width: 132rpx;
height: 132rpx;
background-position: 0rpx 0rpx;
position: fixed;
z-index: 20;
bottom: 40rpx;
left: 50%;
transform: translate(-50%, 0);
}
.icon-findcar:active {
width: 132rpx;
height: 132rpx;
background-position: -132rpx 0rpx;
}
.customCallout {
position: fixed;
top: 0;
left: 0;
width: 100%;
animation: topShow .3s;
z-index: 400;
opacity: 1;
}
.hidden {
top: -100%;
background: none;
animation: topHide .5s;
/* opacity: 0; */
}
.car-info-window {
width: 100%;
background-color: #fff;
border-radius: 8rpx;
border: 2rpx solid #ececec;
color: #666;
word-break: break-all;
user-select: text;
}
.car-info-window view{
font-size: 28rpx;
}
.car-info-window .main-info {
padding: 20rpx;
}
.car-info-window .info-list {
position: relative;
padding-top: 20rpx;
}
.car-info-window .info-list .inline-b{
display: inline-block;
white-space: normal;
width: 100%;
}
.car-info-window .info-list .flex_class {
display: flex;
align-items: flex-start;
}
.car-info-window .info-list .list-info{
align-items: center;
}
.car-info-window .info-list .device-info .icon-device{
width: 42rpx;
height: 42rpx;
background-position: -482rpx -84rpx;
}
.car-info-window .info-list .battery .icon-battery-empty{
width: 76rpx;
height: 40rpx;
position: absolute;
top: 2rpx;
left: 0;
background-position: -182rpx -423rpx;
}
.car-info-window .info-list .battery .icon-battery-enough{
width: 76rpx;
height: 40rpx;
position: absolute;
top: 2rpx;
left: 0;
background-position: -108rpx -423rpx;
}
.car-info-window .info-list .battery .text{
top: 4rpx;
}
.car-info-window .info-list .offline-info .icon-offline{
width: 42rpx;
height: 42rpx;
background-position: -482rpx 0rpx;
}
.car-info-window .info-list .time-info .icon-time{
width: 42rpx;
height: 42rpx;
background-position: -482rpx -42rpx;
}
.car-info-window .info-list .locate-info .icon-locate-sm{
width: 42rpx;
height: 42rpx;
background-position: -482rpx -168rpx;
}
.car-info-window .info-list .list-info .icon-list{
width: 42rpx;
height: 42rpx;
background-position: -436rpx -250rpx;
}
.car-info-window .info-list .list-info .icon-info-radio{
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
background-position: -482rpx -270rpx;
}
.car-info-window .info-list .list-info .active{
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
background-position: -482rpx -300rpx;
}
.car-info-window .info-list .list-info .radio-class {
margin-right: 20rpx;
display: flex;
align-items: center;
}
.car-info-window .info-title {
font-weight: normal;
border-bottom: 2rpx solid #ececec;
padding-bottom: 20rpx;
font-size: 32rpx;
color: #333;
}
.car-info-window .info-title .close_btn{
float: right;
margin-right: 30rpx;
}
.car-info-window .info-title view {
margin-right: 20rpx;
display: inline-block;
}
.car-info-window .icon {
vertical-align: middle;
margin-right: 10rpx;
display: inline-block;
}
.car-info-window .cmd-list {
display: flex;
border-top: 2rpx solid #ececec;
}
.car-info-window .cmd-list view {
flex: 1;
text-align: center;
padding: 10rpx 0;
border-right: 2rpx solid #ececec;
}
.car-info-window .cmd-list view:last-child {
border-right: none;
}
.car-info-window .battery {
position: absolute;
top: 20rpx;
right: 0rpx;
width: 74rpx;
height: 38rpx;
word-break: break-all;
}
.car-info-window .battery > view {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.car-info-window .battery .fill {
background-color: #d4f1dc;
}
.car-info-window .battery .text {
color: #37c060;
font-size: 12px;
text-align: center;
}
.car-info-window .battery.empty .fill {
background-color: #f0d0d0;
}
.car-info-window .battery.empty .text {
color: #df2222;
}
.icon-wrap{
position: fixed;
}
.icon-wrap cover-image{
display: inline-block;
width: 100%;
height: 100%;
}
.icon-wrap cover-image.active{
display: none;
}
.icon-wrap.hover cover-image{
display: none;
}
.icon-wrap.hover cover-image.active{
display: inline-block;
}
.findcar-icon-wrap{
left: 50%;
bottom: 20rpx;
margin-left: -66rpx;
width: 132rpx;
height: 132rpx;
}
.locate-icon-wrap{
left: 30rpx;
bottom: 40rpx;
width: 98rpx;
height: 98rpx;
}
.refresh-icon-wrap{
left: 30rpx;
bottom: 160rpx;
width: 98rpx;
height: 98rpx;
}
.sidebar {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
animation: sidebarShow 1s;
z-index: 400;
opacity: 1;
}
.sidebar.hidden {
left: -100%;
background: none;
animation: sidebarHide 1s;
opacity: 0;
}
.sidebar .sidebar-nav {
width: 70%;
height: 100%;
background-color: #fff;
padding: 0;
display: flex;
flex-direction: column;
}
.sidebar .sidebar-nav .weui-cells {
margin-top: 0;
}
.sidebar .sidebar-nav .weui-cells .icon {
vertical-align: middle;
margin-right: 20rpx;
}
.sidebar .sidebar-nav .weui-cell.disabled {
opacity: 0.4;
}
.icon-more-monitor{
width: 30rpx;
height: 30rpx;
background-position: -482rpx -330rpx;
}
.icon-more-freq{
width: 30rpx;
height: 30rpx;
background-position: -482rpx -240rpx;
}
.icon-more-fence{
width: 30rpx;
height: 30rpx;
background-position: -482rpx -210rpx;
}
.icon-more-share{
width: 30rpx;
height: 30rpx;
background-position: -482rpx -360rpx;
}
.arrow-right{
display: inline-block;
width: 16rpx;
height: 25rpx;
margin-right: 10rpx;
}
.share-tip {
position: fixed;
top: 0px;
left: 50%;
margin-left: -280rpx;
width: 520rpx;
padding: 10rpx 20rpx;
background-color: rgba(0, 0, 0, 0.5);
z-index: 300;
color: #f3f3f3;
display: none;
}
.share-tip.active {
display: block;
}
.share-tip .icon-small {
margin-right: 10rpx;
}
.share-cover {
position: fixed;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 600;
display: none;
}
.share-cover.active {
display: block;
}
.share-cover > .icon-share {
position: absolute;
top: 20rpx;
right: 150rpx;
}
.share-cover > .tip {
margin-top: 120rpx;
text-align: center;
color: #fff;
font-size: 36rpx;
}
.icon-share {
width: 68rpx;
height: 80rpx;
background-position: -384rpx -98rpx;
}
@keyframes topShow {
from {
transform: translate(0, -100%); }
to {
transform: translate(0, 0);
}
}
@keyframes topHide {
from {
top: 0;
}
to {
top: -100%;
}
}
@keyframes sidebarHide
{
from {
left: 0;
}
to {
left: -100%;
}
}
@keyframes sidebarShow
{
0% {
left: -100%;
background: none;
}
25% {
left: 0;
background: none;
}
100%{
background: rgba(0,0,0,0.5);
}
}
\ No newline at end of file \ No newline at end of file
const WXRequest = require('../../utils/wxrequest.js');
Page({
data: {
inputVal: '',
searchTypes: [{
label: '申请单号',
value: '4'
},{
label: '车架号',
value: '2'
},{
label: '设备号',
value: '1'
}
// {
// label: '姓名',
// value: '3'
// }
],
placeholders: [
'请输入完整的申请单号',
'请输入完整的车架号',
'请输入设备SN',
'请输入客户姓名'
],
searchTypesIndex: 0,
list: [],
scrollTop: 0,
scrollHeight: 300,
page: 1,
maxPage: 0,
ing: false,
initSearch: false,
},
onLoad(option) {
var that = this;
wx.getSystemInfo({
success: function(res) {
that.setData({
scrollHeight: res.windowHeight-50
})
}
});
},
clearInput: function () {
this.setData({
inputVal: ""
});
},
inputTyping: function (e) {
this.setData({
inputVal: e.detail.value
});
},
searchConfirm(e){
this.setData({
ing: false,
page: 1,
scrollTop: 0
});
this.loadData();
},
loadData(isInit){
var that = this;
if(!isInit && !that.validate()) return;
that.setData({
ing: true
});
let params = {
termType: that.data.searchTypes[that.data.searchTypesIndex].value,
term: that.data.inputVal,
pageSize: 10,
pageNumber: that.data.page
}
WXRequest.get('trialdrive/api/vehicle/search',params, true).then((res)=>{
if(!that.data.ing) return;
const _list = res.data && res.data.list;
const maxPage = res.data && res.data.totalPages;
if(_list){
_list.forEach((item)=>{
const deviceObj = {}
let encrySns = [] // 加密设备号
item.devices&&item.devices.forEach((deviceItem)=>{
deviceItem.wireType = deviceItem.wireType === 0 ? '无线设备' : deviceItem.wireType === 1 ? '有线设备' : ''
if(!deviceObj[deviceItem.wireType]){
deviceObj[deviceItem.wireType] = [];
}
deviceObj[deviceItem.wireType].push(deviceItem.sn);
encrySns.push(deviceItem.deviceCode)
item.encrySns = encrySns.join(',')
});
item.deviceList = [];
for(let type in deviceObj){
item.deviceList.push({
type: type,
sns: deviceObj[type]
});
}
});
that.setData({
list: that.data.page===1?_list:that.data.list.concat(_list),
ing: false,
maxPage,
initSearch: true
});
} else {
that.setData({
list: [],
ing: false,
maxPage
});
}
})
},
searchTypeChange(e){
this.setData({
searchTypesIndex: e.detail.value
});
if(!this.data.inputVal) return;
this.setData({
ing: false,
page: 1,
scrollTop: 0
});
this.loadData()
},
bindDownLoad(){
if(this.data.ing) return;
const nextPage = this.data.page+1;
if(nextPage>this.data.maxPage) return;
this.setData({
page: nextPage
});
this.loadData();
},
bindScroll(){
},
validate(){
const type = this.data.searchTypes[this.data.searchTypesIndex].value;
const inputVal = this.data.inputVal;
if(type === '3'){//姓名
if(inputVal.length<2){
wx.showToast({
title: '请输入正确的姓名,至少2个字',
icon: 'none'
});
return false;
}
}else if(inputVal.length<6){
wx.showToast({
title: '请输入至少6位数',
icon: 'none'
});
return false;
}
return true;
},
redirectDetail(e){
const dataset = e.currentTarget.dataset;
wx.navigateTo({
url: `../../pages/newFindCar/findCar?sns=${encodeURIComponent(dataset.sns)}`,
})
}
})
\ No newline at end of file \ No newline at end of file
{}
\ No newline at end of file \ No newline at end of file
<view class="serach-box">
<view class="weui-search-bar__form">
<view class="weui-search-bar__box search-wrap">
<icon class="weui-icon-search_in-box" type="search" size="14"></icon>
<input
type="text"
class="weui-search-bar__input"
placeholder="{{placeholders[searchTypesIndex]}}"
value="{{inputVal}}"
focus="{{inputShowed}}"
bindinput="inputTyping"
bindconfirm="searchConfirm"/>
<view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
<icon type="clear" size="14"></icon>
</view>
<picker
class="search-picker"
bindchange="searchTypeChange"
value="{{searchTypesIndex}}"
range="{{searchTypes}}"
range-key="label">
<text>{{searchTypes[searchTypesIndex].label}}</text>
<view class="select-dropdown-icon"></view>
</picker>
</view>
</view>
</view>
<view class="result-list" hidden="{{!list.length}}">
<scroll-view
scroll-top="{{scrollTop}}"
scroll-y="true"
style="height:{{scrollHeight}}px;"
bindscrolltolower="bindDownLoad"
bindscroll="bindScroll">
<view class="weui-cell"
wx:for="{{list}}"
wx:key="index"
bindtap="redirectDetail"
data-sns="{{item.encrySns}}">
<view class="weui-cell__bd">
<view class="title"><text class="name">{{item.ownerName || ''}}</text> {{item.vin}}</view>
<view class="sub-title"><text class="label">申请单号:</text> {{item.orderNo||''}}</view>
<view wx:for="{{item.deviceList}}" wx:key="index" class="sub-list">
<text class="label">{{item.type}}:</text>
<view class="sub-item">
<view wx:for="{{item.sns}}" wx:key="index">{{item}}</view>
</view>
</view>
</view>
</view>
<view class="end-tip" hidden="{{page!=maxPage}}">
没有更多数据了~
</view>
</scroll-view>
</view>
<view class="none" hidden="{{!initSearch || list.length}}">
<image src="../../images/none.png"/>
<view>没有搜索到匹配的车辆数据</view>
</view>
.serach-box{
padding: 20rpx;
background-color: #fff;
}
.search-wrap{
position: relative;
padding-right: 240rpx;
}
.search-wrap input{
}
.search-picker{
position: absolute;
top: 0;
right: 0;
font-size: 28rpx;
}
.search-picker text{
position: absolute;
display: inline-block;
width: 140rpx;
right: 40rpx;
height: 56rpx;
line-height: 56rpx;
padding-left: 20rpx;
border-left: 2rpx solid #eee;
}
.select-dropdown-icon{
content: '';
display: inline-block;
border: 10rpx solid transparent;
border-top-color: #c9c9c9;
position: absolute;
right: 20rpx;
top: 20rpx;
}
.search-wrap .weui-icon-clear{
right: 200rpx;
z-index: 100;
}
.result-list{
background-color: #fff;
color: #666;
font-size: 28rpx;
}
.result-list .title{
color: #000;
}
.result-list .name{
margin-right: 20rpx;
}
.result-list .label{
margin-right: 20rpx;
float: left;
}
.sub-list{
overflow: hidden;
}
.sub-item{
float: left;
}
.sub-title{
overflow: hidden;
}
.result-list .weui-cell:first-child{
border-top: 2rpx solid #d9d9d9;
}
.result-list .weui-cell:last-child{
border-bottom: 2rpx solid #d9d9d9;
}
.none{
padding: 200rpx 0;
text-align: center;
color: #999;
}
.none image{
width: 400rpx;
height: 400rpx;
margin-bottom: 20rpx;
}
.end-tip{
text-align: center;
}
\ No newline at end of file \ No newline at end of file
const WXRequest = require('../../utils/wxrequest.js');
let timeoutId
Page({
/**
* 页面的初始数据
*/
data: {
sns: '',
points: [],
carMarkers: [],
firstPosLng: null, // 首次获取的位置坐标
firstPosLat: null, // 首次获取的位置坐标
listData: [],
isShowList: true,
carLocationObj: {},
scrollIntoViewIndex: '_1',
includePoints: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
sns: decodeURIComponent(options.sn)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.myMap = this.selectComponent('#monitorMap')
this.getPosition()
},
// 刷新
refresh() {
this.setData({
carMarkers: [],
listData: []
})
this.myMap.getMapCtx().removeMarkers({
markerIds: [1, 2]
})
this.myMap.setData({
polyline: []
})
this.getPosition()
timeoutId && clearTimeout(timeoutId)
},
// 获取定位
locationCallback(e) {
let data = JSON.parse(JSON.stringify(this.data.includePoints))
let isHad = data.length && data.find((item) => item.latitude === e.detail.lat && item.longitude === e.detail.lng)
if (!isHad) {
data.push({
latitude: e.detail.lat,
longitude: e.detail.lng
})
}
this.myMap.getMapCtx().includePoints({
points: data,
padding: [60, 60, 60, 60],
success: (res) => {
}
})
},
// 获取车的实时定位
getPosition() {
let listData = this.data.listData
let points = this.data.points
WXRequest.get('trialdrive/api/vehicle/location', {
sns: this.data.sns
}, true, true).then(e => {
let includePoints = this.data.includePoints
if (e.code == 200 && e.data.length > 0) {
// 逆地址解析
wx.request({
url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ e.data[0].gpsLocation.elat + ',' + e.data[0].gpsLocation.elng,
success: res => {
if (res.statusCode === 200) {
let transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough)
listData.push({
transferAddress: transferAddress,
time: e.data[0].gpsLocation.dateTime
})
if (listData.length > 3) listData.shift() // 最多展示最新三条数据
this.setData({
listData: listData,
scrollIntoViewIndex: '_' + listData.length
})
let isHad = includePoints.length && includePoints.find((item) => item.latitude === e.data[0].gpsLocation.elat && item.longitude === e.data[0].gpsLocation.elng)
if (!isHad) {
includePoints.push({
latitude: e.data[0].gpsLocation.elat,
longitude: e.data[0].gpsLocation.elng
})
}
this.setData({
includePoints: includePoints
})
if (this.data.carMarkers.length <= 0) {
let marker = [{
id: 1,
width: 15,
height: 25,
latitude: e.data[0].gpsLocation.elat,
longitude: e.data[0].gpsLocation.elng,
iconPath: '../../images/car.png'
}]
this.myMap.getMapCtx().addMarkers({
markers: marker,
success: () => {
points.push({
latitude: Number(e.data[0].gpsLocation.elat),
longitude: Number(e.data[0].gpsLocation.elng),
})
this.setData({
carMarkers: marker,
points: points,
firstPosLat: Number(e.data[0].gpsLocation.elat),
firstPosLng: Number(e.data[0].gpsLocation.elng)
})
this.moveToLocation(Number(e.data[0].gpsLocation.elat), Number(e.data[0].gpsLocation.elng))
}
})
} else {
if (this.data.firstPosLat !== (Number(e.data[0].gpsLocation.elat)) || this.data.firstPosLng !== (Number(e.data[0].gpsLocation.elng))) {
let marker = [{
id: 2,
width: 15,
height: 25,
latitude: Number(this.data.firstPosLat),
longitude: Number(this.data.firstPosLng),
iconPath: '../../images/begin.png'
}]
this.myMap.getMapCtx().addMarkers({
markers: marker,
success: () => {
let arr = [{
latitude: Number(e.data[0].gpsLocation.elat),
longitude: Number(e.data[0].gpsLocation.elng)
}]
this.myMap.getMapCtx().translateMarker({
markerId: 1,
destination: {
longitude: Number(e.data[0].gpsLocation.elng),
latitude: Number(e.data[0].gpsLocation.elat),
},
duration: 500,
animationEnd: () => {
this.moveToLocation(Number(e.data[0].gpsLocation.elat), Number(e.data[0].gpsLocation.elng))
this.setData({
points: points.concat(arr),
})
this.myMap.setData({
polyline: [{
points: points.concat(arr),
color: '#0b94db',
width: 6,
arrowLine: true
}]
})
}
})
}
})
} else {
this.moveToLocation(Number(e.data[0].gpsLocation.elat), Number(e.data[0].gpsLocation.elng))
}
}
timeoutId = setTimeout(() => {
this.getPosition()
}, 10*1000)
}
}
})
}
})
},
listIconBatch() {
this.setData({
isShowList: !this.data.isShowList
})
},
moveToLocation: function (latitude, longitude ) {
this.myMap.getMapCtx().moveToLocation({
longitude: Number(longitude),
latitude: Number(latitude)
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
timeoutId && clearTimeout(timeoutId)
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
timeoutId && clearTimeout(timeoutId)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
// onShareAppMessage: function () {
// }
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
"myMap": "../../components/myMap/myMap"
},
"navigationBarTitleText": "实时监控"
}
\ No newline at end of file \ No newline at end of file
<view class="monitor_content">
<myMap class="my-map" id="monitorMap" mapId="monitorMap" includePoints="{{includePoints}}" markers="{{markers}}" bind:refresh="refresh" bind:mapCallback="mapCallback" bind:locationCallback="locationCallback"></myMap>
<view class="toggle-bottom {{isShowList ? '' : 'hidden'}}" id="toggleBottom">
<icon class="toggle-btn active icon {{isShowList ? 'icon-toggle-down' : 'icon-toggle-up'}}" bindtap="listIconBatch"></icon>
<scroll-view class="toggle-list" scroll-y="true" scroll-into-view="{{scrollIntoViewIndex}}">
<view id="{{'_' + (index + 1)}}" class="list-item" wx:for="{{listData}}" wx:key="index">
<view class="title">{{(index + 1) + '.' + item.transferAddress}}</view>
<view class="time">{{item.time}}</view>
</view>
</scroll-view>
</view>
</view>
.toggle-bottom {
position: fixed;
width: 100%;
left: 0rpx;
bottom: 0rpx;
animation: bottomShow .3s;
z-index: 1000;
}
.toggle-bottom .toggle-btn {
position: absolute;
top: -70rpx;
left: 50%;
transform: translate(-50%, 0);
visibility: hidden;
}
.toggle-bottom .toggle-btn.active {
visibility: visible;
}
.toggle-bottom .toggle-list {
background-color: #fff;
padding-left: 20rpx;
max-height: 346rpx;
overflow-y: scroll;
}
.toggle-bottom .toggle-list .list-item {
padding: 10rpx 20rpx 10rpx 20rpx;
border-bottom: 2rpx solid #ececec;
}
.toggle-bottom .toggle-list .list-item:last-child {
border-bottom: none;
}
.toggle-bottom .toggle-list .title {
color: #000;
font-size: 32rpx;
}
.toggle-bottom .toggle-list .time {
color: #666;
}
.toggle-bottom.hidden {
transform: translate(0, 100%);
animation: bottomHide .3s;
}
.icon-toggle-up {
width: 60rpx;
height: 62rpx;
background-position: -165rpx -350rpx;
}
.icon-toggle-down {
width: 61rpx;
height: 62rpx;
background-position: -105rpx -350rpx;
}
@keyframes bottomShow {
from {
transform: translate(0, 100%);
}
to {
transform: translate(0, 0);
}
}
@keyframes bottomHide {
from {
transform: translate(0, 0);
}
to {
transform: translate(0, 100%);
}
}
const WXRequest = require('../../utils/wxrequest.js');
const moment = require('../../utils/moment.min.js');
Page({
/**
* 页面的初始数据
*/
data: {
speedItems: [
{
label: '慢',
value: 0
},
{
label: '正常',
value: 1
},
{
label: '快',
value: 2
},
{
label: '很快',
value: 3
}
],
speedItemsIndex: 0,
isReplayIng: false,
markers: [],
isShowModel: false,
clickItem: null,
selectTime: '',
sn: null,
type: null,
durationArr: [20000, 15000, 10000, 5000],
optTime: moment().format('YYYY-MM-DD'),
allowClick: true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
sn: decodeURIComponent(options.sn),
locationType: options.locationType == 'gpsLocation' ? 0 : 1
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.myMap = this.selectComponent('#traReplayMap')
},
// 刷新
refresh() {
if (this.myMap.data.polyline.length <= 0) return
this.setData({
clickItem: null,
selectTime: '',
includePoints: [],
speedItemsIndex: 0,
isReplayIng: false,
markers: []
})
this.myMap.setData({polyline: []})
this.myMap.getMapCtx().removeMarkers({
markerIds: [2]
})
},
// 获取定位
locationCallback(e) {
let data = JSON.parse(JSON.stringify(this.data.includePoints))
let isHad = data.length && data.find((item) => item.latitude === e.detail.lat && item.longitude === e.detail.lng)
if (!isHad) {
data.push({
latitude: e.detail.lat,
longitude: e.detail.lng
})
}
this.myMap.getMapCtx().includePoints({
points: data,
padding: [60, 60, 60, 60],
success: (res) => {
}
})
},
showModel() {
this.setData({
isShowModel: true
})
},
// 自定义时间段选择
dateChange(e) {
this.setData({
clickItem: null,
selectTime: e.detail.value
})
},
// 选择时间取消
cancel() {
this.setData({
isShowModel: false
})
},
// 选择时间确认
confirm() {
if (!this.data.clickItem && !this.data.selectTime) {
wx.showModal({
content: '请选择一个时间段',
showCancel: false
});
return false
} else {
this.setData({
isShowModel: false,
includePoints: [],
speedItemsIndex: 0,
isReplayIng: false,
markers: []
})
this.myMap.getMapCtx().removeMarkers({
markerIds: [2],
complete: () => {
this.getData()
}
})
}
},
// 选择固定时间段
timeClick(e) {
this.setData({
clickItem: e.currentTarget.dataset.time,
selectTime: ''
})
},
getData() {
let _sTime, _eTime
if(this.data.selectTime){
_sTime = this.data.selectTime+' 00:00:00';
_eTime = this.data.selectTime+' 23:59:59';
}else{
_eTime = moment().format('YYYY-MM-DD HH:mm:ss');
_sTime = moment().subtract('day', Number(this.data.clickItem)).format('YYYY-MM-DD HH:mm:ss');
}
let params = {sn: this.data.sn, startTime: _sTime, endTime: _eTime, locationType: this.data.locationType}
WXRequest.get('devicemonitor/api/track/playback', params, true).then(res => {
let arr = []
var polyline = []
if (res.code == 200) {
res.data.forEach(item => {
arr.push({
latitude: Number(item.elat),
longitude: Number(item.elng)
})
});
let obj = {}
let removalArr = arr.reduce((curr, next) => {
/*判断对象中是否已经有该属性 没有的话 push 到 curr数组*/
obj[next.latitude + next.longitude] ? '' : obj[next.latitude + next.longitude] = curr.push(next);
return curr;
}, []);
this.distance(removalArr)
if (res.data.length) {
polyline.push({
points: arr,
color: '#0b94db',
width: 6,
arrowLine: true
})
this.myMap.getMapCtx().includePoints({
points: arr,
padding: [40, 40, 40, 40]
})
this.setData({
includePoints: arr
})
this.myMap.setData({polyline: polyline})
} else {
wx.showModal({
content: '暂无数据',
showCancel: false
})
}
}
})
},
// 距离计算总和
distance(arr) {
var s, all = 0
arr.forEach((item, index) => {
if (arr[index + 1]) {
var La1 = arr[index].latitude * Math.PI / 180.0;
var La2 = arr[index + 1].latitude * Math.PI / 180.0;
var La3 = La1 - La2;
var Lb3 = arr[index].longitude * Math.PI / 180.0 - arr[index + 1].longitude * Math.PI / 180.0;
s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(La3 / 2), 2) + Math.cos(La1) * Math.cos(La2) * Math.pow(Math.sin(Lb3 / 2), 2)));
s = s * 6378.137;//地球半径
s = Math.round(s * 10000) / 10000;
all = all + s
}
})
if (all > 10 && all < 100) {
this.setData({
durationArr: [15*1000, 10*1000, 6*1000, 3*1000]
})
} else if (all <= 10) {
this.setData({
durationArr: [8*1000, 6*1000, 4*1000, 2*1000]
})
} else {
this.setData({
durationArr: [20*1000, 15*1000, 10*1000, 5*1000]
})
}
},
// 切换回放速度
speedTypeChange(e) {
this.setData({
speedItemsIndex: Number(e.detail.value)
})
this.beginTrack()
},
// 播放
play() {
this.beginTrack()
},
addmerker() {
let marker = [{
id: 105,
width: 15,
height: 25,
latitude: this.myMap.data.polyline[0].points[0].latitude,
longitude: this.myMap.data.polyline[0].points[0].longitude,
iconPath: '../../images/car.png'
}]
this.setData({
isReplayIng: true,
markers: marker
})
},
move() {
if (this.myMap.getMapCtx().moveAlong) {
this.myMap.getMapCtx().moveAlong({
markerId: 105,
path: this.myMap.data.polyline[0].points,
duration: this.data.durationArr[this.data.speedItemsIndex],
fail: (res) => { // 真机上容易执行失败
if (res.errMsg === 'moveMapMarkerAlong:fail') {
this.move()
} else if (res.errMsg === 'moveMapMarkerAlong:fail cancel') {
return
}
},
})
} else {
wx.showModal({
title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。',
showCancel: false
})
}
},
async beginTrack() {
if (this.myMap.data.polyline.length) {
await this.addmerker()
await this.move()
}
},
// 暂停
pause() {
},
// 重新播放
replayRefresh() {
this.setData({
allowClick: false
})
this.beginTrack()
setTimeout(() => {
this.setData({
allowClick: true
})
}, 500)
},
// 点击地图回调
mapCallback(e) {
if (this.myMap.data.polyline.length <= 0) return
let transferAddress
// 删除上一个marker
this.myMap.getMapCtx().removeMarkers({
markerIds: [2]
})
// 逆地址解析
wx.request({
url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ e.detail.detail.latitude + ',' + e.detail.detail.longitude,
success: res => {
if (res.statusCode === 200) {
transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '\n' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '\n' + res.data.result.formatted_addresses.rough)
this.myMap.getMapCtx().addMarkers({
markers: [{
id: 2,
latitude: e.detail && e.detail.detail && e.detail.detail.latitude,
longitude: e.detail && e.detail.detail && e.detail.detail.longitude,
width: 20,
height: 30,
callout: {
content: transferAddress,
borderRadius: 10,
padding: 10,
display: 'ALWAYS'
}
}],
})
}
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
// onShareAppMessage: function () {
// }
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
"myMap": "../../components/myMap/myMap"
},
"navigationBarTitleText": "轨迹回放"
}
\ No newline at end of file \ No newline at end of file
<view class="traReplay_content">
<view class="tabbar">
<view class="tabbar-item" bindtap="showModel">轨迹时间</view>
<picker
class="tabbar-item"
bindchange="speedTypeChange"
value="{{speedItemsIndex}}"
range="{{speedItems}}"
range-key="label">
<text>回放速度 {{speedItems[speedItemsIndex].label}}</text>
<view class="select-dropdown-icon"></view>
</picker>
</view>
<myMap class="my-map" id="traReplayMap" mapId="traReplayMap" includePoints="{{includePoints}}" markers="{{markers}}" bind:refresh="refresh" bind:mapCallback="mapCallback" bind:locationCallback="locationCallback"></myMap>
<!-- 回放控制按钮 -->
<view class="btn-control" slot="bottomBox">
<view class="icon icon-replay-play play-btn {{isReplayIng? '' : 'active'}}" bindtap="play"></view>
<!-- <view class="icon icon-replay-pause pause-btn {{isReplayIng? 'active' : ''}}" bindtap="pause"></view> -->
<view class="icon icon-replay-refresh refresh-btn active" bindtap="{{allowClick ? 'replayRefresh' : ''}}"></view>
</view>
<!-- 轨迹时间弹窗 -->
<view class="model_class" wx:if="{{isShowModel}}" slot="sidebar">
<view class="mode_box">
<view class="tilte_class">选择轨迹回放时间</view>
<view class="weui-flex time-choose" >
<view class="weui-flex__item {{clickItem === '1' ? 'weui-btn_plain-primary' : ''}}" bindtap="timeClick" data-time="1">
<text class="weui-btn weui-btn_mini weui-btn_plain-default">24小时</text>
</view>
<view class="weui-flex__item {{clickItem === '3' ? 'weui-btn_plain-primary' : ''}}" bindtap="timeClick" data-time="3">
<text class="weui-btn weui-btn_mini weui-btn_plain-default" >3天</text>
</view>
<view class="weui-flex__item {{clickItem === '7' ? 'weui-btn_plain-primary' : ''}}" bindtap="timeClick" data-time="7">
<text class="weui-btn weui-btn_mini weui-btn_plain-default " >7天</text>
</view>
</view>
<view class="weui-flex time-pick" >
<view class="label-class">自定义时间</view>
<picker
mode="date"
end="{{optTime}}"
class="tabbar-item"
bindchange="dateChange">
<button size="mini" class="date-class">{{selectTime}}</button>
</picker>
</view>
<view class="modelFooter">
<text bindtap="cancel">取消</text>
<text bindtap="confirm" class="saveBtn">确定</text>
</view>
</view>
</view>
</view>
.tabbar {
font-size: 0rpx;
display: flex;
border-top: 2rpx solid #eee;
border-bottom: 2rpx solid #eee;
position: relative;
z-index: 1000;
background: #fff;
}
.tabbar-item {
flex: 1;
font-size: 28rpx;
text-align: center;
border-right: 2rpx solid #eee;
padding: 20rpx 0;
}
.select-dropdown-icon{
content: '';
display: inline-block;
width: 10rpx;
height: 10rpx;
border: 2rpx solid #999;
border-top: none;
border-right: none;
transform: rotate(-45deg);
margin-left: 12rpx;
position: relative;
top: -4rpx;
}
.tabbar-item.active {
color: #37c060;
font-weight: bold;
}
.tabbar-item:last-child {
border-right: none;
}
.btn-control {
position: fixed;
bottom: 40rpx;
left: 50%;
margin-left: -150rpx;
z-index: 300;
}
.play-btn, .pause-btn, .refresh-btn{
display: none;
}
.play-btn.active, .pause-btn.active, .refresh-btn.active{
display: inline-block;
}
.icon-replay-play{
width: 122rpx;
height: 122rpx;
background-position: 0rpx -133rpx;
}
.icon-replay-pause{
width: 122rpx;
height: 122rpx;
background-position: -264rpx 0rpx;
}
.icon-replay-refresh.active{
width: 122rpx;
height: 122rpx;
background-position: -121rpx -133rpx;
}
.refresh-btn{
margin-left: 60rpx;
}
.model_class {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 400;
opacity: 1;
display: flex;
align-items: center;
justify-content: center;
}
.mode_box{
width: 70%;
border-radius: 10rpx;
background: #fff;
padding: 30rpx;
}
.tilte_class{
font-size: 36rpx;
color: #000;
}
.time-choose {
margin: 20rpx 0;
color: #333;
display: flex;
align-items: center;
}
.time-pick{
margin: 30rpx 10rpx 0 10rpx;
display: flex;
}
.time-pick .label-class{
color: #666;
margin-right: 15rpx;
}
.time-pick .tabbar-item{
padding: 0;
text-align: left;
}
.time-pick .tabbar-item .date-class{
width: 100%;
height: 50rpx;
line-height: 50rpx;
}
.time-choose .weui-flex__item {
padding: 0 6rpx;
text-align: center;
border-radius: 10rpx;
margin: 0 10rpx;
border: 2rpx solid #999;
}
.time-choose .weui-btn_plain-primary {
border: 2rpx solid #1aad19;
color: #1aad19;
}
.modelFooter{
padding: 30rpx 20rpx;
text-align: right;
}
.modelFooter .saveBtn{
margin-left: 50rpx;
color: #1aad19;
}
// webviewPackage/pages/webview.js
Page({
/**
* 页面的初始数据
*/
data: {
pagePath:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let url = 'https://img01.glsx.com.cn/weapp/resource/saas/scrm/html/privacy.html'
if(options.id == 'agreement'){
url = 'https://img01.glsx.com.cn/weapp/resource/saas/scrm/html/agreement.html'
}
this.setData({
pagePath:url
})
console.log(options)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<!--webviewPackage/pages/webview.wxml-->
<web-view src="{{pagePath}}"/>
/* pages/webview/index.wxss */
\ No newline at end of file \ No newline at end of file
...@@ -12,9 +12,11 @@ Page({ ...@@ -12,9 +12,11 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let domain = WXRequest.domain.split('//')[1] let domain = WXRequest.wxDomain.split('//')[1]
let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxcad686d44f4c8c4d&redirect_uri=https%3a%2f%2f${domain}%2fopenid.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect` //let _appid = 'wxcad686d44f4c8c4d'; // 旧公众号
let _appid = 'wxb75708fc3ebb3605'; //新公众号
let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${_appid}&redirect_uri=https%3a%2f%2f${domain}%2fopenid.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
console.log(url)
this.setData({ this.setData({
jumpLink: url jumpLink: url
}); });
......
...@@ -20,28 +20,22 @@ ...@@ -20,28 +20,22 @@
"disablePlugins": [], "disablePlugins": [],
"outputPath": "" "outputPath": ""
}, },
"useIsolateContext": true, "useIsolateContext": false,
"useCompilerModule": true, "userConfirmedBundleSwitch": false,
"userConfirmedUseCompilerModuleSwitch": false,
"packNpmManually": false, "packNpmManually": false,
"packNpmRelationList": [], "packNpmRelationList": [],
"minifyWXSS": true, "minifyWXSS": true,
"enhance": true,
"preloadBackgroundData": false,
"uglifyFileName": false,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"disableUseStrict": false, "disableUseStrict": false,
"minifyWXML": true,
"showES6CompileOption": false, "showES6CompileOption": false,
"useCompilerPlugins": false, "useCompilerPlugins": false,
"ignoreUploadUnusedFiles": true, "ignoreUploadUnusedFiles": true,
"useStaticServer": true, "condition": false
"minifyWXML": true
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.23.4", "libVersion": "2.22.1",
"appid": "wxdae8cf8710b62fee", "appid": "wxdae8cf8710b62fee",
"projectname": "wx", "projectname": "%E8%99%8E%E5%93%A5e%E7%9B%BE",
"simulatorType": "wechat", "simulatorType": "wechat",
"simulatorPluginLibVersion": {}, "simulatorPluginLibVersion": {},
"condition": { "condition": {
......
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"libVersion": "2.33.0"
}
\ No newline at end of file \ No newline at end of file
const domain = 'https://e-shield.didihu.com.cn/otmini/'; //正式环境 //const domain = 'https://e-shield.didihu.com.cn/otmini/'; //正式环境
// const domain = 'https://devwx.glsx.com.cn/otmini/'; //开发环境 //const domain = 'https://e-shield.hhxtechnology.com/otmini/'; //正式环境
const domain = 'https://devwx.glsx.com.cn/otmini/'; //开发环境
/* /*
新e盾找车 新e盾找车
*/ */
...@@ -8,6 +9,9 @@ const domain = 'https://e-shield.didihu.com.cn/otmini/'; //正式环境 ...@@ -8,6 +9,9 @@ const domain = 'https://e-shield.didihu.com.cn/otmini/'; //正式环境
// 生产:https://eshield.didihu.com.cn/ // 生产:https://eshield.didihu.com.cn/
const newDomain = 'https://eshield.didihu.com.cn/' const newDomain = 'https://eshield.didihu.com.cn/'
// 公众号授权页面
const wxDomain = 'https://e-shield.hhxtechnology.com/otmini/'
function redirectToLogin(){console.log('redirectToLogin') function redirectToLogin(){console.log('redirectToLogin')
wx.redirectTo({ wx.redirectTo({
url: '../../pages/login/login' url: '../../pages/login/login'
...@@ -16,6 +20,7 @@ function redirectToLogin(){console.log('redirectToLogin') ...@@ -16,6 +20,7 @@ function redirectToLogin(){console.log('redirectToLogin')
module.exports = { module.exports = {
domain, domain,
wxDomain,
login(data){ login(data){
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
wx.showLoading(); wx.showLoading();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!