he2802 4 лет назад
Родитель
Сommit
dbe5fc02c5
3 измененных файлов с 10 добавлено и 1 удалено
  1. 5 0
      App.vue
  2. 1 1
      pages/index/index.vue
  3. 4 0
      pages/login/login.vue

+ 5 - 0
App.vue

@@ -1,6 +1,11 @@
 <script>
 	export default {
 		onLaunch: function(option) {
+			let inviteCode = option.inviteCode
+			if(inviteCode&&inviteCode!=''){
+				console.log(inviteCode)
+				uni.setStorageSync("inviteCode",inviteCode)
+			}
 		uni.showModal({
 			title: '提示',
 			content: option

+ 1 - 1
pages/index/index.vue

@@ -43,7 +43,7 @@ export default {
 		var self = this;
 		return {
 			title: '中正',
-			path: `/pages/index/index`,
+			path: `/pages/index/index?inviteCode=`+userInfo==null?'':userInfo.userAccount,
 		};
 	},
 	methods: {

+ 4 - 0
pages/login/login.vue

@@ -37,12 +37,16 @@ export default {
 		putInfo(e){
 			let that = this;
 			if (e.detail.encryptedData) {
+				let inviteCode =  uni.getStorageSync("inviteCode") 
 				//用户同意授权
 				var datas = {
 					iv: e.detail.iv,
 					encryptedData: e.detail.encryptedData,
 					code: that.code
 				};
+				if(inviteCode){
+					datas.inviteCode = inviteCode
+				}
 				that.$api.login(datas).then(
 					res => {
 						if (res.data.code == 200) {