login.vue 21 KB

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