login-account.vue 7.1 KB

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