XSLu08042 vor 1 Monat
Ursprung
Commit
ddacf870fc
1 geänderte Dateien mit 30 neuen und 8 gelöschten Zeilen
  1. 30 8
      pages_course/activity.vue

+ 30 - 8
pages_course/activity.vue

@@ -114,10 +114,8 @@
 </template>
 
 <script>
-	import {
-		mapGetters
-	} from 'vuex';
-	import { getLuckyBagInfo, receiveLuckyBag,loginByMp,editUser}from '@/api/course.js'
+	import {mapGetters} from 'vuex';
+	import { getLuckyBagInfo, receiveLuckyBag,loginByMp,editUser,isAddCompanyUser}from '@/api/course.js'
 	export default {
 		data() {
 			return {
@@ -140,7 +138,8 @@
 					nickname:"",
 					avatar:""
 				},
-				btnLoading: false
+				btnLoading: false,
+				registerLoading: false,
 			}
 		},
 		computed: {
@@ -190,6 +189,28 @@
 			uni.$off('usercode')
 		},
 		methods: {
+			getAddCompanyUser() {
+				if(this.registerLoading) return;
+				uni.showLoading({
+					title: '注册中'
+				})
+				this.registerLoading = true
+				isAddCompanyUser(this.urlOption).then(res=>{
+					this.registerLoading = false
+					uni.hideLoading()
+					if(res.code==200) {
+						this.receiveLuckyBag()
+					} else {
+						uni.showToast({
+							title: res.msg,
+							icon: 'none'
+						});
+					}
+				}).catch(()=>{
+					this.registerLoading = false
+					uni.hideLoading()
+				})
+			},
 			//修改用户昵称以及头像
 			editUserA(){
 				this.userinfos=uni.getStorageSync('userinfos')?uni.getStorageSync('userinfos'):this.userinfos
@@ -205,7 +226,7 @@
 							title:'修改成功!',
 						});
 						setTimeout(()=>{
-							this.receiveLuckyBag()
+							this.getAddCompanyUser()
 						},100)
 					}else{
 						uni.removeStorageSync('userinfos')
@@ -276,7 +297,7 @@
 								if (this.chatId) {
 									this.userlogo = true
 								} else {
-									this.receiveLuckyBag()
+									this.getAddCompanyUser()
 								}
 							} else {
 								this.goLogin()
@@ -289,7 +310,7 @@
 						isLogin => {
 							this.isLogin = isLogin
 							if (this.isLogin) {
-								this.receiveLuckyBag()
+								this.getAddCompanyUser()
 							} else {
 								this.goLogin()
 							}
@@ -344,6 +365,7 @@
 				})
 			},
 			getLuckyBagInfo() {
+				uni.hideLoading()
 				getLuckyBagInfo({
 					recordId: this.recordId
 				}).then(res => {