Commit a5a39a67 authored by wangwei's avatar wangwei

神策登录接口调整

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