|
@@ -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()
|
|
|
})
|