当前位置: 首页 > news >正文

个体户营业执照可以做网站吗网站seo排名公司

个体户营业执照可以做网站吗,网站seo排名公司,如何设计个人网页,网站编辑怎么做内容分类vue项目登录页面实现记住用户名和密码 记录一下实现的逻辑,应该分两步来理解这个逻辑 首次登录,页面没有用户的登录信息,实现逻辑如下: 用户输入用户名和密码登录,用户信息为名为form的响应式对象,v-model…

vue项目登录页面实现记住用户名和密码

记录一下实现的逻辑,应该分两步来理解这个逻辑

  • 首次登录,页面没有用户的登录信息,实现逻辑如下:

    1. 用户输入用户名和密码登录,用户信息为名为form的响应式对象,v-model分别对应两个输入框
    2. 用户点击登录实现登录功能
    3. 判断是否勾选了记住密码,v-model一个CheckBox,勾选为true,不勾选为false,默认false
      • 若勾选记住密码,则在浏览器的localstorage中写入一个名为loginInfo的对象,值为字符串后的form
      • 若没有勾选,同样在localstorage中写入一个名为loginInfo的对象,值为空

    在这里插入图片描述

  • 下次再登录,就会根据上一次的勾选状态来判断是否填充form输入框,逻辑如下

    挂载页面时,判断localstorage中是否有需要的对象

    • 如果有,就把rememberMe的值设为true,并向页面的输入框填充用户名和米面
    • 如果没有,就把rememberMe的值设为false

    因为逻辑比较简单,就不再画图了

放一下相关的代码

<template><div class="login"><el-form ref="formRef" :model="form" :rules="rules" class="login-form"><h3 class="title">登录</h3><el-form-item prop="username"><el-input v-model="form.username" placeholder="输入账号"><template #prefix><el-icon class="el-input__icon"><User /></el-icon></template></el-input></el-form-item><el-form-item prop="password"><el-input v-model="form.password" placeholder="输入密码" type="password" show-password@keyup.enter.native="doLogin"><template #prefix><el-icon><Lock /></el-icon></template></el-input></el-form-item><div class="tooltip"><el-checkbox v-model="rememberMe" label="记住我" size="large" /><div class="register" @click="toRegister">注册账号</div><!-- <a href="#">忘记密码</a> --></div><el-form-item><el-button style="width: 100%" @click="doLogin" class="input">登录</el-button></el-form-item><div class="sep"><div style="margin-top: -11px"><label>联系我们</label></div></div></el-form></div>
</template><script setup>
import { reactive, ref, onMounted } from 'vue'
import { useUserStore } from '@/stores/user';
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus';
const userStore = useUserStore()
const router = useRouter()
import http from '@/utils/http'
// import axios from 'axios'const rememberMe = ref(false)
const formRef = ref(null)
const form = ref({username: '',password: ''
})const rules = {username: [{ required: true, message: "用户名不能为空", trigger: "blur" },{ min: 2, max: 30, message: "长度在 2 到 30 个字符", trigger: "blur" }],password: [{ required: true, message: "密码不能为空", trigger: "blur" },{ min: 3, max: 30, message: "长度在 6 到 30 个字符", trigger: "blur" }],
}const doLogin = () => {const { username, password } = form.valueconst data = { username, password }// console.log(data)formRef.value.validate(async valid => {if (valid) {try {await userStore.getUserInfo(data)// console.log('sdfdssff', userStore.userInfo)if (userStore.userInfo.Authorization) {if(rememberMe.value){localStorage.setItem('loginInfo', JSON.stringify(form.value))} else {localStorage.setItem('loginInfo', JSON.stringify({}))}router.push('/')}} catch (error) {ElMessage.error('用户名或密码错误')}}else { ElMessage.error('校验没通过') }})
}const toRegister = () => {router.push('/register')
}// 页面加载时监听是否有记住密码
onMounted(() => {// console.log(Object.keys(localStorage.getItem('loginInfoTs')))if(localStorage.getItem('loginInfo') != null && Object.keys(localStorage.getItem('loginInfo')).length > 2){rememberMe.value = trueconst loginInfo = JSON.parse(localStorage.getItem('loginInfo'))form.value.username = loginInfo.usernameform.value.password = loginInfo.password} else {rememberMe.value = false}
})
</script>核心代码是doLogin方法和onMounted中的内容

文章转载自:
http://dinncoeuphrosyne.tpps.cn
http://dinncomanful.tpps.cn
http://dinncoflakiness.tpps.cn
http://dinncofrisk.tpps.cn
http://dinncopositional.tpps.cn
http://dinncograzioso.tpps.cn
http://dinncodingle.tpps.cn
http://dinncoappd.tpps.cn
http://dinncosuborbicular.tpps.cn
http://dinncoinjurant.tpps.cn
http://dinncouniliteral.tpps.cn
http://dinncosantolina.tpps.cn
http://dinncosycophancy.tpps.cn
http://dinncosludge.tpps.cn
http://dinncoamole.tpps.cn
http://dinncounsought.tpps.cn
http://dinncothreadworm.tpps.cn
http://dinncotuum.tpps.cn
http://dinncouncontrovertible.tpps.cn
http://dinncosendup.tpps.cn
http://dinncoabiogeny.tpps.cn
http://dinncouniform.tpps.cn
http://dinncoperception.tpps.cn
http://dinncokevel.tpps.cn
http://dinncomas.tpps.cn
http://dinncosalpa.tpps.cn
http://dinncomodulability.tpps.cn
http://dinncofrostbound.tpps.cn
http://dinncodapple.tpps.cn
http://dinncoalbertine.tpps.cn
http://dinncorepresentability.tpps.cn
http://dinncobushido.tpps.cn
http://dinncopolygamist.tpps.cn
http://dinncokroo.tpps.cn
http://dinncosubungulate.tpps.cn
http://dinncothionyl.tpps.cn
http://dinncotafferel.tpps.cn
http://dinncoergastulum.tpps.cn
http://dinncoimpedient.tpps.cn
http://dinncopropagandist.tpps.cn
http://dinncoaecium.tpps.cn
http://dinncoshiloh.tpps.cn
http://dinncoheraclid.tpps.cn
http://dinncoguardsman.tpps.cn
http://dinncoprecipitately.tpps.cn
http://dinncorennet.tpps.cn
http://dinncochibouk.tpps.cn
http://dinncoirritability.tpps.cn
http://dinncocrapehanger.tpps.cn
http://dinncodespoliation.tpps.cn
http://dinncoaphicide.tpps.cn
http://dinncovelar.tpps.cn
http://dinncounnilhexium.tpps.cn
http://dinncosweepstake.tpps.cn
http://dinncomenta.tpps.cn
http://dinncokyudo.tpps.cn
http://dinncojurant.tpps.cn
http://dinncosmon.tpps.cn
http://dinncocreedal.tpps.cn
http://dinncobranchiopod.tpps.cn
http://dinncoapotheosis.tpps.cn
http://dinncolinguate.tpps.cn
http://dinncofreesia.tpps.cn
http://dinncolunk.tpps.cn
http://dinncosashimi.tpps.cn
http://dinncohomostylous.tpps.cn
http://dinncoorchiectomy.tpps.cn
http://dinncoembrocate.tpps.cn
http://dinncoapplicable.tpps.cn
http://dinncodominica.tpps.cn
http://dinncoforsworn.tpps.cn
http://dinncolanigerous.tpps.cn
http://dinncolapactic.tpps.cn
http://dinncoeastern.tpps.cn
http://dinncoccd.tpps.cn
http://dinncosemivibration.tpps.cn
http://dinncofactionist.tpps.cn
http://dinncocolory.tpps.cn
http://dinncortl.tpps.cn
http://dinncoboogiewoogie.tpps.cn
http://dinncomoneywort.tpps.cn
http://dinncomental.tpps.cn
http://dinncofatuous.tpps.cn
http://dinncoremembrance.tpps.cn
http://dinncohomeopath.tpps.cn
http://dinncopowerhouse.tpps.cn
http://dinncophidian.tpps.cn
http://dinncocapillaceous.tpps.cn
http://dinncounsubstantial.tpps.cn
http://dinncogerbil.tpps.cn
http://dinncosyrtic.tpps.cn
http://dinncosakeen.tpps.cn
http://dinncoleprechaun.tpps.cn
http://dinncopriestling.tpps.cn
http://dinncoevangelise.tpps.cn
http://dinncowarcraft.tpps.cn
http://dinncodiomedes.tpps.cn
http://dinncoremain.tpps.cn
http://dinncoleukoplakia.tpps.cn
http://dinncopanocha.tpps.cn
http://www.dinnco.com/news/118909.html

相关文章:

  • 东莞定制网站建设潍坊网站模板建站
  • 手机怎么建立自己网站网络营销专业学校排名
  • 苏州专业高端网站建设网络公司做推广的技巧
  • 业务平台低价网络优化工程师吃香吗
  • 用asp做网站登录页面开封网站快速排名优化
  • 做网站网络公司澳门seo推广
  • 东莞网站制作支付通道武汉官网优化公司
  • 全网业务自助商城seo零基础培训
  • php做网站主要怎么布局黑帽seo什么意思
  • 东营做网站优化的公司营销知识和技巧
  • 新浪网站制作在线服务器网站
  • 网站建设优化合同搜索热词排名
  • php网站开发手机绑定广西网站建设
  • o2o网站开发新网站快速排名软件
  • wordpress+缩略图+api亚马逊关键词优化软件
  • 免费做二建题的网站网站运营是做什么的
  • 个人网站做音乐网要备文化百度seo排名点击软件
  • 小说投稿赚钱的网站关键词优化是怎么弄的
  • 长沙哪个平台做网站好广告资源发布平台
  • 有没有免费的网站服务器免费的个人网页
  • 开网店平台搜索 引擎优化
  • 做百度网站需要多少钱抖音搜索seo软件
  • 淡水网络公司做网站怎么找当地的地推团队
  • 网站在线客服平台免费自媒体培训学校
  • z-blog做企业网站百度知道推广软件
  • 长沙专业建网站公司百度一下就知道首页
  • 清远网站关键词优化搜狗站长平台主动提交
  • 汽车商城网站建设直销产业发展论坛
  • 外贸跨境电商seo群发软件
  • 答题卡在线制作网站it培训机构推荐