小程序授权登录回复正常

pull/1/MERGE
stivepeim 2021-05-07 18:31:36 +08:00
parent df945fc609
commit 96cbe9d7e3
85 changed files with 524 additions and 600 deletions

110
App.vue
View File

@ -1,8 +1,13 @@
<!-- <template>
<view>
<iframe ref="geoPage" width="0" height="0" frameborder="0" style="display:none;"
scrolling="no" src="https://java.crmeb.net">
</iframe>
</view>
</template> -->
<script>
import { checkLogin } from "./libs/login";
import { HTTP_REQUEST_URL } from './config/app';
import Auth from './libs/wechat.js';
import Routine from './libs/routine.js';
export default {
globalData: {
@ -23,16 +28,16 @@
switch (option.scene) {
//
case 1047:
// let val = that.$util.getUrlParams(decodeURIComponent(option.query.scene));
that.globalData.spid = option.query.scene;
let val = that.$util.getUrlParams(decodeURIComponent(option.query.scene));
that.globalData.code = val.pid;
break;
//
case 1048:
that.globalData.spid = option.query.scene;
that.globalData.code = option.query.scene;
break;
//
case 1049:
that.globalData.spid = option.query.scene;
that.globalData.code = option.query.scene;
break;
//
case 1001:
@ -47,100 +52,9 @@
that.globalData.navHeight = res.statusBarHeight * (750 / res.windowWidth) + 91;
}
});
// #ifdef H5
let snsapiBase = 'snsapi_base';
let urlData = location.pathname + location.search;
if (!that.$store.getters.isLogin && Auth.isWeixin()) {
const { code, state, scope } = option.query;
if (code && location.pathname.indexOf('/pages/users/wechat_login/index') === -1) {
// code
uni.setStorageSync('snsapiCode', code);
let spread = that.globalData.spid ? that.globalData.spid : 0;
Auth.auth(code, that.$Cache.get('spread'))
.then(res => {
uni.setStorageSync('snRouter', decodeURIComponent(decodeURIComponent(option.query.back_url)));
if (res.type === 'register') {
this.$Cache.set('snsapiKey', res.key);
}
if(res.type === 'login'){
// let time = res.data.expires_time - this.$Cache.time();
this.$store.commit('LOGIN', {
token: res.token,
// time: time
});
// this.$store.commit('SETUID', res.data.userInfo.uid);
// this.$store.commit('UPDATE_USERINFO', res.data.userInfo);
//location.replace(decodeURIComponent(decodeURIComponent(option.query.back_url)));
}
})
.catch(error => {
this.$util.Tips({
title: error
});
});
} else {
if (!this.$Cache.has('snsapiKey')) {
console.log('app.vue页面中',location.pathname.indexOf('/pages/users/wechat_login/index') === -1)
//Auth.oAuth(snsapiBase, urlData);
if (location.pathname.indexOf('/pages/users/wechat_login/index') === -1) {
Auth.oAuth(snsapiBase, urlData);
}
}
}
} else {
if (option.query.back_url) {
location.replace(uni.getStorageSync('snRouter'));
}
}
// #endif
// #ifdef MP
//
if (!this.$store.getters.isLogin) {
let spread = that.globalData.spid ? that.globalData.spid : 0;
Routine.getCode()
.then(code => {
Routine.authUserInfo(code,{'spread_spid': spread}).then(res => {
that.$store.commit('AuthorizeType', res.data.type);
})
})
.catch(res => {
uni.hideLoading();
});
}
// #endif
},
mounted() {
},
methods: {
//
silenceAuth(code) {
let that = this;
let spread = that.globalData.spid ? that.globalData.spid : 0;
silenceAuth({
code: code,
spread_spid: spread,
spread_code: that.globalData.code
})
.then(res => {
if (res.data.token !== undefined && res.data.token) {
uni.hideLoading();
let time = res.data.expires_time - this.$Cache.time();
that.$store.commit('LOGIN', {
token: res.data.token,
time: time
});
that.$store.commit('SETUID', res.data.userInfo.uid);
that.$store.commit('UPDATE_USERINFO', res.data.userInfo);
}
})
.catch(res => {
console.log(res);
});
}
},
onShow: function() {
// #ifdef H5
uni.getSystemInfo({
@ -195,4 +109,4 @@
height: 0;
color: transparent;
}
</style>
</style><!-- -->

View File

@ -10,7 +10,8 @@
<button class='item grant' @click="setUserInfo"></button>
<!-- #endif -->
<!-- #ifdef MP -->
<button class='item grant' type="primary" open-type="getUserInfo" lang="zh_CN" @getuserinfo="setUserInfo"></button>
<!-- <button class='item grant' type="primary" open-type="getUserInfo" lang="zh_CN" @getuserinfo="setUserInfo"></button> -->
<button hover-class="none" @tap="getUserProfile" class='item grant'>微信登录</button>
<!-- #endif -->
</view>
</view>
@ -58,6 +59,52 @@
this.setAuthStatus();
},
methods:{
getUserProfile() {
let self = this;
uni.showLoading({
title: '正在登录中'
});
Routine.getUserProfile()
.then(res => {
Routine.getCode()
.then(code => {
self.getWxUser(code, res);
})
.catch(res => {
uni.hideLoading();
});
})
.catch(res => {
uni.hideLoading();
});
},
getWxUser(code, res) {
let self = this
let userInfo = res.userInfo;
userInfo.code = code;
userInfo.spread_spid = app.globalData.spid; //广ID
userInfo.spread_code = app.globalData.code; //广ID
userInfo.avatar = userInfo.userInfo.avatarUrl;
userInfo.city = userInfo.userInfo.city;
userInfo.country = userInfo.userInfo.country;
userInfo.nickName = userInfo.userInfo.nickName;
userInfo.province = userInfo.userInfo.province;
userInfo.sex = userInfo.userInfo.gender;
userInfo.type = 'routine'
Routine.authUserInfo(code,userInfo).then(res=>{
uni.hideLoading();
this.$emit('authColse',false);
this.$emit('onLoadFun',this.userInfo);
}).catch(res=>{
uni.hideLoading();
uni.showToast({
title:res.message,
icon:'none',
duration:2000
});
});
},
setAuthStatus(){
Routine.authorize().then(res=>{
if(res.islogin === false)
@ -71,6 +118,7 @@
},
getUserInfo(code){
Routine.getUserInfo().then(res=>{
console.log('res',res);
let userInfo = res.userInfo
userInfo.code = code;
userInfo.spread_spid = app.globalData.spid;//广ID

View File

@ -1,6 +1,5 @@
import store from "../store";
import Cache from '../utils/cache';
import { Debounce } from '@/utils/validate.js'
// #ifdef H5 || APP-PLUS
import { isWeixin } from "../utils";
import auth from './wechat';
@ -11,74 +10,31 @@ import { LOGIN_STATUS, USER_INFO, EXPIRES_TIME, STATE_R_KEY} from './../config/c
function prePage(){
let pages = getCurrentPages();
let prePage = pages[pages.length - 1];
// #ifndef APP-PLUS
return prePage.route;
// #endif
// #ifdef APP-PLUS
return prePage.$page.fullPath;
// #endif
}
export const toLogin = Debounce(_toLogin,800)
export function _toLogin(push, pathLogin) {
export function toLogin(push, pathLogin) {
store.commit("LOGOUT");
let path = prePage();
// #ifdef H5
// path = location.href;
path = location.pathname + location.search;
path = location.href;
// #endif
if(!pathLogin)
pathLogin = '/page/users/login/index'
Cache.set('login_back_url',path);
// #ifdef H5
// #ifdef H5 || APP-PLUS
if (isWeixin()) {
// auth.oAuth();
let urlData = location.pathname + location.search
if (urlData.indexOf('?') !== -1) {
urlData += '&go_longin=1';
} else {
urlData += '?go_longin=1';
}
console.log('ppppp',Cache.has('snsapiKey'))
if (Cache.has('snsapiKey')) {
uni.navigateTo({
url: '/pages/users/wechat_login/index',
});
}
// if (!Cache.has('snsapiKey')) {
// auth.oAuth('snsapi_base', urlData);
// } else {
// uni.navigateTo({
// url: '/pages/users/wechat_login/index',
// });
// }
auth.oAuth();
} else {
uni.navigateTo({
url: '/pages/users/login/index'
})
// if (path !== pathLogin) {
// push ? uni.navigateTo({
// url:'/pages/users/login/index'
// }) : uni.reLaunch({
// url: '/pages/users/login/index'
// });
// }
if (path !== pathLogin) {
push ? uni.navigateTo({
url:'/pages/users/login/index'
}) : uni.reLaunch({
url: '/pages/users/login/index'
});
}
}
// #endif
// #ifdef MP
uni.navigateTo({
url: '/pages/users/wechat_login/index'
})
// #endif
// #ifdef APP-PLUS
uni.navigateTo({
url: '/pages/users/login/index'
})
// #endif
}
@ -102,4 +58,4 @@ export function checkLogin()
return true;
}
}
}

View File

@ -3,6 +3,7 @@ import { checkLogin } from './login';
import { login } from '../api/public';
import Cache from '../utils/cache';
import { STATE_R_KEY, USER_INFO, EXPIRES_TIME, LOGIN_STATUS} from './../config/cache';
class Routine
{
@ -24,6 +25,16 @@ class Routine
getUserProfile(){
let that = this , code = this.getUserCode();
return new Promise( (resolve,reject) => {
// uni.getUserInfo({
// lang: 'zh_CN',
// success(user) {
// if(code) user.code = code;
// resolve({userInfo:user,islogin:false});
// },
// fail(res){
// reject(res);
// }
// })
uni.getUserProfile({
lang: 'zh_CN',
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
@ -65,6 +76,9 @@ class Routine
async getCode(){
let provider = await this.getProvider();
return new Promise((resolve,reject)=>{
if(Cache.has(STATE_R_KEY)){
return resolve(Cache.get(STATE_R_KEY));
}
uni.login({
provider:provider,
success(res) {
@ -121,16 +135,17 @@ class Routine
{
return new Promise((resolve, reject)=>{
login(code,data).then(res=>{
if(res.data.type==='login'){
store.commit('LOGIN', {
token: res.data.token
});
}
// let time = res.data.expiresTime - Cache.time();
store.commit('UPDATE_USERINFO', res.data.user);
store.commit('LOGIN', {token:res.data.token});
store.commit('SETUID', res.data.user.uid);
// Cache.set(EXPIRES_TIME,res.data.expiresTime,time);
Cache.set(USER_INFO,res.data.user);
return resolve(res);
}).catch(res=>{
return reject(res);
})
});
})
}
}

View File

@ -46,7 +46,7 @@ if (vconsole !== undefined && vconsole === md5Crmeb) {
let vConsole = new VConsole();
}
// Auth.isWeixin() && Auth.oAuth();
Auth.isWeixin() && Auth.oAuth();
// #endif

View File

@ -59,7 +59,7 @@
"appid" : "wxcda5a2b1b98b6a95",
"setting" : {
"urlCheck" : false,
"minified" : true,
"minified" : false,
"postcss" : true,
"es6" : true
},

View File

@ -25,7 +25,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -96,7 +96,13 @@
this.getUserInfo();
this.getBargainList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -224,7 +224,7 @@
<image src="/static/images/share-info.png" @click="H5ShareBox = false"></image>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -391,7 +391,13 @@
// '&spid=' + e.detail.uid;
// this.$set(that, 'bargainPartake', e.detail.uid);
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}

View File

@ -214,7 +214,7 @@
<image src="/static/images/share-info.png" @click="H5ShareBox = false"></image>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
<product-window :attr='attribute' :limitNum='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" @ChangeCartNum="ChangeCartNum"
@ -422,7 +422,13 @@
uni.setStorageSync('comGoodsId', options.id);
} catch (e) {}
// #endif
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
} else {
try {

View File

@ -95,7 +95,7 @@
<!-- 发送给朋友图片 -->
<view class="share-box" v-if="H5ShareBox"><image src="/static/images/share-info.png" @click="H5ShareBox = false"></image></view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
<!-- <Product-window v-on:changeFun="changeFun" :attr="attr" :limitNum='1' :iSbnt='1'></Product-window> -->
@ -195,7 +195,13 @@ export default {
var that = this;
that.pinkId = options.id;
if (that.isLogin == false) {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
} else {
this.timestamp = (new Date()).getTime();
// #ifdef H5

View File

@ -110,7 +110,7 @@
<product-window :attr='attribute' :limitNum='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" @ChangeCartNum="ChangeCartNum"
@attrVal="attrVal" @iptCartNum="iptCartNum"></product-window>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth"></authorize>
<!-- #endif -->
<home></home>
<!-- 分享按钮 -->
@ -350,7 +350,13 @@
this.getProductReplyList();
this.getProductReplyCount();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -36,6 +36,7 @@
},
onLoad: function (options) {
this.type = options.type;
cosole.log('hello')
},
onShow: function () {
let type = this.type;

View File

@ -198,7 +198,7 @@
<view class="mask" v-if="posters" @click="closePosters"></view>
<view class="mask" v-if="canvasStatus" @click="listenerActionClose"></view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<!-- 海报展示 -->
<view class='poster-pop' v-if="canvasStatus">
@ -904,7 +904,13 @@
setCollect: function() {
let that = this;
if (this.isLogin === false) {
toLogin();
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
} else {
if (this.storeInfo.userCollect) {
collectDel(this.storeInfo.id).then(res => {

View File

@ -175,7 +175,7 @@
</view>
<!-- <coupon-window :window='window' :couponList="couponList" @onColse="onColse"></coupon-window> -->
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse" :isGoIndex="false"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse" :isGoIndex="false"></authorize>
<!-- #endif -->
</view>
</template>
@ -706,7 +706,13 @@
//
goDetail(item) {
if (item.activityH5 && item.activityH5.type === "2" && !this.isLogin) {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
// // #ifdef H5
// uni.showModal({
// title: '',

View File

@ -113,7 +113,7 @@
<productWindow :attr="attr" :isShow='1' :iSplus='1' :iScart='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
@ChangeCartNum="ChangeCartNum" @attrVal="attrVal" @iptCartNum="iptCartNum" @goCat="reGoCat" id='product-window'></productWindow>
<!-- #ifdef MP -->
<!-- <authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
@ -203,7 +203,13 @@
onLoad: function(options) {
let that = this;
if (that.isLogin == false) {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
onShow: function() {

View File

@ -226,7 +226,7 @@
</view>
<home></home>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<payment :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :order_id="pay_order_id" :totalPrice='totalPrice'></payment>
</view>
@ -677,7 +677,13 @@
this.getOrderInfo();
this.getUserInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
onHide: function() {

View File

@ -47,7 +47,7 @@
<button @click="goIndex" class='returnBnt cart-color' formType="submit" hover-class='none' v-else></button>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -88,16 +88,16 @@
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getOrderPayInfo();
}
},
deep:true
}
},
// watch:{
// isLogin:{
// handler:function(newV,oldV){
// if(newV){
// this.getOrderPayInfo();
// }
// },
// deep:true
// }
// },
onLoad: function(options) {
if (!options.order_id) return this.$util.Tips({
title: '缺少参数无法查看订单支付状态'
@ -111,7 +111,13 @@
if (this.isLogin) {
this.getOrderPayInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -113,7 +113,7 @@
</view>
<img src="/static/images/support.png" alt="" class='support'>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -201,11 +201,15 @@
let that = this;
that.$set(that, 'MyMenus', app.globalData.MyMenus);
console.log('user页面',that.isLogin)
if (that.isLogin == false) {
// #ifdef H5 || APP-PLUS
toLogin()
// #endif
}
// if (that.isLogin == false) {
// // #ifdef H5 || APP-PLUS
// toLogin();
// // #endif
// // #ifdef MP
// this.isAuto = true;
// this.$set(this, 'isShowAuth', true);
// // #endif
// }
},
onShow: function() {
let that = this;
@ -215,7 +219,13 @@
// this.setVisit();
this.getOrderData();
}else{
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {
@ -258,8 +268,8 @@
},
//
openAuto() {
console.log('点击事件','lala')
toLogin();
this.isAuto = true;
this.isShowAuth = true
},
//
onLoadFun() {
@ -317,7 +327,13 @@
//
goEdit() {
if (this.isLogin == false) {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
} else {
uni.navigateTo({
url: '/pages/users/user_info/index'

View File

@ -32,7 +32,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -90,7 +90,13 @@
this.getBrokerageRankList();
this.getBrokerageRankNumber(this.type);
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -40,7 +40,7 @@
</view>
</form>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -116,7 +116,13 @@
if (this.isLogin) {
this.getOrderProduct();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -40,7 +40,7 @@
<recommend :hostProduct='hostProduct' v-if="hostProduct.length"></recommend>
</view>
<!-- #ifdef MP -->
<!-- <authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -106,7 +106,13 @@
this.getExpress();
this.get_host_product();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
onReady: function() {

View File

@ -59,7 +59,7 @@
</view>
</form>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -111,7 +111,13 @@
this.getOrderInfo();
this.getRefundReason();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -1,36 +1,47 @@
<template>
<div class="login-wrapper">
<div class="register absolute">
<div class="shading">
<image :src="logoUrl" v-if="logoUrl" />
<image src="/static/images/logo2.png" v-else />
<div class="pictrue acea-row row-center-wrapper">
<image :src="logoUrl" v-if="logoUrl" />
<image src="/static/images/logo2.png" v-else />
</div>
</div>
<div class="whiteBg" v-if="formItem === 1">
<div class="list" v-if="current !== 1">
<div class="title acea-row row-center-wrapper">
<div class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" @click="navTap(index)"
:key="index">
{{ item }}
</div>
</div>
<div class="list" :hidden="current !== 1">
<form @submit.prevent="submit">
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png" style="width: 24rpx; height: 34rpx;"></image>
<image src="/static/images/phone_1.png"></image>
<input type="text" placeholder="输入手机号码" v-model="account" required />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
<image src="/static/images/code_2.png"></image>
<input type="password" placeholder="填写登录密码" v-model="password" required />
</div>
</div>
</form>
<!-- <navigator class="forgetPwd" hover-class="none" url="/pages/users/retrievePassword/index">
<span class="iconfont icon-wenti"></span>忘记密码
</navigator> -->
</div>
<div class="list" v-if="current !== 0 || appLoginStatus || appleLoginStatus">
<div class="list" :hidden="current !== 0">
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png" style="width: 24rpx; height: 34rpx;"></image>
<image src="/static/images/phone_1.png"></image>
<input type="text" placeholder="输入手机号码" v-model="account" />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
<image src="/static/images/code_2.png"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">
{{ text }}
@ -39,44 +50,59 @@
</div>
<div class="item" v-if="isShowCode">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
<image src="/static/images/code_2.png"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
<div class="code" @click="again"><img :src="codeUrl" /></div>
</div>
</div>
</div>
<div class="logon" @click="loginMobile" v-if="current !== 0"></div>
<div class="logon" @click="submit" v-if="current === 0"></div>
<!-- #ifndef APP-PLUS -->
<div class="tips">
<div v-if="current==0" @click="current = 1"></div>
<div v-if="current==1" @click="current = 0"></div>
<div class="logon" @click="loginMobile" :hidden="current !== 0">登录</div>
<div class="logon" @click="submit" :hidden="current === 0">登录</div>
<div class="tip">
<div :hidden="current !== 1">
没有账号?
<span @click="current = 0" class="font-color-red">快速登录</span>
</div>
</div>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view class="appLogin" v-if="!appLoginStatus && !appleLoginStatus">
<view class="hds">
<span class="line"></span>
<p>其他方式登录</p>
<span class="line"></span>
</view>
<view class="btn-wrapper">
<view class="btn wx" @click="wxLogin">
<span class="iconfont icon-s-weixindenglu1"></span>
</view>
<view class="btn mima" v-if="current == 1" @click="current =0">
<span class="iconfont icon-s-mimadenglu1"></span>
</view>
<view class="btn yanzheng" v-if="current == 0" @click="current =1">
<span class="iconfont icon-s-yanzhengmadenglu1"></span>
</view>
<view class="apple-btn" @click="appleLogin" v-if="appleShow">
<view class="iconfont icon-s-pingguo"></view>通过Apple登录
</view>
</view>
</view>
<!-- #endif -->
</div>
<!-- <div class="whiteBg" v-else>
<div class="title">注册账号</div>
<div class="list">
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png"></image>
<input type="text" placeholder="输入手机号码" v-model="account" />
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">
{{ text }}
</button>
</div>
</div>
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/code_1.png"></image>
<input type="password" placeholder="填写您的登录密码" v-model="password" />
</div>
</div>
<div class="item" v-if="isShowCode">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
<div class="code" @click="again"><img :src="codeUrl" /></div>
</div>
</div>
</div>
<div class="logon" @click="register"></div>
<div class="tip">
已有账号?
<span @click="formItem = 1" class="font-color-red">立即登录</span>
</div>
</div> -->
<div class="bottom"></div>
</div>
</template>
@ -124,12 +150,7 @@
keyCode: "",
codeUrl: "",
codeVal: "",
isShowCode: false,
appLoginStatus: false, //
appUserInfo: null, //
appleLoginStatus: false, //
appleUserInfo: null,
appleShow: false // ios13
isShowCode: false
};
},
watch:{
@ -146,133 +167,6 @@
this.getLogoImage();
},
methods: {
//
appleLogin() {
let self = this
this.account = ''
this.captcha = ''
uni.showLoading({
title: '登录中'
})
uni.login({
provider: 'apple',
timeout: 10000,
success(loginRes) {
uni.getUserProfile({
provider: 'apple',
success: function(infoRes) {
console.log(infoRes.userInfo, 'yyyy')
self.appleUserInfo = infoRes.userInfo
self.appleLoginApi()
},
fail() {
uni.showToast({
title: '获取用户信息失败',
icon: 'none',
duration: 2000
})
},
complete() {
uni.hideLoading()
}
});
},
fail(error) {
console.log(error)
}
})
},
// Api
appleLoginApi() {
let self = this
appleLogin({
openId: self.appleUserInfo.openId,
email: self.appleUserInfo.email || '',
phone: this.account,
captcha: this.captcha
}).then(({
data
}) => {
if (data.isbind) {
uni.showModal({
title: '提示',
content: '请绑定手机号后,继续操作',
showCancel: false,
success: function(res) {
if (res.confirm) {
self.current = 1
self.appleLoginStatus = true
}
}
});
} else {
self.$store.commit("LOGIN", {
'token': data.token,
'time': data.expires_time - self.$Cache.time()
});
let backUrl = self.$Cache.get(BACK_URL) || "/pages/index/index";
self.$Cache.clear(BACK_URL);
self.$store.commit("SETUID", data.userInfo.uid);
uni.reLaunch({
url: backUrl
});
}
}).catch(error => {
uni.showModal({
title: '提示',
content: `错误信息${error}`,
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
})
},
// App
wxLogin() {
let self = this
this.account = ''
this.captcha = ''
uni.showLoading({
title: '登录中'
})
uni.login({
provider: 'weixin',
success: function(loginRes) {
//
uni.getUserProfile({
provider: 'weixin',
success: function(infoRes) {
self.appUserInfo = infoRes.userInfo
self.wxLoginApi()
console.log(self.$store);
console.log(infoRes.userInfo);
},
fail() {
uni.showToast({
title: '获取用户信息失败',
icon: 'none',
duration: 2000
})
},
complete() {
uni.hideLoading()
}
});
},
fail() {
uni.showToast({
title: '登录失败',
icon: 'none',
duration: 2000
})
}
});
},
again() {
this.codeUrl =
VUE_APP_API_URL +
@ -327,9 +221,8 @@
});
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
that.$Cache.clear(BACK_URL);
getUserInfo().then(res => {
that.$store.commit("UPDATE_USERINFO", res.data);
that.$store.commit("SETUID", res.data.uid);
// getUserInfo().then(res => {
that.$store.commit("SETUID", res.data.user.uid);
if (backUrl === '/pages/index/index' || backUrl === '/pages/order_addcart/order_addcart' || backUrl ===
'/pages/user/index') {
@ -338,12 +231,11 @@
});
} else {
uni.navigateBack()
// uni.switchTab({
// url: '/pages/index/index'
// });
uni.switchTab({
url: '/pages/index/index'
});
}
})
// })
})
.catch(res => {
that.$util.Tips({
@ -445,7 +337,6 @@
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
that.$Cache.clear(BACK_URL);
getUserInfo().then(res => {
that.$store.commit("UPDATE_USERINFO", res.data);
that.$store.commit("SETUID", res.data.uid);
if (backUrl === '/pages/index/index' || backUrl === '/pages/order_addcart/order_addcart' || backUrl ==='/pages/user/index') {
uni.switchTab({
@ -467,81 +358,7 @@
}
};
</script>
<style lang="scss" scoped>
.appLogin {
margin-top: 60rpx;
.hds {
display: flex;
justify-content: center;
align-items: center;
font-size: 24rpx;
color: #B4B4B4;
.line {
width: 68rpx;
height: 1rpx;
background: #CCCCCC;
}
p {
margin: 0 20rpx;
}
}
.btn-wrapper {
display: flex;
align-items: center;
justify-content: center;
margin-top: 30rpx;
.btn {
display: flex;
align-items: center;
justify-content: center;
width: 68rpx;
height: 68rpx;
border-radius: 50%;
}
.apple-btn {
display: flex;
align-items: center;
justify-content: center;
width: 246rpx;
height: 66rpx;
margin-left: 30rpx;
background: #EAEAEA;
border-radius: 34rpx;
font-size: 24rpx;
.icon-s-pingguo {
color: #333;
margin-right: 10rpx;
font-size: 34rpx;
}
}
.iconfont {
font-size: 40rpx;
color: #fff;
}
.wx {
margin-right: 30rpx;
background-color: #61C64F;
}
.mima {
background-color: #28B3E9;
}
.yanzheng {
background-color: #F89C23;
}
}
}
<style lang="scss">
.code img {
width: 100%;
height: 100%;
@ -550,67 +367,6 @@
.acea-row.row-middle {
input {
margin-left: 20rpx;
display: block;
}
}
.login-wrapper{
padding: 30rpx;
.shading{
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 200rpx;
margin-top: 200rpx;
image{
width: 180rpx;
height: 180rpx;
}
}
.whiteBg{
margin-top: 100rpx;
.list{
border-radius: 16rpx;
overflow: hidden;
.item{
border-bottom: 1px solid #F0F0F0;
background: #fff;
.row-middle{
position: relative;
padding: 30rpx 45rpx;
input{
flex: 1;
font-size: 28rpx;
height: 80rpx;
}
.code{
position: absolute;
right: 30rpx;
top: 50%;
color: #E93323;
font-size: 26rpx;
transform: translateY(-50%);
}
}
}
}
.logon{
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 86rpx;
margin-top: 100rpx;
background-color: $theme-color;
border-radius: 120rpx;
color: #FFFFFF;
font-size: 30rpx;
}
.tips{
margin:30rpx;
text-align: center;
color: #999;
}
}
}
</style>
</style>

View File

@ -142,7 +142,7 @@
<addressWindow ref="addressWindow" @changeTextareaStatus="changeTextareaStatus" :address='address' :pagesUrl="pagesUrl"
@OnChangeAddress="OnChangeAddress" @changeClose="changeClose"></addressWindow>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -321,7 +321,13 @@
//
this.$nextTick(function() {})
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
/**

View File

@ -93,7 +93,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
<payment :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :order_id="pay_order_id" :totalPrice='totalPrice'></payment>
@ -173,7 +173,13 @@
this.getOrderList();
this.getUserInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -69,7 +69,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -119,7 +119,13 @@
if (this.isLogin) {
this.userSpreadNewList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
onShow: function() {

View File

@ -46,7 +46,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -92,7 +92,13 @@
if (this.isLogin) {
this.getRecordOrderList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -48,7 +48,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -107,7 +107,13 @@
if (this.isLogin) {
this.getRanklist();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
// onShow: function () {

View File

@ -43,7 +43,7 @@
</view>
</form>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -131,7 +131,13 @@
// this.initialize();
// }
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -52,7 +52,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -122,7 +122,13 @@
this.bargain = options.bargain || false;
this.getAddressList(true);
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
onShow: function() {

View File

@ -31,7 +31,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -78,7 +78,13 @@
if (this.isLogin) {
this.getUserBillList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
/**

View File

@ -108,7 +108,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -182,7 +182,13 @@
this.getUserExtractBank();
//this.getBrokerageCommission();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -26,7 +26,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -87,7 +87,13 @@
if (this.isLogin) {
this.getUseCoupons();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -31,7 +31,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -83,7 +83,13 @@
if(this.isLogin){
this.getUseCoupons();
}else{
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
/**

View File

@ -25,7 +25,7 @@
<recommend :hostProduct="hostProduct"></recommend>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -81,7 +81,13 @@
this.get_user_collect_product();
this.get_host_product();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
onShow(){

View File

@ -59,7 +59,7 @@
</view>
</form>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -113,7 +113,13 @@
if (this.isLogin) {
this.getUserInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -61,7 +61,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -125,7 +125,13 @@
this.getUserInfo();
this.getIntegralList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
/**

View File

@ -121,7 +121,7 @@
<recommend :hostProduct="hostProduct" v-if="hostProduct.length"></recommend>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -194,7 +194,13 @@
this.get_activity();
this.userDalance();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -47,7 +47,7 @@
</view>
</form>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -123,7 +123,13 @@
this.getRecharge();
this.getUserExtractBank();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -19,7 +19,7 @@
<button form-type="submit" v-if="!isNew" class="confirmBnt bg-color" @click="editPwd"></button>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -71,7 +71,13 @@
// this.$set(this, 'key', res.data.key)
// });
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -21,7 +21,7 @@
</form>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -77,7 +77,13 @@
if (this.isLogin) {
this.getUserInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -26,7 +26,7 @@
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -81,7 +81,13 @@
if (this.isLogin) {
this.getOrderList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
/**

View File

@ -65,7 +65,7 @@
<view class='mask' @touchmove.stop.prevent="false" :hidden='active==false'></view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -128,7 +128,13 @@
this.getSignSysteam();
this.getSignList();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -20,7 +20,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
</view>
</template>
@ -65,7 +65,13 @@
if(this.isLogin){
this.getSignMoneList();
}else{
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
onReachBottom: function () {

View File

@ -21,7 +21,7 @@
<!-- #endif -->
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<view class="canvas" v-if="canvasStatus">
<canvas style="width:750px;height:1190px;" canvas-id="canvasOne"></canvas>
@ -99,7 +99,13 @@
this.userSpreadBannerList();
// // #endif
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
/**

View File

@ -61,7 +61,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -113,7 +113,13 @@
if (this.isLogin) {
this.type = options.type;
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
onShow: function() {

View File

@ -52,7 +52,7 @@
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!-- #endif -->
<home></home>
</view>
@ -100,7 +100,13 @@
if (this.isLogin) {
this.getSpreadInfo();
} else {
// #ifdef H5 || APP-PLUS
toLogin();
// #endif
// #ifdef MP
this.isAuto = true;
this.$set(this, 'isShowAuth', true);
// #endif
}
},
methods: {

View File

@ -21,7 +21,7 @@
<button hover-class="none" @click="wechatLogin" class="bg-green btn1">微信登录</button>
<!-- #endif -->
<!-- #ifdef MP -->
<button hover-class="none" @tap="getUserProfile" class="bg-green btn1">微信登录</button>
<button hover-class="none" open-type="getUserInfo" @getuserinfo="setUserInfo" class="bg-green btn1">微信登录</button>
<!-- #endif -->
<!-- <button hover-class="none" @click="isUp = true" class="btn2">手机号登录</button> -->
</view>
@ -238,25 +238,6 @@
})
});
},
getUserProfile() {
let self = this;
uni.showLoading({
title: '正在登录中'
});
Routine.getUserProfile()
.then(res => {
Routine.getCode()
.then(code => {
self.getWxUser(code, res);
})
.catch(res => {
uni.hideLoading();
});
})
.catch(res => {
uni.hideLoading();
});
},
setUserInfo(e) {
uni.showLoading({
title: '正在登录中'
@ -269,49 +250,57 @@
uni.hideLoading();
});
},
getWxUser(code, res) {
let self = this
let userInfo = res.userInfo;
userInfo.code = code;
userInfo.spread_spid = app.globalData.spid; //广ID
userInfo.spread_code = app.globalData.code; //广ID
userInfo.avatar = userInfo.userInfo.avatarUrl;
userInfo.city = userInfo.userInfo.city;
userInfo.country = userInfo.userInfo.country;
userInfo.nickName = userInfo.userInfo.nickName;
userInfo.province = userInfo.userInfo.province;
userInfo.sex = userInfo.userInfo.gender;
userInfo.type = 'routine'
Routine.authUserInfo(userInfo.code, userInfo)
.then(res => {
self.authKey = res.data.key;
if (res.data.type === 'register') {
getWxUser(code) {
let self = this
Routine.getUserInfo()
.then(res => {
console.log('res1',res);
let userInfo = res.userInfo;
userInfo.code = code;
userInfo.spread_spid = app.globalData.spid;//广ID
userInfo.spread_code = app.globalData.code;//广ID
userInfo.avatar = userInfo.userInfo.avatarUrl;
userInfo.city = userInfo.userInfo.city;
userInfo.country = userInfo.userInfo.country;
userInfo.nickName = userInfo.userInfo.nickName;
userInfo.province = userInfo.userInfo.province;
userInfo.sex = userInfo.userInfo.gender;
userInfo.type = 'routine'
Routine.authUserInfo(userInfo.code, userInfo)
.then(res => {
console.log(res)
self.authKey = res.data.key;
if (res.data.type === 'register') {
uni.hideLoading();
self.isPhoneBox = true
} else {
uni.hideLoading();
let time = res.data.expires_time - self.$Cache.time();
self.$store.commit('LOGIN', {
token: res.data.token,
time: time
});
self.$util.Tips({
title: res,
icon: 'success'
}, {
tab: 3
})
}
})
.catch(res => {
uni.hideLoading();
uni.showToast({
title: res,
icon: 'none',
duration: 2000
});
});
})
.catch(res => {
uni.hideLoading();
self.isPhoneBox = true
}
if (res.data.type === 'login') {
uni.hideLoading();
self.$store.commit('LOGIN', {
token: res.data.token
});
self.$util.Tips({
title: res,
icon: 'success'
}, {
tab: 3
})
}
})
.catch(res => {
uni.hideLoading();
uni.showToast({
title: res,
icon: 'none',
duration: 2000
});
});
},
},
// #endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 895 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -22,6 +22,7 @@ function baseRequest(url, method, data, {
if (params != undefined) {
header = HEADERPARAMS;
}
console.log('Url:',Url);
if (!noAuth) {
//登录过期自动登录
if (!store.state.app.token && !checkLogin()) {