XSLu08042 6 days ago
parent
commit
7d0b4e3e0b
4 changed files with 100 additions and 8 deletions
  1. 10 1
      pages.json
  2. 1 0
      pages/auth/login.vue
  3. 75 7
      pages_user/bindCompanyUser.vue
  4. 14 0
      pages_user/downApp.vue

+ 10 - 1
pages.json

@@ -1184,7 +1184,16 @@
 							"navigationBarBackgroundColor":"#ffffff",
 							"navigationBarTextStyle":"black"
 						}
- 				 }
+ 				 },
+				 {
+					"path": "downApp",
+					"style": {
+						"navigationBarTitleText": "下载",
+							"enablePullDownRefresh": false,
+							"navigationBarBackgroundColor":"#ffffff",
+							"navigationBarTextStyle":"black"
+						}
+				 }
 			]
 		},
 		{

+ 1 - 0
pages/auth/login.vue

@@ -199,6 +199,7 @@ export default {
 										icon:'none',
 										title: "登录成功",
 									});
+									uni.setStorageSync('userHistoryApp',res.user.historyApp);
 									uni.setStorageSync('AppToken',res.token);
 									uni.setStorageSync('userId',res.user.userId);
 									uni.setStorageSync('avatar',res.user.avatar);

+ 75 - 7
pages_user/bindCompanyUser.vue

@@ -1,18 +1,23 @@
 <template>
 	<view class="content">
-		<view class="bindbox">
+		<image v-show="isBind" src="https://cos.his.cdwjyyh.com/fs/20250414/3da41caccf8346b188809fac656ba834.jpg" mode="widthFix"></image>
+		<view v-show="!isBind" class="bindbox">{{msg}}</view>
+		<!-- <view class="bindbox">
 			<image :src="baseUrl + '/images/bindComUser.png'" mode="aspectFill"></image>
 			<view>立即绑定,享受更多权益</view>
 		</view>
-		<button class="bind-btn" :loading="btnLodaing" :disabled="btnLodaing" @click="handleBind">立即绑定</button>
+		<button class="bind-btn" :loading="btnLodaing" :disabled="btnLodaing" @click="handleBind">立即绑定</button> -->
 	</view>
 </template>
 
 <script>
+	import {getUserInfo} from '@/api/user.js'
 	import { bindCompanyFsUser } from '@/api/companyUser.js'
 	export default {
 		data() {
 			return {
+				isBind: false,
+				msg: '绑定中...',
 				baseUrl:uni.getStorageSync('requestPath'),
 				btnLodaing: false,
 				companyUserId: '',
@@ -24,21 +29,71 @@
 				q = decodeURIComponent(option.q) // 获取到二维码原始链接内容
 			}
 			this.companyUserId = q.companyUserId || option.companyUserId
+			const historyApp = uni.getStorageSync('historyApp') || '';
+			if(historyApp) {
+				this.handleBind()
+			} else {
+				this.getUser()
+			}
 		},
 		methods: {
+			getUser() {
+				uni.showLoading({
+					title: '绑定中...'
+				})
+				getUserInfo().then(
+					res => {
+						if(res.code==200){
+							if(res.user!=null){
+								if(res.user.historyApp) {
+									uni.setStorageSync('historyApp',res.user.historyApp)
+									this.handleBind()
+								} else {
+									uni.hideLoading()
+									uni.redirectTo({
+										url: '/pages_user/downApp'
+									})
+								}
+							}
+							else{
+								uni.hideLoading()
+								this.utils.loginOut();
+							}
+							
+						}else{
+							uni.hideLoading()
+							uni.showToast({
+								icon:'none',
+								title: "请求失败",
+							});
+						}
+					},
+					rej => {}
+				).catch(()=>{
+					uni.hideLoading()
+				});
+			},
 			handleBind() {
+				uni.showLoading({
+					title: '绑定中...'
+				})
+				this.msg = '绑定中...'
 				this.$isLogin().then(
 					res => {
 						if(res){
 							this.submit();
 						}
 						else{
+							uni.hideLoading()
 							uni.navigateTo({
 								url:'/pages/auth/login'
 							})
 						}
 					}
-				);
+				).catch(()=>{
+					this.msg = '绑定失败'
+					uni.hideLoading()
+				});
 			},
 			submit() {
 				this.btnLodaing = true
@@ -48,11 +103,24 @@
 				bindCompanyFsUser(this.companyUserId).then(res=>{
 					this.btnLodaing = false
 					uni.hideLoading()
-					uni.showToast({
-						title: res.msg,
-						icon: 'none'
-					})
+					if(res.code == 200) {
+						this.isBind = true
+						this.msg = '绑定成功'
+						uni.showToast({
+							title: res.msg,
+							icon: 'none'
+						})
+					}else {
+						this.msg = res.msg
+						this.isBind = false
+						uni.showToast({
+							title: res.msg,
+							icon: 'none'
+						})
+					}
 				}).catch(()=>{
+					this.msg = '绑定失败'
+					this.isBind = false
 					this.btnLodaing = false
 					uni.hideLoading()
 				})

+ 14 - 0
pages_user/downApp.vue

@@ -0,0 +1,14 @@
+<template>
+	<web-view src="https://h5vips.cdwjyyh.com/pages/index/appDownload?source=weixin"></web-view>
+</template>
+
+<script>
+	export default {
+		data() {
+			
+		}
+	}
+</script>
+
+<style>
+</style>