lsc 1 månad sedan
förälder
incheckning
af131aeb97
7 ändrade filer med 8803 tillägg och 168 borttagningar
  1. 8725 165
      package-lock.json
  2. 2 0
      package.json
  3. 1 0
      public/index.html
  4. 1 1
      src/permission.js
  5. 5 0
      src/router/index.js
  6. 1 2
      src/views/login/loginPage.vue
  7. 68 0
      src/views/login/wxTest.vue

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 8725 - 165
package-lock.json


+ 2 - 0
package.json

@@ -14,6 +14,8 @@
     "element-ui": "^2.15.14",
     "js-cookie": "^3.0.5",
     "nprogress": "^0.2.0",
+    "pblAdminTable": "file:",
+    "qrcode": "^1.5.4",
     "userManage": "file:",
     "vue": "^2.6.14",
     "vue-router": "^3.6.5",

+ 1 - 0
public/index.html

@@ -6,6 +6,7 @@
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <title><%= htmlWebpackPlugin.options.title %></title>
+    <script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
     <style>
       @charset "utf-8";
       * {

+ 1 - 1
src/permission.js

@@ -5,7 +5,7 @@ import 'nprogress/nprogress.css' // progress bar style
 
 NProgress.configure({ showSpinner: false }) // NProgress Configuration
 
-const whiteList = ['/login'] // no redirect whitelist
+const whiteList = ['/login', '/wxTest'] // no redirect whitelist
 
 router.beforeEach(async (to, from, next) => {
   // start progress bar

+ 5 - 0
src/router/index.js

@@ -43,6 +43,11 @@ const routes = [
     path:'/KanBan',
     name:'KanBan',
     component:KanBan
+  },
+  {
+    path: '/wxTest',
+    name: 'wxTest',
+    component: () => import('@/views/login/wxTest.vue'), // 补充组件路径
   }
 ];
 

+ 1 - 2
src/views/login/loginPage.vue

@@ -108,7 +108,7 @@
 					确认绑定
 				</div>
 				<div class="lp_r_b_line">
-					<template v-if="['default', 'weChat'].includes(loginType) && false">
+					<template v-if="['default', 'weChat'].includes(loginType) ">
 						<div></div>
 						<span>其他登录方式</span>
 						<div></div>
@@ -117,7 +117,6 @@
 				<div class="lp_r_b_iconBtn">
 					<div
 						@click="loginType = 'weChat'"
-						v-show="false"
 						v-if="['default', 'weChat'].includes(loginType)"
 					>
 						<img src="@/assets/login/wechat.svg" />

+ 68 - 0
src/views/login/wxTest.vue

@@ -0,0 +1,68 @@
+<template>
+    <div class="login-window">
+      <button @click="getWechatQRCode">微信扫码登录</button>
+      <div v-if="qrCodeUrl">
+        <img :src="qrCodeUrl" alt="微信登录二维码"/>
+      </div>
+      <div id="login_container">
+        </div>
+    </div>
+</template>
+
+<script>
+// import axios from 'axios';
+// import QRCode from 'qrcode'
+
+
+export default {
+  data() {
+    return {
+      qrCodeUrl: null
+    };
+  },
+  methods: {
+    async getWechatQRCode() {
+    //   try {
+    //     // 请求后端接口获取二维码 URL
+    //     const response = await axios.get('http://localhost:7003/api/weixin/wechat-login-qrcode');
+    //     this.qrCodeUrl = await QRCode.toDataURL(response.data.url); // 这里假设后端返回的数据中有 url 字段
+    //     this.qrCodeUrl = await QRCode.toDataURL('https://cocorobo.cn/get-weixin-code.html?appid=wxe9d7fff3c659445f&redirect_uri=//cloud.cocorobo.cn/liyuan.html&response_type=code&scope=snsapi_login&state=116405')
+    //   } catch (error) {
+    //     console.error('获取二维码失败:', error);
+    //   }
+      const randomState = Math.random().toString(36).substring(2); // 生成随机状态
+        // eslint-disable-next-line no-undef
+        new WxLogin({
+            self_redirect:true,
+            id: "login_container", 
+            appid: "wxe9d7fff3c659445f", 
+            scope: "snsapi_login", 
+            redirect_uri: encodeURIComponent("https://cocorobo.cn"),//https://liyuan.cocorobo.cn/#/wxTest
+            state: randomState,
+            style: "black",
+            onReady: function(isReady){
+                    console.log(isReady);
+                }
+            });
+    },
+
+
+  },
+  mounted(){
+    
+  }
+};
+</script>
+
+<style scoped>
+.login-window {
+  text-align: center;
+  padding: 20px;
+}
+
+.login-window img {
+  margin-top: 20px;
+  max-width: 200px;
+  border: 1px solid #ddd;
+}
+</style>

Vissa filer visades inte eftersom för många filer har ändrats