| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814 |
- <template>
- <view>
- <template v-if="hasPlat(['sanitation'])">
- <view class="page-container-sanitation">
- <image :src="$getImages(configList.h5_login_bg.configValue||'/assetsMobile/images/loginBg2.png')" class="background-image-new"></image>
- <!-- <image :src="$getImages('/assetsMobile/images/loginBg2.png')" class="background-image"></image> -->
- <!-- <image :src="$getImages('/assetsMobile/images/logo.png')" class="logo-image"></image> -->
- <view class="login-content" style="background-color: transparent; z-index: 99; overflow: hidden;">
- <view class="welcome-copywriting">
- <!-- <image :src="$getImages('/assetsMobile/images/hi.png')" class="hi-img"></image> -->
- <text class="h5_login_title"
- v-if="configList.h5_login_title">{{ configList.h5_login_title.configValue || '欢迎登录!' }}</text>
- <text class="h5_login_subtitle" v-if="configList.h5_login_subtitle&&configList.h5_login_subtitle.isShow===1">{{configList.h5_login_subtitle.configValue || '智慧环卫管理系统'}}</text>
- </view>
- <view class="user-info">
- <view class="verification">
- <u--form :model="model" :rules="rules" ref="uForm" label-width="0">
- <u-form-item label=" " prop="loginForm.username">
- <view class="user-input">
- <image :src="$getImages('/assetsMobile/images/user.png')" class="img"></image>
- <u-input
- v-model="model.loginForm.username"
- placeholder-style="color:#CCCCCC;font-size: 30rpx"
- border="none"
- type="text"
- color="#333"
- :clearable="true"
- placeholder="请输入账号">
- </u-input>
- </view>
- </u-form-item>
- <u-form-item label=" " prop="loginForm.password">
- <view class="user-input">
- <image :src="$getImages('/assetsMobile/images/psw.png')" class="img"></image>
- <u-input
- v-model="model.loginForm.password"
- placeholder-style="color:#CCCCCC;font-size: 30rpx"
- border="none"
- :type="showPassword?'text':'password'"
- color="#333"
- :clearable="true"
- placeholder="请输入密码" />
- <image @click="showPassword=!showPassword" :src="showPassword?$getImages('/assetsMobile/images/enterprises/login/visiabled.png'):$getImages('/assetsMobile/images/enterprises/login/unVisiabled.png')" class="img-append"></image>
- </view>
- </u-form-item>
- <u-form-item label=" " prop="loginForm.code" v-if="captchaEnabled">
- <view class="user-input" style="width: 40%;">
- <u-input
- v-model="model.loginForm.code"
- placeholder-style="color:#CCCCCC;font-size: 30rpx"
- border="none"
- type="text"
- :clearable="true"
- placeholder="验证码" />
- </view>
- <view class="login-code">
- <image :src="codeUrl" @click="getCode" class="login-code-img"></image>
- </view>
- </u-form-item>
- <!-- 记住密码 -->
- <view class="login-remember">
- <u-checkbox-group>
- <u-checkbox size="16" activeColor="#2693FB" :checked="checked" inactiveColor="#39B2FC" labelColor="#ffffff"
- @change="checkboxChange" v-model="checked"
- label="记住密码"></u-checkbox>
- </u-checkbox-group>
- </view>
- <u-button type="primary" shape="circle" :custom-style="{
- width: '100%',
- border:'none'
- }" class="login-btn" @click="handleLogin">登录
- </u-button>
- </u--form>
- </view>
- </view>
- </view>
- </view>
- </template>
-
- <template v-else-if="hasPlat(['enterprises'])">
- <view class="page-container-enterprises">
-
-
- <view class="login-content" style="background-color: transparent; z-index: 99; overflow: hidden;">
-
- <template v-if="configList.h5_login_title">
- <view class="welcome-copywriting" >
-
- <text class="h5_login_title"
- v-if="configList.h5_login_title">{{ configList.h5_login_title.configValue || '欢迎登录' }}</text>
- <text class="h5_login_subtitle" v-if="configList.h5_login_subtitle&&configList.h5_login_subtitle.isShow===1">{{configList.h5_login_subtitle.configValue || '企事业车辆管理系统'}}</text>
- </view>
-
- <view class="bg-img">
- <image :src="$getImages(configList.h5_login_bg.configValue || '/assetsMobile/images/enterprises/login/loginBg.png')" class="background-image"></image>
- </view>
- </template>
-
-
- <view class="user-info">
-
- <view class="verification">
- <u--form :model="model" :rules="rules" ref="uForm" label-width="0">
-
- <u-form-item label=" " prop="loginForm.username">
- <view class="user-input">
- <image :src="$getImages('/assetsMobile/images/enterprises/login/acount.png')" class="img"></image>
- <u-input
- v-model="model.loginForm.username"
- placeholder-style="color:#CCCCCC;font-size: 32rpx"
- border="none"
- type="text"
- color="#333"
- :clearable="true"
- placeholder="请输入账号">
- </u-input>
- </view>
- </u-form-item>
- <u-form-item label=" " prop="loginForm.password">
- <view class="user-input">
- <image :src="$getImages('/assetsMobile/images/enterprises/login/password.png')" class="img"></image>
- <u-input
- v-model="model.loginForm.password"
- placeholder-style="color:#DDDDDD;font-size: 32rpx"
- border="none"
- :type="showPassword?'text':'password'"
- color="#333"
- :clearable="true"
- placeholder="请输入密码" />
- <image @click="showPassword=!showPassword" :src="showPassword?$getImages('/assetsMobile/images/enterprises/login/visiabled.png'):$getImages('/assetsMobile/images/enterprises/login/unVisiabled.png')" class="img-append"></image>
- </view>
- </u-form-item>
-
- <u-form-item label=" " prop="loginForm.code" v-if="captchaEnabled">
- <view class="user-input" style="width: 40%;">
- <u-input
- v-model="model.loginForm.code"
- placeholder-style="color:#DDDDDD;font-size: 32rpx"
- border="none"
- type="text"
- :clearable="true"
- placeholder="验证码" />
- </view>
- <view class="login-code">
- <image :src="codeUrl" @click="getCode" class="login-code-img"></image>
- </view>
- </u-form-item>
-
- <!-- 记住密码 -->
- <view class="login-remember">
- <u-checkbox-group>
- <u-checkbox size="16" activeColor="#4573FC" :checked="checked" inactiveColor="##4573FC" labelColor="#4573FC"
- @change="checkboxChange" v-model="checked" shape="circle"
- label="记住密码"></u-checkbox>
- </u-checkbox-group>
- </view>
-
-
- <u-button type="primary" shape="circle" :custom-style="{
- width: '100%',
- border:'none'
- }" class="login-btn" @click="handleLogin">登录
- </u-button>
-
- </u--form>
- </view>
- </view>
- </view>
- </view>
- </template>
-
- <template v-else>
- <view class="page-container">
- <image :src="$getImages(configList.h5_login_bg.configValue||'/assetsMobile/images/loginBg.png')" class="background-image"></image>
-
- <view class="login-content" style="background-color: transparent; z-index: 99; overflow: hidden;">
-
- <view class="welcome-copywriting">
- <text class="h5_login_title" v-if="configList.h5_login_title">{{configList.h5_login_title.configValue||'欢迎登录!'}}</text>
- <text class="h5_login_subtitle" v-if="configList.h5_login_subtitle&&configList.h5_login_subtitle.isShow===1">{{configList.h5_login_subtitle.configValue || ''}}</text>
- </view>
-
- <view class="user-info">
- <view class="verification">
- <u--form :model="model" :rules="rules" ref="uForm" label-width="0">
-
- <u-form-item label=" " prop="loginForm.username">
- <view class="user-input">
- <u-input
- v-model="model.loginForm.username"
- placeholder-style="color:#80A0C6;font-size: 30rpx"
- border="none"
- type="text"
- :clearable="true"
- placeholder="请输入账号"
- />
- </view>
- </u-form-item>
- <u-form-item label=" " prop="loginForm.password">
- <view class="user-input">
- <u-input
- v-model="model.loginForm.password"
- placeholder-style="color:#80A0C6;font-size: 30rpx"
- border="none"
- type="password"
- :clearable="true"
- placeholder="请输入密码"
- />
- </view>
- </u-form-item>
-
- <u-form-item label=" " prop="loginForm.code" v-if="captchaEnabled">
- <view class="user-input" style="width: 40%;">
- <u-input
- v-model="model.loginForm.code"
- placeholder-style="color:#80A0C6;font-size: 30rpx"
- border="none"
- type="text"
- :clearable="true"
- placeholder="验证码"
- />
- </view>
- <view class="login-code">
- <image :src="codeUrl" @click="getCode" class="login-code-img"></image>
- </view>
- </u-form-item>
-
- <u-button type="primary" shape="circle" :custom-style="{
- width: '100%',
- }" class="login-btn" @click="handleLogin">登录
- </u-button>
-
- </u--form>
- </view>
- </view>
- </view>
- </view>
- </template>
- </view>
- </template>
- <script>
- import { mapState } from 'vuex'
- import { getCodeImg } from '@/api/login'
- import { getToken } from '@/utils/auth'
- export default {
- data() {
- return {
- codeUrl: "",
- captchaEnabled: false,
- checked: false,//记住密码
- model: {
- loginForm: {
- username: "",
- password: "",
- code: "",
- uuid: '',
- client: "TQ-HW-MOBILE",
- }
- },
- rules: {
- 'loginForm.username': {
- type: 'string',
- required: true,
- message: '请输入账号',
- trigger: ['blur', 'change']
- },
- 'loginForm.password': {
- type: 'string',
- required: true,
- message: '请输入密码',
- trigger: ['blur', 'change']
- },
- 'loginForm.code': {
- type: 'string',
- required: true,
- message: '请输入验证码',
- trigger: ['blur', 'change']
- },
- },
- showPassword: false,
- }
- },
- created() {
- this.getCode()
- },
- onLoad: function (option) {
- // #ifdef H5
- if(process.env.NODE_ENV == "production") {
-
- if(this.hasPlat(['enterprises']) && this.hasHostPlat(['wxH5'])) {
-
- let {code} = option
- if (this.isNull(code) && !getToken()) {
- let appid = "wx0f491ff49441493e"; // 公众号ID
- // 回调页面
- let redirect_uri = encodeURI(`${window.location.protocol}//${window.location.host}/mobile/`);
- window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&#wechat_redirect`;
- } else {
- this.model.loginForm.authCode = code
- }
- }
-
- }
- // #endif
- if(process.env.NODE_ENV != "production") {
- this.model.loginForm.username = 'admin'
- this.model.loginForm.password = 'Gdtq1981%%'
- }
- // console.log(this.$PLATFORM,'thisthis')
- },
- onShow() {
- // console.log(this.hasPlat,'thisthisthis')
- //从本地存储中获取密码
- let loginFormInfo = uni.getStorageSync('loginFormInfo')
- if (loginFormInfo) {
- console.log('缓存的信息',loginFormInfo)
- let { username, password ,checked} = JSON.parse(loginFormInfo)
- this.model.loginForm.username = username
- this.model.loginForm.password = password
- this.checked = checked
- }
- },
- computed: {
- ...mapState('appConfig', ['configList'])
- },
- methods: {
- // 记住密码
- checkboxChange(e) {
- this.checked = e
- },
- // 获取图形验证码
- getCode() {
- getCodeImg().then(res => {
- console.log(res, 'res')
- this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
- if (this.captchaEnabled) {
- this.codeUrl = 'data:image/gif;base64,' + res.img
- this.loginForm.uuid = res.uuid
- }
- })
- },
- // 登录方法
- async handleLogin() {
- this.$refs.uForm.validate().then(res => {
- this.pwdLogin()
- }).catch(errors => {
- console.log('校验失败', errors)
- })
- },
- // 密码登录
- async pwdLogin() {
- //保存密码到本地存储
- if (this.checked) {
- uni.setStorageSync('loginFormInfo', JSON.stringify({...this.model.loginForm,checked:this.checked}))
- } else { uni.removeStorageSync('loginFormInfo') }
- this.$store.dispatch('Login', this.model.loginForm).then(() => {
- this.$modal.closeLoading()
- this.loginSuccess()
- }).catch(() => {
- if (this.captchaEnabled) {
- this.getCode()
- }
- })
- },
- // 登录成功
- loginSuccess(result) {
- // 设置用户信息
- this.$store.dispatch('GetInfo').then(res => {
- uni.reLaunch({
- url: '/pages/index/index'
- })
- getApp().checkTabPer()
- })
- }
- },
- onReady() {
- this.$refs.uForm.setRules(this.rules)
- },
- }
- </script>
- <style lang="scss" scoped>
- @font-face {
- font-family: 'MaoKenTangYuan';
- /* 自定义的字体名称 */
- src: url('@/assets/fonts/MaoKenTangYuan.ttf') format('truetype');
- /* 字体文件路径及格式 */
- }
- .page-container-sanitation {
- font-family: PingFangSC, PingFang SC;
- height: 100%;
- width: 100%;
- height:100vh;
- background: linear-gradient(135deg, #49CDFC 0%, #2693FB 100%);
- .background-image-new{
- position: absolute;
- bottom: 0;
- right: 0;
- width: 100%;
- height: 100%;
- }
- .background-image {
- position: absolute;
- bottom: 0;
- right: 0;
- width: 100%;
- height: 362rpx;
- }
- .logo-image{
- width: 174rpx;
- height: 58rpx;
- position: absolute;
- top: 58rpx;
- right: 58rpx;
- }
- .login-content {
- background-color: transparent;
- z-index: 99;
- overflow: hidden;
- // 登录提示
- .welcome-copywriting {
- position: absolute;
- width: 100%;
- // top: 35%;
- top: 190rpx;
- height: auto;
- .hi-img{
- width: 92rpx;
- height: 92rpx;
- position: absolute;
- left: 24rpx;
- top: -72rpx;
- }
- text {
- width: 100%;
- float: left;
- padding: 0 60rpx 0 92rpx;
- box-sizing: border-box;
- font-family: YSBTH;
- font-weight: normal;
- font-size: 68rpx;
- color: #FFFFFF;
- line-height: 72rpx;
- text-align: left;
- font-style: normal;
- }
- .h5_login_subtitle{
- padding-left: 144rpx;
- }
- }
- //登录提示框
- .user-info {
- position: absolute;
- top: 50%;
- transform: translate(0,-50%);
- width: 100%;
- .verification {
- padding: 0 60rpx;
- .img{
- width: 36rpx;
- height: 36rpx;
- margin-right: 10rpx;
- }
- .img-append {
- width: 42rpx;
- height: 40rpx;
- margin-left: 16rpx;
- }
- .user-input {
- padding: 20rpx 48rpx;
- width: calc(100% - 96rpx);
- border-radius: 30px;
- // background-color: #EDF0F7;
- border-radius: 46rpx;
- border: 2rpx solid #B2E1FD;
- display: flex;
- justify-content: center;
- align-items: center;
- color: #FFFFFF;
- background-color: #fff;
- }
- .login-code {
- height: 38px;
- float: right;
- .login-code-img {
- height: 38px;
- position: absolute;
- margin-left: 10px;
- width: 200rpx;
- }
- }
- .login-btn {
- margin-top: 68rpx;
- background: linear-gradient(to right, #26E3B6, #2ED7FF);
- height: 96rpx;
- font-size: 36rpx;
- font-family: PingFangSC, PingFang SC;
- font-weight: 500;
- font-size: 32rpx;
- color: #fff;
- line-height: 96rpx;
- text-align: center;
- display: flex;
- justify-content: center;
- font-style: normal;
- }
- .login-remember {
- display: flex;
- align-items: center;
- margin-top: 28rpx;
- padding-left: 16rpx;
- /deep/ .u-checkbox__icon-wrap {
- background-color: rgba(57, 178, 252,0) !important;
- border: 2rpx solid #FFFFFF!important;
- }
- }
- }
- }
- }
- }
- .page-container-enterprises {
- font-family: PingFangSC, PingFang SC;
- height: 100%;
- width: 100%;
- height:100vh;
- background: #FFFFFF;
-
- .login-content {
- background-color: transparent;
- z-index: 99;
- overflow: hidden;
-
-
- // 登录提示
- .welcome-copywriting {
- position: absolute;
- width: 100%;
- top: 6%;
- // top: 110rpx;
- height: auto;
-
- text {
- width: 100%;
- float: left;
- padding: 0 54rpx 0 54rpx;
- box-sizing: border-box;
- font-family: YSBTH;
- font-weight: normal;
- font-size: 68rpx;
- color: #FFFFFF;
- line-height: 76rpx;
- text-align: left;
- font-style: normal;
- }
- .h5_login_title {
- font-family: PingFangSC, PingFang SC;
- font-weight: 500;
- font-size: 60rpx;
- color: #4573FC;
- line-height: 76rpx;
- text-align: left;
- font-style: normal;
- }
- .h5_login_subtitle{
- font-family: PingFangSC, PingFang SC;
- font-weight: 500;
- font-size: 40rpx;
- color: #4573FC;
- line-height: 76rpx;
- text-align: left;
- font-style: normal;
- }
- }
-
- .bg-img {
- position: absolute;
- top: 21%;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- .background-image {
-
- width: 578rpx;
- height: 458rpx;
- }
- }
-
- //登录提示框
- .user-info {
- position: absolute;
- top: 71%;
- transform: translate(0,-50%);
- width: 100%;
- .verification {
- padding: 0 74rpx;
- .img{
- width: 42rpx;
- height: 40rpx;
- margin-right: 16rpx;
- }
- .img-append {
- width: 42rpx;
- height: 40rpx;
- margin-left: 16rpx;
- }
- .user-input {
- padding: 20rpx 0rpx;
- width: calc(100%);
- border-radius: 0px;
- border-bottom: 2rpx solid #DDDDDD;
- display: flex;
- justify-content: center;
- align-items: center;
-
-
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 32rpx;
- color: #DDDDDD;
- line-height: 44rpx;
- text-align: left;
- font-style: normal;
- }
- .login-code {
- height: 38px;
- float: right;
- .login-code-img {
- height: 38px;
- position: absolute;
- margin-left: 10px;
- width: 200rpx;
- }
- }
- .login-btn {
- margin-top: 40rpx;
- background: #4573FC;
- border-radius: 40rpx;
-
- height: 80rpx;
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 36rpx;
- color: #FFFFFF;
- line-height: 80rpx;
- text-align: center;
- font-style: normal;
- }
- .login-remember {
- display: flex;
- align-items: center;
- margin-top: 28rpx;
- padding-left: 0rpx;
-
-
- /deep/ .u-checkbox-label--left {
-
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #4573FC;
- line-height: 40rpx;
- text-align: left;
- font-style: normal;
- }
- }
- }
- }
- }
- }
- .page-container {
- font-family: PingFangSC, PingFang SC;
- height: 100%;
- width: 100%;
- height:100vh;
- .background-image {
- position: absolute;
- top: 0;
- right: 0;
- width: 100%;
- height: 100%;
- }
-
- .login-content {
- background-color: transparent;
- z-index: 99;
- overflow: hidden;
-
- // 登录提示
- .welcome-copywriting {
- position: absolute;
- width: 100%;
- top: 35%;
- height: auto;
-
- text {
- width: 100%;
- float: left;
- padding: 0 90rpx 0 90rpx;
- color: #1990FF;
- box-sizing: border-box;
-
- // &:first-child {
- // font-size: 48rpx;
- // font-weight: 600;
- // margin-bottom: 20rpx;
- // }
-
- // &:last-child {
- // font-size: 40rpx;
- // font-weight: 600;
- // }
- }
- .h5_login_title {
- font-size: 48rpx;
- font-weight: 600;
- margin-bottom: 20rpx;
- }
-
- .h5_login_subtitle {
- font-size: 40rpx;
- font-weight: 600;
- }
- }
- //登录提示框
- .user-info {
- position: absolute;
- top: 48%;
- width: 100%;
-
- .verification {
- padding: 0 40rpx;
-
- .user-input {
- padding: 20rpx 48rpx;
- width: calc(100% - 96rpx);
- border-radius: 30px;
- background-color: #EDF0F7;
- display: flex;
- justify-content: center;
- align-items: center;
- }
-
- .login-code {
- height: 38px;
- float: right;
-
- .login-code-img {
- height: 38px;
- position: absolute;
- margin-left: 10px;
- width: 200rpx;
- }
- }
-
- .login-btn {
- margin-top: 20rpx;
- background: #1990FF;
- height: 96rpx;
- font-size: 36rpx;
- }
-
- }
- }
- }
- }
- </style>
|