login.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <template>
  2. <view class="container">
  3. <u-icon class="back-btn" name="arrow-left" color="black" size="20" @click="navBack"></u-icon>
  4. <view class="wrapper">
  5. <image style='width:38px;height:38px;margin:223rpx 0 20px 0;' src='@/static/logo.png'></image>
  6. <h2 class="title Semibold">欢迎使用智运货主端</h2>
  7. <view
  8. style='position:relative;width:100%;margin-top:50px;border-bottom:1px solid #E8E9ED;padding:10px;align-items: center;'
  9. class="flex">
  10. <view class="phone-before-num NumberMedium">+86</view>
  11. <view style='width:85%;'>
  12. <!-- <u--input class="phone-number" border="none" maxlength='11' v-model='phone'
  13. placeholder="请输入手机号码" type="number"></u--input>
  14. <u-input /> -->
  15. <u--input v-model="phone" border="none" type='number' placeholder="请输入手机号码" class="phone-number"
  16. maxlength='11' :clearable='true'></u--input>
  17. </view>
  18. </view>
  19. <view style='margin-top:20px;border-bottom:1px solid #E8E9ED;position:relative;height:40px'>
  20. <!-- <u--input class='password' border="none" v-model='password'
  21. placeholder="请输入密码,6-16位字符" :type="type" value="">
  22. </u--input> -->
  23. <u-input class='password' border="none" v-model='password' placeholder="请输入密码,6-16位字符"
  24. :type="isShowPassword" :clearable='true'>
  25. <template slot="suffix">
  26. <u-icon name="eye-fill" color="rgb(192, 196, 204)" size="24" @click="passWordStatus(1)"
  27. v-if="isShowPassword=='password'"></u-icon>
  28. <u-icon name="eye-off" color="rgb(192, 196, 204)" size="24" @click="passWordStatus(2)" v-else>
  29. </u-icon>
  30. </template>
  31. </u-input>
  32. </view>
  33. <button :class='phone!=""&&password!=""?"active":""' @click='passlogin'
  34. class='Regular verificationCode'>登录</button>
  35. <button @click='goregister' class='verificationCode active Regular'>手机号一键注册</button>
  36. <view class='flex' style='color:#6A6A6A;margin-top:10px;'>
  37. <view style='flex:1;text-align:center;border-right:1px solid #E8E9ED;' class="Regular"
  38. @click="forgetpass()">忘记密码</view>
  39. <view @click='gocode' style='flex:1;text-align:center;' class="Regular">验证码登录</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import {
  47. mapMutations
  48. } from 'vuex';
  49. import {
  50. openFSqlite,
  51. createFSQL,
  52. selectFSQL,
  53. addFSQL
  54. } from '../../util/f.js'
  55. import helper from '@/common/helper.js';
  56. import {
  57. queryData,
  58. upData,
  59. initData
  60. } from '../../util/dbUtil.js'
  61. import {
  62. mapState
  63. } from 'vuex';
  64. export default {
  65. data() {
  66. return {
  67. isShowPassword: 'password',
  68. inputContent: null,
  69. loginType: "wechat",
  70. phone: '',
  71. password: '',
  72. logining: false,
  73. isPhone: false,
  74. isApple: true,
  75. accessToken: '',
  76. params: {
  77. encryptedData: '',
  78. session_key: '',
  79. iv: '',
  80. },
  81. userInfo: {
  82. nickName: '',
  83. avatarUrl: '',
  84. gender: '',
  85. phone: ''
  86. },
  87. type: 'password',
  88. inputStatus: 'none',
  89. verifyCode: null,
  90. sendText: '获取验证码',
  91. sendDisabled: false,
  92. system: '',
  93. platform: '',
  94. userData: undefined,
  95. canIUseProfile: false
  96. }
  97. },
  98. computed: {
  99. ...mapState(['clientId'])
  100. },
  101. onShow() {
  102. // this.loginType = "wechat"
  103. this.$api.logout()
  104. },
  105. onLoad(options) {
  106. if (wx.getUserProfile) {
  107. console.log('--check getUserProfile--OK');
  108. this.canIUseProfile = true;
  109. }
  110. console.log("login on load")
  111. // var that = this
  112. // that.$request.baseRequest('user', 'sendIsApple', {
  113. // }).then(res => {
  114. // that.isApple = res.data
  115. // })
  116. // uni.getSystemInfo({
  117. // success:(res) => {
  118. // // console.log(res)
  119. // this.system = res.system // ios
  120. // this.platform = res.platform // 14.3
  121. // }
  122. // })
  123. },
  124. methods: {
  125. passWordStatus(type) {
  126. if (type == 1) {
  127. this.isShowPassword = 'text'
  128. } else {
  129. this.isShowPassword = 'password'
  130. }
  131. },
  132. passlogin(e) {debugger
  133. var that = this
  134. uni.showLoading({
  135. title: '登录中',
  136. mask: true
  137. })
  138. console.log("clinetId", this.clientId)
  139. that.$request.baseRequest('get', '/commonUser/login', {
  140. phone: this.phone,
  141. password: this.password,
  142. loginFlag: 1
  143. }).then(res => {
  144. if (res.code == 200) {
  145. console.log("userInfo", res.data)
  146. uni.setStorageSync('userInfo', res.data)
  147. that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  148. reCommonId: this.userInfo.id,
  149. }).then(res3 => {
  150. if (res3.data) {
  151. let name = 'myTip';
  152. let value = res3.data
  153. if (value == 0) {
  154. uni.removeTabBarBadge({
  155. index: 2
  156. })
  157. }
  158. that.$store.commit('$uStore', {
  159. name,
  160. value
  161. });
  162. if (value != 0 && value) {
  163. uni.setTabBarBadge({
  164. index: 2,
  165. text: value + ""
  166. })
  167. }
  168. }
  169. })
  170. // that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  171. // driverPhone: this.phone,
  172. // }).then(res2 => {
  173. // //
  174. // //
  175. // })
  176. // that.$request.baseRequest('post', '/commonUser/api/loginQuickly', {
  177. // mobilePhone: this.phone,
  178. // veriCode: "123456",
  179. // loginFlag: 1
  180. // }).then(res1 => {
  181. // console.log("loginQuickly", res)
  182. // if (res1.code == 200) {
  183. // uni.setStorageSync('pcuserInfo', res1.data)
  184. // that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  185. // reCommonId: this.userInfo.id,
  186. // }).then(res3 => {
  187. // if (res3.data) {
  188. // let name = 'myTip';
  189. // let value = res3.data
  190. // if (value == 0) {
  191. // uni.removeTabBarBadge({
  192. // index: 2
  193. // })
  194. // }
  195. // that.$store.commit('$uStore', {
  196. // name,
  197. // value
  198. // });
  199. // if (value != 0 && value) {
  200. // uni.setTabBarBadge({
  201. // index: 2,
  202. // text: value + ""
  203. // })
  204. // }
  205. // }
  206. // })
  207. // uni.setStorageSync('pcuserInfo', res.data)
  208. // uni.setStorageSync('userInfo', res.data)
  209. // helper.getListByUserId()
  210. // that.$store.commit('login', res.data)
  211. // uni.hideLoading()
  212. // uni.switchTab({
  213. // url: '/pages/goodSource/index'
  214. // });
  215. // } else {
  216. // that.$request.baseRequest('post', '/commonUser/api/loginQuickly', {
  217. // mobilePhone: '14444444444',
  218. // veriCode: "123456",
  219. // loginFlag: 1
  220. // }).then(res2 => {
  221. // that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  222. // reCommonId: this.userInfo.id,
  223. // }).then(res3 => {
  224. // if (res3.data) {
  225. // let name = 'myTip';
  226. // let value = res3.data
  227. // if (value == 0) {
  228. // uni.removeTabBarBadge({
  229. // index: 2
  230. // })
  231. // }
  232. // that.$store.commit('$uStore', {
  233. // name,
  234. // value
  235. // });
  236. // if (value != 0 && value) {
  237. // uni.setTabBarBadge({
  238. // index: 2,
  239. // text: value + ""
  240. // })
  241. // }
  242. // }
  243. // })
  244. // uni.setStorageSync('pcuserInfo', res2.data)
  245. // helper.getListByUserId()
  246. // })
  247. // }
  248. // })
  249. that.$store.commit('login', res.data)
  250. var name = 'userInfo';
  251. var value = res.data;
  252. that.$store.commit('$uStore', {
  253. name,
  254. value
  255. });
  256. // that.liangxinLogin()
  257. uni.switchTab({
  258. url: '/pages/goodSource/index'
  259. });
  260. uni.hideLoading()
  261. } else {
  262. uni.hideLoading()
  263. uni.showToast({
  264. title: res.message,
  265. icon: 'none',
  266. duration: 2000
  267. })
  268. }
  269. })
  270. .catch(res => {
  271. uni.$u.toast(res.message);
  272. });
  273. },
  274. gocode() {
  275. uni.navigateTo({
  276. url: '/pages/public/loginOther'
  277. })
  278. },
  279. forgetpass() {
  280. uni.navigateTo({
  281. url: '/pages/mine/settings/editPassword'
  282. })
  283. },
  284. goregister() {
  285. uni.navigateTo({
  286. url: '/pages/public/register'
  287. })
  288. },
  289. ...mapMutations(['login']),
  290. navBack() {
  291. uni.navigateBack();
  292. },
  293. },
  294. }
  295. </script>
  296. <style lang='scss' scoped>
  297. .apple {
  298. background: #000;
  299. width: 35px;
  300. height: 35px;
  301. padding: 8px;
  302. border-radius: 50%;
  303. vertical-align: middle;
  304. }
  305. page {
  306. background: #fff;
  307. }
  308. .close {
  309. width: 20px;
  310. height: 20px;
  311. position: absolute;
  312. right: 0px;
  313. }
  314. .close1 {
  315. width: 20px;
  316. height: 20px;
  317. position: absolute;
  318. right: 10px;
  319. top: 0;
  320. }
  321. .close2 {
  322. width: 15px;
  323. height: 15px;
  324. position: absolute;
  325. right: 19px;
  326. top: 50%;
  327. transform: translateY(-45%);
  328. }
  329. .password {
  330. border: none;
  331. outline: none;
  332. }
  333. .cuIcon-weixin {
  334. background: #2772FB;
  335. color: #fff;
  336. font-size: 18px;
  337. padding: 9px;
  338. border-radius: 50%;
  339. vertical-align: middle;
  340. margin-right: 5px;
  341. }
  342. .container {
  343. /* padding-top: 85px; */
  344. position: relative;
  345. width: 100vw;
  346. height: 100vh;
  347. overflow: hidden;
  348. background: url('~@/static/images/mine/bg@2x.png');
  349. background-size: cover;
  350. }
  351. .wrapper {
  352. position: relative;
  353. z-index: 90;
  354. padding-bottom: 40upx;
  355. height: 100%;
  356. padding: 0 30px;
  357. }
  358. .back-btn {
  359. position: absolute;
  360. left: 40upx;
  361. z-index: 9999;
  362. padding-top: var(--status-bar-height);
  363. top: 40upx;
  364. font-size: 40upx;
  365. color: red;
  366. }
  367. .verificationCode {
  368. margin-top: 20px;
  369. background: #F5F6F9;
  370. color: #AFB3BF;
  371. }
  372. .verificationCode:after {
  373. border: none;
  374. }
  375. .verificationCode.active {
  376. background: #2772FB;
  377. color: #fff;
  378. }
  379. .register {
  380. /* position:absolute; */
  381. bottom: 20px;
  382. left: 50%;
  383. transform: translateX(-50%);
  384. color: #333333;
  385. height: 50px;
  386. line-height: 50px;
  387. border-radius: 30px;
  388. border: 1px solid #444444;
  389. }
  390. .register:after {
  391. border: none;
  392. }
  393. .phone-before-num {
  394. font-size: 34rpx;
  395. color: #333333;
  396. border-right: 1px solid #E8E9ED;
  397. padding-right: 20rpx;
  398. }
  399. .phone-number {
  400. margin-left: 20rpx;
  401. font-size: 34rpx;
  402. font-family: DINPro-Medium, DINPro;
  403. font-weight: 500;
  404. color: #333333;
  405. }
  406. </style>