Files
LSM_OIL_SITE/pages/temp/temp.vue
xk_guohonglei b68df95618 已对接6个接口
准备回复订单详情页面
2020-08-22 09:55:17 +08:00

144 lines
3.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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>
</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: '登陆失败'
});
}
},
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();
}
},
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)
}
});
}
}
};
</script>
<style scoped>
.page-content {
min-height: 100%;
}
.logo {
min-width: 100%;
text-align: center;
}
.logo img {
width: 200upx;
height: 200rpx;
background-size: contain;
margin: auto;
}
</style>