PageAdmin网站内容管理系统(CMS)交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

请问新版怎么实现自动填用户名和密码 [复制链接]

1#
<input type="text" id="username" style="positionixed;bottom:-9999px" />
            <input type="password"  id="password" style="positionixed;bottom:-9999px" />
            <el-form-item v-show="!formData.SmsLogin">
                <el-input v-model.trim="formData.Account" autocomplete="off" placeholder="用户名/邮箱/手机号" maxlength="50" v-validate="{dataormData.Account,dataType:'*',nullMsg:'请填写登录账号',ignoreormData.SmsLogin==1}"></el-input>
                <span class="help-block validate-tips-box"></span>
            </el-form-item>

            <el-form-item v-show="!formData.SmsLogin">
                <el-input type="password" v-model.trim="formData.Password" autocomplete="off" placeholder="登录密码" maxlength="50" v-validate="{dataormData.Password,dataType:'password',nullMsg:'请填写登录密码',ignoreormData.SmsLogin==1}"></el-input>
                <span class="help-block validate-tips-box"></span>
            </el-form-item>

html中加上id,  js也写了
         var userID = document.getElementById("username");
         var passWD = document.getElementById("password");
         var s_form = document.getElementById("loginForm");
         userID.setAttribute("value",userName);
         passWD.setAttribute("value",Password);
看见输入框中有用户名和密码填上,点登录按钮,显示用户名和密码没有输入,这是为什么呢?
分享 转发
TOP
2#

html改进为
<input type="text" id="username1" style="positionixed;bottom:-9999px" />
            <input type="password" id="password1" style="positionixed;bottom:-9999px" />
            <el-form-item v-show="!formData.SmsLogin">
                <el-input v-model.trim="formData.Account" autocomplete="off" placeholder="用户名/邮箱/手机号" maxlength="50"

v-validate="{dataormData.Account,dataType:'*',nullMsg:'请填写登录账号',ignoreormData.SmsLogin==1}" id="username"></el-

input>
                <span class="help-block validate-tips-box"></span>
            </el-form-item>

            <el-form-item v-show="!formData.SmsLogin">
                <el-input type="password" v-model.trim="formData.Password" autocomplete="off" placeholder="登录密码"

maxlength="50" v-validate="{dataormData.Password,dataType:'password',nullMsg:'请填写登录密码',ignoreormData.SmsLogin==1}"

id="password"></el-input>
                <span class="help-block validate-tips-box"></span>
            </el-form-item>

js改进为
  var userID = document.getElementById("username");
         var passWD = document.getElementById("password");

         var userID1 = document.getElementById("username1");
         var passWD1 = document.getElementById("password1");

         var s_form = document.getElementById("loginForm");
         userID.setAttribute("value",userName);
         passWD.setAttribute("value",Password);

         userID1.setAttribute("value",userName);
         passWD1.setAttribute("value",Password);
TOP
3#


TOP
4#

    function mySubmit(userName, Password)
    {
         var vm = new Vue({
              el: '#loginForm',
              data: {
                username1: userName,
                password1: Password,
                username: userName,
                password: Password,
              },
            }
         })
    }
TOP
5#

用vue了,不知道怎么触发created,这是html加载完成后执行,不知道怎么弄
最后编辑chaikm 最后编辑于 2021-12-23 11:48:23
TOP
6#

请财务插件支持4.0.8版本吗?如果支持的话,我还是还原到升级前的版本
TOP
7#

回复 7楼xiyou的帖子

试过了没有用
TOP
8#

function mySubmit(userName, Password)
{
         var userID = document.getElementById("username");
         var passWD = document.getElementById("password");
         var userID1 = document.getElementById("username");
         var passWD1 = document.getElementById("password");

//         var s_form = document.getElementById("loginForm");
         userID.setAttribute("value",userName);
         passWD.setAttribute("value",Password);
         userID1.setAttribute("value",userName);
         passWD1.setAttribute("value",Password);
    //     alert("stop");
  //       subbtn.click();
//        s_form.submit();

    var supportMobileLogin=@supportMobileLogin;
    if (self != top) { top.location = self.location; };
    var formData = {SmsLoginalse,Account:userName,Username:userName,Passwordassword,Mobile:"",SmsCode:"",VerificationCode: "", SaveCookie: false };
    var localStorageKey = "memberLogin40101";
    var saveInfo = getLocalStorage(localStorageKey);
    if (saveInfo!= ""){
        formData = JSON.parse(saveInfo);
        if (supportMobileLogin == 0){
            formData.SmsLogin = false;
        }
        formData.VerificationCode = "";
        formData.SmsCode = "";
    }
    //vue实例化
    var vue = new Vue({
        el: "#login",
        data: {
            formData: formData,
            openopen,
        },
        methods: {
            postSubmit: function ()
            {
                var _this = this;
                var validated = this.validateForm();//基础数据验证
                if (validated)
                {
                  this.formData.Username = this.formData.Account; //兼容老版本和插件
                  this.submit({ url: "@Url.ActionUrl()", data: formData, success: loginSuccess, showFailMsg: false, showSuccessMsg: false, failCallback: failLogin, });
                }
            },
        },
    });
}
TOP
9#

function mySubmit(userName, Password)
{
         var userID = document.getElementById("username");
         var passWD = document.getElementById("password");
         var userID1 = document.getElementById("username");
         var passWD1 = document.getElementById("password");

         userID.setAttribute("value",userName);
         passWD.setAttribute("value",Password);
         userID1.setAttribute("value",userName);
         passWD1.setAttribute("value",Password);
    var formData =

{SmsLoginalse,Account:userName,Username:userName,Passwordassword,Mobile:"",SmsCode:"",VerificationCode: "", SaveCookie:

false };
  
}
TOP
10#

回复 12楼搜企网络的帖子

那就说明不能用vue了,而那个全局变量也不起作用,怎么办?
TOP
发新话题 回复该主题