login.vue 3.7 KB

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