Browse Source

登录后的底部导航切换、邀请码

master
luyisha 3 years ago
parent
commit
6f4e743eab
  1. 8
      common/js/updateTabBar.js
  2. 5
      pages/home/home.vue
  3. 2
      pages/list/team.vue
  4. 10
      pages/ucenter/invite/invite.vue
  5. 13
      pages/ucenter/ucenter.vue
  6. 8
      uni_modules/uni-id-pages/pages/login/login-withpwd.vue

8
common/js/updateTabBar.js

@ -18,10 +18,6 @@ export default {
})
},
changeAgent(){
uni.setTabBarItem({
index:1,
visible: true
})
uni.setTabBarItem({
index:0,
visible: false
@ -34,6 +30,10 @@ export default {
index:3,
visible: false
})
uni.setTabBarItem({
index:1,
visible: true
})
},
changebackground(){
uni.setTabBarItem({

5
pages/home/home.vue

@ -103,7 +103,7 @@
<script>
import * as echarts from 'echarts';
import API from '@/common/js/api.js'
// import updateTabBar from '@/common/js/updateTabBar.js'
import updateTabBar from '@/common/js/updateTabBar.js'
export default {
data() {
return {
@ -161,6 +161,9 @@
onShow() {
if(this.userType=='user'){
this.getAwardRecords();
updateTabBar.changeUser();
}else if(this.userType=='background'){
updateTabBar.changebackground();
}
},

2
pages/list/team.vue

@ -50,6 +50,7 @@
</template>
<script>
import updateTabBar from '@/common/js/updateTabBar.js'
import API from '@/common/js/api.js'
export default {
data(){
@ -132,6 +133,7 @@
},
onLoad() {
this.getDataList();
updateTabBar.changeAgent();
},
onReachBottom() {
if(!this.noMore){

10
pages/ucenter/invite/invite.vue

@ -1,7 +1,7 @@
<template>
<view class="">
<view class="invitePage">
<view class="invite_code">999987</view>
<view class="invite_code">{{Invite_code}}</view>
</view>
<view class="about" v-if="0">
<view class="box">
@ -25,6 +25,7 @@
</view>
</template>
<script>
import API from '@/common/js/api.js'
export default {
computed: {
uniStarterConfig() {
@ -35,6 +36,7 @@
return {
about: {},
code: "",
Invite_code: '',
isIos: "",
showMask: false,
downloadUrl: {
@ -44,6 +46,7 @@
};
},
created() {
this.getDatas();
this.about = this.uniStarterConfig.about
this.downloadUrl = this.uniStarterConfig.download
this.year = (new Date).getFullYear()
@ -63,6 +66,11 @@
document.getElementsByTagName("body")[0].style = ""
},
methods: {
getDatas(){
API.request('/agentTeam/getAgentInviteCode', {}, res=>{
this.Invite_code = res.data.code;
})
},
download() {
if (this.code) {
uni.setClipboardData({

13
pages/ucenter/ucenter.vue

@ -5,7 +5,7 @@
</view>
<!-- <uni-sign-in ref="signIn"></uni-sign-in> -->
<view class="userInfo">
<cloud-image width="120rpx" height="120rpx" v-if="hasLogin&&userInfo.avatar" :src="userInfo.avatar"></cloud-image>
<cloud-image width="120rpx" height="120rpx" style="margin-right: 8px;border-radius: 50%;overflow: hidden;" v-if="hasLogin&&userInfo.avatar" :src="userInfo.avatar"></cloud-image>
<view v-else class="defaultAvatarUrl"></view>
@ -310,7 +310,8 @@
"radius": "100%" //
}
},
showRecharge: true
showRecharge: true,
userInfo: {},
}
},
onLoad() {
@ -341,9 +342,9 @@
// }
},
computed: {
userInfo() {
return store.userInfo
},
// userInfo() {
// return store.userInfo
// },
hasLogin(){
return uni.getStorageSync('user_token');
// return store.hasLogin
@ -563,7 +564,7 @@
},
getUserInfo(){
API.request('/user/userInfo', {}, res=>{
this.userInfo = res.data.userInfo;
this.userInfo = res.data.data;
})
},
getAdminUserInfo(){

8
uni_modules/uni-id-pages/pages/login/login-withpwd.vue

@ -157,7 +157,6 @@
// }
if(this.userType=='user'){
updateTabBar.changeUser();
API.login(data, res=>{
console.log(res);
// this.loginSuccess()
@ -170,6 +169,7 @@
accounts.push(this.username);
uni.setStorageSync('accounts', accounts);
uni.setStorageSync('userType', 'user');
// updateTabBar.changeUser();
setTimeout(()=>{
uni.switchTab({
url:'/pages/home/home'
@ -179,7 +179,6 @@
}
if(this.userType=='agent'){
updateTabBar.changeAgent();
API.request('/passport/agentLogin', {
phone: this.username,
password: this.password
@ -190,16 +189,16 @@
})
uni.setStorageSync('user_token', res.data.token);
uni.setStorageSync('userType', 'agent');
// updateTabBar.changeAgent();
setTimeout(()=>{
uni.switchTab({
url:'/pages/home/home'
url:'/pages/list/team'
})
}, 1500)
}, fail=>{}, false)
}
if(this.userType=='background'){
updateTabBar.changebackground();
API.request('/passport/adminLogin', {
account_number: this.username,
password: this.password
@ -210,6 +209,7 @@
})
uni.setStorageSync('user_token', res.data.token);
uni.setStorageSync('userType', 'background');
// updateTabBar.changebackground();
setTimeout(()=>{
uni.switchTab({
url:'/pages/home/home'

Loading…
Cancel
Save