Commit c9214edc by suwenbiao

处理冲突

parent 36315d54
<script>
export default {
onLaunch() {
let status = navigator.userAgent.toLowerCase();
if (status.match(/MicroMessenger/i) == "micromessenger") {
//微信浏览器
uni.setStorageSync('browser_type', '1')
} else {
//其他浏览器
uni.setStorageSync('browser_type', '0')
if(window.location.href.slice( window.location.href.indexOf('/',10)+1,9999).length > 5 && window.location.href.indexOf("&code=" == -1)){
uni.setStorageSync('room_id', window.location.href.slice( window.location.href.indexOf('/',10)+1,9999))
window.location.href = window.location.href.slice(0, window.location.href.indexOf('/',10));
}
},
onShow() {
......@@ -21,18 +17,7 @@
<style>
/*每个页面公共css */
.contents {
.contents{
overflow-x: hidden;
}
uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
color: transparent;
}
</style>
......@@ -246,7 +246,19 @@ function delwatchtype() {
return request('/LiveRoomWatchType/delWatchType', "POST", {
})
}
//获取appid
function getappid() {
return request('/ocLogin/getAppid', "GET", {
})
}
//wx登录
function loginbywx(code) {
return request('/ocLogin/loginByWx', "GET", {
code
})
}
export default {
loginbywx,
sendsms,
getverification,
loginforphone,
......@@ -287,5 +299,6 @@ export default {
livechatinfo,
livechecktoken,
livewatchurl,
delwatchtype
delwatchtype,
getappid
}
\ No newline at end of file
......@@ -6,104 +6,294 @@
<view class="">
登录即可查看详情内容
</view>
<view class="wx_btn">
<img src="../../static/images/wx_pic.png" alt="">
<text>微信快捷登录</text>
<view class="" v-if="log_types==1">
<view class="wx_btn" @click="go_login">
<img src="../../static/images/wx_pic.png" alt="">
<text>微信快捷登录</text>
</view>
<view class="wx_canelbtn" @click="is_show = false">
<text>取消</text>
</view>
</view>
<view class="wx_canelbtn" @click="is_show = false">
<text>取消</text>
<view class="" v-if="log_types==0">
<u--input placeholder="请输入手机号" border="none" maxlength="11" clearable type="number"
inputAlign="center" v-model="tel"
style="width: 88%;margin: 62rpx auto 32rpx auto;background-color: #F2F2F4;border-radius: 10rpx;font-size: 28rpx;padding: 20rpx 0;">
</u--input>
<view class="input_imgcode">
<u--input placeholder="请输入图片验证码" border="none" inputAlign="center" v-model="icode"
style="width: 52.5%;background-color: #F2F2F4;border-radius: 10rpx;font-size: 28rpx;padding: 20rpx 0;float: left;">
</u--input>
<u--image :showLoading="true" :src="code_src" width="280rpx" height="88rpx"
@click="clickcodeimg" style="float: left;margin-left: 5%;"></u--image>
</view>
<view class="input_imgcode">
<u--input placeholder="请输入短信验证码" border="none" inputAlign="center" v-model="smscode"
style="width: 52.5%;background-color: #F2F2F4;border-radius: 10rpx;font-size: 28rpx;padding: 20rpx 0;float: left;">
</u--input>
<view class="btn_getsms">
<u-notify ref="uNotify" message=""></u-notify>
<u-code :seconds="seconds" ref="uCode" @change="codeChange" @start="start"></u-code>
<u-button @tap="getCode" style="border: 2rpx solid #276EE8;outline: none;color: #276EE8;margin-top: 4rpx;">{{tips}}</u-button>
</view>
</view>
</view>
<view class="agreement_view">
<view class="check_agreement" v-if="agree_agreement"
@click="agree_agreement = agree_agreement ? false : true"></view>
<view class="check_agreement" v-if="agree_agreement"
@click="agree_agreement = agree_agreement ? false : true"></view>
<view class="notcheck_agreement" v-if="!agree_agreement"
@click="agree_agreement = agree_agreement ? false : true"></view>
<text>我已阅读并同意 <a href="https://xs-service.finezb.com/privacyAgreement.html" target="_blank">《用户隐私协议》</a>
<a href="https://xs-service.finezb.com/privacyAgreement.html" target="_blank">《商家隐私协议》</a> </text>
@click="agree_agreement = agree_agreement ? false : true"></view>
<text>我已阅读并同意 <a href="https://xs-service.finezb.com/privacyAgreement.html"
target="_blank">《用户隐私协议》</a>
<a href="https://xs-service.finezb.com/privacyAgreement.html" target="_blank">《商家隐私协议》</a>
</text>
</view>
<view class="btn_smslogin" @click="sumbit" v-if="log_types==0">
登录
</view>
</view>
<view class="">
</view>
<pwdlogin></pwdlogin>
</u-popup>
</view>
</template>
<script>
import pwdlogin from "@/components/login/password_login.vue"
export default {
name:"login",
props:{
name: "login",
props: {
},
components:{
pwdlogin
},
data() {
return {
is_show:true,
agree_agreement:true
tel:'',
icode:'',
smscode:'',
is_show: true,
agree_agreement: true,
authorization_info: {},
code_src: '',
numrandom: '',
seconds: 60,
tips: '获取验证码',
log_types:'',
};
},
mounted() {
let status = navigator.userAgent.toLowerCase();
if (status.match(/MicroMessenger/i) == "micromessenger") {
//微信浏览器
this.log_types = 1
}else{
//其他浏览器
this.log_types = 0
}
this.wx_loginok()
this.getwxid()
this.clickcodeimg()
},
methods: {
//获取appid
getwxid() {
this.$api.getappid().then(res => {
console.log(res);
this.authorization_info = res.data.data
})
},
start() {
},
//判断是否微信登录成功
wx_loginok(){
var ahref = window.location.href
if(ahref.indexOf("&code=") != -1){
wxcode = ahref.slice(ahref.indexOf("&code=") + 6,ahref.indexOf("&state="))
this.$api.loginbywx(wxcode).then(res=>{
console.log(res);
})
}
},
//发起登录
go_login() {
var local = window.location.href;
var url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + this.authorization_info.appId +
"&redirect_uri=" + encodeURIComponent(local) +
"&response_type=code&scope=snsapi_userinfo&state=1&component_appid=" +
this.authorization_info.componentAppId + "#wechat_redirect"
window.location.href = url;
},
//图片验证码
clickcodeimg() {
this.numrandom = Date.now() + Math.random(0, 9);
this.code_src = "https://oc-testapi.finezb.com/ocLogin/generateValidateCode?time=" + this.numrandom;
},
codeChange(text) {
this.tips = text;
},
//获取短信验证码
getCode() {
if (this.$refs.uCode.canGetCode) {
this.$api.sendsms(this.tel,this.numrandom, this.icode).then(res => {
console.log(res);
if(res.data.code === 200){
this.$refs.uNotify.show({
top: 30,
type: 'success',
message: '发送成功',
duration: 1000 * 3,
fontSize: 20,
safeAreaInsetTop:true
})
this.$refs.uCode.start();
}
else{
this.$refs.uNotify.show({
top: 30,
type: 'error',
message: res.data.msg,
duration: 1000 * 3,
fontSize: 20,
safeAreaInsetTop:true
})
}
})
// 通知验证码组件内部开始倒计时
} else {
this.$refs.uNotify.show({
top: 30,
type: 'warning',
message: '请在倒计时结束后再试',
duration: 1000 * 3,
fontSize: 20,
safeAreaInsetTop:true
})
}
},
//短信登录
sumbit() {
this.$api.loginforphone(this.tel, this.smscode,
this.numrandom, this.icode, "0").then(res => {
console.log(res);
if (!res.data.data.avatar) {
uni.setStorageSync('user_headimg',
'https://ts1.cn.mm.bing.net/th/id/R-C.baa2d1577cf82ad47aa705957237bff6?rik=IciTRLgFHnunww&riu=http%3a%2f%2fwww.sucaijishi.com%2fuploadfile%2f2016%2f0203%2f20160203022632945.png&ehk=4PjlDtyivWKN7CP%2b5JlcgUiuD1nyme8IaxbNbPnANIw%3d&risl=&pid=ImgRaw&r=0')
uni.setStorageSync("user_token", res.data.data.token);
uni.setStorageSync("user_phone", this.tel);
uni.setStorageSync("user_name", res.data.data.account);
this.$refs.uNotify.show({
top: 30,
type: 'success',
message: '登录成功',
duration: 1000 * 3,
fontSize: 20,
safeAreaInsetTop:true
})
setTimeout(() => {
window.location.reload()
}, 1500);
}
}).catch(err => {
console.log(err);
});
},
}
}
</script>
<style>
.wx_view{
text-align: center;
font-size: 28rpx;
padding-top: 68rpx;
padding-bottom: 80rpx;
}
.wx_view>img{
width: 122rpx;
height: 122rpx;
}
.wx_btn{
width: 520rpx;
height: 96rpx;
background: #00E36B;
border-radius: 60rpx;
margin: 80rpx auto 24rpx auto;
line-height: 96rpx;
color: #fff;
}
.wx_btn img{
width: 52rpx;
height: 52rpx;
vertical-align: middle;
margin: 0 16rpx;
}
.wx_canelbtn{
width: 520rpx;
font-size: 24rpx;
height: 96rpx;
background: #EEEEEE;
border-radius: 60rpx;
margin: 0 auto;
line-height: 96rpx;
color: #777777;
}
.agreement_view{
margin-top: 100rpx;
padding: 0 50rpx;
}
.check_agreement{
display: inline-block;
vertical-align: middle;
margin-right: 20rpx;
width: 28rpx;
height: 28rpx;
background-color: #00E36B;
border-radius: 50%;
}
.agreement_view a{
text-decoration: none;
}
.notcheck_agreement{
display: inline-block;
vertical-align: middle;
margin-right: 20rpx;
width: 25rpx;
height: 25rpx;
border: 1rpx solid #ccc;
border-radius: 50%;
}
</style>
\ No newline at end of file
.wx_view {
text-align: center;
font-size: 28rpx;
padding-top: 68rpx;
padding-bottom: 80rpx;
}
.wx_view>img {
width: 122rpx;
height: 122rpx;
}
.wx_btn {
width: 520rpx;
height: 96rpx;
background: #00E36B;
border-radius: 60rpx;
margin: 80rpx auto 24rpx auto;
line-height: 96rpx;
color: #fff;
}
.wx_btn img {
width: 52rpx;
height: 52rpx;
vertical-align: middle;
margin: 0 16rpx;
}
.wx_canelbtn {
width: 520rpx;
font-size: 24rpx;
height: 96rpx;
background: #EEEEEE;
border-radius: 60rpx;
margin: 0 auto;
line-height: 96rpx;
color: #777777;
}
.agreement_view {
font-size: 20rpx;
margin-top: 100rpx;
padding: 0 50rpx;
}
.check_agreement {
display: inline-block;
vertical-align: middle;
margin-right: 20rpx;
width: 28rpx;
height: 28rpx;
background-color: #00E36B;
border-radius: 50%;
}
.agreement_view a {
text-decoration: none;
}
.notcheck_agreement {
display: inline-block;
vertical-align: middle;
margin-right: 20rpx;
width: 25rpx;
height: 25rpx;
border: 1rpx solid #ccc;
border-radius: 50%;
}
.input_imgcode {
width: 88%;
margin: 30rpx auto;
overflow: hidden;
}
.btn_getsms {
float: right;
width: 280rpx;
}
.btn_smslogin{
width: 686rpx;
height: 80rpx;
background: #256EE7;
border-radius: 40rpx;
margin: 80rpx auto 5rpx auto ;
line-height: 80rpx;
color: #fff;
font-size: 30rpx;
}
</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