login-account.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <view class="container">
  3. <view class="content">
  4. <view class="top">
  5. <image src="/static/images/logo_login.png" class="logo" mode="widthFix"></image>
  6. <view style="width: 100%;text-align: center;margin-bottom: 100rpx;">
  7. <text style="font-size: 32rpx;">
  8. 山洪灾害预警监测平台运维系统
  9. </text>
  10. </view>
  11. <view class="cell">
  12. <view class="input-box">
  13. <uIcons type="auth" size="30"></uIcons>
  14. <input type="text" v-model="username" placeholder="请输入账号" class="ipt" placeholder-class="hold"
  15. @blur="handleInputCheck" />
  16. </view>
  17. </view>
  18. <view class="cell">
  19. <view class="input-box">
  20. <uIcons type="locked" size="30"></uIcons>
  21. <input type="password" v-model="password" placeholder="请输入密码" class="ipt"
  22. placeholder-class="hold" @blur="handleInputCheck" />
  23. </view>
  24. </view>
  25. <!-- <view class="agree">
  26. 登录即代表同意
  27. <text class="a">《用户协议》</text>
  28. <text class="a">《隐私政策》</text>
  29. </view> -->
  30. <!-- <view class="tip">未注册用户验证后将自动注册并登录</view> -->
  31. <view class="cell">
  32. <view style="margin-top: 30rpx;margin-right:24rpx;display: flex;justify-content: flex-end;flex-direction:row;">
  33. <checkbox-group @change="checkboxChange">
  34. <label style="font-size: 24rpx;">
  35. <checkbox value="rememberPw" :checked="rememberPw" />记住密码
  36. </label>
  37. </checkbox-group>
  38. </view>
  39. </view>
  40. <view class="cell">
  41. <button class="submit" @click="submit" :disabled="disabled">登录</button>
  42. </view>
  43. <!-- <navigator url="/pages/login/login-phone" hover-class="none" class="change">手机登录 ></navigator> -->
  44. </view>
  45. <!-- 社交账号登录 -->
  46. <!-- <view class="bottom">
  47. <view class="tag">社交账号登录</view>
  48. <view class="chat-arr">
  49. <image src="/static/images/wx.png" class="icon" mode=""></image>
  50. <image src="/static/images/qq.png" class="icon" mode=""></image>
  51. <image src="/static/images/wb.png" class="icon" mode=""></image>
  52. </view>
  53. </view> -->
  54. </view>
  55. <!-- -->
  56. </view>
  57. </template>
  58. <script>
  59. import md5 from '@/utils/md5.js'
  60. import uIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
  61. import {
  62. devUrl,
  63. prodUrl,
  64. contentType
  65. } from '@/common/setting'
  66. export default {
  67. components: {
  68. uIcons,
  69. },
  70. data() {
  71. return {
  72. tenantId: '000000',
  73. username: '',
  74. password: '',
  75. disabled: true,
  76. rememberPw: false
  77. };
  78. },
  79. onLoad() {
  80. var userLoginInfo = uni.getStorageSync("userLoginInfo");
  81. if (null != userLoginInfo && "" != userLoginInfo) {
  82. this.rememberPw = true;
  83. this.disabled = false;
  84. this.username = userLoginInfo.username;
  85. this.password = userLoginInfo.pw;
  86. }
  87. },
  88. methods: {
  89. submit() {
  90. this.$u.api.token(this.tenantId, this.username, md5(this.password)).then(data => {
  91. var dt = new Date();
  92. uni.setStorageSync("loginTime", dt.getTime());
  93. if (this.rememberPw) {
  94. uni.setStorageSync("userLoginInfo", {
  95. username: this.username,
  96. pw: this.password,
  97. });
  98. } else {
  99. uni.removeStorageSync("userLoginInfo");
  100. }
  101. this.$u.func.login(data)
  102. }).catch(err => {
  103. console.log(err)
  104. this.$u.func.showToast({
  105. title: '用户名或密码错误'+err,
  106. })
  107. })
  108. },
  109. handleInputCheck() {
  110. this.disabled = false
  111. },
  112. checkboxChange: function(e) {
  113. var values = e.detail.value;
  114. if (values.length > 0) {
  115. this.rememberPw = true;
  116. } else {
  117. this.rememberPw = false;
  118. }
  119. }
  120. }
  121. };
  122. </script>
  123. <style lang="scss">
  124. .container {
  125. min-height: 100vh;
  126. overflow: hidden;
  127. .set-icon {
  128. vertical-align: middle;
  129. width: 41rpx;
  130. height: auto;
  131. margin-right: 35rpx;
  132. }
  133. }
  134. .content {
  135. display: flex;
  136. flex-direction: column;
  137. justify-content: center;
  138. align-items: center;
  139. height: 90vh;
  140. width: 100%;
  141. .top {
  142. width: 100%;
  143. }
  144. .logo {
  145. display: block;
  146. width: 128rpx;
  147. height: auto;
  148. margin: 0 auto 40rpx;
  149. }
  150. .cell {
  151. width: 100%;
  152. padding: 0 85rpx;
  153. box-sizing: border-box;
  154. margin-top: 12rpx;
  155. .name {
  156. font-size: 22rpx;
  157. font-family: Source Han Sans CN;
  158. font-weight: 400;
  159. color: #3e4a59;
  160. line-height: 30rpx;
  161. opacity: 0.72;
  162. }
  163. .input-box {
  164. padding: 30rpx 0;
  165. border-bottom: 2rpx solid #f6f6f6;
  166. display: flex;
  167. align-items: center;
  168. .code {
  169. font-size: 22rpx;
  170. font-family: Source Han Sans CN;
  171. font-weight: 400;
  172. color: #0d0d0d;
  173. line-height: 30rpx;
  174. text {
  175. color: #14b9c8;
  176. }
  177. }
  178. .ipt {
  179. flex: 1;
  180. // height: 24rpx;
  181. font-size: 24rpx;
  182. padding-left: 10rpx;
  183. }
  184. .hold {
  185. font-size: 24rpx;
  186. font-family: Source Han Sans CN;
  187. font-weight: 400;
  188. color: #3e4a59;
  189. line-height: 30px;
  190. opacity: 0.45;
  191. }
  192. }
  193. }
  194. .agree {
  195. margin: 27rpx 95rpx 0;
  196. font-size: 22rpx;
  197. font-family: Adobe Heiti Std;
  198. font-weight: normal;
  199. color: #cacaca;
  200. line-height: 34rpx;
  201. .a {
  202. color: #000000;
  203. }
  204. }
  205. .submit {
  206. margin-top: 40rpx;
  207. border: none;
  208. width: 100%;
  209. height: 80rpx;
  210. line-height: 80rpx;
  211. box-sizing: border-box;
  212. border-radius: 15rpx;
  213. // font-size: 36rpx;
  214. background: linear-gradient(to right, #48b1f8, #3976f7);
  215. color: #ffffff;
  216. &::after {
  217. content: none;
  218. }
  219. &::before {
  220. content: none;
  221. }
  222. &[disabled='true'] {
  223. background: linear-gradient(to right, #48b1f8, #3976f7);
  224. font-size: 36rpx;
  225. font-family: Source Han Sans CN;
  226. font-weight: 500;
  227. color: #ffffff;
  228. }
  229. }
  230. .tip {
  231. margin-top: 30rpx;
  232. text-align: center;
  233. font-size: 22rpx;
  234. font-family: Adobe Heiti Std;
  235. font-weight: normal;
  236. color: #cacaca;
  237. line-height: 34rpx;
  238. }
  239. .change {
  240. margin-top: 20rpx;
  241. text-align: center;
  242. font-size: 22rpx;
  243. font-family: Adobe Heiti Std;
  244. font-weight: normal;
  245. color: #14b9c8;
  246. line-height: 34rpx;
  247. }
  248. .tag {
  249. display: flex;
  250. justify-content: center;
  251. align-items: center;
  252. font-size: 22rpx;
  253. font-family: Adobe Heiti Std;
  254. font-weight: normal;
  255. color: #9f9f9f;
  256. line-height: 34rpx;
  257. &::before {
  258. content: '';
  259. display: block;
  260. width: 160rpx;
  261. height: 1px;
  262. background: #d8d8d8;
  263. opacity: 0.86;
  264. }
  265. &::after {
  266. content: '';
  267. display: block;
  268. width: 160rpx;
  269. height: 1px;
  270. background: #d8d8d8;
  271. opacity: 0.86;
  272. }
  273. }
  274. .chat-arr {
  275. margin-top: 50rpx;
  276. display: flex;
  277. align-items: center;
  278. justify-content: space-between;
  279. .icon {
  280. width: 73rpx;
  281. height: 73rpx;
  282. }
  283. }
  284. }
  285. </style>