| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406 |
- <template>
- <view>
- <view class="loginway">
- <div class="navigation"></div>
- <image class="loginimg" mode="widthFix" src="/static/login/logo_word.png"></image>
- <view class="input_wrap">
- <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
- <u-form-item label="" prop="username" class="inputFormWrap">
- <u--input shape="circle" clearable prefixIcon="/static/login/icon-account.png"
- :prefixIconStyle="prefixIconStyle" v-model="form.username" placeholder="请输入账号"></u--input>
- </u-form-item>
- <u-form-item label="" prop="password" class="inputFormWrap">
- <u--input shape="circle" clearable password prefixIcon="/static/login/icon-password.png"
- :prefixIconStyle="prefixIconStyle" v-model="form.password" placeholder="请输入密码"></u--input>
- </u-form-item>
- <u-form-item label="" prop="" class="inputFormWrap">
- <u-checkbox-group v-model="checkboxs" placement="column" @change="changeRemember">
- <u-checkbox :label="'记住密码'" :name="'remember'"></u-checkbox>
- </u-checkbox-group>
- </u-form-item>
- <u-form-item label="" prop="agreePrivacy" class="inputFormWrap agree_form_item">
- <view class="agree_row">
- <u-checkbox-group v-model="agreePrivacyList" placement="row" @change="onAgreeChange">
- <u-checkbox :name="'agree'"></u-checkbox>
- </u-checkbox-group>
- <text class="agree_text">我已阅读并同意</text>
- <text class="agree_link" @click="toPrivacy">《隐私政策》</text>
- </view>
- </u-form-item>
- <u-form-item>
- <u-button type="primary" text="登录" shape="circle" @click="handleLogin"></u-button>
- </u-form-item>
- <!-- <u-form-item>
- <view class="network_configuration_box">
- <view class="netWrokSet" @click="handleToConfiguration">
- <image src="/static/login/network.png" mode=""></image>
- <text class="text">呼叫中心配置</text>
- </view>
- </view>
- </u-form-item> -->
- </u--form>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- firstLoginState : "",
- // systemList,
- prefixIconStyle: {
- width: "16px",
- height: "16px",
- marginRight: "4px",
- marginLeft: "10px"
- },
- form: {
- // password: "Huilong@#$999",
- password: "",
- systemCode: "system_crm",
- username: "",
- clientFlag: "2",
- // username: "huihui",
- code: "996007qa.code",
- uuid: "123",
- agreePrivacy: false
- },
- checkboxs: [],
- agreePrivacyList: [],
- rules: {
- username: {
- type: 'string',
- required: true,
- message: '请输入账号',
- trigger: []
- },
- password: {
- type: 'string',
- required: true,
- message: '请输入密码',
- trigger: []
- },
- agreePrivacy: {
- required: true,
- message: '请阅读并同意《隐私政策》',
- trigger: [],
- validator: (rule, value, callback) => {
- if (this.form.agreePrivacy === true) {
- callback();
- } else {
- callback(new Error('请阅读并同意《隐私政策》'));
- }
- }
- }
- },
- // mac: getMacAddress(),
- };
- },
- computed: {
- systemList() {
- return this.$store.state.user.systemList;
- },
- remember: {
- get() {
- return this.checkboxs.length > 0
- },
- set(value) {
- this.checkboxs = value ? ['remember'] : [];
- }
- }
- },
- mounted() {
- // 触发水印隐藏
- this.systemChange(this.form.systemCode);
- this.getUserByCache();
- },
- onLoad(option){
- const { shiYuWxLogin } = option;
- this.firstLoginState = shiYuWxLogin;
- },
- methods: {
- onAgreeChange(list) {
- this.form.agreePrivacy = (list || []).indexOf('agree') >= 0;
- },
- toPrivacy() {
- uni.navigateTo({ url: '/pages/privacy/index' });
- },
- changeRemember(value){
- if (value.length > 0) {
- uni.setStorageSync('username', this.form.username);
- uni.setStorageSync('password', this.form.password);
- } else {
- uni.removeStorageSync('username');
- uni.removeStorageSync('password');
- }
- },
- getUserByCache() {
- const savedUsername = uni.getStorageSync('username');
- const savedPassword = uni.getStorageSync('password');
- if (savedUsername && savedPassword) {
- this.form.username = savedUsername;
- this.form.password = savedPassword;
- this.remember = true;
- }
- },
- handleToConfiguration() {
- uni.navigateTo({
- url: "/pages/configuration/index"
- })
- },
- systemChange(e) {
- if (!e) return;
- uni.$u.api.getAppSystemList().then((res) => {
- const systemCodeList = res.data;
- this.$store.dispatch("user/setSystemlist", systemCodeList);
- const system = this.systemList.find(v => v.value === e);
- this.$store.commit("user/SET_SYSTEM", system);
- }).catch((e) => {
- uni.$u.toast("服务网络不通");
- })
- },
- handleLogin() {
- this.$refs.uForm.validate().then(() => {
- if (this.remember) {
- uni.setStorageSync('username', this.form.username);
- uni.setStorageSync('password', this.form.password);
- } else {
- uni.removeStorageSync('username');
- uni.removeStorageSync('password');
- }
- this.$store.dispatch("user/login", this.form).then(async (userId) => {
- // #ifdef H5
- uni.switchTab({
- url: `/pages/person/index`,
- success: () => {
- this.$store.dispatch("app/register");
- uni.$u.toast("登录成功");
- }
- })
- // if(this.firstLoginState){
- // // 有state要绑定一下用户
- // await uni.$u.api.firstLogin({ userId , firstLoginState : this.firstLoginState });
-
- // uni.reLaunch({
- // url:"/pages/bindSuccess/index",
- // success: () => {
- // uni.$u.toast("绑定成功");
- // }
- // });
- // }else{
- // uni.$u.toast("授权失败,无法绑定");
- // }
- // #endif
-
- // #ifdef APP-PLUS
- uni.switchTab({
- url: `/pages/person/index`,
- success: () => {
- this.$store.dispatch("app/register");
- uni.$u.toast("登录成功");
- }
- })
- // #endif
-
- }).catch((res) => {
- uni.$u.toast(res);
- })
- })
- },
- },
- }
- </script>
- <style lang="scss">
- .network_configuration_box {
- margin: auto;
- .netWrokSet {
- display: flex;
- align-items: center;
- image {
- width: 30rpx;
- height: 30rpx;
- }
- .text {
- margin-left: 10rpx;
- font-size: 26rpx;
- }
- }
- }
- .systemLabel_wrap {
- display: flex;
- align-items: center;
- .label {
- margin-left: 10rpx;
- }
- }
- .systemCode_wrap {
- position: relative;
- ::v-deep .uni-select {
- border-radius: 100px;
- border: 1px solid #dadbde;
- height: 40px;
- padding: 0px 10px 0px 46px;
- &:before {
- content: "";
- display: block;
- width: 16px;
- height: 16px;
- background-image: url("../../static/login/icon-system.png");
- background-size: 16px 16px;
- position: absolute;
- left: 20px;
- top: 50%;
- transform: translate(0%, -50%);
- }
- .uni-select__input-placeholder {
- font-size: 14px;
- color: rgb(192, 196, 204);
- }
- }
- .system_debt {
- ::v-deep .uni-select {
- &:before {
- background-image: url("../../static/outbound/icon-zycs.png");
- }
- }
- }
- .system_debt_ccb {
- ::v-deep .uni-select {
- &:before {
- background-image: url("../../static/outbound/icon-zycs.png");
- }
- }
- }
- .system_debt_spdb {
- ::v-deep .uni-select {
- &:before {
- background-image: url("../../static/outbound/icon-zycs.png");
- }
- }
- }
- .system_debt_public {
- ::v-deep .uni-select {
- &:before {
- background-image: url("../../static/outbound/icon-zycs.png");
- }
- }
- }
- .system_debt_dfkl {
- ::v-deep .uni-select {
- &:before {
- background-image: url("../../static/outbound/icon-zycs.png");
- }
- }
- }
- .system_debt_cib {
- ::v-deep .uni-select {
- &:before {
- background-image: url("../../static/outbound/icon-zycs.png");
- }
- }
- }
- .system_debt_icbc_h {
- ::v-deep .uni-select {
- &:before {
- background-image: url("../../static/outbound/icon-zycs.png");
- }
- }
- }
- .system_debt_tjxt {
- ::v-deep .uni-select {
- &:before {
- background-image: url("../../static/outbound/icon-zycs.png");
- }
- }
- }
- // .systemIcon{
- // width: 16px;
- // height: 16px;
- // position: absolute;
- // left: 20px;
- // top: 50%;
- // transform: translate(0%, -50%);
- // display: none;
- // }
- }
- .inputFormWrap {
- ::v-deep .u-border {
- border: 1px solid #dadbde !important;
- }
- }
- .agree_form_item {
- ::v-deep .u-form-item__body__right {
- flex: 1;
- }
- }
- .agree_row {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- }
- .agree_text {
- font-size: 26rpx;
- color: #606266;
- margin-left: 8rpx;
- }
- .agree_link {
- font-size: 26rpx;
- color: #108cff;
- margin-left: 4rpx;
- }
- .max {
- width: 500rpx;
- height: 500rpx;
- }
- page {
- background: #fff;
- }
- .loginway {
- display: flex;
- flex-direction: column;
- height: 100vh;
- .navigation {
- background-color: #108cff;
- width: 100%;
- height: 120rpx;
- }
- .loginimg {
- display: block;
- width: 100%;
- height: 100%;
- }
- .input_wrap {
- padding: 20rpx 30rpx;
- }
- }
- </style>
|