sunChengjie 11 months ago
parent
commit
c7fc350b5e
2 changed files with 5 additions and 5 deletions
  1. 1 1
      src/pages/index.vue
  2. 4 4
      src/script/common.js

+ 1 - 1
src/pages/index.vue

@@ -48,7 +48,7 @@ export default {
 		};
 	},
 	created: async function () {
-		this.getOpenid("index.html");
+		this.getOpenid();
 
 		// const code = getUrlParam('code');
 		// if (code) {

+ 4 - 4
src/script/common.js

@@ -2,7 +2,7 @@ import { getWxUserInfo, getWxConfig } from '../api/login'
 
 export default {
 	install(Vue) {
-		Vue.prototype.getOpenid = async function (page) {
+		Vue.prototype.getOpenid = async function () {
 			if (localStorage.getItem("openid") != 'undefined' && localStorage.getItem("openid") != null) {
 				return;
 			}
@@ -10,7 +10,7 @@ export default {
 			console.log(code, 'code====++++')
 			if (code == 'undefined' || code == null || code == "") {
 				// alert("参数异常,请返回首页重试");
-				this.urlredirect(page);
+				this.urlredirect();
 				return;
 			}
 
@@ -21,12 +21,12 @@ export default {
 				localStorage.setItem("openid", res.body.openId);
 				localStorage.setItem("headimgurl", res.body.headimgurl);
 			} else {
-				this.urlredirect(page);
+				this.urlredirect();
 			}
 		}
 
 
-		Vue.prototype.urlredirect = async function (page) {
+		Vue.prototype.urlredirect = async function () {
 			const res = await getWxConfig({})
 			const href = window.location.href
 			// const href = 'https://tianzong.info666.com/'