十一月十一凌晨更新
This commit is contained in:
@@ -1,143 +1,113 @@
|
||||
<template>
|
||||
<view class="page-content my-bg">
|
||||
<cu-custom class="main-topbar bg-main-oil" bgColor="bg-white">
|
||||
<block slot="content">绑定星油云站</block>
|
||||
</cu-custom>
|
||||
<view class="pannel">
|
||||
<view class="logo margin-top">
|
||||
<img :src="baseURL+'/static/img/order-xy.png'" mode="" />
|
||||
</view>
|
||||
<view class="bg-white margin padding radius shadow-warp">
|
||||
<view class="text-bold padding-bottom text-center">
|
||||
油站工作人员绑定油站
|
||||
</view>
|
||||
<view class="text-grey padding-bottom text-center">
|
||||
请确认您的手机号码已注册星油云站
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">云站号</view>
|
||||
<input placeholder="请输入云站编号" name="input"></input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="margin">
|
||||
<button class="bg-main-oil" @tap="loginWeixin">
|
||||
登录
|
||||
</button>
|
||||
<button class="bg-main-oil" open-type="getUserInfo" @getuserinfo="getUserInfo">
|
||||
登录测试getuserinfo
|
||||
</button>
|
||||
<button class="bg-main-oil" @tap="getMsg">
|
||||
订阅消息
|
||||
</button>
|
||||
<button class="bg-gradual-pink" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">获取微信绑定手机号</button>
|
||||
<button class="bg-gradual-pink" open-type="launchApp" @error="launchAppError">获取微信绑定手机号</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page-content">
|
||||
<view class="page-section page-section-gap">
|
||||
<map
|
||||
style="width: 100%; height: 1600rpx;"
|
||||
id="mymap"
|
||||
show-location
|
||||
enable-traffic
|
||||
show-compass
|
||||
:latitude="latitude"
|
||||
enable-3D
|
||||
:longitude="longitude"
|
||||
:markers="covers"
|
||||
:polyline="polyline"
|
||||
@markertap="ontouchMaker"
|
||||
></map>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import loginApi from '@/api/login.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
baseURL: this.global.baseURL,
|
||||
forcedLogin: true
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// this.loginWeixin()
|
||||
},
|
||||
methods: {
|
||||
launchAppError(err){
|
||||
console.log(err)
|
||||
},
|
||||
getPhoneNumber(obj){
|
||||
console.log(obj)
|
||||
},
|
||||
getMsg() {
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: ['W5XD3NQVa6knC5jXHeWT8GS7q5CHrDUMY_sF79kLkKk'],
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
},
|
||||
getUserInfo({
|
||||
detail
|
||||
}) {
|
||||
console.log('三方登录只演示登录api能力,暂未关联云端数据');
|
||||
console.log('detail', detail)
|
||||
if (detail.userInfo) {
|
||||
this.loginLocal(detail.userInfo.nickName);
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '登陆失败'
|
||||
});
|
||||
}
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: 0, // 使用 marker点击事件 需要填写id
|
||||
title: 'map',
|
||||
longitude: 117.166483,
|
||||
latitude: 31.764309,
|
||||
|
||||
},
|
||||
loginLocal(nickName) {
|
||||
uni.setStorageSync('login_type', 'local')
|
||||
uni.setStorageSync('username', nickName)
|
||||
this.toMain(nickName);
|
||||
},
|
||||
toMain(userName) {
|
||||
// this.login(userName)
|
||||
console.log(userName)
|
||||
/**
|
||||
* 强制登录时使用reLaunch方式跳转过来
|
||||
* 返回首页也使用reLaunch方式
|
||||
*/
|
||||
if (this.forcedLogin) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
success: () => {
|
||||
console.log('success')
|
||||
},
|
||||
fail: err => {
|
||||
console.log(err)
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
polyline: [{
|
||||
points: [{
|
||||
latitude: 31.764325,
|
||||
longitude: 117.16659
|
||||
}, {
|
||||
latitude: 31.764309,
|
||||
longitude: 117.166482
|
||||
},
|
||||
{
|
||||
latitude: 31.764308,
|
||||
longitude: 117.166483
|
||||
},
|
||||
{
|
||||
latitude: 31.764312,
|
||||
longitude: 117.166488
|
||||
},
|
||||
{
|
||||
latitude: 31.764332,
|
||||
longitude: 117.166583
|
||||
}
|
||||
],
|
||||
color: '#0AED4D',
|
||||
width: 3,
|
||||
borderWidth: 2,
|
||||
}],
|
||||
|
||||
},
|
||||
loginWeixin() {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: loginRes => {
|
||||
const code = loginRes.code
|
||||
console.log(code)
|
||||
loginApi.loginWeixin(code).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
console.log(err)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
covers: [{
|
||||
id: 0,
|
||||
latitude: 39.909,
|
||||
longitude: 116.39742,
|
||||
iconPath: '../../static/img/60.jpg',
|
||||
width: 36,
|
||||
height: 36,
|
||||
alpha: 0.8
|
||||
}, {
|
||||
id: 1,
|
||||
latitude: 39.90,
|
||||
longitude: 116.39,
|
||||
iconPath: '../../static/img/28.png',
|
||||
width: 36,
|
||||
alpha: 0.8,
|
||||
height: 36
|
||||
}]
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
var mymap = uni.createMapContext('mymap', this)
|
||||
mymap.moveToLocation()
|
||||
|
||||
},
|
||||
onReady() {
|
||||
var mymap = uni.createMapContext('mymap', this)
|
||||
mymap.moveToLocation()
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
ontouchMaker(e) {
|
||||
console.log(e, e.detail)
|
||||
console.log(this.covers[e.detail.markerId])
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-content {
|
||||
min-height: 100%;
|
||||
}
|
||||
.page-content {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.logo {
|
||||
min-width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
.logo {
|
||||
min-width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo img {
|
||||
width: 200upx;
|
||||
height: 200rpx;
|
||||
background-size: contain;
|
||||
margin: auto;
|
||||
}
|
||||
.logo img {
|
||||
width: 200upx;
|
||||
height: 200rpx;
|
||||
background-size: contain;
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user