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()
// that.decodePhoneLogin(e.detail)
// } else {
// uni.hideLoading() // uni.hideLoading()
that.decodePhoneLogin(e.detail) // console.log("用户点击了拒绝")
} else { // }
uni.hideLoading() // },
console.log("用户点击了拒绝") // //解密手机号码
} // async decodePhoneLogin(detail) {
}, // let encryptedData = detail.encryptedData
//解密手机号码 // let iv = detail.iv
async decodePhoneLogin(detail) { // let that = this
let encryptedData = detail.encryptedData //
let iv = detail.iv // let param = {
let that = this // code: detail.code,
// openid: that.openid
let param = { // }
code: detail.code, // let opts = {
openid: that.openid // url: '/xcx/login',
} // method: 'post'
let opts = { // }
url: '/xcx/login', //
method: 'post' // await that.http.httpRequest(opts, param).then(res => {
} // if (res.data.code == 200) {
// uni.showToast({
await that.http.httpRequest(opts, param).then(res => { // title: '授权成功',
if (res.data.code == 200) { // duration: 1500
uni.showToast({ // })
title: '授权成功', // uni.setStorageSync('xcxIndexPath', res.data.data.xcxIndexPath);
duration: 1500 // uni.setStorageSync("userToken", res.data.data.token)
}) //
uni.setStorageSync('xcxIndexPath', res.data.data.xcxIndexPath); // if (this.scene) {
uni.setStorageSync("userToken", res.data.data.token) // let param = {
// code: this.scene
if (this.scene) { // }
let param = { // opts = {
code: this.scene // url: '/app/user/c/m/c',
} // method: 'post'
opts = { // }
url: '/app/user/c/m/c', // that.http.httpTokenRequest(opts, param).then(res => {
method: 'post' // if (res.data.code == 200) {
} // if (res.data.data.bindFlag) {
that.http.httpTokenRequest(opts, param).then(res => { // that.gotoMoveCar();
if (res.data.code == 200) { // } else {
if (res.data.data.bindFlag) { // that.gotoBindMoveCar();
that.gotoMoveCar(); // }
} else { // }
that.gotoBindMoveCar(); // })
} //
} // } else if (this.failure == 401) {
}) // uni.navigateBack()
// return
} else if (this.failure == 401) { // } else {
uni.navigateBack() // that.gotoIndex()
return // }
} else { //
that.gotoIndex() // } else {
} // uni.showToast({
// title: '授权失败',
} else { // icon: 'none',
uni.showToast({ // })
title: '授权失败', // }
icon: 'none', // })
}) // },
} // gotoIndex() {
}) // let jumpUrl = this.superiorUrl
}, // if (this.superiorUrl == '/pages/main') {
gotoIndex() { // if (!this.superiorParam) {
let jumpUrl = this.superiorUrl // this.superiorParam = "0"
if (this.superiorUrl == '/pages/main') { // }
if (!this.superiorParam) { // jumpUrl += "?index=" + this.superiorParam
this.superiorParam = "0" // } else {
} // jumpUrl += "?id=" + this.superiorParam
jumpUrl += "?index=" + this.superiorParam // }
} else { // //跳转到绑定页面
jumpUrl += "?id=" + this.superiorParam // uni.reLaunch({ //信息更新成功后跳转到小程序首页
} // //todo 友众账号绑定界面暂缓
//跳转到绑定页面 // //url: '/pages/binding/binding'
uni.reLaunch({ //信息更新成功后跳转到小程序首页 // url: jumpUrl
//todo 友众账号绑定界面暂缓 // })
//url: '/pages/binding/binding' //
url: jumpUrl // // uni.navigateTo({
}) // // url: '/pages/binding/binding'
// // });
//
// },
// //跳转到挪车页面
// gotoMoveCar() {
// let that = this;
// uni.navigateTo({ // uni.navigateTo({
// url: '/pages/binding/binding' // url: '/pagesB/pages/move-car/oneMoveCar?scene=' + that.scene
// }); // });
// },
}, // //跳转到绑定页面
//跳转到挪车页面 // gotoBindMoveCar() {
gotoMoveCar() { // let that = this;
let that = this; // uni.navigateTo({
uni.navigateTo({ // url: '/pagesB/pages/move-car/scan?moveCode=' + that.scene
url: '/pagesB/pages/move-car/oneMoveCar?scene=' + that.scene // });
}); // },
}, // // 跳转协议政策页面
//跳转到绑定页面 // goArticle(index) {
gotoBindMoveCar() { // let opts = {
let that = this; // url: '',
uni.navigateTo({ // method: 'get'
url: '/pagesB/pages/move-car/scan?moveCode=' + that.scene // };
}); // if (index == 1) {
}, // opts.url = "/app/user/registerAgreement"
// 跳转协议政策页面 // } else {
goArticle(index) { // opts.url = "/app/user/ofPrivacy"
let opts = {
url: '',
method: 'get'
};
if (index == 1) {
opts.url = "/app/user/registerAgreement"
} else {
opts.url = "/app/user/ofPrivacy"
}
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
let data = res.data.msg
uni.setStorageSync("articelContent", data)
uni.navigateTo({
url: '/pages/binding/article'
});
}
})
}
},
onLoad(e) { //默认加载
let openid = uni.getStorageSync('openid');
this.failure = e.failure
if (!openid) {
this.wechatLogin()
} else {
this.openid = openid;
}
if (e && e.url) {
this.superiorUrl = e.url
if (e.index) {
this.superiorParam = e.index
}
if (e.id) {
this.superiorParam = e.id
}
}
// #ifdef MP-WEIXIN
if (e.scene) {
//获取二维码携带的参数
//扫码后得到的参数
let scene = decodeURIComponent(e.scene)
// scene = scene.split('&')
// let data = {
// //场景值
// scene: e.scene
// } // }
// this.http.httpTokenRequest(opts, {}).then(res => {
this.scene = scene; // if (res.data.code == 200) {
} // let data = res.data.msg
// uni.setStorageSync("articelContent", data)
// uni.navigateTo({
let userToken = uni.getStorageSync('userToken') // url: '/pages/binding/article'
if (userToken) { // });
let that = this // }
let opts = { // })
url: '/app/user/info', // }
method: 'get' // },
} // onLoad(e) { //默认加载
// let openid = uni.getStorageSync('openid');
that.http.httpTokenRequest(opts, {}).then(res => { // this.failure = e.failure
if (res.data.code == 200) { // if (!openid) {
uni.setStorageSync('xcxIndexPath', res.data.data.xcxIndexPath); // this.wechatLogin()
if (that.scene) { // } else {
let param = { // this.openid = openid;
code: this.scene // }
} // if (e && e.url) {
opts = { // this.superiorUrl = e.url
url: '/app/user/c/m/c', // if (e.index) {
method: 'post' // this.superiorParam = e.index
} // }
that.http.httpTokenRequest(opts, param).then(res => { // if (e.id) {
console.info(res); // this.superiorParam = e.id
if (res.data.code == 200) { // }
if (res.data.data.bindFlag) { //
that.gotoMoveCar(); // }
} else { // // #ifdef MP-WEIXIN
that.gotoBindMoveCar(); // if (e.scene) {
} //
} // //获取二维码携带的参数
}) // //扫码后得到的参数
// let scene = decodeURIComponent(e.scene)
} else { // // scene = scene.split('&')
this.gotoIndex() // // let data = {
} // // //场景值
// // scene: e.scene
} else { // // }
uni.showToast({ //
title: '授权失败', // this.scene = scene;
icon: 'none', // }
}) //
this.isCanUse2 = true //
} // let userToken = uni.getStorageSync('userToken')
}) // if (userToken) {
} else { // let that = this
this.isCanUse2 = true // let opts = {
} // url: '/app/user/info',
// #endif // method: 'get'
// }
//
// that.http.httpTokenRequest(opts, {}).then(res => {
// if (res.data.code == 200) {
// uni.setStorageSync('xcxIndexPath', res.data.data.xcxIndexPath);
// if (that.scene) {
// let param = {
// code: this.scene
// }
// opts = {
// url: '/app/user/c/m/c',
// method: 'post'
// }
// that.http.httpTokenRequest(opts, param).then(res => {
// console.info(res);
// if (res.data.code == 200) {
// if (res.data.data.bindFlag) {
// that.gotoMoveCar();
// } else {
// that.gotoBindMoveCar();
// }
// }
// })
//
// } else {
// this.gotoIndex()
// }
//
// } else {
// uni.showToast({
// title: '授权失败',
// icon: 'none',
// })
// this.isCanUse2 = true
// }
// })
// } else {
// this.isCanUse2 = true
// }
// // #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