gaoluyang
5 天以前 af23456f7bdab22c0963ce3ee35c6fcdb647a72c
湟水峡app:
1.部署修改
2.修改客户拜访和巡检上传修改
已修改1个文件
62 ■■■■■ 文件已修改
src/pages/login.vue 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/login.vue
@@ -6,22 +6,10 @@
        <view class="login-form-content">
            <view class="input-item flex align-center">
                <up-input prefixIcon="account" placeholder="请输入账号" border="bottom"
                                    @blur="getUserLoginFacotryList"
                                    maxlength="30" v-model="loginForm.userName" clearable></up-input>
            </view>
            <view class="input-item flex align-center">
                <up-input prefixIcon="lock" placeholder="请输入密码" border="bottom" maxlength="20" v-model="loginForm.password" clearable type="password"></up-input>
            </view>
            <view class="input-item flex align-center select-container">
                <up-icon name="tags" size="18"></up-icon>
                <up-picker-data
                    v-model="loginForm.factoryId"
                    title="请选择公司"
                    :options="factoryList"
                    valueKey="id"
                    style="width: 100%;"
                    labelKey="name">
                </up-picker-data>
            </view>
            <view>
                <button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
@@ -50,23 +38,18 @@
        icon: 'none'
    })
}
import { userLoginFacotryList} from '@/api/login'
import { ref, onMounted } from "vue";
import useUserStore from '@/store/modules/user'
import { getWxCode } from '@/utils/geek';
import { wxLogin } from '@/api/oauth';
import { setToken } from '@/utils/auth';
import View from "@/pages/procurementManagement/procurementLedger/view.vue";
const userStore = useUserStore()
const useWxLogin = ref(false); // 是否使用微信登录
const rememberPassword = ref(false); // 记住密码
const loginForm = ref({
    userName: "",
    password: "",
    factoryId: "",
    currentFatoryName: "",
});
const factoryList = ref([]) // 公司列表
// 保存密码到本地存储
function savePassword() {
@@ -109,30 +92,6 @@
    })
}
function getUserLoginFacotryList() {
    if(loginForm.value.userName){
        userLoginFacotryList({userName:loginForm.value.userName}).then(res => {
            console.log('res',res)
            // 检查res.data是否为数组
            if (res.data && Array.isArray(res.data)) {
                // 重新组装数据格式:deptId变成id,deptName变成name
                factoryList.value = res.data.map(item => ({
                    id: item.deptId,
                    name: item.deptName
                }))
            } else {
                // 如果res.data不是数组,设置为空数组
                factoryList.value = []
            }
        }).catch(error => {
            showToast('获取公司列表失败:', error)
            factoryList.value = []
        })
    }else {
        factoryList.value = []
    }
}
async function handleLogin() {
    if (loginForm.value.userName === "") {
        showToast("请输入您的账号")
@@ -166,7 +125,6 @@
// 页面加载时检查是否有保存的密码
onMounted(() => {
    loadPassword();
    getUserLoginFacotryList()
});
</script>
@@ -219,26 +177,6 @@
                line-height: 20px;
                text-align: left;
                padding-left: 15px;
            }
        }
        .select-container {
            flex: 1;
            border-bottom: 1px solid #e5e5e5;
            padding: 6px 9px;
            :deep(.up-select) {
                border: none;
                background: transparent;
                .up-select__label {
                    font-size: 14px;
                    color: #333;
                }
                .up-select__value {
                    font-size: 14px;
                    color: #333;
                }
            }
        }