|
|
|
@ -4,12 +4,15 @@ |
|
|
|
|
<!-- <view class="navbarText">登录</view> --> |
|
|
|
|
<uni-nav-bar :fixed="false" :shadow="false" :statusBar="true" :onlyLeft="true" :color="`#fff`" |
|
|
|
|
></uni-nav-bar> |
|
|
|
|
<!-- #ifdef APP-PLUS --> |
|
|
|
|
<u-icon name="close" size="26" @click="goHome" style="position: absolute;z-index:99;right:50upx;top:100upx;"></u-icon> |
|
|
|
|
<!-- #ifndef H5 --> |
|
|
|
|
<view style="position: absolute;z-index:99;right:50upx;top:120upx;"> |
|
|
|
|
<u-icon name="close" size="26" @click="goHome"></u-icon> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<!-- #endif --> |
|
|
|
|
<view class="logocontent"> |
|
|
|
|
<!-- <view class="title">LOGO</view> --> |
|
|
|
|
<image src="../static/logopic.png" style="width:200rpx;margin:0 auto" mode="widthFix"></image> |
|
|
|
|
<image src="../static/logopic.png" style="width:200rpx;margin:0 auto;height:auto" mode="widthFix"></image> |
|
|
|
|
<view class="subtitle">希希到家专业O2O服务平台</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="form"> |
|
|
|
@ -107,7 +110,7 @@ |
|
|
|
|
<view class="line"></view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<image src="@/static/wlogin.png" class="wlogin" @tap="miniProLogin" mode="widthFix"></image> |
|
|
|
|
<image src="@/static/wlogin.png" class="wlogin" @tap="miniLoginHandle" mode="widthFix"></image> |
|
|
|
|
<!-- #endif --> |
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
@ -120,6 +123,7 @@ |
|
|
|
|
mapMutations |
|
|
|
|
} from 'vuex'; |
|
|
|
|
import siteInfo from '@/siteinfo.js'; |
|
|
|
|
import $store from "@/store/index.js" |
|
|
|
|
export default { |
|
|
|
|
components: {}, |
|
|
|
|
data() { |
|
|
|
@ -243,36 +247,41 @@ |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//小程序微信登陆 |
|
|
|
|
miniProLogin(){ |
|
|
|
|
async miniLoginHandle(){ |
|
|
|
|
if(this.checked.length==0){ |
|
|
|
|
uni.$u.toast('请阅读并同意《隐私政策》'); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
uni.getUserProfile({ |
|
|
|
|
desc: '用于您的页面展示用户头像与昵称', |
|
|
|
|
lang: 'zh_CN', |
|
|
|
|
success: (res) => { |
|
|
|
|
console.log(res,"jjj"); |
|
|
|
|
uni.login({ |
|
|
|
|
provider: 'weixin', |
|
|
|
|
success:async(res) => { |
|
|
|
|
console.log(res,"===="); |
|
|
|
|
let userLoginInfo = await this.$api.base.mpproLogin({ |
|
|
|
|
code: res.code |
|
|
|
|
}) |
|
|
|
|
console.log(userLoginInfo) |
|
|
|
|
this.$util.goUrl({ |
|
|
|
|
url: `/pages/service`, |
|
|
|
|
openType: `reLaunch` |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
let res = await this.miniproLogin(); |
|
|
|
|
console.log(res,"=======") |
|
|
|
|
uni.navigateBack({ |
|
|
|
|
delta:1 |
|
|
|
|
}) |
|
|
|
|
// uni.getUserProfile({ |
|
|
|
|
// desc: '用于您的页面展示用户头像与昵称', |
|
|
|
|
// lang: 'zh_CN', |
|
|
|
|
// success: (res) => { |
|
|
|
|
// console.log(res,"jjj"); |
|
|
|
|
// uni.login({ |
|
|
|
|
// provider: 'weixin', |
|
|
|
|
// success:async(res) => { |
|
|
|
|
// console.log(res,"===="); |
|
|
|
|
// let userLoginInfo = await this.$api.base.mpproLogin({ |
|
|
|
|
// code: res.code |
|
|
|
|
// }) |
|
|
|
|
// console.log(userLoginInfo) |
|
|
|
|
// this.$util.goUrl({ |
|
|
|
|
// url: `/pages/service`, |
|
|
|
|
// openType: `reLaunch` |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
fail: err => { |
|
|
|
|
console.log(err.errMsg); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// }, |
|
|
|
|
// fail: err => { |
|
|
|
|
// console.log(err.errMsg); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
async smsLogin(item){ |
|
|
|
@ -443,6 +452,91 @@ |
|
|
|
|
uni.$u.toast('倒计时结束后再发送'); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//小程序登录 |
|
|
|
|
async miniproLogin() { |
|
|
|
|
const isW7 = true |
|
|
|
|
const isH5 = false |
|
|
|
|
const formatUrl = function(url) { |
|
|
|
|
let model_name = "longbing_massages_city"; |
|
|
|
|
let baseUrl = isW7 ? |
|
|
|
|
`${siteInfo.siteroot}?i=${siteInfo.uniacid}&t=${siteInfo.multiid}&v=${siteInfo.version}&from=wxapp&c=entry&a=wxapp&do=api&core=core2&m=${model_name}&s=${url}` : |
|
|
|
|
`${siteInfo.siteroot}?i=${siteInfo.uniacid}&m=${model_name}&s=${url}` |
|
|
|
|
|
|
|
|
|
if (isH5) { |
|
|
|
|
baseUrl = `/api?i=${siteInfo.uniacid}&m=${model_name}&s=${url}` |
|
|
|
|
} |
|
|
|
|
return baseUrl; |
|
|
|
|
} |
|
|
|
|
let { |
|
|
|
|
query |
|
|
|
|
} = await uni.getLaunchOptionsSync(); |
|
|
|
|
console.log('query', query) |
|
|
|
|
let url = formatUrl("index/login") |
|
|
|
|
try { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: "登录中..." |
|
|
|
|
}) |
|
|
|
|
let [providerErr, providerData] = await uni.getProvider({ |
|
|
|
|
service: 'oauth', |
|
|
|
|
}); |
|
|
|
|
let [loginErr, loginData] = await uni.login({ |
|
|
|
|
provider: providerData.provider[0] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
let login_param = { |
|
|
|
|
code: loginData.code, |
|
|
|
|
pid: query.pid |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log("login_param=1111=>", login_param); |
|
|
|
|
var Fly = require("../utils/wx.js") //wx.js为您下载的源码文件 |
|
|
|
|
var fly = new Fly; //创建fly实例 |
|
|
|
|
var tokenFly = new Fly(); |
|
|
|
|
let d = await tokenFly.post(url, login_param); |
|
|
|
|
console.log(d,"0001111111") |
|
|
|
|
let { |
|
|
|
|
code, |
|
|
|
|
data, |
|
|
|
|
error |
|
|
|
|
} = d.data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (code !== 200) { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
serverError({ |
|
|
|
|
code, |
|
|
|
|
msg: error |
|
|
|
|
}); |
|
|
|
|
throw d; |
|
|
|
|
} |
|
|
|
|
//登录成功 |
|
|
|
|
uni.hideLoading() |
|
|
|
|
console.log(data.data,"0003333333") |
|
|
|
|
$store.commit('updateUserItem', { |
|
|
|
|
key: 'userInfo', |
|
|
|
|
val: data.data |
|
|
|
|
}) |
|
|
|
|
$store.commit('updateUserItem', { |
|
|
|
|
key: 'autograph', |
|
|
|
|
val: data.autograph |
|
|
|
|
}) |
|
|
|
|
return data; |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e,"0000") |
|
|
|
|
uni.hideLoading() |
|
|
|
|
let { |
|
|
|
|
code, |
|
|
|
|
error |
|
|
|
|
} = e.response.data |
|
|
|
|
if (code !== 200) { |
|
|
|
|
serverError({ |
|
|
|
|
code, |
|
|
|
|
msg: error |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
return await Promise.reject(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
beforeDestroy() { |
|
|
|
|
|
|
|
|
@ -473,6 +567,7 @@ |
|
|
|
|
} |
|
|
|
|
.pages-user-login { |
|
|
|
|
height: calc(100vh); |
|
|
|
|
position: relative; |
|
|
|
|
.navbarText{ |
|
|
|
|
height: 88upx; |
|
|
|
|
text-align: center; |
|
|
|
|