Commit a5a39a67 authored by wangwei's avatar wangwei

神策登录接口调整

parent ea00a311
......@@ -40,7 +40,7 @@
<script>
import QRCode from 'qrcodejs2'
import { Indicator } from 'mint-ui';
import {getwechatParam,getGoodsDetailApi,getGroupDetailApi,getStatusWechatApi,getUserDetailApi,getInviteResultApi,getInviteListApi} from "../../service/api";
import {getwechatParam,getGoodsDetailApi,getGroupDetailApi,getStatusWechatApi,getInviteResultApi,getInviteListApi} from "../../service/api";
import refBg from '../../assets/refBg.png'
import moreUrl from '../../assets/moreIcon.png'
import refIcon from '../../assets/refIcon.png'
......@@ -157,8 +157,7 @@
if(!this.invite_code){
this.invite_code = 'CC-USER'
}
getUserDetailApi().then(res=>{
this.user_id=res.user_id;
this.user_id=JSON.parse(localStorage.getItem('userDesc')).user_id;
let invite_code = this.invite_code.split('-');
if(invite_code.length > 2 && invite_code[1] === 'TEACHER'){
invite_code[1] = 'USER'
......@@ -200,7 +199,6 @@
}
})
});
},500)
}else{
......
......@@ -10,7 +10,7 @@
</div>
</div>
<img :src="dataURL" class="cvs-img" id="cvs-img"/>
<div class="inviteBtn" id="inviteBtn">
<div class="content-text">
<h3>长按保存海报 或发送给好友</h3>
......@@ -49,7 +49,7 @@
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import QRCode from 'qrcodejs2'
import { Indicator } from 'mint-ui';
import {getwechatParam,getGoodsDetailApi,getGroupDetailApi,getStatusWechatApi,getUserDetailApi} from "../../service/api";
import {getwechatParam,getGoodsDetailApi,getGroupDetailApi,getStatusWechatApi} from "../../service/api";
import refBg from '../../assets/refBg.png'
import moreUrl from '../../assets/moreIcon.png'
import refIcon from '../../assets/refIcon.png'
......@@ -154,8 +154,7 @@
if(!this.invite_code){
this.invite_code = 'CC-USER'
}
getUserDetailApi().then(res=>{
this.user_id=res.user_id;
this.user_id=JSON.parse(localStorage.getItem('userDesc')).user_id;
let _that = this;
let invite_code = this.invite_code.split('-');
if(invite_code.length > 2 && invite_code[1] === 'TEACHER'){
......@@ -163,14 +162,15 @@
}
let code = `${invite_code[0]}-${invite_code[1]}`;
let URL = `${process.env.BUY_URL}shopId=${this.shopId}&invite_code=${code}-${this.user_id}`;
if(this.groupId && this.groupId !== 'null'){
URL += `&groupId=${this.groupId}`
}
this.onNewShare(URL);
this.toDataURLBase64(res.avatar.replace('http://','https://'), function (avatar) {
this.toDataURLBase64(JSON.parse(localStorage.getItem('userDesc')).avatar.replace('http://','https://'), function (avatar) {
_that.avatar = avatar
});
_that.qrcode(URL);
this.refVisible = true;
this.$nextTick(()=>{
......@@ -204,14 +204,13 @@
}).catch(res=>{alert(res);console.log()});
}
})
},500)
}else{
}
})
});
}else{
let query = {retUrl:this.$route.fullPath,is_new_user_url:'1'};
this.$router.push({name:'author',query:query})
......
......@@ -65,7 +65,7 @@
<script>
import { Toast, MessageBox } from 'mint-ui'
import {getUserAdressApi,getGoodsDetailApi,payApi,getwechatParam,getStatusWechatApi,getCouponListApi,getUserDetailApi} from "../../service/api";
import {getUserAdressApi,getGoodsDetailApi,payApi,getwechatParam,getStatusWechatApi,getCouponListApi} from "../../service/api";
import addAddress from './address'
import youHuiUrl from '../../assets/shop/youHui.png'
import saleDiv from './sale'
......@@ -235,8 +235,7 @@
this.addressPop = true
},
initPage(){
getUserDetailApi().then(res=>{
if(!res.mobile|| res.mobile === ''){
if(!JSON.parse(localStorage.getItem('userDesc')).mobile|| JSON.parse(localStorage.getItem('userDesc')).mobile === ''){
this.$router.push({name:'bindMobile',query:{retUrl:this.$route.fullPath}})
}else{
getwechatParam({api_list:'chooseWXPay'}).then(res=>{
......@@ -285,7 +284,6 @@
});
this.orderFlag = true
}
});
}
}
}
......
......@@ -121,7 +121,7 @@
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import QRCode from 'qrcodejs2'
import { Indicator } from 'mint-ui';
import {getwechatParam,getGoodsDetailApi,getGroupDetailApi,getStatusWechatApi,getUserDetailApi} from "../../service/api";
import {getwechatParam,getGoodsDetailApi,getGroupDetailApi,getStatusWechatApi} from "../../service/api";
import refBg from '../../assets/refBg.png'
import moreUrl from '../../assets/moreIcon.png'
import weChatIcon from '../../assets/wechatIcon.png'
......@@ -361,8 +361,7 @@
this.invite_code_f = false
}
}
getUserDetailApi().then(res=>{
this.user_id=res.user_id;
this.user_id=JSON.parse(localStorage.getItem('userDesc')).user_id;
if(window.location.href.indexOf('shopId')>-1){
this.shopId = this.$route.query.shopId;
getGoodsDetailApi(this.shopId).then(res=>{
......@@ -427,7 +426,6 @@
}
})
}
});
},
showTeacher(){
this.popType = false;
......
......@@ -76,7 +76,7 @@
import guidePage from './guide/index'
import 'swiper/dist/css/swiper.css'
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import {getBannerListApi,getUserDetailApi,getUserLessonApi,getTeacherApi,getNewApi,getRedirectApi} from "../service/api";
import {getBannerListApi,getUserLessonApi,getTeacherApi,getNewApi,getRedirectApi} from "../service/api";
import {IndexImage} from "../util/imgUrl";
import bottomTab from './public/bottomTab';
import { Toast } from 'mint-ui';
......@@ -157,10 +157,7 @@
window.location.href = res
}
});
getUserDetailApi().then(res=>{
this.user_id=res.user_id;
// this.$sa.login(this.user_id)
});
this.user_id=JSON.parse(localStorage.getItem('userDesc')).user_id;
getBannerListApi().then(res=>{
this.bannerList = res.list
});
......
......@@ -23,7 +23,6 @@
<script>
import bottomTab from './public/bottomTab';
import {mineImage} from "../util/imgUrl";
import {getUserDetailApi} from "../service/api";
import { Toast } from 'mint-ui';
export default {
name: "mine",
......@@ -41,9 +40,7 @@
},
methods:{
initPage(){
getUserDetailApi().then(res=>{
this.userDetail = res
})
this.userDetail = JSON.parse(localStorage.getItem('userDesc'))
},
clearBoth(){
this.$sa.track('buttonClick',{
......
This diff is collapsed.
......@@ -4,7 +4,6 @@
<script>
import {share} from "../util/imgUrl";
import {getUserWatchApi,getUserDetailApi} from "../service/api";
export default {
name: "share",
data(){
......
......@@ -86,7 +86,7 @@ const router =new Router({
name: 'buyDetail',
component: e=>require(['@/components/buy/index'],e),
meta:{
skip_login:true,
skip_login:false,
noNew:true,
deep:10
}
......@@ -218,22 +218,22 @@ router.beforeEach((to,from,next)=> {
let token = common.getUrlParam().token || to.query.token;
store.dispatch('setToken',token);
getUserDetailApi().then(res=>{
localStorage.setItem('userId',res.user_id);
localStorage.setItem('userDesc',JSON.stringify(res));
sa.login(res.user_id);
goOn()
});
goOn()
// 通过cookie获取token
}else if(localStorage.getItem('cc_token')) {
store.dispatch('setToken', localStorage.getItem('cc_token'));
if(localStorage.getItem('userId')){
sa.login(localStorage.getItem('userId'));
if(localStorage.getItem('userDesc')){
sa.login(JSON.parse(localStorage.getItem('userDesc')).user_id);
goOn()
}else{
getUserDetailApi().then(res=>{
localStorage.setItem('userId',res.user_id);
localStorage.setItem('userDesc',JSON.stringify(res));
sa.login(res.user_id);
goOn()
});
}
goOn()
// 无需token登录页面
}else if(to.meta.skip_login){
goOn()
......
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