login.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <view class="container">
  3. <view class="bg bg-color-base margin-b20"></view>
  4. <view class="tab vs-row vs-align-center">
  5. <image class="tab-bg"
  6. src="https://6e69-niew6-1302638010.tcb.qcloud.la/denglu/%E7%99%BB%E5%BD%955/banner-icon.png?sign=d63f6b91aed3733b261cc0127d2cf702&t=1604049324"
  7. mode=""></image>
  8. <view class="vs-row vs-align-center">
  9. <view class="vs-column vs-align-center margin-r40" @click="cur = 0">
  10. <text class="font-50 margin-b20" style="color: #000000;">登录</text>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="login margin-b80">
  15. <view class="input vs-row vs-align-center margin-b40">
  16. <image style="color: #88d8bc;width: 42rpx;height: 40rpx;" class="input-icon margin-r20" src="/static/login/a4.png"></image>
  17. <input class="vs-flex-item font-30" v-model="phone" type="text" value="" placeholder="请输入您的账号"
  18. placeholder-class="input-placeholder" />
  19. </view>
  20. <view class="input vs-row vs-align-center margin-b40">
  21. <image style="width: 40rpx;height: 40rpx;" class="input-icon margin-r20" src="/static/login/psw2.png"
  22. ></image>
  23. <input class="vs-flex-item font-30" v-model="pwd" type="text" password value="" placeholder="请输入您的密码"
  24. placeholder-class="input-placeholder" />
  25. </view>
  26. <view style="margin-left: 20rpx;">
  27. <u-checkbox active-color="#7dc7ae" @change="checkboxChange" v-model="isSave" >记住密码</u-checkbox>
  28. </view>
  29. </view>
  30. <view @click="login" class="button bg-color-base vs-row vs-align-center vs-space-center margin-b20">
  31. <text class="color-white font-34">立即登录</text>
  32. </view>
  33. <u-modal v-model="show" :content="content"></u-modal>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. isSave: false,
  41. show: false,
  42. content: "",
  43. phone: '', //手机号码
  44. pwd: '' //密码
  45. }
  46. },
  47. onLoad() {
  48. uni.getStorage({
  49. key: 'account',
  50. success: (res)=>{
  51. this.phone = res.data.account;
  52. this.pwd = res.data.pwd;
  53. this.isSave = true;
  54. }
  55. });
  56. },
  57. methods:{
  58. checkboxChange(e){
  59. this.isSave=e.value
  60. },
  61. login() {
  62. var that = this;
  63. if (!that.phone) {
  64. that.content="请输入您的账号";
  65. that.show = true;
  66. return;
  67. }
  68. if (!that.pwd) {
  69. that.content="请输入您的密码";
  70. that.show = true;
  71. return;
  72. }
  73. this.$api.permissions.login({
  74. loginName: that.phone,
  75. loginPwd: that.pwd
  76. },{"Content-Type":"application/x-www-form-urlencoded"}).then(res => {
  77. if(res.code=="200"){
  78. if(this.isSave==true){
  79. uni.setStorageSync('account',{account:that.phone,pwd:that.pwd});
  80. }else{
  81. uni.removeStorageSync("account");
  82. }
  83. uni.setStorageSync('access-token',res.data);
  84. uni.reLaunch({
  85. url:"../index/index"
  86. })
  87. }else{
  88. that.content=res.msg;
  89. that.show = true;
  90. }
  91. console.log(res);
  92. });
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. page{
  99. background-color: #FFFFFF;
  100. }
  101. .container {
  102. position: relative;
  103. }
  104. .bg {
  105. position: relative;
  106. width: 750rpx;
  107. height: 380rpx;
  108. }
  109. .tab {
  110. position: absolute;
  111. top: 240rpx;
  112. left: 20rpx;
  113. right: 20rpx;
  114. height: 150rpx;
  115. padding: 0 50rpx;
  116. background-color: #fff;
  117. border-top-left-radius: 20rpx;
  118. border-top-right-radius: 20rpx;
  119. &-bg {
  120. position: absolute;
  121. top: -200rpx;
  122. right: -50rpx;
  123. width: 440rpx;
  124. height: 285rpx;
  125. }
  126. }
  127. .line {
  128. width: 25rpx;
  129. height: 7rpx;
  130. }
  131. .login,
  132. .register {
  133. padding: 0 60rpx;
  134. }
  135. .input {
  136. width: 580rpx;
  137. height: 90rpx;
  138. padding: 0 30rpx;
  139. background-color: rgba(80, 100, 235, 0.1);
  140. border-radius: 100rpx;
  141. &-icon {
  142. width: 30rpx;
  143. height: 38rpx;
  144. }
  145. &-placeholder {
  146. color: #909090;
  147. }
  148. }
  149. .button {
  150. width: 630rpx;
  151. height: 90rpx;
  152. margin-left: 60rpx;
  153. border-radius: 100rpx;
  154. }
  155. .separator {
  156. height: 2rpx;
  157. margin: 0 30rpx;
  158. background-color: #f5f5f5;
  159. }
  160. // 下边距
  161. .margin-b5 {
  162. margin-bottom: 5rpx;
  163. }
  164. .margin-b10 {
  165. margin-bottom: 10rpx;
  166. }
  167. .margin-b15 {
  168. margin-bottom: 15rpx;
  169. }
  170. .margin-b20 {
  171. margin-bottom: 20rpx;
  172. }
  173. .margin-b25 {
  174. margin-bottom: 25rpx;
  175. }
  176. .margin-b30 {
  177. margin-bottom: 30rpx;
  178. }
  179. .margin-b40 {
  180. margin-bottom: 40rpx;
  181. }
  182. .margin-b60 {
  183. margin-bottom: 60rpx;
  184. }
  185. .margin-b80 {
  186. margin-bottom: 80rpx;
  187. }
  188. .margin-b100 {
  189. margin-bottom: 100rpx;
  190. }
  191. // 右边距
  192. .margin-r5 {
  193. margin-right: 5rpx;
  194. }
  195. .margin-r10 {
  196. margin-right: 10rpx;
  197. }
  198. .margin-r15 {
  199. margin-right: 15rpx;
  200. }
  201. .margin-r20 {
  202. margin-right: 20rpx;
  203. }
  204. .margin-r25 {
  205. margin-right: 25rpx;
  206. }
  207. .margin-r30 {
  208. margin-right: 30rpx;
  209. }
  210. .margin-r40 {
  211. margin-right: 40rpx;
  212. }
  213. .margin-r60 {
  214. margin-right: 60rpx;
  215. }
  216. // 字体大小
  217. .font-18 {
  218. font-style: normal;
  219. font-size: 18rpx;
  220. font-family: Droid Sans Fallback;
  221. }
  222. .font-20 {
  223. font-style: normal;
  224. font-size: 20rpx;
  225. font-family: Droid Sans Fallback;
  226. }
  227. .font-22 {
  228. font-style: normal;
  229. font-size: 22rpx;
  230. font-family: Droid Sans Fallback;
  231. }
  232. .font-24 {
  233. font-style: normal;
  234. font-size: 24rpx;
  235. font-family: Droid Sans Fallback;
  236. }
  237. .font-26 {
  238. font-style: normal;
  239. font-size: 26rpx;
  240. font-family: Droid Sans Fallback;
  241. }
  242. .font-28 {
  243. font-style: normal;
  244. font-size: 28rpx;
  245. font-family: Droid Sans Fallback;
  246. }
  247. .font-30 {
  248. font-style: normal;
  249. font-size: 30rpx;
  250. font-family: Droid Sans Fallback;
  251. }
  252. .font-32 {
  253. font-style: normal;
  254. font-size: 32rpx;
  255. font-family: Droid Sans Fallback;
  256. }
  257. .font-34 {
  258. font-style: normal;
  259. font-size: 34rpx;
  260. font-family: Droid Sans Fallback;
  261. }
  262. .font-36 {
  263. font-style: normal;
  264. font-size: 36rpx;
  265. font-family: Droid Sans Fallback;
  266. }
  267. .font-38 {
  268. font-style: normal;
  269. font-size: 38rpx;
  270. font-family: Droid Sans Fallback;
  271. }
  272. .font-40 {
  273. font-style: normal;
  274. font-size: 40rpx;
  275. font-family: Droid Sans Fallback;
  276. }
  277. .font-46 {
  278. font-style: normal;
  279. font-size: 46rpx;
  280. font-family: Droid Sans Fallback;
  281. }
  282. .font-50 {
  283. font-style: normal;
  284. font-size: 50rpx;
  285. font-family: Droid Sans Fallback;
  286. }
  287. .font-60 {
  288. font-style: normal;
  289. font-size: 60rpx;
  290. font-family: Droid Sans Fallback;
  291. }
  292. .font-80 {
  293. font-style: normal;
  294. font-size: 80rpx;
  295. font-family: Droid Sans Fallback;
  296. }
  297. // 字体对齐
  298. .text-left {
  299. text-align: left;
  300. }
  301. .text-center {
  302. text-align: center;
  303. }
  304. .text-right {
  305. text-align: right;
  306. }
  307. // color相关
  308. .color-white {
  309. color: #FFFFFF;
  310. }
  311. .color-red {
  312. color: #dc0000;
  313. }
  314. // 黑色色阶向下
  315. .color-black {
  316. color: #000;
  317. }
  318. .color-black-3 {
  319. color: #333;
  320. }
  321. .color-black-6 {
  322. color: #666;
  323. }
  324. .color-black-9 {
  325. color: #999;
  326. }
  327. // 字体宽度
  328. .font-weight-400 {
  329. font-weight: 400;
  330. }
  331. .font-weight-500 {
  332. font-weight: bold;
  333. }
  334. // 间隔
  335. .spacing-20 {
  336. width: 750rpx;
  337. height: 20rpx;
  338. background-color: #f8f8f8;
  339. }
  340. // 圆角
  341. .radius-10 {
  342. border-radius: 10rpx;
  343. }
  344. .radius-20 {
  345. border-radius: 20rpx;
  346. }
  347. .radius-30 {
  348. border-radius: 30rpx;
  349. }
  350. .radius-circle {
  351. border-radius: 50%;
  352. }
  353. .radius-height {
  354. border-radius: 10000px;
  355. }
  356. // flex相关
  357. .vs-flex-item {
  358. flex: 1;
  359. }
  360. .vs-space-between {
  361. justify-content: space-between;
  362. }
  363. .vs-space-around {
  364. justify-content: space-around;
  365. }
  366. .vs-space-center {
  367. justify-content: center;
  368. }
  369. .vs-space-end {
  370. justify-content: flex-end;
  371. }
  372. .vs-row {
  373. flex-direction: row;
  374. }
  375. .vs-column {
  376. flex-direction: column;
  377. }
  378. .vs-align-end {
  379. align-items: flex-end;
  380. }
  381. .vs-align-center {
  382. display: flex;
  383. align-items: center;
  384. }
  385. .vs-align-start {
  386. align-items: flex-start;
  387. }
  388. .vs-item-hover {
  389. background-color: rgba(0, 0, 0, 0.05);
  390. }
  391. .vs-btn-hover {
  392. opacity: 0.8;
  393. }
  394. .color-base {
  395. color: #7dc7ae;
  396. }
  397. .bg-color-base {
  398. background-color: #7dc7ae;
  399. }
  400. </style>