index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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 maoScroll from '@/components/mao-scroll/mao-scroll.vue';
  143. import customerWiget from '@/components/ui-public/customer-wiget.vue';
  144. import { mapMutations } from 'vuex';
  145. import Request from '@/library/Request';
  146. export default {
  147. components: {
  148. maoScroll,
  149. customerWiget
  150. },
  151. computed: {
  152. getWebSocket(){
  153. // #ifdef APP-PLUS
  154. const webSocket = getApp().globalData.webSocket
  155. // #endif
  156. // #ifndef APP-PLUS
  157. const webSocket = this.webSocket
  158. // #endif
  159. return webSocket
  160. }
  161. },
  162. data() {
  163. return {
  164. statusBarHeight: 20,
  165. form:{
  166. mobile : "",
  167. password : ""
  168. },
  169. isRead : false
  170. }
  171. },
  172. onLoad() {
  173. this.initView();
  174. },
  175. onReachBottom() {
  176. if(this.page.isFoot || this.page.isLoad) {
  177. return;
  178. }
  179. this.page.page ++;
  180. this.getData();
  181. },
  182. methods: {
  183. ...mapMutations(['setSys','setUser']),
  184. initView: function() {
  185. uni.getSystemInfo({
  186. success: (res) => {
  187. this.statusBarHeight = res.statusBarHeight;
  188. }
  189. });
  190. },
  191. /**
  192. * 注册
  193. */
  194. tapReg:function(){
  195. uni.navigateTo({ url:"./register" });
  196. },
  197. tapPassword:function(){
  198. uni.navigateTo({
  199. url:'/pages/login/forgotPassword'
  200. })
  201. },
  202. /**
  203. * 提交数据
  204. */
  205. tapSubmit:function(){
  206. //手机号码
  207. if(this.form.mobile == ""){
  208. uni.showToast({
  209. title:"请输入手机号码",icon:"none",mask:true
  210. })
  211. return;
  212. }
  213. //手机验证号码
  214. //this.form.mobile
  215. if(!this.utils.isPoneAvailable(this.form.mobile) ){
  216. uni.showToast({
  217. title:"请输入正确的手机号码",icon:"none",mask:true
  218. })
  219. return;
  220. }
  221. if(!this.isRead){
  222. uni.showToast({
  223. title:"请阅读并同意相关政策",icon:"none",mask:true
  224. })
  225. return;
  226. }
  227. uni.showLoading({ title: '登录中..' });
  228. Request
  229. .post("userLogin",this.form)
  230. .then(res=>{
  231. uni.hideLoading();
  232. if(res.code == 200) {
  233. this.setUser(res.data);
  234. this.getWebSocket.connect();
  235. uni.reLaunch({ url:"../index/index"});
  236. } else {
  237. uni.showToast({ title:res.msg,icon:"none",mask:true});
  238. }
  239. })
  240. .catch(res=>{
  241. console.log(res);
  242. uni.hideLoading();
  243. uni.showModal({title: '系统提示',content: '加载失败,重新点击尝试!',showCancel: false});
  244. });
  245. },
  246. /**
  247. * 打开Open
  248. * @param {Object} ev
  249. */
  250. tapOpen: function(ev) {
  251. let url = ev.currentTarget.dataset.url;
  252. this.utils.navigateTo(url);
  253. },
  254. }
  255. }
  256. </script>