login.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='创衡汇教练AI智能体' bgColor="transparent" backUrl="/pages/home"></cus-header>
  4. <image class="topbg" :src="imgBase+'login_top_bg.png'"></image>
  5. <div class="content">
  6. <div class="c_top">
  7. <image :src="imgBase+'logo.png'" mode="heightFix"></image>
  8. <div class="title">Hi,我是创衡团队教练助手</div>
  9. <div class="tip">可以为您提供PERILL团队评估、团队评估报告分析和团队教练督导对话,期待和您的共创~</div>
  10. <div class="item adf">
  11. <div class="qa">
  12. <p>PERILL团队发展动态评估</p>
  13. <p>据您对相关陈述的评分,帮助团队从六个维度评估团队的现状。</p>
  14. </div>
  15. </div>
  16. <div class="item adf">
  17. <div class="qa">
  18. <p>AI教练督导对话</p>
  19. <p>保持正念教练督导心态,对您的PERILL测评报告或团队教练计划进行启发式沟通。</p>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="c_bottom">
  24. <button class="zt_btn" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">手机号一键登录</button>
  25. <div class="qx_btn" style="margin-top: 40rpx;" @tap="codeLogin">授权码登录</div>
  26. <div class="agree adfacjc" @click="changeAgree">
  27. <image :src="imgBase+'not_select.png'" v-if="!agree"></image>
  28. <image :src="imgBase+'selected.png'" v-else></image>
  29. <div class="text"v>已阅读并同意我们的<span>“服务协议与隐私政策”</span></div>
  30. </div>
  31. </div>
  32. </div>
  33. <u-popup :show="show" @close="cancel" mode="center" :round="20">
  34. <div class="code">
  35. <p>授权码登录</p>
  36. <u-input v-model="phone" placeholder="请输入手机号"></u-input>
  37. <div style="margin-top: 20rpx;"></div>
  38. <u-input v-model="code" placeholder="请输入授权码"></u-input>
  39. <div class="cbtns adfacjb">
  40. <div class="zt_btn" @tap="toCodeLogin">登录</div>
  41. <div class="qx_btn" @tap="cancel">取消</div>
  42. </div>
  43. </div>
  44. </u-popup>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data(){
  50. return {
  51. show:false,
  52. phone:'',
  53. code:'',
  54. agree:false
  55. }
  56. },
  57. methods:{
  58. decryptPhoneNumber(e){
  59. if(!this.agree) return this.$showToast('请勾选协议与政策')
  60. if(uni.getStorageSync('token')){
  61. uni.reLaunch({
  62. url:'/pages/home'
  63. })
  64. return
  65. }
  66. if(e.detail.code) this.wxLogin(e.detail.code);
  67. },
  68. codeLogin(){
  69. if(!this.agree) return this.$showToast('请勾选协议与政策')
  70. this.show = true;
  71. },
  72. toCodeLogin(){
  73. if(!this.$reg.mobile(this.phone)) return this.$showToast('请输入正确的手机号!')
  74. if(!this.code) return this.$showToast('请输入授权码!')
  75. this.$api.get('/wx/login-code',{
  76. checkCode:this.code,
  77. phone:this.phone
  78. }).then(res=>{
  79. if(res.data.code!==0) return this.$showToast(res.data.msg)
  80. this.loginSuccessFn(res);
  81. })
  82. },
  83. cancel(){
  84. this.code = '';
  85. this.show = false;
  86. },
  87. wxLogin(code){
  88. uni.showLoading({ title:'登录中' });
  89. let that = this;
  90. wx.login({
  91. success(res){
  92. that.$api.get('/wx/login',{
  93. code:res.code,
  94. phoneCode:code
  95. },false).then(res=>{
  96. if(res.data.code===0){
  97. that.loginSuccessFn(res);
  98. }else that.$showToast(res.data.msg)
  99. })
  100. }
  101. })
  102. },
  103. loginSuccessFn(res){
  104. uni.setStorageSync('token',res.data.data.token);
  105. uni.setStorageSync('userInfo',JSON.stringify({
  106. id:res.data.data.id,
  107. gender:res.data.data.gender,
  108. realName:res.data.data.realName,
  109. mobile:res.data.data.mobile,
  110. headUrl:res.data.data.headUrl,
  111. teamId:res.data.data.teamId,
  112. enterpriseId:res.data.data.enterpriseId,
  113. enterpriseName:res.data.data.enterpriseName,
  114. teamName:res.data.data.teamName
  115. }));
  116. uni.hideLoading();
  117. this.$showToast('登录成功');
  118. setTimeout(()=>{
  119. uni.reLaunch({ url:'/pages/home' })
  120. },1500)
  121. },
  122. changeAgree(){
  123. this.agree = !this.agree
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped lang="scss">
  129. .page{
  130. background: #FFFFFF;
  131. display: flex;
  132. flex-direction: column;
  133. box-sizing: border-box;
  134. .topbg{
  135. width: 100%;
  136. height: 584rpx;
  137. position: fixed;
  138. top: 0;
  139. left: 0;
  140. }
  141. .content{
  142. padding: 0 45rpx;
  143. flex: 1;
  144. overflow-y: auto;
  145. display: flex;
  146. flex-direction: column;
  147. justify-content: space-between;
  148. position: relative;
  149. .c_top{
  150. padding: 0 20rpx;
  151. &>image{
  152. height: 88rpx;
  153. margin-top: 76rpx;
  154. }
  155. .title{
  156. font-family: PingFang-SC, PingFang-SC;
  157. font-weight: bold;
  158. font-size: 48rpx;
  159. color: #252525;
  160. line-height: 67rpx;
  161. margin-top: 36rpx;
  162. }
  163. .tip{
  164. font-family: PingFangSC, PingFang SC;
  165. font-weight: 400;
  166. font-size: 30rpx;
  167. color: #646464;
  168. line-height: 47rpx;
  169. margin-top: 20rpx;
  170. }
  171. .item{
  172. margin-top: 64rpx;
  173. .qa{
  174. box-sizing: border-box;
  175. p{
  176. font-family: PingFang-SC, PingFang-SC;
  177. font-weight: bold;
  178. font-size: 32rpx;
  179. color: #252525;
  180. line-height: 45rpx;
  181. &:last-child{
  182. font-weight: 400;
  183. font-size: 28rpx;
  184. color: #646464;
  185. line-height: 47rpx;
  186. }
  187. }
  188. }
  189. }
  190. }
  191. .c_bottom{
  192. .qx_btn{
  193. margin-top: 36rpx;
  194. }
  195. .agree{
  196. margin-top: 64rpx;
  197. image{
  198. width: 30rpx;
  199. height: 30rpx;
  200. }
  201. .text{
  202. margin-left: 8rpx;
  203. font-family: PingFangSC, PingFang SC;
  204. font-weight: 400;
  205. font-size: 24rpx;
  206. color: #95A5B1;
  207. line-height: 44rpx;
  208. span{
  209. color: #833478;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. .code{
  217. width: 700rpx;
  218. padding: 40rpx 60rpx 40rpx;
  219. border-radius: 32rpx 32rpx 0 0;
  220. box-sizing: border-box;
  221. p{
  222. font-size: 40rpx;
  223. font-weight: bold;
  224. margin-bottom: 50rpx;
  225. }
  226. .cbtns{
  227. margin-top: 50rpx;
  228. &>div{
  229. width: calc(50% - 20rpx);
  230. }
  231. .qx_btn{
  232. background: #f1f1f1;
  233. }
  234. }
  235. }
  236. </style>