From 5345d78885467ad07c42cfc3a57fc60059854703 Mon Sep 17 00:00:00 2001
From: jhzh <1628036192@qq.com>
Date: Wed, 09 Jul 2025 15:43:04 +0800
Subject: [PATCH] 1

---
 .env.development                                        |    2 
 .gitignore                                              |    1 
 src/views/user/Login.vue                                |   15 ++
 src/api/managesettings.js                               |   34 +++++
 .env.preview                                            |    2 
 .env                                                    |    2 
 src/config/router.config.js                             |   11 +
 src/views/userlist/components/editCapitaluserdialog.vue |    4 
 src/views/account/settings/Index.vue                    |    5 
 src/views/account/settings/googleAuthCode.vue           |  233 ++++++++++++++++++++++++++++++++++++++
 10 files changed, 303 insertions(+), 6 deletions(-)

diff --git a/.env b/.env
index 6596844..ea84af7 100644
--- a/.env
+++ b/.env
@@ -1,6 +1,6 @@
 NODE_ENV=production
 VUE_APP_PREVIEW=true
-VUE_APP_API_BASE_URL= https://stockapi.yanshiz.com/
+VUE_APP_API_BASE_URL= https://rgapi.yanshiz.com/
 # VUE_APP_API_BASE_URL=http://www.jqydl.com:8091/
 # VUE_APP_API_BASE_URL= https://api.dfddgj346.xyz/
 # VUE_APP_API_BASE_URL=https://www.rksv.store:8091/
diff --git a/.env.development b/.env.development
index 91803ad..34407d3 100644
--- a/.env.development
+++ b/.env.development
@@ -5,7 +5,7 @@
 # VUE_APP_API_BASE_URL=https://api.marwadi.online/
 # VUE_APP_API_BASE_URL=https://www.rksv.store:8091/
 # VUE_APP_API_BASE_URL=https://api.dfddgj346.xyz/
-VUE_APP_API_BASE_URL=http://stockapi.yanshiz.com/
+VUE_APP_API_BASE_URL=https://rgapi.yanshiz.com/
 # VUE_APP_API_BASE_URL=https://api.durocaspitall.com/
 # VUE_APP_API_BASE_URL=https://api.fidelityio.com/
 # VUE_APP_API_BASE_URL= https://www.prudentcapitals.net/
diff --git a/.env.preview b/.env.preview
index f1b6932..a608ab2 100644
--- a/.env.preview
+++ b/.env.preview
@@ -2,6 +2,6 @@
 
 VUE_APP_PREVIEW=true
 
-VUE_APP_API_BASE_URL=https://stockapi.yanshiz.com/
+VUE_APP_API_BASE_URL=https://rgapi.yanshiz.com/
 
 # VUE_APP_API_BASE_URL=http://192.168.10.4:8091/
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 1f8602b..94bf1e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,4 @@
 *.sln
 *.sw*
 package-lock.json
+*.rar
diff --git a/src/api/managesettings.js b/src/api/managesettings.js
index ecf9b15..44c1a75 100644
--- a/src/api/managesettings.js
+++ b/src/api/managesettings.js
@@ -4,7 +4,11 @@
     adminlist: '/admin/list.do', // 管理列表
     adminupdateLock: '/admin/updateLock.do', // 管理锁定 解锁
     adminadd: '/admin/add.do', // 添加管理员
-    adminupdate: '/admin/update.do' // 修改管理员密码
+    adminupdate: '/admin/update.do' ,// 修改管理员密码
+    getAdmin: '/api/admin/getAdmin',//获取当前管理用户信息
+    getLoginGoogleAuthSecret: '/api/admin/getLoginGoogleAuthSecret',//生成秘钥二维码
+    bindGoogleAuth: '/api/admin/bindGoogleAuth',//获取当前管理验证码
+    unbindingGoogleAuth:'/api/admin/unbindingGoogleAuth',//解绑
 }
 
 /**
@@ -18,6 +22,34 @@
  * @param parameter
  * @returns {*}
  */
+export function unbindingGoogleAuth (parameter) {
+    return request({
+        url: userApi.unbindingGoogleAuth,
+        method: 'post',
+        data: qs.stringify(parameter)
+    })
+}
+export function getLoginGoogleAuthSecret (parameter) {
+    return request({
+        url: userApi.getLoginGoogleAuthSecret,
+        method: 'get',
+        data: qs.stringify(parameter)
+    })
+}
+export function bindGoogleAuth (parameter) {
+    return request({
+        url: userApi.bindGoogleAuth,
+        method: 'post',
+        data: qs.stringify(parameter)
+    })
+}
+export function getAdmin (parameter) {
+    return request({
+        url: userApi.getAdmin,
+        method: 'get',
+        data: qs.stringify(parameter)
+    })
+}
 export function adminlist (parameter) {
     return request({
         url: userApi.adminlist,
diff --git a/src/config/router.config.js b/src/config/router.config.js
index ec00a19..3e5ab5e 100644
--- a/src/config/router.config.js
+++ b/src/config/router.config.js
@@ -579,6 +579,17 @@
                 },
               },
               {
+                path: '/account/settings/googleAuthCode',
+                name: 'GoogleAuthCode',
+                component: () => import('@/views/account/settings/googleAuthCode'),
+                meta: {
+                  title: '绑定谷歌验证器',
+                  hidden: true,
+                  keepAlive: true,
+                  permission: ['user'],
+                },
+              },
+              {
                 path: '/account/settings/custom',
                 name: 'CustomSettings',
                 component: () => import('@/views/account/settings/Custom'),
diff --git a/src/views/account/settings/Index.vue b/src/views/account/settings/Index.vue
index 32f268e..85dada2 100644
--- a/src/views/account/settings/Index.vue
+++ b/src/views/account/settings/Index.vue
@@ -19,6 +19,11 @@
                 {{ $t('account.settings.menuMap.security') }}
               </router-link>
             </a-menu-item>
+            <a-menu-item key="/account/settings/googleAuthCode">
+              <router-link :to="{ name: 'GoogleAuthCode' }">
+                绑定谷歌验证器
+              </router-link>
+            </a-menu-item>
             <!-- <a-menu-item key="/account/settings/custom">
               <router-link :to="{ name: 'CustomSettings' }">
                 {{ $t('account.settings.menuMap.custom') }}
diff --git a/src/views/account/settings/googleAuthCode.vue b/src/views/account/settings/googleAuthCode.vue
new file mode 100644
index 0000000..5071ad4
--- /dev/null
+++ b/src/views/account/settings/googleAuthCode.vue
@@ -0,0 +1,233 @@
+<template>
+  <div class="account-settings-info-view">
+    <a-form layout="vertical" :form="addUserform" ref="addUserform" v-if="!googleAuthBind">
+      <a-row :gutter="16" type="flex" justify="center">
+        <a-col :order="isMobile ? 2 : 1" :md="24" :lg="16">
+          <a-form-item label="秘钥">
+            <a-input
+              placeholder="请点击右侧 生成秘钥和二维码"
+              readonly    
+              @click="handleCopy"
+              :addonAfter="addonContent"
+              v-decorator="['secret', { rules: [{ required: false, message: '请输入您的昵称' }] }]"
+            />
+            <img v-if="googleAuthimg" style="width: 100px;margin-top:10px;" :src="googleAuthimg"/>
+          </a-form-item>
+          
+          <a-form-item label="谷歌验证码">
+            <a-input
+              placeholder="请输入谷歌验证码"
+              v-decorator="['googleAuthCode', { rules: [{ required: true, message: '请输入谷歌验证码' }] }]"
+            />
+          </a-form-item>
+
+          <!-- <a-form-item label="超级谷歌验证码">
+            <a-input
+              placeholder="请输入超级谷歌验证码"
+              v-decorator="['rootGoogleAuthCode', { rules: [{ required: true, message: '请输入超级谷歌验证码' }] }]"
+            />
+          </a-form-item> -->
+          <a-form-item>
+            <a-button type="primary" @click="saveinfo">绑定</a-button>
+          </a-form-item>
+        </a-col>
+      </a-row>
+    </a-form>
+    <div v-else style="">
+      <div style="margin-bottom: 20px;">已绑定</div>
+      
+      <a-form-item label="谷歌验证码">
+        <a-input
+          placeholder="请输入谷歌验证码"
+          v-model="ggyzm"
+          v-decorator="['googleAuthCode', { rules: [{ required: true, message: '请输入谷歌验证码' }] }]"
+        />
+      </a-form-item>
+      
+      <a-button type="primary" @click="adskille">解绑</a-button>
+    </div>
+    <avatar-modal ref="modal" @ok="setavatar" />
+  </div>
+</template>
+
+<script>
+import AvatarModal from './AvatarModal'
+import { baseMixin } from '@/store/app-mixin'
+import { adminlist, adminupdate,bindGoogleAuth,getLoginGoogleAuthSecret,getAdmin,unbindingGoogleAuth } from '@/api/managesettings'
+import pick from 'lodash.pick'
+export default {
+  mixins: [baseMixin],
+  components: {
+    AvatarModal,
+  },
+  data() {
+    return {
+      // cropper
+      addonContent: (
+              <a
+                onClick={this.handleGenerate} // 这里是点击事件
+              >
+                生成秘钥和二维码
+              </a>
+      ),
+      preview: {},
+      googleAuthimg:'',
+      ggyzm:'',
+      userid:'',
+      googleAuthBind:'',
+      option: {
+        img: '/avatar2.jpg',
+        info: true,
+        size: 1,
+        outputType: 'jpeg',
+        canScale: false,
+        autoCrop: true,
+        // 只有自动截图开启 宽度高度才生效
+        autoCropWidth: 180,
+        autoCropHeight: 180,
+        fixedBox: true,
+        // 开启宽度和高度比例
+        fixed: true,
+        fixedNumber: [1, 1],
+      },
+      settingdetail: {},
+      addUserform: this.$form.createForm(this),
+      fields: ['googleAuthCode', 'secret','id'],
+    }
+  },
+  mounted() {
+    this.getnowuser()
+  },
+  methods: {
+    adskille(){
+          var values ={}
+          values.rootGoogleAuthCode = this.ggyzm
+          values.id = this.userid
+          unbindingGoogleAuth(values).then((res) => {
+            if (res.status == 0) {
+              this.getnowuser()
+              this.$message.success({ content: '解绑成功', duration: 2 });
+              form.resetFields();
+            } else {
+              this.$message.error(res.msg);
+            }
+          });
+    },
+    getnowuser() {
+      getAdmin().then((res) => {
+        if(res.status==0){
+          this.userid = res.data.id
+          this.googleAuthBind = res.data.googleAuthBind
+        }
+        console.log(res);
+      })
+    },
+    setavatar(url) {
+      this.option.img = url
+    },
+    handleCopy() {
+          // 使用浏览器的 execCommand 来实现复制功能
+          const input = document.createElement('input');
+          input.value = this.addUserform.getFieldValue('secret');  // 这里用你的秘钥变量
+          document.body.appendChild(input);
+          input.select();
+          document.execCommand('copy');
+          document.body.removeChild(input);
+    
+          this.$message.success('秘钥已复制');
+     },
+    handleGenerate() {
+      getLoginGoogleAuthSecret().then((res) => {
+        if (res.status == 0) {
+          // this.$set(this.$refs.addUserform.form, 'secret', res.data.googleAuthSecret);
+          this.addUserform.setFieldsValue({
+            secret: res.data.googleAuthSecret,
+          })
+          this.googleAuthimg = res.data.googleAuthImg;
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    saveinfo() {
+      const form = this.$refs.addUserform.form;
+      form.validateFields((errors, values) => {
+        if (!errors) {
+          values.id = this.userid
+          bindGoogleAuth(values).then((res) => {
+            if (res.status == 0) {
+              this.getnowuser()
+              this.$message.success({ content: '绑定成功', duration: 2 });
+              form.resetFields();
+              this.getnowuser();
+            } else {
+              this.$message.error(res.msg);
+            }
+          });
+        }
+      });
+    }
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.avatar-upload-wrapper {
+  height: 200px;
+  width: 100%;
+}
+
+.ant-upload-preview {
+  position: relative;
+  margin: 0 auto;
+  width: 100%;
+  max-width: 180px;
+  border-radius: 50%;
+  box-shadow: 0 0 4px #ccc;
+
+  .upload-icon {
+    position: absolute;
+    top: 0;
+    right: 10px;
+    font-size: 1.4rem;
+    padding: 0.5rem;
+    background: rgba(222, 221, 221, 0.7);
+    border-radius: 50%;
+    border: 1px solid rgba(0, 0, 0, 0.2);
+  }
+
+  .mask {
+    opacity: 0;
+    position: absolute;
+    background: rgba(0, 0, 0, 0.4);
+    cursor: pointer;
+    transition: opacity 0.4s;
+
+    &:hover {
+      opacity: 1;
+    }
+
+    i {
+      font-size: 2rem;
+      position: absolute;
+      top: 50%;
+      left: 50%;
+      margin-left: -1rem;
+      margin-top: -1rem;
+      color: #d6d6d6;
+    }
+  }
+
+  img,
+  .mask {
+    width: 100%;
+    max-width: 180px;
+    height: 100%;
+    border-radius: 50%;
+    overflow: hidden;
+  }
+}
+</style>
+
+<style>
+</style>
\ No newline at end of file
diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue
index 25e90c9..b602264 100644
--- a/src/views/user/Login.vue
+++ b/src/views/user/Login.vue
@@ -36,6 +36,18 @@
               <a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }" />
             </a-input-password>
           </a-form-item>
+          
+          <a-form-item>
+            <a-input
+              size="large"
+              type="number" 
+              placeholder="请输入谷歌验证码"
+              v-decorator="[
+                'googleAuthCode',
+                { rules: [], validateTrigger: 'change' }
+              ]">
+            </a-input>
+          </a-form-item>
         </a-tab-pane>
         <!-- <a-tab-pane key="tab2" :tab="$t('user.login.tab-login-mobile')">
           <a-form-item>
@@ -174,7 +186,7 @@
 
       state.loginBtn = true
 
-      const validateFieldsKey = customActiveKey === 'tab1' ? ['username', 'password'] : ['mobile', 'captcha']
+      const validateFieldsKey = customActiveKey === 'tab1' ? ['username', 'password' ,'googleAuthCode'] : ['mobile', 'captcha']
 
       validateFields(validateFieldsKey, { force: true }, (err, values) => {
         if (!err) {
@@ -183,6 +195,7 @@
           const loginParams = {}
           loginParams.adminPhone = values.username
           loginParams.adminPwd = values.password
+          loginParams.googleAuthCode = values.googleAuthCode
           loginParams.verifyCode = 1234
           Login(loginParams)
             .then((res) => this.loginSuccess(res))
diff --git a/src/views/userlist/components/editCapitaluserdialog.vue b/src/views/userlist/components/editCapitaluserdialog.vue
index 47e932c..db3a87d 100644
--- a/src/views/userlist/components/editCapitaluserdialog.vue
+++ b/src/views/userlist/components/editCapitaluserdialog.vue
@@ -66,6 +66,8 @@
           return `沙特(${value.symbol} ${value.availableBalance})`
         case 'USDT':
           return `USDT( ${value.availableBalance})`
+          case 'JP':
+            return `JP( ${value.availableBalance})`
         default:
           break
       }
@@ -109,7 +111,7 @@
   },
   methods: {
     getEditorder(val) {
-      val.accectType = 'ST'
+      val.accectType = 'JP'
       this.currentDetails = val
       this.editUserdialog = true
       this.fields.forEach((v) => this.editUserform.getFieldDecorator(v))

--
Gitblit v1.9.3