login.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  1. <template>
  2. <view class="">
  3. <view class="top">
  4. </view>
  5. <view class="content" style="height: 85vh;">
  6. <scroll-view style="border-radius: 20rpx;padding-left: 20rpx;" scroll-x class="bg-white nav" scroll-with-animation :scroll-left="scrollLeft">
  7. <view class="cu-item text-lg" :class="index==current?'text-checked text-bold cur':''" v-for="(item,index) in list" :key="index" @tap="tabSelect(index)" >
  8. {{item.name}}
  9. </view>
  10. </scroll-view>
  11. <view class="item">
  12. <swiper :circular="true" style="height: 100%;" :current="current" @change="swiperChange"
  13. @animationfinish="animationfinish">
  14. <swiper-item style="height: 100%;">
  15. <view class="flex justify-center flex-direction align-center">
  16. <image style="width: 120rpx;height: 120rpx;" src="../../static/login/yuangong.png" ></image>
  17. </view>
  18. <view class="input">
  19. <image src="../../static/login/yuanqu.png" mode=""></image>
  20. <input disabled v-model="agencyName" @click="agencyShow = true" placeholder="请选择您所在的园区" type="text" value="" />
  21. </view>
  22. <view class="input">
  23. <image class="phone" src="../../static/login/phone.png" mode=""></image>
  24. <input v-model="phone" placeholder="请输入您的手机号码" type="text" value="" />
  25. </view>
  26. <view class="input" style="position: relative;">
  27. <image src="../../static/login/code.png" mode=""></image>
  28. <input v-model="yzm" style="width: 60%;" placeholder="请输入验证码" type="text" value="" />
  29. <view :style="showText?'':'background-color: #A7A7A7;'" class="code" @click="getCode()">{{tips}}</view>
  30. </view>
  31. </swiper-item>
  32. <swiper-item >
  33. <view class="flex justify-center flex-direction align-center">
  34. <image style="width: 90rpx;height: 90rpx;" src="../../static/login/qiye.png" ></image>
  35. </view>
  36. <view class="input">
  37. <image src="../../static/login/yuanqu.png" mode=""></image>
  38. <input disabled v-model="agencyName" @click="agencyShow = true" placeholder="请选择您所在的园区" type="text" value="" />
  39. </view>
  40. <view class="input">
  41. <image class="qiye" src="../../static/login/qiye.png" mode=""></image>
  42. <input disabled v-model="enterpriseName" @click="enterpriseShow = true" placeholder="请选择您所在的企业" type="text" value="" />
  43. </view>
  44. <view class="input" >
  45. <image src="../../static/login/account.png" mode=""></image>
  46. <input v-model="enterpriseAccount" style="width: 60%;" placeholder="请输入您的登录账号" type="text" value="" />
  47. </view>
  48. <view class="input" >
  49. <image src="../../static/login/password.png" mode=""></image>
  50. <input v-model="enterprisePassword" style="width: 60%;" placeholder="请输入您的登录密码" type="password" value="" />
  51. </view>
  52. </swiper-item>
  53. <swiper-item >
  54. <view class="flex justify-center " >
  55. <image style="width: 120rpx;height: 120rpx;" src="../../static/login/guanliyuan.png" ></image>
  56. </view>
  57. <view class="input">
  58. <image src="../../static/login/yuanqu.png" mode=""></image>
  59. <input disabled v-model="agencyName" @click="agencyShow = true" placeholder="请选择您所在的园区" type="text" value="" />
  60. </view>
  61. <view class="input" >
  62. <image src="../../static/login/account.png" mode=""></image>
  63. <input v-model="agencyAccount" style="width: 60%;" placeholder="请输入您的登录账号" type="text" value="" />
  64. </view>
  65. <view class="input" >
  66. <image src="../../static/login/password.png" mode=""></image>
  67. <input type="password" v-model="agencyPassword" style="width: 60%;" placeholder="请输入您的登录密码" value="" />
  68. </view>
  69. </swiper-item>
  70. <swiper-item >
  71. <view class="flex justify-center flex-direction align-center">
  72. <image style="width: 100rpx;height: 100rpx;" src="../../static/login/fangke.png"></image>
  73. </view>
  74. <view class="input">
  75. <image class="qiye" src="../../static/login/time.png" mode=""></image>
  76. <input disabled v-model="interviewTime" @click="interviewTimeShow = true" placeholder="请选择访问时间" type="text" value="" />
  77. </view>
  78. <view class="input">
  79. <image src="../../static/login/yuanqu.png" mode=""></image>
  80. <input disabled v-model="agencyName" @click="agencyShow = true" placeholder="请选择您要访问的园区" type="text" value="" />
  81. </view>
  82. <view class="input">
  83. <image class="qiye" src="../../static/login/qiye.png" mode=""></image>
  84. <input disabled v-model="enterpriseName" @click="enterpriseShow = true" placeholder="请选择您要访问的企业 (选填)" type="text" value="" />
  85. </view>
  86. <view @click="jump('/pages/guest/records/records')" class="text-center base-color padding-top-50 text-lg">
  87. <text style="text-decoration: underline;">申请记录</text>
  88. </view>
  89. </swiper-item>
  90. </swiper>
  91. </view>
  92. <button v-if="current!=3" class="button" @click="login()">登 录</button>
  93. <button v-else class="button" @click="applyOpenDoor">申请开门</button>
  94. </view>
  95. <!-- 园区 -->
  96. <u-popup border-radius="60" height="60%" mode="bottom" v-model="agencyShow">
  97. <view class="fixed cu-bar search bg-white">
  98. <view class="search-form round">
  99. <text class="cuIcon-search"></text>
  100. <u-input style="width: 90%;" v-model="agencyKeyWord" type="text" :adjust-position="false" placeholder="请输入关键字搜索" confirm-type="search"/>
  101. </view>
  102. </view>
  103. <scroll-view v-if="!$isEmpty(agencyList)" style="padding-top: 110rpx;height: 100%;" :scroll-y="true" >
  104. <view @click="selectAgency(item)" hover-class="hoverClass" class="text-center padding-30 solid-bottom" v-for="(item,index) in agencyList" :key="index">
  105. <text>{{item.agencyName}}</text>
  106. </view>
  107. <u-divider v-if="agencyList.length>=20" height="80">只显示20条数据</u-divider>
  108. </scroll-view>
  109. <u-empty v-else name="search"></u-empty>
  110. </u-popup>
  111. <!-- 企业列表 -->
  112. <u-popup border-radius="60" height="60%" mode="bottom" v-model="enterpriseShow">
  113. <view class="fixed cu-bar search bg-white">
  114. <view class="search-form round">
  115. <text class="cuIcon-search"></text>
  116. <u-input style="width: 90%;" v-model="enterpriseKeyword" type="text" :adjust-position="false" placeholder="请输入关键字搜索" confirm-type="search"/>
  117. </view>
  118. </view>
  119. <scroll-view v-if="!$isEmpty(enterpriseList)" style="padding-top: 110rpx;height: 100%;" :scroll-y="true" >
  120. <view @click="selectEnterprise(item)" hover-class="hoverClass" class="text-center padding-30 solid-bottom" v-for="(item,index) in enterpriseList" :key="index">
  121. <text>{{item.enterpriseName}}</text>
  122. </view>
  123. <u-divider v-if="enterpriseList.length>=20" height="80">只显示20条数据</u-divider>
  124. </scroll-view>
  125. <u-empty v-else name="search"></u-empty>
  126. </u-popup>
  127. <!-- 访问时间 -->
  128. <u-picker @confirm="interviewTimeConfirm" :params="params" v-model="interviewTimeShow" mode="time"></u-picker>
  129. <!-- 验证码 -->
  130. <u-verification-code seconds="60" @end="end" @start="start" ref="uCode" @change="codeChange"></u-verification-code>
  131. </view>
  132. </template>
  133. <script>
  134. var that;
  135. export default {
  136. name: 'card',
  137. data() {
  138. return {
  139. contentHeight:'',
  140. list: [{
  141. name: '员工'
  142. }, {
  143. name: '企业'
  144. }, {
  145. name: '管理员',
  146. }, {
  147. name: '访客',
  148. }],
  149. current: 0,
  150. //发送验证码
  151. tips: '',
  152. showText:true,
  153. //园区下拉框
  154. agencyName:'',
  155. agencyList:[],
  156. agencyKeyWord:'',
  157. agencyShow:false,
  158. //园区登录
  159. agencyId:'',
  160. agencyAccount:'',
  161. agencyPassword:'',
  162. //企业下拉框
  163. enterpriseName:'',//回显
  164. enterpriseShow:false,
  165. enterpriseList:[],
  166. enterpriseKeyword:'',
  167. //企业登录
  168. creditCode:'',
  169. enterpriseId:'',
  170. enterpriseAccount:'',
  171. enterprisePassword:'',
  172. openId:'',
  173. //员工登录
  174. phone:'',
  175. yzm:'',
  176. //访客
  177. interviewTimeShow:false,
  178. interviewTime:'',
  179. params: {
  180. year: true,
  181. month: true,
  182. day: true,
  183. hour: false,
  184. minute: false,
  185. second: false
  186. },
  187. };
  188. },
  189. onLoad() {
  190. this.contentHeight=this.$u.sys().windowHeight+'px'
  191. that=this
  192. if (this.$isAuth()) {
  193. uni.reLaunch({
  194. url:'/pages/index/index'
  195. })
  196. //免登录
  197. return
  198. }
  199. if(this.$isEmpty(this.$cache.get('openId'))){
  200. this.getOpenId()
  201. }else{
  202. this.openId=this.$cache.get('openId')
  203. }
  204. this.getAgencyList()
  205. },
  206. onShow() {
  207. this.handelNoToken()
  208. this.getAppletStatus()
  209. },
  210. watch:{
  211. agencyKeyWord(){
  212. let that=this
  213. //节流函数
  214. if (this.timer){
  215. clearTimeout(this.timer)
  216. }
  217. this.timer = setTimeout(() => {
  218. that.agencyList=[]
  219. that.getAgencyList()
  220. }, 500)
  221. },
  222. enterpriseKeyword(){
  223. let that=this
  224. //节流函数
  225. if (this.timer){
  226. clearTimeout(this.timer)
  227. }
  228. this.timer = setTimeout(() => {
  229. that.enterpriseList=[]
  230. that.getEnterpriseList()
  231. }, 500)
  232. },
  233. },
  234. methods:{
  235. //处理没token但是却选择了园区的情况
  236. //访客从申请列表返回登录页时,是没有token的,这样导致其他接口报错
  237. async handelNoToken(){
  238. let that=this
  239. if(!this.$cache.get('tokenObj')&&!this.$isEmpty(this.agencyId)){
  240. //如果没有token,且园区id不为空
  241. this.agencyList.forEach(item=>{
  242. if(item.id==that.agencyId){
  243. let params={
  244. tenantId:item.tenantId,
  245. username:item.account,
  246. password:item.password
  247. }
  248. //放进缓存中,并获取token
  249. that.$cache.put('tokenObj',params)
  250. //获取token
  251. that.$api.getToken(that.$u.queryParams(params)).then(res=>{
  252. let token=res.token_type+" "+res.access_token
  253. uni.setStorageSync('token', token)
  254. //获取企业列表
  255. that.getEnterpriseList()
  256. })
  257. }
  258. })
  259. }
  260. },
  261. //访问时间
  262. interviewTimeConfirm(e){
  263. this.interviewTime=e.year+'-'+e.month+'-'+e.day
  264. },
  265. /**
  266. * 获取openid
  267. */
  268. getOpenId(){
  269. uni.login({
  270. success: (res) => {
  271. let data={
  272. appId:this.$api.wxData.appId,
  273. jsCode:res.code,
  274. secret:this.$api.wxData.secret
  275. }
  276. this.$api.wxApi.getOpenId(data).then(res=>{
  277. let resData= JSON.parse(res.data)
  278. this.openId=resData.openid
  279. this.$cache.put('openId',this.openId)
  280. })
  281. }
  282. })
  283. },
  284. //获取园区列表
  285. getAgencyList(){
  286. let params={
  287. size:20,
  288. agencyName:this.agencyKeyWord
  289. }
  290. this.$api.agency.getAgencyTenantList(params).then(res=>{
  291. this.agencyList = res.data
  292. })
  293. },
  294. //选择园区
  295. selectAgency(item){
  296. console.log(item);
  297. let params={
  298. tenantId:item.tenantId,
  299. username:item.account,
  300. password:item.password
  301. }
  302. this.agencyId=item.id
  303. this.agencyName=item.agencyName
  304. this.agencyShow=false
  305. this.$cache.put('tokenObj',params)
  306. //获取token
  307. this.$api.getToken(this.$u.queryParams(params)).then(res=>{
  308. let token=res.token_type+" "+res.access_token
  309. uni.setStorageSync('token', token)
  310. //获取企业列表
  311. this.getEnterpriseList()
  312. })
  313. },
  314. /**
  315. * 获取验证码
  316. */
  317. async getCode() {
  318. let that=this
  319. if (this.$isEmpty(this.phone)) {
  320. this.$u.toast("请输入手机号")
  321. return
  322. }
  323. if (!this.$u.test.mobile(this.phone)) {
  324. this.$u.toast("请输入正确的手机号")
  325. return
  326. }
  327. if(this.$refs.uCode.canGetCode) {
  328. // 模拟向后端请求验证码
  329. uni.showLoading({
  330. title: '正在获取验证码'
  331. })
  332. setTimeout(async () => {
  333. uni.hideLoading();
  334. let params=`?phone=${this.phone}`
  335. this.$api.SMSApi.sendSms(params).then(res=>{
  336. if (res.data=='获取验证码成功') {
  337. that.$u.toast('验证码已发送');
  338. // 通知验证码组件内部开始倒计时
  339. that.$refs.uCode.start();
  340. }else{
  341. that.$refs.uTips.show({
  342. title: res.data,
  343. type: 'primary',
  344. duration: '3000'
  345. })
  346. }
  347. // 通知验证码组件内部开始倒计时
  348. that.$refs.uCode.start();
  349. }).catch(err=>{
  350. that.$u.toast('获取验证码失败');
  351. })
  352. }, 2300);
  353. } else {
  354. this.$u.toast('倒计时结束后再发送');
  355. }
  356. },
  357. codeChange(text) {
  358. this.tips = text;
  359. },
  360. end() {
  361. this.showText=true
  362. },
  363. start() {
  364. this.showText=false
  365. },
  366. //当前登录按钮操作
  367. async login() {
  368. if (this.current==0) {
  369. //员工登录
  370. this.staffLogin()
  371. }else if (this.current==1) {
  372. //企业登录
  373. this.enterpriseLogin()
  374. }else if (this.current==2) {
  375. //管理员登陆
  376. this.ganderLogin()
  377. }
  378. },
  379. //员工登录
  380. async staffLogin(){
  381. //15622205184
  382. if (this.phone=='15622205184') {
  383. this.userLogin()
  384. return
  385. }
  386. if (this.$isEmpty(this.agencyId)) {
  387. this.$u.toast('请选择您所在的园区')
  388. return
  389. }
  390. if (!this.phone) {
  391. uni.showToast({ title: '请输入手机号', icon: 'none' });
  392. return;
  393. }
  394. if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.phone)) {
  395. uni.showToast({ title: '请输入正确手机号', icon: 'none' });
  396. return;
  397. }
  398. if (!this.yzm) {
  399. uni.showToast({ title: '请输入验证码', icon: 'none' });
  400. return;
  401. }
  402. if (this.yzm.length!=6) {
  403. this.$u.toast('请输入6位数的验证码')
  404. return
  405. }
  406. let params={
  407. phone:this.phone,
  408. code:this.yzm
  409. }
  410. let smsRes=await this.$api.SMSApi.validCode(this.$u.queryParams(params))
  411. if (smsRes.data!='success') {
  412. this.$u.toast(smsRes.data)
  413. return
  414. }
  415. this.userLogin()
  416. },
  417. //用户登陆
  418. async userLogin(){
  419. //通过手机号查找该员工信息
  420. let staffRes=await this.$api.login({loginType:0,phone:this.phone})
  421. let records=staffRes.data
  422. if (this.$isEmpty(records)) {
  423. //如果没有员工信息。新用户。跳转到注册认证界面
  424. uni.navigateTo({
  425. url:'/pages/auth/auth?phone='+this.phone
  426. })
  427. }else{
  428. let userInfo=records[0]
  429. if (userInfo.examine==0) {
  430. //有员工信息,但审核未通过,提示等待审核
  431. this.$showModel('您的认证信息尚未审核,请联系企业负责人审核',false)
  432. }else if(userInfo.examine==1){
  433. //后台导入的员工信息没有openid,需要在小程序重新插入
  434. if (this.$isEmpty(userInfo.openId)&&!this.$isEmpty(this.openId)) {
  435. userInfo.openId=this.openId
  436. this.$api.enterprisestaff.submit(userInfo)
  437. }
  438. this.$cache.put('agencyId',userInfo.agencyId)
  439. this.$cache.put('agencyTenantId',userInfo.tenantId)
  440. getApp().globalData.userInfo=userInfo
  441. //存储手机号,便于拉取用户信息
  442. this.$cache.put('phone',userInfo.phone)
  443. this.$cache.put('userId',userInfo.id)
  444. this.$cache.put('enterpriseId',userInfo.enterpriseId)
  445. this.handelSuccessLogin('staff')
  446. }else if (userInfo.examine==2) {
  447. //审核不通过
  448. this.$showModel('您的认证信息审核不通过,是否重新认证!').then(res=>{
  449. uni.navigateTo({
  450. url:"/pages/auth/auth?operationType=1&phone="+that.phone
  451. })
  452. })
  453. }
  454. }
  455. },
  456. //获取企业列表
  457. getEnterpriseList(){
  458. let params={
  459. size:20,
  460. enterpriseName:this.enterpriseKeyword
  461. }
  462. this.$api.enterprise.page(params).then(res=>{
  463. this.enterpriseList =res.data.records
  464. })
  465. },
  466. //选择企业
  467. selectEnterprise(item){
  468. this.creditCode=item.creditCode
  469. this.enterpriseShow=false
  470. this.enterpriseName=item.enterpriseName
  471. this.enterpriseId=item.id
  472. },
  473. /**
  474. * 企业登录
  475. */
  476. async enterpriseLogin(){
  477. if(this.$isEmpty(this.agencyId)){
  478. this.$u.toast('请选择园区')
  479. return
  480. }
  481. if (this.$isEmpty(this.enterpriseId)) {
  482. this.$u.toast('请选择企业')
  483. return
  484. }
  485. if (this.$isEmpty(this.enterpriseAccount)) {
  486. this.$u.toast("请输入账号")
  487. return
  488. }
  489. if (this.$isEmpty(this.enterprisePassword)) {
  490. this.$u.toast("请输入密码")
  491. return
  492. }
  493. let params={
  494. "loginType":1,  
  495.     "enterpriseId": this.enterpriseId,
  496.     "enterpriseAccount": this.enterpriseAccount,
  497.     "enterprisePassword": this.enterprisePassword
  498. }
  499. this.$api.login(params).then(res=>{
  500. if (this.$isEmpty(res.data)) {
  501. this.$u.toast('账号或密码错误')
  502. return
  503. }else{
  504. //公司信息
  505. let userInfo=res.data[0]
  506. this.$cache.put('agencyId',userInfo.agencyId)
  507. getApp().globalData.userInfo=userInfo
  508. this.$cache.put('loginAccount',this.enterpriseAccount)
  509. this.$cache.put('agencyTenantId',userInfo.tenantId)
  510. this.$cache.put('creditCode',this.creditCode)
  511. this.$cache.put('enterpriseId',userInfo.enterpriseId)
  512. this.handelSuccessLogin('enterprise')
  513. }
  514. })
  515. },
  516. /**
  517. * 管理员登陆
  518. */
  519. async ganderLogin(){
  520. if (this.$isEmpty(this.agencyId)) {
  521. this.$u.toast('请选择您所在的园区')
  522. return
  523. }
  524. if (this.$isEmpty(this.agencyAccount)) {
  525. this.$u.toast('请输入账号')
  526. return
  527. }
  528. if (this.$isEmpty(this.agencyPassword)) {
  529. this.$u.toast('请输入密码')
  530. return
  531. }
  532. let params={
  533.     "loginType":2,  
  534.     "agencyId": this.agencyId,
  535.     "agencyAccount": this.agencyAccount,
  536.     "agencyPassword": this.agencyPassword
  537. }
  538. let res=await this.$api.login(params)
  539. let ganderInfo=res.data[0]
  540. if (this.$isEmpty(ganderInfo)) {
  541. this.$u.toast('账号或密码错误')
  542. return
  543. }
  544. //订阅消息通知
  545. await this.$mpi.subscribe(this.$adminTmplIds)
  546. //输入密码成功
  547. //园区信息
  548. this.$cache.put('loginAccount',this.agencyAccount)
  549. this.$cache.put('agencyId',ganderInfo.agencyId)
  550. this.$cache.put('agency',ganderInfo.agencyName)
  551. this.$cache.put('agencyTenantId',ganderInfo.tenantId)
  552. getApp().globalData.userInfo=ganderInfo
  553. this.handelSuccessLogin('agency')
  554. },
  555. /**
  556. * 登录成功的处理方式
  557. * 如果是从其他地方跳转回的登录页,则登录后跳转回原页面
  558. * 否则跳转到首页
  559. */
  560. handelSuccessLogin(loginType){
  561. that.$cache.put("loginType",loginType)
  562. //跳转
  563. uni.showLoading({
  564. title: '登陆中...'
  565. })
  566. uni.switchTab({
  567. url:"/pages/index/index"
  568. })
  569. // setTimeout(()=>{
  570. // uni.hideLoading()
  571. // if (that.$isEmpty(that.$Route.query.fullPath)) {
  572. // uni.switchTab({
  573. // url:"/pages/index/index"
  574. // })
  575. // return
  576. // }
  577. // if (that.$Route.query.fullPath.indexOf('login')) {
  578. // uni.switchTab({
  579. // url:"/pages/index/index"
  580. // })
  581. // }else{
  582. // uni.reLaunch({
  583. // url:that.$Route.query.fullPath
  584. // })
  585. // }
  586. // },1200)
  587. },
  588. async applyOpenDoor(){
  589. if (this.$isEmpty(this.interviewTime)) {
  590. this.$u.toast('请选择访问时间')
  591. return
  592. }
  593. if (this.$isEmpty(this.agencyId)) {
  594. this.$u.toast('请选择要访问的园区')
  595. return
  596. }
  597. let params={
  598. interviewTime:this.interviewTime,
  599. agencyId:this.agencyId,
  600. openId:this.openId
  601. }
  602. let res=await this.$api.guest.page(params)
  603. let data=res.data.records[0]
  604. if (this.$isEmpty(data)) {
  605. that.reApply(params)
  606. return
  607. }
  608. uni.showModal({
  609. content:"检测到您有该园区的申请记录,是否立即去开门?",
  610. cancelText:"重新申请",
  611. confirmText:'去开门',
  612. success: (res) => {
  613. if (res.confirm) {
  614. console.log("去开门")
  615. }else{
  616. that.reApply(params)
  617. }
  618. }
  619. })
  620. },
  621. reApply(params){
  622. params.enterpriseId=this.enterpriseId,
  623. params.agencyName=this.agencyName
  624. params.enterpriseName=this.enterpriseName
  625. uni.navigateTo({
  626. url:"/pages/guest/guest"+this.$u.queryParams(params)
  627. })
  628. },
  629. jump(url){
  630. if (!this.$isEmpty(url)) {
  631. uni.navigateTo({
  632. url
  633. })
  634. }
  635. },
  636. isToday(str){
  637. var d = new Date(str.replace(/-/g,"/"));
  638. var todaysDate = new Date();
  639. if(d.setHours(0,0,0,0) == todaysDate.setHours(0,0,0,0)){
  640. return true;
  641. } else {
  642. return false;
  643. }
  644. },
  645. getAppletStatus(){
  646. this.$api.wxApi.getAppletStatus({id:1}).then(res=>{
  647. uni.setStorageSync("appletStatus",res.data.isOnline)
  648. })
  649. },
  650. tabSelect(index){
  651. this.current=index
  652. },
  653. swiperChange(e) {
  654. this.current = e.detail.current
  655. },
  656. animationfinish({detail: { current }}) {
  657. this.current = current;
  658. },
  659. }
  660. };
  661. </script>
  662. <style lang="scss">
  663. page{
  664. background-color: #FFFFFF;
  665. height: 100%;
  666. }
  667. .text-checked{
  668. font-size: 36rpx;
  669. // color: #333;
  670. color: $base-color;
  671. }
  672. .button{
  673. position: fixed;
  674. bottom: 5%;
  675. left: 0;
  676. right: 0;
  677. font-size: 28rpx;
  678. background: $base-color;
  679. color: #fff;
  680. height: 90rpx;
  681. margin:0rpx 30rpx;
  682. line-height: 90rpx;
  683. border-radius: 50rpx;
  684. box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
  685. }
  686. .guest{
  687. font-size: 28rpx;
  688. color: #fff;
  689. background: $base-color;
  690. height: 90rpx;
  691. margin:120rpx 30rpx;
  692. line-height: 90rpx;
  693. border-radius: 50rpx;
  694. box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
  695. }
  696. .top{
  697. height: 220rpx;
  698. background-color: #5064eb;
  699. }
  700. .content{
  701. border-radius: 20rpx;
  702. background-color: #FFFFFF;
  703. margin: -120rpx 20rpx 0;
  704. .item{
  705. height: 100%;
  706. padding-top: 15%;
  707. .input{
  708. margin:40rpx 30rpx;
  709. border-radius: 50rpx;
  710. background-color: rgba(80, 100, 235,.1);
  711. display: flex;
  712. padding: 20rpx 30rpx;
  713. image{
  714. width: 30rpx;
  715. height: 36rpx;
  716. margin-top: 4rpx;
  717. margin-right: 20rpx;
  718. }
  719. .phone{
  720. width: 40rpx;
  721. height: 40rpx;
  722. margin-top: 4rpx;
  723. margin-right: 22rpx;
  724. }
  725. .qiye{
  726. width: 38rpx;
  727. height: 38rpx;
  728. margin-top: 4rpx;
  729. margin-right: 22rpx;
  730. }
  731. input{
  732. width: 100%;
  733. height: 100%;
  734. }
  735. .code{
  736. position: absolute;
  737. right: 22rpx;
  738. top: 18rpx;
  739. background: $base-color;
  740. color: #fff;
  741. font-size: 24rpx;
  742. border-radius: 50rpx;
  743. height: 50rpx;
  744. line-height: 50rpx;
  745. padding: 0 25rpx;
  746. z-index: 1000;
  747. }
  748. }
  749. }
  750. }
  751. </style>