login.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='创衡正念企业教练' :showback="false"></cus-header>
  4. <div class="content">
  5. <image src="@/static/logo.png"></image>
  6. <div class="title">Hi,我是企业教练~</div>
  7. <div class="tip">很高兴遇见你!作为你的AI教练,我随时可以回答您的问题</div>
  8. <div class="item adf">
  9. <image src="@/static/qa.png"></image>
  10. <div class="qa">
  11. <p>智能问答</p>
  12. <p>正念修己 教练达人,知识推理整合,要点清晰呈现,助力企业打造高价值团队</p>
  13. </div>
  14. </div>
  15. <div class="item adf">
  16. <image src="@/static/qs.png"></image>
  17. <div class="qa">
  18. <p>PERILL模型问题库</p>
  19. <p>作为团队成员,您可以对所在团队相关描述的体验进行评分,帮助团队有效评估团队的现状</p>
  20. </div>
  21. </div>
  22. <button class="zt_btn" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">手机号一键登录</button>
  23. <div class="qx_btn" @click="cancelLogin">取消</div>
  24. </div>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data(){
  30. return {
  31. }
  32. },
  33. onShow: function() {
  34. if(uni.getStorageSync('userInfo')){
  35. uni.reLaunch({
  36. url:'/pages/home'
  37. })
  38. }else{
  39. uni.reLaunch({
  40. url:'/pages/login'
  41. })
  42. }
  43. },
  44. methods:{
  45. decryptPhoneNumber(e){
  46. if(uni.getStorageSync('token')){
  47. uni.reLaunch({
  48. url:'/pages/home'
  49. })
  50. return
  51. }
  52. if(e.detail.code) this.wxLogin(e.detail.code);
  53. },
  54. wxLogin(code){
  55. uni.showLoading({ title:'登录中' });
  56. let that = this;
  57. wx.login({
  58. success(res){
  59. that.$api.get('/wx/login',{
  60. code:res.code,
  61. phoneCode:code
  62. },false).then(res=>{
  63. if(res.data.code===0){
  64. uni.setStorageSync('token',res.data.data.token);
  65. uni.setStorageSync('userInfo',JSON.stringify({
  66. id:res.data.data.id,
  67. gender:res.data.data.gender,
  68. realName:res.data.data.realName,
  69. mobile:res.data.data.mobile,
  70. headUrl:res.data.data.headUrl,
  71. teamId:res.data.data.teamId,
  72. enterpriseId:res.data.data.enterpriseId,
  73. enterpriseName:res.data.data.enterpriseName,
  74. teamName:res.data.data.teamName
  75. }));
  76. uni.hideLoading();
  77. that.$showToast('登录成功');
  78. setTimeout(()=>{
  79. uni.reLaunch({ url:'/pages/home' })
  80. },1500)
  81. }else that.$showToast(res.data.msg)
  82. })
  83. }
  84. })
  85. },
  86. cancelLogin(){
  87. uni.exitMiniProgram();
  88. }
  89. }
  90. }
  91. </script>
  92. <style scoped lang="scss">
  93. .page{
  94. background: #FFFFFF;
  95. display: flex;
  96. flex-direction: column;
  97. box-sizing: border-box;
  98. .content{
  99. padding: 0 45rpx;
  100. flex: 1;
  101. overflow-y: auto;
  102. &>image{
  103. width: 88rpx;
  104. height: 88rpx;
  105. margin-top: 100rpx;
  106. }
  107. .title{
  108. font-family: PingFang-SC, PingFang-SC;
  109. font-weight: bold;
  110. font-size: 48rpx;
  111. color: #252525;
  112. line-height: 67rpx;
  113. margin-top: 36rpx;
  114. }
  115. .tip{
  116. font-family: PingFangSC, PingFang SC;
  117. font-weight: 400;
  118. font-size: 30rpx;
  119. color: #646464;
  120. line-height: 47rpx;
  121. margin-top: 20rpx;
  122. }
  123. .item{
  124. margin-top: 64rpx;
  125. &>image{
  126. width: 64rpx;
  127. height: 64rpx;
  128. }
  129. .qa{
  130. width: calc(100% - 64rpx);
  131. padding-left: 24rpx;
  132. box-sizing: border-box;
  133. p{
  134. font-family: PingFang-SC, PingFang-SC;
  135. font-weight: bold;
  136. font-size: 32rpx;
  137. color: #252525;
  138. line-height: 45rpx;
  139. &:last-child{
  140. font-weight: 400;
  141. font-size: 28rpx;
  142. color: #646464;
  143. line-height: 47rpx;
  144. }
  145. }
  146. }
  147. }
  148. .zt_btn{
  149. margin-top: 216rpx;
  150. }
  151. .qx_btn{
  152. margin-top: 36rpx;
  153. }
  154. }
  155. }
  156. </style>