Prechádzať zdrojové kódy

fix(controller): 分享绑定

Zhou Jianjia 3 rokov pred
rodič
commit
f4adc31996
5 zmenil súbory, kde vykonal 15 pridanie a 5 odobranie
  1. 1 0
      core/constant.js
  2. 1 1
      core/site.js
  3. 7 1
      pages/index/index.vue
  4. 2 1
      pages/login/login.vue
  5. 4 2
      store/index.js

+ 1 - 0
core/constant.js

xqd
@@ -2,4 +2,5 @@ module.exports = {
    USER_TOKEN: 'vuex_user_token',
    USER_DATA: 'vuex_user_data',
    USER_SCENE: 'vuex_user_scene',
+   USER_PARENT_ID: 'vuex_user_parent_id',
 }

+ 1 - 1
core/site.js

xqd
@@ -3,6 +3,6 @@
  */
 const ENV = process.env.NODE_ENV === 'development';
 module.exports = {
-    root: ENV ? 'http://www.sange-bridge.me/' : 'https://sg.9026.com/',
+    root: 'https://sg.9026.com/',
     authKey: "!j1^z9hE4sXJdEE$#S1GLYQnWfEBakex",
 }

+ 7 - 1
pages/index/index.vue

xqd xqd xqd
@@ -43,6 +43,7 @@
 					subTitle: '做桥架不求人,让你秒变大师',
 				},
 				scene: '',
+				parent_id: '',
 				setting: null
 			}
 		},
@@ -61,7 +62,7 @@
 				this.$jump({url:'/pages/my/member',type:'to'})
 			},
 			handleBind(){
-				this.$u.api.userBind({scene:this.scene}).then(res => {
+				this.$u.api.userBind({scene:this.scene,parent_id:this.parent_id}).then(res => {
 					this.$u.vuex(this.$const.USER_SCENE, null);
 				})
 			},
@@ -73,11 +74,16 @@
 		},
 		onLoad(options){
 			this.scene = options.scene;
+			this.parent_id = options.user_id;
 			console.log('-->data',this.scene)
 			if(this.scene){
 				this.$u.vuex(this.$const.USER_SCENE,this.scene);
 				this.handleBind()
 			}
+			if(this.parent_id){
+				this.$u.vuex(this.$const.USER_SCENE,this.scene);
+				this.handleBind()
+			}
 			this.getSetting();
 
 		},

+ 2 - 1
pages/login/login.vue

xqd
@@ -103,8 +103,9 @@
                 });
             },
             handleBind(){
-                this.$u.api.userBind({scene:this.vuex_user_scene}).then(res => {
+                this.$u.api.userBind({scene:this.vuex_user_scene,parent_id:this.vuex_user_parent_id}).then(res => {
                     this.$u.vuex(this.$const.USER_SCENE, null);
+                    this.$u.vuex(this.$const.USER_PARENT_ID, null);
                 })
             }
         },

+ 4 - 2
store/index.js

xqd xqd
@@ -13,7 +13,7 @@ try{
 }
 
 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
-let saveStateKeys = [constant.USER_TOKEN,constant.USER_DATA,constant.USER_SCENE];
+let saveStateKeys = [constant.USER_TOKEN,constant.USER_DATA,constant.USER_SCENE,constant.USER_PARENT_ID];
 
 // 保存变量到本地存储中
 const saveStorage = function(key, value){
@@ -34,8 +34,10 @@ const store = new Vuex.Store({
 		vuex_user_token: lifeData[constant.USER_TOKEN],
 		// 用户信息
 		vuex_user_data: lifeData[constant.USER_DATA],
-		// 用户信息
+		// 分享扫码
 		vuex_user_scene: lifeData[constant.USER_SCENE],
+		// 分享
+		vuex_user_parent_id: lifeData[constant.USER_PARENT_ID],
 	},
 	mutations: {
 		$uStore(state, payload) {