login-password.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view style="height: 100% !important;">
  3. <view class="context">
  4. <!-- <image src="../../static/loginback.png" class="context-img"></image> -->
  5. <view class="confirm-list">
  6. 欢迎登录 !
  7. </view>
  8. <view class="input-wrap">
  9. <input style="text-align: start;" placeholder="请输入用户名" v-model="loginId" auto-complete="new-password"
  10. autocomplete="off" />
  11. </view>
  12. <view class="input-wrap" style="margin-top: 50rpx;">
  13. <input class="uni-input" placeholder="请输入密码" :type="isShow ? 'text' : 'password'" v-model="pwd" />
  14. </view>
  15. <view style="text-align: center;margin-top: 100rpx;" @tap="loginFun()">
  16. <view class="login" style="background-color: #49A992">登录</view>
  17. </view>
  18. </view>
  19. <zero-privacy ref="privacy" @disagree='handleNeedAuthorization' :onNeed="false"
  20. @agree='agehandleNeed'></zero-privacy>
  21. <button class="bottom" @click.stop="showLoding">
  22. 手机号快速登录
  23. </button>
  24. <fLogin :agree="agreeTwo" />
  25. </view>
  26. </template>
  27. <script>
  28. import fLogin from '@/uni_modules/f-wxLogin/components/f-wxLogin/f-wxLogin.vue';
  29. import md5 from '@/components/md5.js'
  30. import {
  31. mapState,
  32. mapMutations
  33. } from 'vuex';
  34. import sha1 from "js-sha1";
  35. export default {
  36. components: {
  37. fLogin
  38. },
  39. props: {
  40. themeColor: {
  41. type: String,
  42. default: '#33CCCC',
  43. },
  44. logoUrl: {
  45. type: String,
  46. default: '',
  47. },
  48. },
  49. computed: {
  50. style_xuan() {
  51. let that = this;
  52. var themeColor = that.themeColor;
  53. var isRemeber = that.isRemeber;
  54. var style = '';
  55. if (isRemeber) {
  56. style += `color:${themeColor};`;
  57. }
  58. return style;
  59. },
  60. },
  61. data() {
  62. return {
  63. isRemeber: false,
  64. isShow: false, //是否显示输的密码
  65. loginId: '',
  66. pwd: '',
  67. agree: false,
  68. agreeTwo: false,
  69. }
  70. },
  71. methods: {
  72. isLoding() {
  73. let isglag;
  74. let isLogin = uni.getStorageSync('headLogo');
  75. if (isLogin) {
  76. isglag = false;
  77. } else {
  78. isglag = true;
  79. }
  80. return isglag;
  81. },
  82. ...mapMutations(['setShowWxLogin']),
  83. showLoding() {
  84. // let that = this;
  85. // if (that.agreeTwo == false) {
  86. // uni.showToast({
  87. // title: '请阅读并勾选用户协议和隐私政策',
  88. // icon: 'none'
  89. // });
  90. // return;
  91. // }
  92. this.setShowWxLogin(true);
  93. },
  94. isShowPassword() {
  95. let that = this;
  96. that.isShow = !that.isShow;
  97. },
  98. loginFun() {
  99. let that = this;
  100. if (that.loginId == "" || that.pwd == "") {
  101. uni.showToast({
  102. title: '请输入账号或密码',
  103. icon: 'none'
  104. });
  105. return;
  106. }
  107. // if (that.agreeTwo == false) {
  108. // uni.showToast({
  109. // title: '请阅读并勾选用户协议和隐私政策',
  110. // icon: 'none'
  111. // });
  112. // return;
  113. // }
  114. let pad = md5(that.pwd).substr(8, 16).toUpperCase();
  115. let data = {
  116. loginId: that.loginId,
  117. pwd: md5(
  118. sha1(that.pwd).toUpperCase()
  119. ).toUpperCase(),
  120. };
  121. this.$emit('loginFun', data);
  122. },
  123. handleNeedAuthorization() {
  124. uni.exitMiniProgram({
  125. success: function() {
  126. console.log('退出小程序成功');
  127. },
  128. fail: function(err) {
  129. console.log('退出小程序失败', err);
  130. }
  131. })
  132. },
  133. agehandleNeed() {},
  134. }
  135. }
  136. </script>
  137. <style lang="scss">
  138. .context {
  139. width: 100%;
  140. height: 100%;
  141. padding: 300rpx 50rpx 0rpx 50rpx;
  142. background-color: #FFFFFF;
  143. background-image: linear-gradient(#90ffe4, #FFFFFF);
  144. position: relative;
  145. .confirm-list {
  146. font-size: 50rpx;
  147. font-weight: bold;
  148. position: absolute;
  149. top: 30rpx;
  150. font-family: "微软雅黑"
  151. }
  152. }
  153. .input-wrap {
  154. height: 100rpx;
  155. text-align: center;
  156. padding: 35rpx;
  157. border: 2rpx solid #d5d4d4;
  158. border-radius: 100rpx;
  159. background-color: #fff;
  160. }
  161. view {
  162. box-sizing: border-box;
  163. }
  164. .cf-hengStart {
  165. display: flex;
  166. flex-direction: row;
  167. justify-content: flex-start;
  168. align-items: center;
  169. width: 100%;
  170. }
  171. .xuanShowBox {
  172. padding-left: 40rpx;
  173. .icon-weixuan {
  174. color: #eaeeed;
  175. }
  176. .xuanShowTip {
  177. padding-left: 10rpx;
  178. }
  179. }
  180. .uni-input {
  181. text-align: start;
  182. }
  183. .login {
  184. color: #FFFFFF;
  185. width: 100%;
  186. border-radius: 68rpx;
  187. margin: 20rpx auto;
  188. padding: 35rpx;
  189. font-size: 28rpx;
  190. }
  191. .changeShow {
  192. font-size: 36rpx;
  193. position: relative;
  194. top: -12rpx;
  195. left: 84rpx;
  196. }
  197. .input-placeholder {
  198. font-size: 28rpx;
  199. }
  200. .bottom {
  201. margin-top: 23rpx;
  202. background: #fff;
  203. font-size: 30rpx;
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. color: #39b54a;
  208. width: 85%;
  209. border: solid 1px #39b54a;
  210. border-radius: 40rpx;
  211. image {
  212. width: 54rpx;
  213. height: 54rpx;
  214. margin-right: 16rpx;
  215. }
  216. }
  217. </style>