wenxin0805 hai 1 ano
pai
achega
7cba7a69ab

+ 6 - 3
src/views/Fuzeren/GetMyId.vue

@@ -12,10 +12,10 @@ export default{
         }
     },
     created(){
-      this.getCorpId() 
+     
     },
     mounted(){
-      this.setCode()
+      this.getCorpId() 
     },
     methods:{
       //获取corpid
@@ -23,6 +23,9 @@ export default{
         get('/api/customer/chat_side/corpid/').then(res=>{
           if(res.code==2000){
             this.corpid=res.data.corpid
+            if(this.corpid && this.corpid!==''&&this.corpid!=='undefind'){
+              this.setCode()
+            }
           }
         })
       },
@@ -41,7 +44,7 @@ export default{
       setCode(){
         let query =this.getQuery()
         if(!query.code){
-        return window.location.href='https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.corpid}&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_base&state=STATE&agentid=AGENTID#wechat_redirect'
+        return window.location.href=`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.corpid}&redirect_uri=${encodeURIComponent(window.location.href)}&response_type=code&scope=snsapi_base&state=STATE&agentid=AGENTID#wechat_redirect`
         }else{
           this.$router.push({name:'fuzeren',query:{code:query.code}})
         }

+ 3 - 2
src/views/userindex/indexpage/ArticleIndex.vue

@@ -76,11 +76,12 @@ export default {
     }
   },
   created () {
+    
+  },
+  mounted () {
     if (!this.myId) {
       this.myId = storage.getLocalstorage('user_id')
     }
-  },
-  mounted () {
     if (this.myId != null && this.myId !== '' && this.myId !== 'undefined') {
       this.getMemberapi(this.myId)
     }

+ 6 - 3
src/views/userindex/indexpage/GetUserIndexMyid.vue

@@ -11,10 +11,10 @@ export default {
     }
   },
   created () {
-    this.getCorpId()
+   
   },
   mounted () {
-    this.setCode()
+    this.getCorpId()
   },
   methods: {
     //获取corpid
@@ -22,6 +22,9 @@ export default {
       get('/api/customer/chat_side/corpid/').then(res => {
         if (res.code == 2000) {
           this.corpid = res.data.corpid
+          if(this.corpid && this.corpid!==''&&this.corpid!=='undefind'){
+              this.setCode()
+            }
         }
       })
     },
@@ -40,7 +43,7 @@ export default {
     setCode () {
       let query = this.getQuery()
       if (!query.code) {
-        return window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.corpid}&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_base&state=STATE&agentid=AGENTID#wechat_redirect'
+        return window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.corpid}&redirect_uri=${encodeURIComponent(window.location.href)}&response_type=code&scope=snsapi_base&state=STATE&agentid=AGENTID#wechat_redirect`
       } else {
         this.$router.push({ name: 'index', query: { code: query.code } })
       }

+ 5 - 4
src/views/userindex/indexpage/UserIndex.vue

@@ -69,8 +69,11 @@ export default {
     Swipe, SwipeItem, Tab, Tabs, List,
   },
   created () {
-    //获取自己的userId
-    if (!this.$route.query.code) {
+   
+  },
+  mounted () {
+     //获取自己的userId
+     if (!this.$route.query.code) {
       let user_id = sessionStorage.getLocalstorage('user_id')
       if (user_id && user_id != undefined && user_id != '') {
         this.myId = user_id
@@ -85,8 +88,6 @@ export default {
         }
       })
     }
-  },
-  mounted () {
     this.indexswiperapi()
     this.indexcategoryapi(this.id, this.limit, this.page)
     this.getSwiperUrlapi()

+ 3 - 3
src/views/userindex/my/MyForward.vue

@@ -61,15 +61,15 @@ export default {
     Tab, Tabs, List
   },
   created () {
-    if (!this.myId) {
-      this.myId = storage.getLocalstorage('user_id')
-    }
     //获取本地category数据
     const data = sessionStorage.getItem('category')
     this.category = JSON.parse(data)
     console.log(data);
   },
   mounted () {
+    if (!this.myId) {
+      this.myId = storage.getLocalstorage('user_id')
+    }
     if (this.myId != null && this.myId !== '' && this.myId !== 'undefined') {
       this.forwardapi(this.myId, '', this.limit, this.page)
     }

+ 4 - 3
src/views/userindex/my/MyIndex.vue

@@ -51,12 +51,13 @@ export default {
     }
   },
   created () {
-    if(!this.myId){
-      this.myId = storage.getLocalstorage('user_id')
-    }
+  
     
   },
   mounted () {
+    if(!this.myId){
+      this.myId = storage.getLocalstorage('user_id')
+    }
     if (this.myId != null && this.myId !== '' && this.myId !== 'undefined') {
       this.getMemberapi(this.myId)
     }