index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view class="app">
  3. <view class="top-view">
  4. <image class="bg" src="/static/img/login-bg.png"></image>
  5. <view class="inner">
  6. <view class="statusBar" :style="'height:' + statusBarHeight + 'px'"></view>
  7. <view class="inner-body fx-h fx-bc fx-ac">
  8. <view class="prv" @tap="utils.navigateBack()">
  9. <image src="/static/img/ic_back_white.png" class="icon-back"></image>
  10. </view>
  11. <view class="logo">
  12. <image src="/static/img/cbb_white.png"></image>
  13. </view>
  14. <view class="label-text">欢迎登录长城易趣</view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="body">
  19. <view class="h120"></view>
  20. <view class="input-view">
  21. <view class="login-input fx-r">
  22. <view class="left fx-r fx-bc ">
  23. <view class="label">+86</view>
  24. <image class="loginv" src="/static/img/login-v.png"></image>
  25. </view>
  26. <input type="number" v-model="form.mobile" placeholder="请输入手机号" />
  27. </view>
  28. <view class="login-input fx-r">
  29. <view class="left fx-h fx-ac">
  30. <image class="icon" style="margin-left: 20rpx;" src="/static/img/login-password.png"></image>
  31. </view>
  32. <input type="text" v-model="form.password" password="*" placeholder="请输入密码" />
  33. </view>
  34. <view class="btn ihover" @tap="tapSubmit">登 录</view>
  35. <view class="mb-view fx-r" >
  36. <view class="link" @tap="tapReg">注册新用户</view>
  37. <view class="fx-g1"></view>
  38. <view class="link" @tap="tapPassword">忘记密码</view>
  39. </view>
  40. <view class="agament fx-r fx-bc fx-ac">
  41. <view @tap="isRead = !isRead" class="fx-r fx-ac fx-bc">
  42. <image v-if="!isRead" src="/static/img/radio_buttons.png"></image>
  43. <image v-else src="/static/img/radio_buttons_btn.png"></image>
  44. 注册及同意
  45. </view>
  46. <text @tap="tapOpen" data-url="/pages/operation/user">《用户协议》</text>
  47. ,认真阅读<text @tap="tapOpen" data-url="/pages/operation/package">《长城易趣产品购买协议》</text>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <style lang="scss">
  54. page{background: #fff;}
  55. .top-view{
  56. position: relative;
  57. width: 100vw;
  58. height: 62vw;
  59. .bg{width: 100vw;height: 62vw;}
  60. .inner{
  61. position: absolute;
  62. width: 100%;
  63. height: 100%;
  64. top: 0;
  65. left: 0;
  66. .inner-body{
  67. position:relative;
  68. .prv{
  69. position: absolute;
  70. left: 20rpx;
  71. top: 20rpx;
  72. .icon-back{
  73. width: 60rpx;
  74. height: 60rpx;
  75. }
  76. }
  77. .logo{
  78. width: 200rpx;
  79. height: 119rpx;
  80. margin-bottom: 40rpx;
  81. margin-top: 60rpx;
  82. image{width: 100%;height: 100%;}
  83. }
  84. .label-text{
  85. font-size: 42rpx;
  86. color: #FFFFFF;
  87. }
  88. }
  89. }
  90. }
  91. .body{
  92. position: relative;
  93. background: #fff;
  94. border-radius: 80rpx 80rpx 0px 0px;
  95. top: -120rpx;
  96. z-index: 9;
  97. height: 500px;
  98. .h120{height: 100rpx;}
  99. .input-view{
  100. padding: 0px 60rpx;
  101. .login-input{
  102. border-radius: 70rpx;
  103. border: 1px solid #E0E0E0;
  104. padding: 30rpx 46rpx;
  105. margin-bottom: 50rpx;
  106. .left{
  107. .label{
  108. font-size: 28rpx;
  109. color: #DB292B;
  110. font-weight: bold;
  111. }
  112. .loginv{width: 15rpx;height: 12rpx;margin-left: 14rpx;}
  113. .icon{width: 30rpx;height: 33rpx;}
  114. width: 90rpx;
  115. }
  116. input{
  117. width: calc(100% - 90rpx);
  118. }
  119. }
  120. }
  121. .btn{
  122. background: #DB292B;
  123. border-radius: 60rpx;
  124. text-align: center;
  125. font-weight: bold;
  126. font-size: 28rpx;
  127. padding: 30rpx 0;
  128. color: #FAFAFA;
  129. }
  130. .agament{
  131. margin-top: 40rpx;
  132. image{width: 36rpx;height: 36rpx;margin-right: 20rpx;}
  133. color: #999999;
  134. font-size:24rpx;
  135. text{color: #DB292B;}
  136. }
  137. }
  138. .mb-view{font-size: 14px; margin-top: 30px;padding: 0px 5px;}
  139. .mb-view .link{color: #DB292B;}
  140. </style>
  141. <script>
  142. import uParse from '@/components/gaoyia-parse/parse.vue';
  143. import maoScroll from '@/components/mao-scroll/mao-scroll.vue';
  144. import customerWiget from '@/components/ui-public/customer-wiget.vue';
  145. import { mapState, mapMutations } from 'vuex';
  146. export default {
  147. components: {
  148. uParse,
  149. maoScroll,
  150. customerWiget
  151. },
  152. data() {
  153. return {
  154. statusBarHeight: 20,
  155. form:{
  156. mobile : "",
  157. password : ""
  158. },
  159. isRead : false
  160. }
  161. },
  162. onLoad() {
  163. this.initView();
  164. },
  165. onReachBottom() {
  166. if(this.page.isFoot || this.page.isLoad) {
  167. return;
  168. }
  169. this.page.page ++;
  170. this.getData();
  171. },
  172. methods: {
  173. ...mapMutations(['setSys','setUser']),
  174. initView: function() {
  175. uni.getSystemInfo({
  176. success: (res) => {
  177. this.statusBarHeight = res.statusBarHeight;
  178. }
  179. });
  180. },
  181. /**
  182. * 注册
  183. */
  184. tapReg:function(){
  185. uni.navigateTo({ url:"./register" });
  186. },
  187. tapPassword:function(){
  188. uni.navigateTo({
  189. url:'/pages/login/forgotPassword'
  190. })
  191. },
  192. /**
  193. * 提交数据
  194. */
  195. tapSubmit:function(){
  196. //手机号码
  197. if(this.form.mobile == ""){
  198. uni.showToast({
  199. title:"请输入手机号码",icon:"none",mask:true
  200. })
  201. return;
  202. }
  203. //手机验证号码
  204. //this.form.mobile
  205. if(!this.utils.isPoneAvailable(this.form.mobile) ){
  206. uni.showToast({
  207. title:"请输入正确的手机号码",icon:"none",mask:true
  208. })
  209. return;
  210. }
  211. if(!this.isRead){
  212. uni.showToast({
  213. title:"请阅读并同意相关政策",icon:"none",mask:true
  214. })
  215. return;
  216. }
  217. uni.showLoading({ title: '登录中..' });
  218. this.request
  219. .post("userLogin",this.form)
  220. .then(res=>{
  221. uni.hideLoading();
  222. if(res.code == 200) {
  223. this.setUser(res.data);
  224. this.webSocket.connect();
  225. uni.reLaunch({ url:"../index/index"});
  226. } else {
  227. uni.showToast({ title:res.msg,icon:"none",mask:true});
  228. }
  229. })
  230. .catch(res=>{
  231. console.log(res);
  232. uni.hideLoading();
  233. uni.showModal({title: '系统提示',content: '加载失败,重新点击尝试!',showCancel: false});
  234. });
  235. },
  236. /**
  237. * 打开Open
  238. * @param {Object} ev
  239. */
  240. tapOpen: function(ev) {
  241. let url = ev.currentTarget.dataset.url;
  242. this.utils.navigateTo(url);
  243. },
  244. }
  245. }
  246. </script>