| <template> | 
|     <view class="loginP"> | 
|         <view class="logo"> | 
|             <image src="@/static/images/login/logo.svg" mode=""></image> | 
|             <!-- <text>energy</text> --> | 
|         </view> | 
|   | 
|         <view class="mainTitle"> | 
|             <h2>-广州西门子-</h2> | 
|             <h3>原材料仓储管理系统</h3> | 
|              | 
|         </view> | 
|         <view class="user-pwd"> | 
|             <view class="userP"> | 
|                 <i class="iconfont icon-yonghutouxiang"></i> | 
|                 <view class="inputC"> | 
|                     <u-input v-model="phone" @input="test" type="text" placeholder="用户名/手机号" /> | 
|                 </view> | 
|             </view> | 
|             <view class="pwdP"> | 
|                 <i class="iconfont icon-mima"></i> | 
|                 <view class="inputC"> | 
|                     <u-input v-model="pwd" type="password" placeholder="密码" /> | 
|                 </view> | 
|             </view> | 
|         </view> | 
|         <view class="loginBtnP" style="padding: 2rem 0 1rem 0;"> | 
|             <view class="loginBtn" @click="goHome"> | 
|                 系统登录 | 
|             </view> | 
|         </view> | 
|         <view class="forgot-register"> | 
|             <!-- <view class="forgot" @click="show=true"> | 
|                 设置接口地址 | 
|             </view> --> | 
|             <view class="register"> | 
|                 <!-- 更新APP --> | 
|             </view> | 
|         </view> | 
|         <!-- <text>当前地址为{{loadUrl}}</text> --> | 
|         <view class="" style="position: fixed;left:12px;bottom: 5px;width: 100%;text-align: center;"> | 
|             应用版本号 1.0.0 | 
|         </view> | 
|         <u-modal v-model="show" title="接口地址" @confirm="upDateUrl"> | 
|             <view class="slot-conurltent" style="margin:20px 20px;"> | 
|                 <u-input v-model="url" placeholder="请输入地址" size=""></u-input> | 
|                 <!-- <text>当前地址为{{loadUrl}}</text> --> | 
|             </view> | 
|         </u-modal> | 
|     </view> | 
| </template> | 
| <script lang='js'> | 
|     import { | 
|         login,loginToken | 
|     } from '../../api/login.js' | 
|      | 
|      | 
|     export default { | 
|         data() { | 
|             return { | 
|                 phone: "", | 
|                 pwd: "", | 
|                 show: false, | 
|                 url: '', //接口地址 | 
|                 loadUrl: '', | 
|                 operator:''  | 
|             } | 
|         }, | 
|         mounted() { | 
|             this.getToken(); | 
|             let creator = uni.getStorageSync('creator') || '' | 
|             if(creator){ | 
|                 this.operator = JSON.parse(uni.getStorageSync('creator')) || '' | 
|             } | 
|         }, | 
|         methods: { | 
|             getToken(){ | 
|                 loginToken({}).then((res) => { | 
|                     if(res.data.result){ | 
|                         if(res.data.data){ | 
|                             uni.setStorageSync('$tokenInfouser', JSON.stringify(res.data.data)); | 
|                         } | 
|                     } | 
|                 }).catch(err=>{ | 
|                     console.log(err) | 
|                 }) | 
|             }, | 
|             test(event){ | 
|                 console.log(event) | 
|             }, | 
|             upDateUrl() { | 
|                 uni.setStorageSync( | 
|                     'isUrl', this.url | 
|                 ); | 
|             }, | 
|             // 点击登录按钮 | 
|             goHome() { | 
|                     if(this.phone=="" || this.pwd=="" ){ | 
|                         this.$u.toast("请输入用户名或者密码!") | 
|                         return | 
|                     } | 
|                     this.loadUrl=uni.getStorageSync('isUrl') | 
|                 // uni.clearStorageSync() | 
|                 let params = { | 
|                     // UserName: this.phone, | 
|                     // passWord: this.pwd,  user-f9849a91-d134-d6e7-ab96-fd5653b1361a | 
|                     //新 | 
|                     validateCode:"pass", | 
|                     // guid:"user-f9849a91-d134-d6e7-ab96-fd5653b1361a", | 
|                     // guid: getUserGuid(), | 
|                     guid: this.common.getUserGuid(), | 
|                     openNodeApi:true, | 
|                     userProductCode:"", | 
|                     userName: this.phone, | 
|                     userPwd: this.pwd | 
|                 } | 
|                 login(params).then((res) => { | 
|                     if (res.data.result) { | 
|                         uni.setStorageSync('token', res.data.data.accessToken); | 
|                         uni.setStorageSync('creator', JSON.stringify(res.data.data.userTrueName || '')) //操作人 | 
|                         uni.setStorageSync('menu_auth',res.data.dynamic) // 菜单权限 【Editby shaocx,2024-03-18】 | 
|                         uni.switchTab({ | 
|                             url: "../Home/Home",//存储好后跳转页面 | 
|                         }); | 
|                     } else { | 
|                         this.$u.toast(res.data.msg) | 
|                     } | 
|                     // if (res.data.status == 200) { | 
|                     //     uni.setStorageSync('token', res.data.token); | 
|                     //     uni.switchTab({ | 
|                     //         url: "../Home/Home",//存储好后跳转页面 | 
|                     //     }); | 
|                     // } else { | 
|                     //     this.$u.toast(res.data.msg) | 
|                     // } | 
|                 }).catch(err=>{ | 
|                     this.$u.toast("请检查网络是否畅通!") | 
|                 }) | 
|             } | 
|         } | 
|     } | 
| </script> | 
|   | 
| <style lang="scss" scoped> | 
|     .loginP { | 
|         padding: 2rem; | 
|   | 
|         .logo { | 
|             text-align: center; | 
|             image { | 
|                 width: 125px; | 
|                 height: 70px; | 
|                 margin: 0 auto -25px; | 
|                 padding: 0 10px; | 
|                 border: 1px solid #009999; | 
|             } | 
|         } | 
|     } | 
|   | 
|   | 
|     .btn { | 
|         border: 1px solid #717171; | 
|         padding: 5px 7px; | 
|         border-radius: 5px; | 
|         color: #717171; | 
|     } | 
|   | 
|     .iconfont { | 
|         color: #ccc; | 
|     } | 
|   | 
|     .mainTitle { | 
|         color: #525659; | 
|         text-align: center; | 
|         font-size: 1.2rem; | 
|         padding: 2rem 2rem 0 2rem; | 
|   | 
|         h3 { | 
|             margin-top: 10px; | 
|             font-size: 1.3rem; | 
|         } | 
|     } | 
|   | 
|     .classesifyP { | 
|         text-align: center; | 
|         display: flex; | 
|         justify-content: center; | 
|     } | 
|   | 
|     .classesify { | 
|         width: 11rem; | 
|         height: 2.1875rem; | 
|         border: 1px solid #02af74; | 
|         display: flex; | 
|         align-items: center; | 
|         border-radius: 100px; | 
|     } | 
|   | 
|     .classesify-puc { | 
|         width: 50%; | 
|         font-size: 0.6rem; | 
|         border-bottom-left-radius: 100px; | 
|         border-top-left-radius: 100px; | 
|         height: 100%; | 
|         line-height: 100%; | 
|         display: flex; | 
|         align-items: center; | 
|         justify-content: center; | 
|         background-color: #02af74; | 
|     } | 
|   | 
|     .classesify-pucs { | 
|         width: 50%; | 
|         font-size: 0.6rem; | 
|         border-bottom-left-radius: 100px; | 
|         border-top-left-radius: 100px; | 
|         height: 100%; | 
|         line-height: 100%; | 
|         display: flex; | 
|         align-items: center; | 
|         justify-content: center; | 
|         background-color: white; | 
|     } | 
|   | 
|     .classesify-bus { | 
|         width: 50%; | 
|     } | 
|   | 
|     .classesify-buss { | 
|         width: 50%; | 
|         font-size: 0.6rem; | 
|         border-bottom-right-radius: 100px; | 
|         border-top-right-radius: 100px; | 
|         height: 100%; | 
|         line-height: 100%; | 
|         display: flex; | 
|         align-items: center; | 
|         justify-content: center; | 
|         background-color: #02af74; | 
|     } | 
|   | 
|     .userP { | 
|         display: flex; | 
|         align-items: center; | 
|         margin: 4rem 0rem 1rem 0rem; | 
|         padding: 0 0.5rem; | 
|         border: 1px solid #dfdfdf; | 
|     } | 
|   | 
|     .pwdP { | 
|         display: flex; | 
|         align-items: center; | 
|         margin: 2rem 0rem 1rem 0rem; | 
|         padding: 0rem 0.5rem; | 
|         border: 1px solid #dfdfdf; | 
|     } | 
|   | 
|     .forgot-register { | 
|         padding: 1rem 0rem; | 
|         display: flex; | 
|         justify-content: space-between; | 
|         color: #747474; | 
|         margin-top: 15px; | 
|     } | 
|   | 
|     .inputC { | 
|         width: 100%; | 
|         padding-left: 1rem; | 
|     } | 
|   | 
|     .rightIcon { | 
|         margin: 0 auto; | 
|     } | 
|   | 
|     .loginBtnP { | 
|         width: 100%; | 
|         display: flex; | 
|         justify-content: center; | 
|         margin-top: 50px; | 
|     } | 
|   | 
|     .loginBtn { | 
|         width: 14rem; | 
|         padding: 0.5rem; | 
|         background-color: #009999; | 
|         border-radius: 0.5rem; | 
|         color: white; | 
|         text-align: center; | 
|         font-size: 1.1rem; | 
|     } | 
|   | 
|     // .forgot-register { | 
|     //     padding: 1rem 0rem; | 
|     //     display: flex; | 
|     //     justify-content: space-between; | 
|     //     color: #747474; | 
|     //     margin-top: 15px; | 
|     // } | 
|   | 
|     .user-pwd { | 
|         margin-bottom: 2rem; | 
|         margin-top: -20px; | 
|     } | 
| </style> |