You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

127 lines
3.1 KiB

<template>
<view class="u-page">
<uni-section title="汇融云眼" type="line">
<uni-card :is-shadow="false" :isFull="true" :border="true">
<text>
汇融云眼贷后监管平台
</text>
</uni-card>
<uni-card title="登录" :thumbnail="avatar" sub-title="人员登录" extra="" note="Tips">
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item label="账号:" name="userName">
<uni-easyinput prefixIcon="person" type="text" v-model="formData.userName" placeholder="请输入账号" />
</uni-forms-item>
<uni-forms-item label="密码:" name="password">
<uni-easyinput prefixIcon="locked" type="password" v-model="formData.password" placeholder="请输入密码" />
</uni-forms-item>
<uni-forms-item>
<checkbox-group @change="checkboxChange">
<label>
<checkbox value="ty" style="transform:scale(0.8)" />
<text>已阅读并同意</text>
<text @click="fwxy">《服务协议》</text>
<text @click="yszc">《隐私政策》</text>
</label>
</checkbox-group>
</uni-forms-item>
</uni-forms>
<button @click="dologin">登录</button>
<!-- <button @click="dologin" style="margin-top: 15px;">微信登录</button> -->
</uni-card>
</uni-section>
</view>
</template>
<script>
export default {
data() {
return {
sssss: "",
avatar: 'https://jianguan.yyundong.com/wx/logo-hryy.png',
// 表单数据
formData: {
userName: '13131100001',
password: '123456'
},
rules: {
// 对name字段进行必填验证
userName: {
rules: [{
required: true,
errorMessage: '账号不可以为空'
}]
},
// 对passwd字段进行必填验证
password: {
rules: [{
required: true,
errorMessage: '密码不可以为空'
}]
}
},
ty: 0
}
},
created() {},
methods: {
checkboxChange(e) {
let values = e.detail.value
console.log('KKK', values)
if (values && values.length > 0) {
this.ty = 1
} else {
this.ty = 0
}
},
dologin() {
let _this = this
this.$refs.form
.validate()
.then(r => {
if (this.ty == 0) {
uni.showToast({
title: '请选择同意服务协议与隐私政策',
icon: 'none'
})
return;
}
_this.$store
.dispatch('login', _this.formData)
.then(uinfo => {
console.log('MMMM:', uinfo)
getApp().globalData.username = uinfo.name
getApp().globalData.token = uinfo.token
//存
uni.setStorageSync('tokenValue', uinfo.tokenValue);
console.log('gd--:', getApp().globalData)
uni.redirectTo({
url: '/pages/index/index',
})
// uni.switchTab({
// url: '/pages/home/FindFragment'
// });
})
.catch(er => {
console.log('EEEE:', er)
})
})
.catch(err => {
console.log('eeee:', err)
})
},
fwxy() {
uni.navigateTo({
url: '/pages/login/fwxy'
})
},
yszc() {
uni.navigateTo({
url: '/pages/login/yszc'
})
}
}
}
</script>
<style></style>