From 7de1396e315896dbc72a9d54e44f77434ea90f18 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 14 十二月 2025 23:47:34 +0800
Subject: [PATCH] feat:增加企业微信自动登录
---
ruoyi-ui/src/views/system/qywechat/autologin.vue | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 108 insertions(+), 0 deletions(-)
diff --git a/ruoyi-ui/src/views/system/qywechat/autologin.vue b/ruoyi-ui/src/views/system/qywechat/autologin.vue
new file mode 100644
index 0000000..a665e56
--- /dev/null
+++ b/ruoyi-ui/src/views/system/qywechat/autologin.vue
@@ -0,0 +1,108 @@
+<template>
+ <div class="app-container">
+ <el-card class="box-card">
+ <div slot="header" class="clearfix">
+ <span>浼佷笟寰俊鍏嶇櫥娴嬭瘯</span>
+ </div>
+
+ <el-alert
+ title="璇存槑"
+ type="info"
+ description="姝ら〉闈㈢敤浜庢祴璇曚紒涓氬井淇″厤鐧诲姛鑳斤紝璇风‘淇濆凡鍦ㄤ紒涓氬井淇′腑閰嶇疆濂界浉鍏冲弬鏁�"
+ show-icon
+ :closable="false"
+ style="margin-bottom: 20px;"
+ >
+ </el-alert>
+
+ <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+ <el-form-item label="鎺堟潈Code" prop="code">
+ <el-input v-model="form.code" placeholder="璇疯緭鍏ヤ紒涓氬井淇℃巿鏉僀ode" />
+ <div class="form-tip">鍙�氳繃浼佷笟寰俊鎵爜鐧诲綍鑾峰彇Code</div>
+ </el-form-item>
+
+ <el-form-item>
+ <el-button type="primary" @click="handleAutoLogin">娴嬭瘯鍏嶇櫥</el-button>
+ <el-button @click="handleReset">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
+
+ <el-divider />
+
+ <div v-if="loginResult">
+ <h4>娴嬭瘯缁撴灉锛�</h4>
+ <el-card class="result-card">
+ <pre>{{ loginResult }}</pre>
+ </el-card>
+ </div>
+ </el-card>
+ </div>
+</template>
+
+<script>
+import { getCodeImg } from "@/api/login";
+
+export default {
+ name: "QyWechatAutoLogin",
+ data() {
+ return {
+ form: {
+ code: ""
+ },
+ rules: {
+ code: [
+ { required: true, message: "璇疯緭鍏ユ巿鏉僀ode", trigger: "blur" }
+ ]
+ },
+ loginResult: null
+ };
+ },
+ methods: {
+ /** 娴嬭瘯鍏嶇櫥 */
+ handleAutoLogin() {
+ this.$refs["form"].validate(valid => {
+ if (valid) {
+ // 璋冪敤浼佷笟寰俊鍏嶇櫥鎺ュ彛
+ this.$axios
+ .post("/system/qywechat/autoLogin", { code: this.form.code })
+ .then(response => {
+ this.loginResult = response;
+ if (response.code === 200) {
+ this.$modal.msgSuccess("鍏嶇櫥鎴愬姛");
+ } else {
+ this.$modal.msgError(response.msg || "鍏嶇櫥澶辫触");
+ }
+ })
+ .catch(error => {
+ this.loginResult = error;
+ this.$modal.msgError("璇锋眰寮傚父锛�" + error.message);
+ });
+ }
+ });
+ },
+
+ /** 閲嶇疆琛ㄥ崟 */
+ handleReset() {
+ this.$refs["form"].resetFields();
+ this.loginResult = null;
+ }
+ }
+};
+</script>
+
+<style lang="scss" scoped>
+.form-tip {
+ font-size: 12px;
+ color: #999;
+ margin-top: 5px;
+}
+
+.result-card {
+ background-color: #f5f5f5;
+ pre {
+ white-space: pre-wrap;
+ word-wrap: break-word;
+ margin: 0;
+ }
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.1