Commit 68a06d53 authored by 肖健's avatar 肖健

注释用不到的登录

parent 53cc17e1
...@@ -6,343 +6,343 @@ ...@@ -6,343 +6,343 @@
<view class="appCotent"> <view class="appCotent">
<div class="binding"> <!-- <div class="binding">-->
<div class="login__logo"> <!-- <div class="login__logo">-->
<image src="@/static/binding/logo.png"> <!-- <image src="@/static/binding/logo.png">-->
</div> <!-- </div>-->
<!-- #ifdef MP-WEIXIN --> <!-- &lt;!&ndash; #ifdef MP-WEIXIN &ndash;&gt;-->
<!-- <view v-if="isCanUse"> <!-- &lt;!&ndash; <view v-if="isCanUse">-->
<view> <!-- <view>-->
<button class="login__btn" hover-class="none" type='primary' @click="getUserProfile"> <!-- <button class="login__btn" hover-class="none" type='primary' @click="getUserProfile">-->
微信一键登录 <!-- 微信一键登录-->
</button> <!-- </button>-->
</view> <!-- </view>-->
</view> --> <!-- </view> &ndash;&gt;-->
<view v-if="isCanUse2"> <!-- <view v-if="isCanUse2">-->
<view> <!-- <view>-->
<button class="login__btn" v-if="!checked" hover-class="none" type='primary' @click="checkLogin"> <!-- <button class="login__btn" v-if="!checked" hover-class="none" type='primary' @click="checkLogin">-->
微信一键登录 <!-- 微信一键登录-->
</button> <!-- </button>-->
<button class="login__btn" v-if="checked" hover-class="none" type='primary' <!-- <button class="login__btn" v-if="checked" hover-class="none" type='primary'-->
open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"> <!-- open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">-->
微信一键登录 <!-- 微信一键登录-->
</button> <!-- </button>-->
</view> <!-- </view>-->
</view> <!-- </view>-->
<!-- #endif --> <!-- &lt;!&ndash; #endif &ndash;&gt;-->
<div class="login__read"> <!-- <div class="login__read">-->
<u-checkbox-group placement="row"> <!-- <u-checkbox-group placement="row">-->
<u-checkbox :checked='checked' @change="changeBtn"></u-checkbox> <!-- <u-checkbox :checked='checked' @change="changeBtn"></u-checkbox>-->
</u-checkbox-group> <!-- </u-checkbox-group>-->
已阅读并同意 <span @click="goArticle(1)">《用户注册服务协议》</span><span <!-- 已阅读并同意 <span @click="goArticle(1)">《用户注册服务协议》</span><span-->
@click="goArticle(2)">《京东汽车挪车牌隐私权政策》</span>。若您的手机号未注册,将为您直接注册友众账号 <!-- @click="goArticle(2)">《京东汽车挪车牌隐私权政策》</span>。若您的手机号未注册,将为您直接注册友众账号-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
checked: true, // checked: true,
code: "", // code: "",
isCanUse: false, //默认为true // isCanUse: false, //默认为true
isCanUse2: false, //默认为true // isCanUse2: false, //默认为true
openid: '', // openid: '',
nc_protocol: false, // nc_protocol: false,
//扫描二维码参数 // //扫描二维码参数
scene: "", // scene: "",
//检查绑定挪车码 // //检查绑定挪车码
checkCode: {}, // checkCode: {},
//上级url // //上级url
superiorUrl: '/pages/main', // superiorUrl: '/pages/main',
//上级路径参数 // //上级路径参数
superiorParam: "index", // superiorParam: "index",
failure: null // failure: null
}; };
}, },
methods: { methods: {
changeBtn() { // changeBtn() {
this.checked = !this.checked; // this.checked = !this.checked;
}, // },
//登录 // //登录
checkLogin() { // checkLogin() {
uni.showToast({ // uni.showToast({
title: "请先阅读并同意《用户注册服务协议》、《京东汽车挪车牌隐私权政策》", // title: "请先阅读并同意《用户注册服务协议》、《京东汽车挪车牌隐私权政策》",
icon: 'none', // icon: 'none',
duration: 2000, // duration: 2000,
}); // });
//
}, // },
//检查挪车码存在、是否绑定 // //检查挪车码存在、是否绑定
getCheckMoveCode() { // getCheckMoveCode() {
let opts = { // let opts = {
url: '/app/user/c/m/c', // url: '/app/user/c/m/c',
method: 'post' // method: 'post'
}; // };
this.http.httpTokenRequest(opts, { // this.http.httpTokenRequest(opts, {
code: this.scene // code: this.scene
}).then(res => { // }).then(res => {
if (res.data.code == 200) { // if (res.data.code == 200) {
this.checkCode = res.data.data // this.checkCode = res.data.data
//未绑定了的情况 // //未绑定了的情况
if (!this.checkCode.bindFlag) { // if (!this.checkCode.bindFlag) {
uni.navigateTo({ // uni.navigateTo({
url: '/pagesB/pages/move-car/scan?moveCode=' + this.checkCode.code // url: '/pagesB/pages/move-car/scan?moveCode=' + this.checkCode.code
}) // })
} else if (this.checkCode.selfFlag) { // } else if (this.checkCode.selfFlag) {
//
} else { // } else {
//
} // }
} // }
}) // })
}, // },
wechatLogin() { // wechatLogin() {
wx.login({ // wx.login({
success: (res) => { // success: (res) => {
this.code = res.code // this.code = res.code
this.wechatSession(res.code) // this.wechatSession(res.code)
} // }
}) // })
}, // },
//获取session_key // //获取session_key
async wechatSession(code) { // async wechatSession(code) {
let that = this // let that = this
let param = { // let param = {
code: code, // code: code,
} // }
let opts = { // let opts = {
url: '/xcx/code/session', // url: '/xcx/code/session',
method: 'post' // method: 'post'
} // }
await that.http.httpRequest(opts, param).then(res => { // await that.http.httpRequest(opts, param).then(res => {
if (res.data.code == 200) { // if (res.data.code == 200) {
that.openid = res.data.data.openid // that.openid = res.data.data.openid
uni.setStorageSync('openid', that.openid); // uni.setStorageSync('openid', that.openid);
} // }
}) // })
}, // },
//解析手机号 // //解析手机号
getPhoneNumber(e) { // getPhoneNumber(e) {
uni.showLoading({ // uni.showLoading({
title: '加载中', // title: '加载中',
mask: true // mask: true
}); // });
let that = this // let that = this
if (e.detail.errMsg == "getPhoneNumber:ok") { // if (e.detail.errMsg == "getPhoneNumber:ok") {
// uni.hideLoading() // // uni.hideLoading()
that.decodePhoneLogin(e.detail) // that.decodePhoneLogin(e.detail)
} else { // } else {
uni.hideLoading() // uni.hideLoading()
console.log("用户点击了拒绝") // console.log("用户点击了拒绝")
} // }
}, // },
//解密手机号码 // //解密手机号码
async decodePhoneLogin(detail) { // async decodePhoneLogin(detail) {
let encryptedData = detail.encryptedData // let encryptedData = detail.encryptedData
let iv = detail.iv // let iv = detail.iv
let that = this // let that = this
//
let param = { // let param = {
code: detail.code, // code: detail.code,
openid: that.openid // openid: that.openid
} // }
let opts = { // let opts = {
url: '/xcx/login', // url: '/xcx/login',
method: 'post' // method: 'post'
} // }
//
await that.http.httpRequest(opts, param).then(res => { // await that.http.httpRequest(opts, param).then(res => {
if (res.data.code == 200) { // if (res.data.code == 200) {
uni.showToast({ // uni.showToast({
title: '授权成功', // title: '授权成功',
duration: 1500 // duration: 1500
}) // })
uni.setStorageSync('xcxIndexPath', res.data.data.xcxIndexPath); // uni.setStorageSync('xcxIndexPath', res.data.data.xcxIndexPath);
uni.setStorageSync("userToken", res.data.data.token) // uni.setStorageSync("userToken", res.data.data.token)
//
if (this.scene) { // if (this.scene) {
let param = { // let param = {
code: this.scene // code: this.scene
} // }
opts = { // opts = {
url: '/app/user/c/m/c', // url: '/app/user/c/m/c',
method: 'post' // method: 'post'
} // }
that.http.httpTokenRequest(opts, param).then(res => { // that.http.httpTokenRequest(opts, param).then(res => {
if (res.data.code == 200) { // if (res.data.code == 200) {
if (res.data.data.bindFlag) { // if (res.data.data.bindFlag) {
that.gotoMoveCar(); // that.gotoMoveCar();
} else { // } else {
that.gotoBindMoveCar(); // that.gotoBindMoveCar();
} // }
} // }
}) // })
//
} else if (this.failure == 401) { // } else if (this.failure == 401) {
uni.navigateBack() // uni.navigateBack()
return // return
} else { // } else {
that.gotoIndex() // that.gotoIndex()
} // }
//
} else { // } else {
uni.showToast({ // uni.showToast({
title: '授权失败', // title: '授权失败',
icon: 'none', // icon: 'none',
}) // })
} // }
}) // })
}, // },
gotoIndex() { // gotoIndex() {
let jumpUrl = this.superiorUrl // let jumpUrl = this.superiorUrl
if (this.superiorUrl == '/pages/main') { // if (this.superiorUrl == '/pages/main') {
if (!this.superiorParam) { // if (!this.superiorParam) {
this.superiorParam = "0" // this.superiorParam = "0"
} // }
jumpUrl += "?index=" + this.superiorParam // jumpUrl += "?index=" + this.superiorParam
} else { // } else {
jumpUrl += "?id=" + this.superiorParam // jumpUrl += "?id=" + this.superiorParam
} // }
//跳转到绑定页面 // //跳转到绑定页面
uni.reLaunch({ //信息更新成功后跳转到小程序首页 // uni.reLaunch({ //信息更新成功后跳转到小程序首页
//todo 友众账号绑定界面暂缓 // //todo 友众账号绑定界面暂缓
//url: '/pages/binding/binding' // //url: '/pages/binding/binding'
url: jumpUrl // url: jumpUrl
}) // })
//
// uni.navigateTo({ // // uni.navigateTo({
// url: '/pages/binding/binding' // // url: '/pages/binding/binding'
// }); // // });
//
}, // },
//跳转到挪车页面 // //跳转到挪车页面
gotoMoveCar() { // gotoMoveCar() {
let that = this; // let that = this;
uni.navigateTo({ // uni.navigateTo({
url: '/pagesB/pages/move-car/oneMoveCar?scene=' + that.scene // url: '/pagesB/pages/move-car/oneMoveCar?scene=' + that.scene
}); // });
}, // },
//跳转到绑定页面 // //跳转到绑定页面
gotoBindMoveCar() { // gotoBindMoveCar() {
let that = this; // let that = this;
uni.navigateTo({ // uni.navigateTo({
url: '/pagesB/pages/move-car/scan?moveCode=' + that.scene // url: '/pagesB/pages/move-car/scan?moveCode=' + that.scene
}); // });
}, // },
// 跳转协议政策页面 // // 跳转协议政策页面
goArticle(index) { // goArticle(index) {
let opts = { // let opts = {
url: '', // url: '',
method: 'get' // method: 'get'
}; // };
if (index == 1) { // if (index == 1) {
opts.url = "/app/user/registerAgreement" // opts.url = "/app/user/registerAgreement"
} else { // } else {
opts.url = "/app/user/ofPrivacy" // opts.url = "/app/user/ofPrivacy"
} // }
this.http.httpTokenRequest(opts, {}).then(res => { // this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { // if (res.data.code == 200) {
let data = res.data.msg // let data = res.data.msg
uni.setStorageSync("articelContent", data) // uni.setStorageSync("articelContent", data)
uni.navigateTo({ // uni.navigateTo({
url: '/pages/binding/article' // url: '/pages/binding/article'
}); // });
} // }
}) // })
} // }
}, // },
onLoad(e) { //默认加载 // onLoad(e) { //默认加载
let openid = uni.getStorageSync('openid'); // let openid = uni.getStorageSync('openid');
this.failure = e.failure // this.failure = e.failure
if (!openid) { // if (!openid) {
this.wechatLogin() // this.wechatLogin()
} else { // } else {
this.openid = openid; // this.openid = openid;
} // }
if (e && e.url) { // if (e && e.url) {
this.superiorUrl = e.url // this.superiorUrl = e.url
if (e.index) { // if (e.index) {
this.superiorParam = e.index // this.superiorParam = e.index
} // }
if (e.id) { // if (e.id) {
this.superiorParam = e.id // this.superiorParam = e.id
} // }
//
} // }
// #ifdef MP-WEIXIN // // #ifdef MP-WEIXIN
if (e.scene) { // if (e.scene) {
//
//获取二维码携带的参数 // //获取二维码携带的参数
//扫码后得到的参数 // //扫码后得到的参数
let scene = decodeURIComponent(e.scene) // let scene = decodeURIComponent(e.scene)
// scene = scene.split('&') // // scene = scene.split('&')
// let data = { // // let data = {
// //场景值 // // //场景值
// scene: e.scene // // scene: e.scene
// } // // }
//
this.scene = scene; // this.scene = scene;
} // }
//
//
let userToken = uni.getStorageSync('userToken') // let userToken = uni.getStorageSync('userToken')
if (userToken) { // if (userToken) {
let that = this // let that = this
let opts = { // let opts = {
url: '/app/user/info', // url: '/app/user/info',
method: 'get' // method: 'get'
} // }
//
that.http.httpTokenRequest(opts, {}).then(res => { // that.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { // if (res.data.code == 200) {
uni.setStorageSync('xcxIndexPath', res.data.data.xcxIndexPath); // uni.setStorageSync('xcxIndexPath', res.data.data.xcxIndexPath);
if (that.scene) { // if (that.scene) {
let param = { // let param = {
code: this.scene // code: this.scene
} // }
opts = { // opts = {
url: '/app/user/c/m/c', // url: '/app/user/c/m/c',
method: 'post' // method: 'post'
} // }
that.http.httpTokenRequest(opts, param).then(res => { // that.http.httpTokenRequest(opts, param).then(res => {
console.info(res); // console.info(res);
if (res.data.code == 200) { // if (res.data.code == 200) {
if (res.data.data.bindFlag) { // if (res.data.data.bindFlag) {
that.gotoMoveCar(); // that.gotoMoveCar();
} else { // } else {
that.gotoBindMoveCar(); // that.gotoBindMoveCar();
} // }
} // }
}) // })
//
} else { // } else {
this.gotoIndex() // this.gotoIndex()
} // }
//
} else { // } else {
uni.showToast({ // uni.showToast({
title: '授权失败', // title: '授权失败',
icon: 'none', // icon: 'none',
}) // })
this.isCanUse2 = true // this.isCanUse2 = true
} // }
}) // })
} else { // } else {
this.isCanUse2 = true // this.isCanUse2 = true
} // }
// #endif // // #endif
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
button::after { /*button::after {
border: none; border: none;
} }
...@@ -411,5 +411,5 @@ ...@@ -411,5 +411,5 @@
color: rgb(0, 81, 255); color: rgb(0, 81, 255);
} }
} }
} }*/
</style> </style>
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
// "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" // "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
}, },
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{ // {
"path": "pages/binding/index", // "path": "pages/binding/index",
"style": { // "style": {
"navigationBarTitleText": "登录" // "navigationBarTitleText": "登录"
} // }
}, // },
{ {
"path": "pages/binding/binding", "path": "pages/binding/binding",
"style": { "style": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment