login.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='创衡汇教练AI智能体' :showback="false"></cus-header>
  4. <div class="content">
  5. <div class="c_top">
  6. <image src="@/static/logo2.png" mode="heightFix"></image>
  7. <div class="title">Hi,我是企业教练~</div>
  8. <div class="tip">很高兴遇见你!作为你的AI教练,我随时可以回答您的问题</div>
  9. <div class="item adf">
  10. <image src="@/static/qa.png"></image>
  11. <div class="qa">
  12. <p>智能问答</p>
  13. <p>正念修己 教练达人,知识推理整合,要点清晰呈现,助力企业打造高价值团队</p>
  14. </div>
  15. </div>
  16. <div class="item adf">
  17. <image src="@/static/qs.png"></image>
  18. <div class="qa">
  19. <p>PERILL模型问题库</p>
  20. <p>作为团队成员,您可以对所在团队相关描述的体验进行评分,帮助团队有效评估团队的现状</p>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="c_bottom">
  25. <button class="zt_btn" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">手机号一键登录</button>
  26. <button class="qx_btn" style="margin-top: 20rpx;" @tap="codeLogin">授权码登录</button>
  27. </div>
  28. </div>
  29. <u-popup :show="show" @close="cancel" mode="center" :round="20">
  30. <div class="code">
  31. <p>授权码登录</p>
  32. <u-input v-model="phone" placeholder="请输入手机号"></u-input>
  33. <div style="margin-top: 20rpx;"></div>
  34. <u-input v-model="code" placeholder="请输入授权码"></u-input>
  35. <div class="cbtns adfacjb">
  36. <div class="zt_btn" @tap="toCodeLogin">登录</div>
  37. <div class="qx_btn" @tap="cancel">取消</div>
  38. </div>
  39. </div>
  40. </u-popup>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data(){
  46. return {
  47. show:false,
  48. phone:'',
  49. code:''
  50. }
  51. },
  52. methods:{
  53. decryptPhoneNumber(e){
  54. if(uni.getStorageSync('token')){
  55. uni.reLaunch({
  56. url:'/pages/home'
  57. })
  58. return
  59. }
  60. if(e.detail.code) this.wxLogin(e.detail.code);
  61. },
  62. codeLogin(){
  63. this.show = true;
  64. },
  65. toCodeLogin(){
  66. if(!this.$reg.mobile(this.phone)) return this.$showToast('请输入正确的手机号!')
  67. if(!this.code) return this.$showToast('请输入授权码!')
  68. this.$api.get('/wx/login-code',{
  69. checkCode:this.code,
  70. phone:this.phone
  71. }).then(res=>{
  72. if(res.data.code!==0) return this.$showToast(res.data.msg)
  73. this.loginSuccessFn(res);
  74. })
  75. },
  76. cancel(){
  77. this.code = '';
  78. this.show = false;
  79. },
  80. wxLogin(code){
  81. uni.showLoading({ title:'登录中' });
  82. let that = this;
  83. wx.login({
  84. success(res){
  85. that.$api.get('/wx/login',{
  86. code:res.code,
  87. phoneCode:code
  88. },false).then(res=>{
  89. if(res.data.code===0){
  90. that.loginSuccessFn(res);
  91. }else that.$showToast(res.data.msg)
  92. })
  93. }
  94. })
  95. },
  96. loginSuccessFn(res){
  97. uni.setStorageSync('token',res.data.data.token);
  98. uni.setStorageSync('userInfo',JSON.stringify({
  99. id:res.data.data.id,
  100. gender:res.data.data.gender,
  101. realName:res.data.data.realName,
  102. mobile:res.data.data.mobile,
  103. headUrl:res.data.data.headUrl,
  104. teamId:res.data.data.teamId,
  105. enterpriseId:res.data.data.enterpriseId,
  106. enterpriseName:res.data.data.enterpriseName,
  107. teamName:res.data.data.teamName
  108. }));
  109. uni.hideLoading();
  110. this.$showToast('登录成功');
  111. setTimeout(()=>{
  112. uni.reLaunch({ url:'/pages/home' })
  113. },1500)
  114. },
  115. cancelLogin(){
  116. // uni.exitMiniProgram();
  117. uni.reLaunch({ url:'/pages/home' })
  118. }
  119. }
  120. }
  121. </script>
  122. <style scoped lang="scss">
  123. .page{
  124. background: #FFFFFF;
  125. display: flex;
  126. flex-direction: column;
  127. box-sizing: border-box;
  128. .content{
  129. padding: 0 45rpx;
  130. flex: 1;
  131. overflow-y: auto;
  132. display: flex;
  133. flex-direction: column;
  134. justify-content: space-between;
  135. .c_top{
  136. &>image{
  137. height: 88rpx;
  138. margin-top: 100rpx;
  139. }
  140. .title{
  141. font-family: PingFang-SC, PingFang-SC;
  142. font-weight: bold;
  143. font-size: 48rpx;
  144. color: #252525;
  145. line-height: 67rpx;
  146. margin-top: 36rpx;
  147. }
  148. .tip{
  149. font-family: PingFangSC, PingFang SC;
  150. font-weight: 400;
  151. font-size: 30rpx;
  152. color: #646464;
  153. line-height: 47rpx;
  154. margin-top: 20rpx;
  155. }
  156. .item{
  157. margin-top: 64rpx;
  158. &>image{
  159. width: 64rpx;
  160. height: 64rpx;
  161. }
  162. .qa{
  163. width: calc(100% - 64rpx);
  164. padding-left: 24rpx;
  165. box-sizing: border-box;
  166. p{
  167. font-family: PingFang-SC, PingFang-SC;
  168. font-weight: bold;
  169. font-size: 32rpx;
  170. color: #252525;
  171. line-height: 45rpx;
  172. &:last-child{
  173. font-weight: 400;
  174. font-size: 28rpx;
  175. color: #646464;
  176. line-height: 47rpx;
  177. }
  178. }
  179. }
  180. }
  181. }
  182. .c_bottom{
  183. .qx_btn{
  184. margin-top: 36rpx;
  185. }
  186. }
  187. }
  188. }
  189. .code{
  190. width: 700rpx;
  191. padding: 40rpx 60rpx 40rpx;
  192. border-radius: 32rpx 32rpx 0 0;
  193. box-sizing: border-box;
  194. p{
  195. font-size: 40rpx;
  196. font-weight: bold;
  197. margin-bottom: 50rpx;
  198. }
  199. .cbtns{
  200. margin-top: 50rpx;
  201. &>div{
  202. width: calc(50% - 20rpx);
  203. }
  204. .qx_btn{
  205. background: #f1f1f1;
  206. }
  207. }
  208. }
  209. </style>