login.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  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:93%;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. <input placeholder-style="color:#AFB3BF" v-model="phone" border="none" type='number' placeholder="请输入手机号码" class="phone-number"
  18. maxlength='11' >
  19. </view>
  20. </view>
  21. <view style='margin-top:20px;border-bottom:1px solid #E8E9ED;position:relative;height:40px'>
  22. <view style='position:relative;'>
  23. <input placeholder-style="color:#AFB3BF" class='password' v-model='password' v-if="isShowPassword=='password'" placeholder="请输入密码" type="password">
  24. <input placeholder-style="color:#AFB3BF" class='password' v-model='password' v-else type="text" placeholder="请输入密码">
  25. <!-- <u-icon name="eye-off" color="rgb(192, 196, 204)" size="24" @click="passWordStatus(2)" v-else>
  26. </u-icon> -->
  27. <image class='yanjingicon' style='width:22px;height:22px;' @click="passWordStatus(1)" v-if="isShowPassword=='password'" src="../../static/xianshi.png" mode=""></image>
  28. <image class='yanjingicon' style='width:22px;height:22px;' @click="passWordStatus(2)" v-else src="../../static/yioncang.png" mode=""></image>
  29. </view>
  30. </view>
  31. <button :class='phone!=""&&password!=""?"active":""' @click='passlogin'
  32. class='Regular verificationCode'>登录</button>
  33. <button @click='goregister' class='verificationCode active Regular'>手机号一键注册</button>
  34. <view class='flex' style='color:#6A6A6A;margin-top:10px;'>
  35. <view style='flex:1;text-align:center;border-right:1px solid #E8E9ED;' class="Regular"
  36. @click="forgetpass()">忘记密码</view>
  37. <view @click='gocode' style='flex:1;text-align:center;' class="Regular">验证码登录</view>
  38. </view>
  39. </view>
  40. <u-toast ref="uToast"></u-toast>
  41. <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' confirmText='退出登录' :showCancelButton='true' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick" @cancel="cancelClick"></u-modal>
  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. isShowAlert:false,
  68. alertTitle:'当前账号已禁用',
  69. isShowPassword: 'password',
  70. inputContent: null,
  71. loginType: "wechat",
  72. phone: '',
  73. password: '',
  74. logining: false,
  75. isPhone: false,
  76. isApple: true,
  77. accessToken: '',
  78. params: {
  79. encryptedData: '',
  80. session_key: '',
  81. iv: '',
  82. },
  83. userInfo: {
  84. nickName: '',
  85. avatarUrl: '',
  86. gender: '',
  87. phone: ''
  88. },
  89. type: 'password',
  90. inputStatus: 'none',
  91. verifyCode: null,
  92. sendText: '获取验证码',
  93. sendDisabled: false,
  94. system: '',
  95. platform: '',
  96. userData: undefined,
  97. canIUseProfile: false
  98. }
  99. },
  100. computed: {
  101. ...mapState(['clientId'])
  102. },
  103. onShow() {
  104. // this.loginType = "wechat"
  105. this.$api.logout()
  106. },
  107. onLoad(options) {
  108. if (wx.getUserProfile) {
  109. console.log('--check getUserProfile--OK');
  110. this.canIUseProfile = true;
  111. }
  112. console.log("login on load")
  113. // var that = this
  114. // that.$request.baseRequest('user', 'sendIsApple', {
  115. // }).then(res => {
  116. // that.isApple = res.data
  117. // })
  118. // uni.getSystemInfo({
  119. // success:(res) => {
  120. // // console.log(res)
  121. // this.system = res.system // ios
  122. // this.platform = res.platform // 14.3
  123. // }
  124. // })
  125. },
  126. methods: {
  127. passWordStatus(type) {
  128. if (type == 1) {
  129. this.isShowPassword = 'text'
  130. } else {
  131. this.isShowPassword = 'password'
  132. }
  133. },
  134. cancelClick(){
  135. this.isShowAlert = false
  136. },
  137. confirmClick(){
  138. if (uni.getSystemInfoSync().platform == 'ios'){
  139. plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  140. } else if (uni.getSystemInfoSync().platform == 'android'){
  141. plus.runtime.quit();
  142. }
  143. },
  144. passlogin(e) {
  145. var that = this
  146. that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  147. driverPhone: this.phone,
  148. }).then(res => {
  149. if (res.data.authenticationStatus == '已禁用') {
  150. that.$refs.uToast.show({
  151. type: 'error',
  152. message: "账号审核中!"
  153. })
  154. } else {
  155. uni.showLoading({
  156. title: '登录中',
  157. mask: true
  158. })
  159. console.log("clinetId", this.clientId)
  160. that.$request.baseRequest('get', '/commonUser/login', {
  161. phone: that.phone,
  162. password: that.password,
  163. loginFlag: 2,
  164. identification: 1
  165. }).then(res => {
  166. if (res.code == 200) {
  167. console.log("userInfo", res.data)
  168. uni.setStorageSync('userInfo', res.data)
  169. that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  170. reCommonId: that.userInfo.id,
  171. }).then(res3 => {
  172. if (res3.data) {
  173. let name = 'myTip';
  174. let value = res3.data
  175. if (value == 0) {
  176. uni.removeTabBarBadge({
  177. index: 2
  178. })
  179. }
  180. that.$store.commit('$uStore', {
  181. name,
  182. value
  183. });
  184. if (value != 0 && value) {
  185. uni.setTabBarBadge({
  186. index: 2,
  187. text: value + ""
  188. })
  189. }
  190. }
  191. })
  192. that.$request.baseRequest('get', '/orderInfo/getData', {
  193. commonId:uni.getStorageSync('userInfo').id,
  194. }).then(res1 => {
  195. if(res1.data.length>0){
  196. that.$helper.fUN_AmapLocation.start({
  197. intervalTime: 5000,
  198. isReport: false
  199. },
  200. res => {
  201. // console.log('====确认装车开启连续定位====');
  202. // console.log(res)
  203. let _data = {
  204. orderId: res1.data[0].id,
  205. longitude: res.longitude,
  206. latitude: res.latitude,
  207. province: res.province,
  208. city: res.city,
  209. area: res.district
  210. }
  211. that.$helper.gjList.push(_data)
  212. uni.setStorageSync('mapGJ', that.$helper.gjList);
  213. // console.log('this.$helper.gjList')
  214. // console.log(this.$helper.gjList)
  215. // console.log("条数", uni.getStorageSync('mapGJ').length)
  216. if (uni.getStorageSync('mapGJ').length > 100) {
  217. console.log(JSON.stringify(uni.getStorageSync('mapGJ')) )
  218. that.$request.baseRequest('post', '/hyOrderTravelPath/api/addInfo', {
  219. orderId:"cdae6ec34c2349768c490a9fefa03fb3",
  220. longitudeLatitude:JSON.stringify(uni.getStorageSync('mapGJ'))
  221. }).then(res => {
  222. uni.removeStorageSync('mapGJ');
  223. that.$helper.gjList = []
  224. })
  225. .catch(res => {
  226. uni.$u.toast(res.message);
  227. });
  228. }
  229. //判断缓存数据条数,超过reportInterval时清空缓存,重新存入缓存
  230. }
  231. );
  232. }
  233. })
  234. that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  235. driverPhone: this.phone,
  236. }).then(res2 => {
  237. if(res.data.statusFlag=='已禁用'){
  238. this.isShowAlert = true
  239. uni.hideLoading()
  240. return
  241. }
  242. uni.setStorageSync('pcuserInfo', res.data)
  243. uni.setStorageSync('userInfo', res.data)
  244. uni.setStorageSync('firstAuthentication', res2.data)
  245. helper.getListByUserId()
  246. that.$store.commit('login', res.data)
  247. var name = 'userInfo';
  248. var value = res.data;
  249. that.$store.commit('$uStore', {
  250. name,
  251. value
  252. });
  253. uni.switchTab({
  254. url: '/pages/goodSource/index'
  255. });
  256. uni.hideLoading()
  257. uni.switchTab({
  258. url: '/pages/goodSource/index'
  259. });
  260. uni.hideLoading()
  261. })
  262. } else {
  263. uni.hideLoading()
  264. uni.showToast({
  265. title: res.message,
  266. icon: 'none',
  267. duration: 2000
  268. })
  269. }
  270. })
  271. .catch(res => {
  272. uni.$u.toast(res.message);
  273. });
  274. }
  275. })
  276. },
  277. gocode() {
  278. uni.navigateTo({
  279. url: '/pages/public/loginOther'
  280. })
  281. },
  282. forgetpass() {
  283. uni.navigateTo({
  284. url: '/pages/mine/settings/editPassword'
  285. })
  286. },
  287. goregister() {
  288. uni.navigateTo({
  289. url: '/pages/public/register'
  290. })
  291. },
  292. ...mapMutations(['login']),
  293. navBack() {
  294. uni.navigateBack();
  295. },
  296. },
  297. }
  298. </script>
  299. <style lang='scss' scoped>
  300. .apple {
  301. background: #000;
  302. width: 35px;
  303. height: 35px;
  304. padding: 8px;
  305. border-radius: 50%;
  306. vertical-align: middle;
  307. }
  308. page {
  309. background: #fff;
  310. }
  311. .yanjingicon{
  312. position:absolute;
  313. right:0;
  314. top:50%;
  315. transform: translate(-50%,-50%);
  316. }
  317. .close {
  318. width: 20px;
  319. height: 20px;
  320. position: absolute;
  321. right: 0px;
  322. }
  323. .close1 {
  324. width: 20px;
  325. height: 20px;
  326. position: absolute;
  327. right: 10px;
  328. top: 0;
  329. }
  330. .close2 {
  331. width: 15px;
  332. height: 15px;
  333. position: absolute;
  334. right: 19px;
  335. top: 50%;
  336. transform: translateY(-45%);
  337. }
  338. .password {
  339. border: none;
  340. outline: none;
  341. }
  342. .cuIcon-weixin {
  343. background: #2772FB;
  344. color: #fff;
  345. font-size: 18px;
  346. padding: 9px;
  347. border-radius: 50%;
  348. vertical-align: middle;
  349. margin-right: 5px;
  350. }
  351. .container {
  352. /* padding-top: 85px; */
  353. position: relative;
  354. width: 100vw;
  355. height: 100vh;
  356. overflow: hidden;
  357. background: url('~@/static/images/mine/bg@2x.png');
  358. background-size: cover;
  359. }
  360. .wrapper {
  361. position: relative;
  362. z-index: 90;
  363. padding-bottom: 40upx;
  364. height: 100%;
  365. padding: 0 30px;
  366. }
  367. .back-btn {
  368. position: absolute;
  369. left: 40upx;
  370. z-index: 9999;
  371. padding-top: var(--status-bar-height);
  372. top: 40upx;
  373. font-size: 40upx;
  374. color: red;
  375. }
  376. .verificationCode {
  377. margin-top: 20px;
  378. background: #F5F6F9;
  379. color: #AFB3BF;
  380. }
  381. .verificationCode:after {
  382. border: none;
  383. }
  384. .verificationCode.active {
  385. background: #2772FB;
  386. color: #fff;
  387. }
  388. .register {
  389. /* position:absolute; */
  390. bottom: 20px;
  391. left: 50%;
  392. transform: translateX(-50%);
  393. color: #333333;
  394. height: 50px;
  395. line-height: 50px;
  396. border-radius: 30px;
  397. border: 1px solid #444444;
  398. }
  399. .register:after {
  400. border: none;
  401. }
  402. .phone-before-num {
  403. font-size: 34rpx;
  404. color: #333333;
  405. border-right: 1px solid #E8E9ED;
  406. padding-right: 20rpx;
  407. }
  408. .phone-number {
  409. margin-left: 20rpx;
  410. font-size: 34rpx;
  411. font-family: DINPro-Medium, DINPro;
  412. font-weight: 500;
  413. color: #333333;
  414. }
  415. </style>