logo0125.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <template>
  2. <view class="wrap">
  3. <!--年会注册 -->
  4. <view class="login">
  5. <view class="login-title-linear-gradient">
  6. <view class="login-title">
  7. <img style="height:80rpx;" src="@/assets/logo/logo-nezha.png"></img>
  8. </view>
  9. <view class="login-title" style="padding-top: 40rpx;">
  10. <!-- <h3>哪吒车主登录/注册</h3> -->
  11. <img style="height:80rpx;" src="@/assets/img/nazha0125.png"></img>
  12. <p>欢迎来到{{projectName}}</p>
  13. <p v-if="activityInfo"><span style="color: red;">*</span>正在参加活动<span style="color: #3fbd70;">
  14. &lt;邀请有礼>
  15. </span></p>
  16. </view>
  17. <view class="login-form">
  18. <view class="login-form-item">
  19. <view class="title">手机号</view>
  20. <view class="input">
  21. <u-input :customStyle="customStyle" :placeholderStyle="placeholderStyle"
  22. v-model="form.telephone" type="number" placeholder="请输入手机号"
  23. placeholder-style="font-size:16px;color:#ccc;" />
  24. </view>
  25. <view class="tips">未注册的手机号验证后将自动注册</view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="login-form">
  30. <view class="login-form-item">
  31. <view class="title">验证码</view>
  32. <view class="input">
  33. <u-input :customStyle="customStyle" :placeholderStyle="placeholderStyle"
  34. v-model="form.verifyCode" type="number" placeholder="请输入验证码"
  35. placeholder-style="font-size:16px;color:#ccc;" />
  36. <view class="code" :style="isCodeTipsColor ? 'color: #999999;' : ''" @click="getCode">
  37. {{codeTips}}</view>
  38. </view>
  39. <view style="width: 350px;">
  40. <u-checkbox-group>
  41. <u-checkbox class="tips" active-color="green" v-model="value" shape="circle"
  42. @change="checkboxChange()"></u-checkbox>
  43. </u-checkbox-group>
  44. <span style="font-size: 24rpx;">我已阅读并同意</span>
  45. <span @click="gotoUrl('pages/article/details?code=YHXY')" style="color: #3fbd70;font-size: 24rpx;">《会员协议》</span>和
  46. <span @click="gotoUrl('pages/article/details?code=YSZC')" style="color: #3fbd70;font-size: 24rpx;">《隐私协议》</span>
  47. </view>
  48. </view>
  49. </view>
  50. <u-button :style="[inputStyle]" class="login-btn" type="success" shape="circle" @click="login">登录</u-button>
  51. <u-verification-code :seconds="sendMsgSecond" ref="uCode" @change="codeChange" @end="end" @start="start"
  52. change-text="已发送(Xs)">
  53. </u-verification-code>
  54. </view>
  55. <view class="foot" v-if="!show2">
  56. <span style="color: red;">*</span>我们将使用您的微信昵称及头像,为您补全本平台帐号相关基础信息,请点击下方“<span
  57. style="color: #3fbd70;">使用完整服务</span>”。
  58. </view>
  59. <u-modal v-model="show1" @confirm="gotoGz" cancel-text="暂不关注" confirm-text="前往关注" :show-cancel-button="false"
  60. confirm-color="#53b56b" ref="uModal2" :asyncClose="true">
  61. <view style="padding: 15px;">请先关注<span style=" color: #53b56b;">{{projectName}}</span>公众号,然后进行会员注册</view>
  62. </u-modal>
  63. </view>
  64. </template>
  65. <script>
  66. import * as loginApi from '@/apis/login.js'
  67. import * as API from '@/apis/index.js'
  68. import * as API_weixin from '@/apis/weixin.js'
  69. import {
  70. checkPhone
  71. } from '@/utils'
  72. export default {
  73. data() {
  74. return {
  75. elderMode: false,
  76. customStyle: {
  77. 'font-size': '28rpx'
  78. },
  79. placeholderStyle: "font-size:28rpx",
  80. form: {
  81. telephone: '',
  82. verifyCode: '',
  83. },
  84. activityInfo: null,
  85. isSendMsgIng: false,
  86. isCodeTipsColor: false,
  87. sendMsgSecond: 60,
  88. codeTips: '',
  89. value: false,
  90. code: '',
  91. codeId: '',
  92. projectName: '',
  93. show1: false,
  94. show2: false,
  95. show3: false,
  96. touristBl: false,
  97. personInfo: null,
  98. member: false,
  99. }
  100. },
  101. computed: {
  102. inputStyle() {
  103. let style = {};
  104. if (this.form.telephone) {
  105. style.color = "#fff";
  106. style.backgroundColor = this.$u.color['success'];
  107. }
  108. return style;
  109. }
  110. },
  111. onLoad(op) {
  112. this.projectName = process.car.ProjectName;
  113. if (op.member) {
  114. this.member = true;
  115. }
  116. if (op.jpcode2) {
  117. this.code = op.jpcode2;
  118. }
  119. if (op.codeId) {
  120. this.codeId = op.codeId;
  121. }
  122. if (op.jpcode) {
  123. var str1 = op.jpcode.slice(0, 19);
  124. var str2 = op.jpcode.slice(20, 21);
  125. var str3 = op.jpcode.slice(22);
  126. if (str1 == 'jp_team51_charge_id') {
  127. if (str2 == 'A') {
  128. this.code = str2;
  129. this.codeId = str3;
  130. uni.showToast({
  131. title: "注册后享受充电服务"
  132. })
  133. }
  134. }
  135. }
  136. var obj = this.carhelp.get("friends_invitation")
  137. if (obj) {
  138. if (obj.date + 1000 * 60 * 60 * 24 > new Date().getTime()) {
  139. this.form.inviteId = obj.op.uid
  140. this.form.code = obj.op.icode
  141. this.activityInfo = "true";
  142. }
  143. }
  144. this.personInfo = this.carhelp.getPersonInfo()
  145. if (this.personInfo) {
  146. if (this.personInfo.userType == "1") {
  147. } else {
  148. this.loginresponse()
  149. // uni.redirectTo({
  150. // url: '/pages/index/index'
  151. // })
  152. }
  153. } else {
  154. }
  155. },
  156. onReady() {
  157. this.elderMode = this.carhelp.get('getElderModeClass') == '长辈模式';
  158. if (this.elderMode)
  159. this.theme('elder')
  160. else
  161. this.theme('standard')
  162. },
  163. onShow() {
  164. this.checkSubscribe()
  165. },
  166. methods: {
  167. loginresponse(response, bl) {
  168. //giveCard(){
  169. //var NODE_NAME= process.env['NODE_NAME']
  170. if(response){
  171. var token = response ? response.data.token : '';
  172. this.carhelp.setToken(token);
  173. this.carhelp.setPersonInfo(response.data.regUser);
  174. }
  175. uni.hideLoading();
  176. loginApi.giveCard().then((response2) => {
  177. uni.showModal({
  178. title: '提示',
  179. showCancel:false,
  180. content: response2.message,
  181. success: res => {
  182. if (res.confirm) {
  183. //付钱 改为组件
  184. this.loginresponse2(response,true,true);
  185. } else if (res.cancel) {
  186. //('用户点击取消');
  187. }
  188. }
  189. });
  190. }).catch(error => {
  191. uni.showModal({
  192. title: '提示',
  193. content: error,
  194. showCancel:false,
  195. success: res => {
  196. if (res.confirm) {
  197. //付钱 改为组件
  198. this.loginresponse2(response,true,false);
  199. } else if (res.cancel) {
  200. //('用户点击取消');
  201. }
  202. }
  203. });
  204. //this.loginresponse2(response,true,false);
  205. })
  206. },
  207. touristConfirm() {
  208. uni.showLoading({
  209. title: "加载中",
  210. mask: true,
  211. })
  212. this.form.nickName = this.carhelp.getUserInfo().nickname;
  213. this.form.headImg = this.carhelp.getUserInfo().headimgurl;
  214. this.form.openId = this.carhelp.getOpenId();
  215. this.form.source = 2 //创建渠道1电单车2电车
  216. loginApi.registerGuest(this.form).then((response) => {
  217. this.loginresponse(response,true);
  218. }).catch(error => {
  219. uni.showToast({
  220. title: error,
  221. icon: "none"
  222. })
  223. })
  224. },
  225. gotoGz() {
  226. this.carhelp.setGzDate()
  227. var url = process.car.gzUrl;
  228. window.location.href = url
  229. },
  230. checkSubscribe() {
  231. API_weixin.checkSubscribe({
  232. openId: this.carhelp.getOpenId()
  233. }).then((res) => {
  234. if (res.data == "0") {
  235. this.show1 = true
  236. } else {
  237. //this.init();
  238. this.show1 = false;
  239. this.show2 = true;
  240. //this.carhelp.setGzDate()
  241. }
  242. //setGzDate
  243. }).catch(error => {
  244. uni.showToast({
  245. title: error
  246. })
  247. })
  248. },
  249. theme(type) {
  250. if (type == 'elder') {
  251. document.getElementsByTagName('body')[0].setAttribute('data-theme', type);
  252. let data = {
  253. "font-size": '32rpx',
  254. };
  255. this.customStyle = data;
  256. this.placeholderStyle = "font-size:32rpx"; //data;
  257. } else {
  258. document.getElementsByTagName('body')[0].setAttribute('data-theme', type);
  259. let data = {
  260. "font-size": '28rpx',
  261. };
  262. this.customStyle = data;
  263. this.placeholderStyle = "font-size:28rpx"; //data;
  264. }
  265. },
  266. codeChange(text) {
  267. this.codeTips = text;
  268. },
  269. start() {
  270. if (!this.isSendMsgIng) {
  271. uni.showLoading({
  272. title: "加载中",
  273. mask: true,
  274. })
  275. loginApi.getVerifyCode(this.form.telephone).then((response) => {
  276. uni.hideLoading();
  277. this.carhelp.set("getvcodetime", new Date().getTime());
  278. if (!"") {
  279. //倒计时
  280. uni.showToast({
  281. title: "发送成功"
  282. })
  283. } else {
  284. uni.showToast({
  285. title: "您的验证码已经发送[5分钟有效],请勿重复点击"
  286. })
  287. }
  288. }).catch(error => {
  289. uni.showToast({
  290. title: error,
  291. icon: "none"
  292. })
  293. })
  294. }
  295. },
  296. //倒计时
  297. end() {
  298. this.sendMsgSecond = 60;
  299. this.isSendMsgIng = false;
  300. this.isCodeTipsColor = false;
  301. },
  302. // 获取验证码
  303. getCode() {
  304. if (this.$refs.uCode.canGetCode) {} else {
  305. uni.showToast({
  306. title: '倒计时结束后再发送',
  307. icon: "none"
  308. })
  309. return
  310. }
  311. var checkPhoneResult = checkPhone(this.form.telephone);
  312. if (checkPhoneResult !== true) {
  313. uni.showToast({
  314. title: checkPhoneResult,
  315. })
  316. return;
  317. }
  318. this.$refs.uCode.start();
  319. this.isCodeTipsColor = true;
  320. },
  321. checkboxChange() {
  322. this.value = !this.value;
  323. },
  324. loginresponse2(response, bl,bl2) {
  325. uni.hideLoading();
  326. if(!response){
  327. if(bl2){
  328. uni.redirectTo({
  329. url: '/pages/cardBag/cardBag?k=1'
  330. })
  331. }else{
  332. uni.redirectTo({
  333. url: '/pages/index/index'
  334. })
  335. }
  336. }else{
  337. var token = response ? response.data.token : '';
  338. this.carhelp.setToken(token);
  339. this.carhelp.setPersonInfo(response.data.regUser);
  340. if(bl2){
  341. uni.redirectTo({
  342. url: '/pages/cardBag/cardBag?k=1'
  343. })
  344. }else if (!bl && !response.data.regUser.carId) {
  345. var url = "/pages/login/completeInfo?login=1"
  346. if (this.code == 'A') {
  347. url += "&jpcode=jp_team51_charge_id:A_" + this.codeId
  348. }
  349. uni.redirectTo({
  350. url: url
  351. })
  352. } else if (this.code == 'A') {
  353. var k = API.codeOperation("jp_team51_charge_id:A_" + this.codeId);
  354. if (k) {
  355. uni.redirectTo({
  356. url: k
  357. })
  358. }
  359. }else if(this.code == 'card'){
  360. uni.redirectTo({
  361. url: '/pages/cardBag/cardDetail?id='+ this.codeId
  362. })
  363. }else if (this.code == 'invoice') {
  364. uni.redirectTo({
  365. url: '/pages/MyInvoice/invoiceManagement'
  366. })
  367. }else {
  368. uni.redirectTo({
  369. url: '/pages/index/index'
  370. })
  371. }
  372. }
  373. },
  374. login() {
  375. // if(!this.show2){
  376. // this.show1=true;
  377. // return
  378. // }
  379. var checkPhoneResult = checkPhone(this.form.telephone);
  380. if (!this.form.telephone || checkPhoneResult != true) {
  381. uni.showToast({
  382. title: checkPhoneResult,
  383. icon: "none"
  384. })
  385. return;
  386. }
  387. if (!this.form.verifyCode) {
  388. uni.showToast({
  389. title: "请输入验证码",
  390. icon: "none"
  391. })
  392. return
  393. }
  394. if (!this.value) {
  395. uni.showToast({
  396. title: "请勾选协议",
  397. icon: "none"
  398. })
  399. return
  400. }
  401. uni.showLoading({
  402. title: "加载中",
  403. mask: true,
  404. })
  405. //this.form.nickName= this.form.telephone;
  406. this.form.nickName = this.carhelp.getUserInfo().nickname;
  407. this.form.headImg = this.carhelp.getUserInfo().headimgurl;
  408. this.form.openId = this.carhelp.getOpenId();
  409. this.form.source = 2 //创建渠道1电单车2电车
  410. if (this.personInfo && this.personInfo.userType == "1") {
  411. loginApi.validateGuestCode(this.form).then((response) => {
  412. this.loginresponse(response, true)
  413. }).catch(error => {
  414. uni.showToast({
  415. title: error,
  416. icon: "none"
  417. })
  418. })
  419. } else {
  420. loginApi.validateCode(this.form).then((response) => {
  421. this.loginresponse(response)
  422. }).catch(error => {
  423. uni.showToast({
  424. title: error,
  425. icon: "none"
  426. })
  427. })
  428. }
  429. }
  430. }
  431. }
  432. </script>
  433. <style>
  434. page {
  435. background-color: #fff;
  436. }
  437. </style>
  438. <style lang="scss" scoped>
  439. .login-title-span{
  440. font-size: 36rpx;
  441. float: right;
  442. color:#00B962
  443. }
  444. .classtable{
  445. margin: 0rpx 40rpx;
  446. .td1{
  447. width: 50rpx;
  448. padding: 12rpx 0;
  449. text-align: center;
  450. img{
  451. width: 48rpx;
  452. height: 48rpx;
  453. }
  454. font-size: 10px;
  455. }
  456. .td2{
  457. padding-left: 16rpx;
  458. font-size: 12px;
  459. line-height: 24px;
  460. .dian{
  461. padding :0 10rpx
  462. }
  463. }
  464. }
  465. .btnview{
  466. display: flex;
  467. flex-direction: column;
  468. align-items: center;
  469. .btnview1{
  470. }
  471. .btnview2{
  472. color:#999999 ;
  473. padding-bottom:38rpx ;
  474. }
  475. }
  476. .foot {
  477. position: fixed;
  478. left: 0;
  479. right: 0;
  480. bottom: 0;
  481. background-color: #fff;
  482. padding: 0 10px;
  483. }
  484. @import "@/_theme.scss";
  485. .all {
  486. @include themeify {
  487. font-size: themed('font-size2');
  488. }
  489. }
  490. ::v-deep .placeholderStyle {
  491. font-size: themed('font-size2');
  492. }
  493. .wrap {
  494. //background: linear-gradient(#D6EEDC, #F3F4F4);
  495. @include themeify {
  496. font-size: themed('font-size2');
  497. }
  498. /* font-size: 28rpx;*/
  499. .login {
  500. //width: 600rpx;
  501. //
  502. .login-title-linear-gradient {
  503. background: linear-gradient(180deg, rgba(160,188,255,1) 0%,rgba(160,188,255,0) 100%);
  504. }
  505. .login-title {
  506. padding: 0 56rpx 0 56rpx;
  507. padding-top: 80rpx;
  508. text-align: left;
  509. h3 {
  510. color: rgba(16, 16, 16, 1);
  511. font-size: 56rpx;
  512. /* ;*/
  513. font-weight: bold;
  514. font-family: AlibabaPuHui-bold;
  515. }
  516. p {
  517. margin-top: 4px;
  518. color: #777
  519. }
  520. }
  521. .login-form-item {
  522. margin: 0 56rpx;
  523. width: 600rpx;
  524. margin-top: 40px;
  525. .title {
  526. margin-bottom: 8px;
  527. color: rgba(16, 16, 16, 1);
  528. font-size: 36rpx;
  529. @include themeify {
  530. font-weight: themed('fontWeight');
  531. letter-spacing: themed('letterSpacing');
  532. }
  533. }
  534. .input {
  535. border-bottom: 1px solid #f7f7f7;
  536. position: relative;
  537. box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  538. }
  539. .code {
  540. position: absolute;
  541. right: 0;
  542. top: 7px;
  543. color: rgb(63, 189, 112);
  544. }
  545. .tips {
  546. color: $u-type-info;
  547. margin-top: 12px;
  548. @include themeify {
  549. font-size: themed('font-size1');
  550. }
  551. /* font-size: 12px;*/
  552. span {
  553. color: #3fbd70;
  554. }
  555. }
  556. }
  557. .login-btn {
  558. width: 600rpx;
  559. margin: 0 auto;
  560. margin-top: 40px;
  561. background-color: #a7dbc2;
  562. @include themeify {
  563. font-size: themed('font-size3');
  564. }
  565. }
  566. .alternative {
  567. color: $u-tips-color;
  568. display: flex;
  569. justify-content: space-between;
  570. margin-top: 30rpx;
  571. }
  572. }
  573. }
  574. ::v-deep .uni-input-placeholder{
  575. color:#ccc
  576. }
  577. .u-checkbox-group{
  578. width: 40rpx;
  579. }
  580. </style>