login.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. onReady() {
  34. if(uni.getStorageSync('userInfo')){
  35. uni.reLaunch({
  36. url:'/pages/home'
  37. })
  38. }
  39. },
  40. methods:{
  41. decryptPhoneNumber(e){
  42. if(uni.getStorageSync('token')){
  43. uni.reLaunch({
  44. url:'/pages/home'
  45. })
  46. return
  47. }
  48. if(e.detail.code) this.wxLogin(e.detail.code);
  49. },
  50. wxLogin(code){
  51. uni.showLoading({ title:'登录中' });
  52. let that = this;
  53. wx.login({
  54. success(res){
  55. that.$api.get('/wx/login',{
  56. code:res.code,
  57. phoneCode:code
  58. },false).then(res=>{
  59. if(res.data.code===0){
  60. uni.setStorageSync('token',res.data.data.token);
  61. uni.setStorageSync('userInfo',JSON.stringify({
  62. id:res.data.data.id,
  63. gender:res.data.data.gender,
  64. realName:res.data.data.realName,
  65. mobile:res.data.data.mobile,
  66. headUrl:res.data.data.headUrl,
  67. teamId:res.data.data.teamId,
  68. enterpriseId:res.data.data.enterpriseId,
  69. enterpriseName:res.data.data.enterpriseName,
  70. teamName:res.data.data.teamName
  71. }));
  72. uni.hideLoading();
  73. that.$showToast('登录成功');
  74. setTimeout(()=>{
  75. uni.reLaunch({ url:'/pages/home' })
  76. },1500)
  77. }else that.$showToast(res.data.msg)
  78. })
  79. }
  80. })
  81. },
  82. cancelLogin(){
  83. uni.exitMiniProgram();
  84. }
  85. }
  86. }
  87. </script>
  88. <style scoped lang="scss">
  89. .page{
  90. background: #FFFFFF;
  91. display: flex;
  92. flex-direction: column;
  93. box-sizing: border-box;
  94. .content{
  95. padding: 0 45rpx;
  96. flex: 1;
  97. overflow-y: auto;
  98. &>image{
  99. width: 88rpx;
  100. height: 88rpx;
  101. margin-top: 100rpx;
  102. }
  103. .title{
  104. font-family: PingFang-SC, PingFang-SC;
  105. font-weight: bold;
  106. font-size: 48rpx;
  107. color: #252525;
  108. line-height: 67rpx;
  109. margin-top: 36rpx;
  110. }
  111. .tip{
  112. font-family: PingFangSC, PingFang SC;
  113. font-weight: 400;
  114. font-size: 30rpx;
  115. color: #646464;
  116. line-height: 47rpx;
  117. margin-top: 20rpx;
  118. }
  119. .item{
  120. margin-top: 64rpx;
  121. &>image{
  122. width: 64rpx;
  123. height: 64rpx;
  124. }
  125. .qa{
  126. width: calc(100% - 64rpx);
  127. padding-left: 24rpx;
  128. box-sizing: border-box;
  129. p{
  130. font-family: PingFang-SC, PingFang-SC;
  131. font-weight: bold;
  132. font-size: 32rpx;
  133. color: #252525;
  134. line-height: 45rpx;
  135. &:last-child{
  136. font-weight: 400;
  137. font-size: 28rpx;
  138. color: #646464;
  139. line-height: 47rpx;
  140. }
  141. }
  142. }
  143. }
  144. .zt_btn{
  145. margin-top: 216rpx;
  146. }
  147. .qx_btn{
  148. margin-top: 36rpx;
  149. }
  150. }
  151. }
  152. </style>