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(){ changeAgent(){
uni.setTabBarItem({
index:1,
visible: true
})
uni.setTabBarItem({ uni.setTabBarItem({
index:0, index:0,
visible: false visible: false
@ -34,6 +30,10 @@ export default {
index:3, index:3,
visible: false visible: false
}) })
uni.setTabBarItem({
index:1,
visible: true
})
}, },
changebackground(){ changebackground(){
uni.setTabBarItem({ uni.setTabBarItem({

5
pages/home/home.vue

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

2
pages/list/team.vue

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

10
pages/ucenter/invite/invite.vue

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

13
pages/ucenter/ucenter.vue

@ -5,7 +5,7 @@
</view> </view>
<!-- <uni-sign-in ref="signIn"></uni-sign-in> --> <!-- <uni-sign-in ref="signIn"></uni-sign-in> -->
<view class="userInfo"> <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> <view v-else class="defaultAvatarUrl"></view>
@ -310,7 +310,8 @@
"radius": "100%" // "radius": "100%" //
} }
}, },
showRecharge: true showRecharge: true,
userInfo: {},
} }
}, },
onLoad() { onLoad() {
@ -341,9 +342,9 @@
// } // }
}, },
computed: { computed: {
userInfo() { // userInfo() {
return store.userInfo // return store.userInfo
}, // },
hasLogin(){ hasLogin(){
return uni.getStorageSync('user_token'); return uni.getStorageSync('user_token');
// return store.hasLogin // return store.hasLogin
@ -563,7 +564,7 @@
}, },
getUserInfo(){ getUserInfo(){
API.request('/user/userInfo', {}, res=>{ API.request('/user/userInfo', {}, res=>{
this.userInfo = res.data.userInfo; this.userInfo = res.data.data;
}) })
}, },
getAdminUserInfo(){ getAdminUserInfo(){

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

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

Loading…
Cancel
Save