ccjgmwz vor 3 Jahren
Ursprung
Commit
5480ed64f5

+ 31 - 0
pages/business/business.vue

@@ -113,6 +113,37 @@
 		},
 		onShow() {
 			uni.showTabBar()
+			var userInfo = uni.getStorageSync("userInfo")
+			var that = this
+			console.log("userInfo",userInfo)
+			this.$api.doRequest('get', '/salePlanInfo/getTips', {phone:userInfo.phone}).then(res => {
+				if (res.data.data) {
+					let name = 'myTip';
+					let value = res.data.data.myTip;
+					that.$store.commit('$uStore', {
+						name,
+						value
+					});
+					if(value != 0){
+						uni.setTabBarBadge({
+							index:3,
+							text:value+""
+						})
+					}
+					name = 'taskTip';
+					value = res.data.data.taskTip;
+					that.$store.commit('$uStore', {
+						name,
+						value
+					});
+					name = 'contractTip';
+					value = res.data.data.contractTip;
+					that.$store.commit('$uStore', {
+						name,
+						value
+					});
+				}
+			})
 		},
 		onLoad(options) {
 			console.log("buy onload")

+ 6 - 0
pages/public/login_account_number.vue

@@ -105,6 +105,12 @@ username: "13333333333"}).then(res1 => {
 							uni.setStorageSync('pcUserInfo', res1.data.data)
 						})
 						that.$store.commit('login', res.data.data)
+						var name = 'userInfo';
+						var value = res.data.data;
+						that.$store.commit('$uStore', {
+							name,
+							value
+						});
 						// that.liangxinLogin()
 						
 						uni.switchTab({

+ 31 - 0
pages/sale/information.vue

@@ -165,6 +165,37 @@
 			this.isLoadMore = false
 			this.loadStatus = 'more'
 			this.loadData()
+			var userInfo = uni.getStorageSync("userInfo")
+			var that = this
+			console.log("userInfo",userInfo)
+			this.$api.doRequest('get', '/salePlanInfo/getTips', {phone:userInfo.phone}).then(res => {
+				if (res.data.data) {
+					let name = 'myTip';
+					let value = res.data.data.myTip;
+					that.$store.commit('$uStore', {
+						name,
+						value
+					});
+					if(value != 0){
+						uni.setTabBarBadge({
+							index:3,
+							text:value+""
+						})
+					}
+					name = 'taskTip';
+					value = res.data.data.taskTip;
+					that.$store.commit('$uStore', {
+						name,
+						value
+					});
+					name = 'contractTip';
+					value = res.data.data.contractTip;
+					that.$store.commit('$uStore', {
+						name,
+						value
+					});
+				}
+			})
 		},
 		onLoad(options) {
 			var that = this

+ 31 - 0
pages/tran/tran.vue

@@ -122,6 +122,37 @@
 			onShow() {
 				uni.showTabBar()
 				this.loadData()
+				var userInfo = uni.getStorageSync("userInfo")
+				var that = this
+				console.log("userInfo",userInfo)
+				this.$api.doRequest('get', '/salePlanInfo/getTips', {phone:userInfo.phone}).then(res => {
+					if (res.data.data) {
+						let name = 'myTip';
+						let value = res.data.data.myTip;
+						that.$store.commit('$uStore', {
+							name,
+							value
+						});
+						if(value != 0){
+							uni.setTabBarBadge({
+								index:3,
+								text:value+""
+							})
+						}
+						name = 'taskTip';
+						value = res.data.data.taskTip;
+						that.$store.commit('$uStore', {
+							name,
+							value
+						});
+						name = 'contractTip';
+						value = res.data.data.contractTip;
+						that.$store.commit('$uStore', {
+							name,
+							value
+						});
+					}
+				})
 			},
 			//下拉刷新
 			onPullDownRefresh() {

+ 47 - 14
pages/user/user.vue

@@ -262,22 +262,49 @@
 		onShow() {
 			uni.showTabBar()
 			this.loadData()
-			this.userInfo =  uni.getStorageSync("userInfo")
-			if(!this.userInfo.avatarUrl){
-				this.headUrl = "../../static/img/myimg/YongHu@3x.png"
-			}else{
-				this.headUrl = this.userInfo.avatarUrl
-			}
-			console.log("this.userInfo",this.userInfo)
-			if(this.userInfo.userName){
+			console.log("hasLogin",this.hasLogin )
+			if(this.userInfo){
+				if(!this.userInfo.avatarUrl){
+					this.headUrl = "../../static/img/myimg/YongHu@3x.png"
+				}else{
+					this.headUrl = this.userInfo.avatarUrl
+				}
 				this.username = this.userInfo.userName
-			}
-			else{
-				this.username = "请更改昵称"
-			}
-			if(this.userInfo.phone){
 				this.userphone = this.userInfo.phone
+				var that = this
+				this.$api.doRequest('get', '/salePlanInfo/getTips', {phone:this.userInfo.phone}).then(res => {
+					if (res.data.data) {
+						let name = 'myTip';
+						let value = res.data.data.myTip;
+						that.$store.commit('$uStore', {
+							name,
+							value
+						});
+						if(value != 0){
+							uni.setTabBarBadge({
+								index:3,
+								text:value+""
+							})
+						}
+						name = 'taskTip';
+						value = res.data.data.taskTip;
+						that.$store.commit('$uStore', {
+							name,
+							value
+						});
+						name = 'contractTip';
+						value = res.data.data.contractTip;
+						that.$store.commit('$uStore', {
+							name,
+							value
+						});
+					}
+				})
+			}else{
+				this.headUrl = "../../static/img/myimg/YongHu@3x.png"
+				this.username = "立即登录"
 			}
+			console.log("this.userInfo",this.userInfo)
 		},
 		methods: {
 			fankui(){
@@ -397,11 +424,17 @@
 				}
 			},
 			toLogin() {
-				if (!this.hasLogin) {
+				console.log("userInfo",this.userInfo)
+				if (!this.hasLogin || !this.userInfo || this.username == "立即登录") {
 					uni.navigateTo({
 						url: '/pages/public/login_account_number'
 					})
 				}
+				else{
+					uni.navigateTo({
+						url: '/pages/user/setUp'
+					})
+				}
 				// else if(!this.userInfo.nickname){
 				// 	this.inputShow = true
 				// 	this.inputStatus = 'inline'

+ 2 - 7
store/index.js

@@ -11,7 +11,7 @@ try {
 }
 
 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
-let saveStateKeys = ['firendItem','userData','pushRes','myTip','taskTip','contractTip','liangxinTip','packet','linkItem','memberItem','memberItemIndex','chatItem','clientId','infoList'];
+let saveStateKeys = ['firendItem','userData','userInfo','pushRes','myTip','taskTip','contractTip','liangxinTip','packet','linkItem','memberItem','memberItemIndex','chatItem','clientId','infoList'];
 
 // 保存变量到本地存储中
 const saveLifeData = function(key, value) {
@@ -27,9 +27,6 @@ const saveLifeData = function(key, value) {
 			        console.log('震动成功');
 			    }
 			});
-			uni.showTabBarRedDot({
-				index: 3
-			});
 		}
 		if(key == 'taskTip' && tmp[key] < value){
 			uni.vibrateLong({
@@ -37,9 +34,6 @@ const saveLifeData = function(key, value) {
 			        console.log('震动成功');
 			    }
 			});
-			uni.showTabBarRedDot({
-				index: 3
-			});
 		}
 		tmp[key] = value;
 		// 执行这一步后,所有需要存储的变量,都挂载在本地的lifeData对象中
@@ -66,6 +60,7 @@ const store = new Vuex.Store({
 		// 链接
 		linkItem:lifeData.linkItem?lifeData.linkItem: [],
 		userData: lifeData.userData?lifeData.userData: {},
+		userInfo: lifeData.userInfo?lifeData.userInfo: {},
 		//群成员 有索引A~Z
 		memberItem:lifeData.memberItem?lifeData.memberItem:[],
 		//群成员 没有索引

+ 2 - 1
websocket_sdk.js

@@ -288,7 +288,8 @@ export default class Websocket {
 			    },
 			    method: 'GET',
 			    success: (res) => {			
-			    	if (res.statusCode === 200) {
+					console.log("websocket myTips",res)
+					if (res.data.data) {
 			    		let name = 'myTip';
 			    		let value = res.data.data.myTip;
 			    		store.commit('$uStore', {