login.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='PERILL团队动态评估系统' bgColor="transparent" backUrl="/pages/home"></cus-header>
  4. <image class="topbg" :src="imgBase+'login_top_bg.png'"></image>
  5. <view class="content">
  6. <view class="c_top">
  7. <image :src="imgBase+'logo.png'" mode="widthFix"></image>
  8. <view class="title">Hi,我是创衡正念企业教练AI智能体</view>
  9. <view class="tip">我能为你提供PERILL团队发展动态评估、报告分析和团队教练督导对话,期待和你的共创~</view>
  10. <view class="item adf" style="margin-top: 80rpx;">
  11. <view class="qa">
  12. <p>PERILL团队发展动态评估</p>
  13. <p>基于你对相关陈述的评分,从六个关键维度客观呈现团队现状。</p>
  14. </view>
  15. </view>
  16. <view class="item adf">
  17. <view class="qa">
  18. <p>AI教练督导对话</p>
  19. <p>保持正念教练督导心态,对你的PERILL团队发展动态评估或团队教练计划进行启发式沟通。</p>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="c_bottom">
  24. <button class="zt_btn" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">手机号一键登录</button>
  25. <view class="qx_btn" style="margin-top: 40rpx;" @tap="codeLogin" v-if="!channelType">授权码登录</view>
  26. <view class="agree adfacjc" @click.prevent="changeAgree">
  27. <image :src="imgBase+'not_select.png'" v-if="!agree"></image>
  28. <image :src="imgBase+'selected.png'" v-else></image>
  29. <view class="text">已阅读并同意我们的<span @click.stop="turnPage('/pagesMy/serviceAgreement')">“服务协议”</span>与<span @click.stop="turnPage('/pagesMy/privacyPolicy')">“隐私政策”</span></view>
  30. </view>
  31. </view>
  32. </view>
  33. <u-popup :show="show" @close="cancel" mode="bottom" :round="20">
  34. <view class="code">
  35. <image :src="imgBase+'code_top_bg.png'"></image>
  36. <view class="code-box">
  37. <p>授权码登录</p>
  38. <view class="code-box-inp adfacjb" style="margin-top: 64rpx;">
  39. <view class="code-box-inp-left">手机号码</view>
  40. <view class="code-box-inp-right">
  41. <u-input v-model="phone" inputAlign="right" fontSize="30rpx" color="#667E90" border="none" placeholder-style="color:#B3BFC8;font-size:28rpx;" placeholder="请输入手机号"></u-input>
  42. </view>
  43. </view>
  44. <view class="code-box-inp adfacjb">
  45. <view class="code-box-inp-left">授权码</view>
  46. <view class="code-box-inp-right">
  47. <u-input v-model="code" inputAlign="right" fontSize="30rpx" color="#667E90" border="none" placeholder-style="color:#B3BFC8;font-size:28rpx;" placeholder="请输入授权码"></u-input>
  48. </view>
  49. </view>
  50. <view class="zt_btn" @tap="toCodeLogin">立即登录</view>
  51. <view class="qx_btn" @tap="cancel">取消</view>
  52. </view>
  53. </view>
  54. </u-popup>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data(){
  60. return {
  61. show:false,
  62. phone:'',
  63. code:'',
  64. agree:false,
  65. channelType:'',
  66. teamQuestionnaireId:'',
  67. referrerId:''
  68. }
  69. },
  70. created() {
  71. if(uni.getStorageSync('channelType')) this.channelType = uni.getStorageSync('channelType')
  72. if(uni.getStorageSync('shareTQId')) this.teamQuestionnaireId = uni.getStorageSync('shareTQId')
  73. if(uni.getStorageSync('shareUserId')) this.referrerId = uni.getStorageSync('shareUserId')
  74. },
  75. methods:{
  76. decryptPhoneNumber(e){
  77. if(!this.agree) return this.$showToast('请勾选协议与政策')
  78. if(uni.getStorageSync('token')){
  79. uni.reLaunch({
  80. url:'/pages/home'
  81. })
  82. return
  83. }
  84. if(e.detail.code) this.wxLogin(e.detail.code);
  85. },
  86. codeLogin(){
  87. if(!this.agree) return this.$showToast('请勾选协议与政策')
  88. this.show = true;
  89. },
  90. toCodeLogin(){
  91. if(!this.$reg.mobile(this.phone)) return this.$showToast('请输入正确的手机号!')
  92. if(!this.code) return this.$showToast('请输入授权码!')
  93. this.$api.get('/wx/login-code',{
  94. checkCode:this.code,
  95. phone:this.phone
  96. }).then(res=>{
  97. if(res.data.code!==0) return this.$showToast(res.data.msg)
  98. this.loginSuccessFn(res);
  99. })
  100. },
  101. cancel(){
  102. this.code = '';
  103. this.show = false;
  104. },
  105. wxLogin(code){
  106. uni.showLoading({ title:'登录中' });
  107. let that = this;
  108. wx.login({
  109. success(res){
  110. that.$api.get('/wx/login',{
  111. code:res.code,
  112. phoneCode:code,
  113. channelType:that.channelType,
  114. teamQuestionnaireId:that.teamQuestionnaireId,
  115. referrerId:that.referrerId,
  116. },false).then(res=>{
  117. if(res.data.code===0){
  118. if(res.data.data.isRegister==1){
  119. if(uni.getStorageSync('newUser')) uni.removeStorageSync('newUser')
  120. that.loginSuccessFn(res);
  121. } else{
  122. uni.setStorageSync('newUser',true)
  123. uni.navigateTo({
  124. url:'/pages/registerInfo?params='+encodeURIComponent(JSON.stringify({
  125. info:{
  126. channelType:that.channelType||'',
  127. mobile:res.data.data.mobile||'',
  128. email:res.data.data.email||'',
  129. isRegister:res.data.data.isRegister,
  130. referrerId:res.data.data.referrerId||that.referrerId||'',
  131. teamQuestionnaireId:res.data.data.teamQuestionnaireId||that.teamQuestionnaireId||'',
  132. userId:res.data.data.id||'',
  133. openId:res.data.data.openId||'',
  134. },
  135. user:{
  136. token:res.data.data.token,
  137. openId:res.data.data.openId,
  138. id:res.data.data.id,
  139. gender:res.data.data.gender,
  140. realName:res.data.data.realName,
  141. mobile:res.data.data.mobile,
  142. email:res.data.data.email,
  143. headUrl:res.data.data.headUrl,
  144. teamId:res.data.data.teamId,
  145. enterpriseId:res.data.data.enterpriseId,
  146. enterpriseName:res.data.data.enterpriseName,
  147. teamName:res.data.data.teamName,
  148. channelType:that.channelType||'',
  149. referrerId:res.data.data.referrerId||that.referrerId||'',
  150. teamQuestionnaireId:res.data.data.teamQuestionnaireId||that.teamQuestionnaireId||'',
  151. isRegister:res.data.data.isRegister,
  152. userBrief:res.data.data.userBrief||'',
  153. }
  154. }))
  155. })
  156. }
  157. }else that.$showToast(res.data.msg)
  158. })
  159. }
  160. })
  161. },
  162. loginSuccessFn(res){
  163. uni.setStorageSync('token',res.data.data.token);
  164. uni.setStorageSync('userInfo',JSON.stringify({
  165. id:res.data.data.id,
  166. openId:res.data.data.openId,
  167. gender:res.data.data.gender,
  168. realName:res.data.data.realName,
  169. mobile:res.data.data.mobile,
  170. email:res.data.data.email,
  171. headUrl:res.data.data.headUrl,
  172. teamId:res.data.data.teamId,
  173. enterpriseId:res.data.data.enterpriseId,
  174. enterpriseName:res.data.data.enterpriseName,
  175. teamName:res.data.data.teamName,
  176. channelType:this.channelType||'',
  177. referrerId:res.data.data.referrerId||this.referrerId||'',
  178. teamQuestionnaireId:res.data.data.teamQuestionnaireId||this.teamQuestionnaireId||'',
  179. isRegister:res.data.data.isRegister,
  180. userBrief:res.data.data.userBrief||'',
  181. }));
  182. uni.hideLoading();
  183. this.$showToast('登录成功');
  184. setTimeout(()=>{
  185. uni.reLaunch({ url:'/pages/home' })
  186. },1500)
  187. },
  188. changeAgree(){
  189. this.agree = !this.agree
  190. },
  191. turnPage(url){
  192. uni.navigateTo({
  193. url
  194. })
  195. },
  196. }
  197. }
  198. </script>
  199. <style scoped lang="scss">
  200. .page{
  201. background: #FFFFFF;
  202. display: flex;
  203. flex-direction: column;
  204. box-sizing: border-box;
  205. .topbg{
  206. width: 100%;
  207. height: 584rpx;
  208. position: fixed;
  209. top: 0;
  210. left: 0;
  211. }
  212. .content{
  213. padding: 0 45rpx;
  214. flex: 1;
  215. overflow-y: auto;
  216. display: flex;
  217. flex-direction: column;
  218. justify-content: space-between;
  219. position: relative;
  220. .c_top{
  221. padding: 0 20rpx;
  222. &>image{
  223. width: 500rpx;
  224. height: 72rpx;
  225. margin-top: 87rpx;
  226. }
  227. .title{
  228. font-family: PingFang-SC, PingFang-SC;
  229. font-weight: bold;
  230. font-size: 30rpx;
  231. color: #002846;
  232. line-height: 40rpx;
  233. margin-top: 51rpx;
  234. }
  235. .tip{
  236. font-family: PingFangSC, PingFang SC;
  237. font-weight: 400;
  238. font-size: 24rpx;
  239. color: #667E90;
  240. line-height: 40rpx;
  241. margin-top: 9rpx;
  242. }
  243. .item{
  244. margin-top: 40rpx;
  245. .qa{
  246. box-sizing: border-box;
  247. p{
  248. font-family: PingFang-SC, PingFang-SC;
  249. font-weight: bold;
  250. font-size: 30rpx;
  251. color: #002846;
  252. line-height: 42rpx;
  253. &:last-child{
  254. font-weight: 400;
  255. font-size: 24rpx;
  256. color: #667E90;
  257. line-height: 40rpx;
  258. margin-top: 12rpx;
  259. }
  260. }
  261. }
  262. }
  263. }
  264. .c_bottom{
  265. .qx_btn{
  266. margin-top: 36rpx;
  267. background: #FFFFFF;
  268. border: 1rpx solid #E0E4E7;
  269. font-family: PingFang-SC, PingFang-SC;
  270. font-weight: bold;
  271. font-size: 32rpx;
  272. color: #002846;
  273. }
  274. .agree{
  275. margin-top: 64rpx;
  276. image{
  277. width: 30rpx;
  278. height: 30rpx;
  279. }
  280. .text{
  281. margin-left: 8rpx;
  282. font-family: PingFangSC, PingFang SC;
  283. font-weight: 400;
  284. font-size: 24rpx;
  285. color: #95A5B1;
  286. line-height: 44rpx;
  287. span{
  288. color: #002846;
  289. }
  290. }
  291. }
  292. }
  293. }
  294. }
  295. .code{
  296. width: 100%;
  297. padding: 48rpx 30rpx 88rpx;
  298. box-sizing: border-box;
  299. border-radius: 32rpx 32rpx 0 0;
  300. position: relative;
  301. &>image{
  302. width: 100%;
  303. height: 514rpx;
  304. border-radius: 32rpx 32rpx 0 0;
  305. position: absolute;
  306. left: 0;
  307. top: 0;
  308. }
  309. .code-box{
  310. position: relative;
  311. p{
  312. font-family: PingFang-SC, PingFang-SC;
  313. font-weight: bold;
  314. font-size: 36rpx;
  315. color: #002846;
  316. line-height: 36rpx;
  317. text-align: center;
  318. }
  319. &-inp{
  320. width: 100%;
  321. height: 120rpx;
  322. background: #FFFFFF;
  323. border-radius: 24rpx;
  324. padding: 0 24rpx;
  325. box-sizing: border-box;
  326. margin-top: 20rpx;
  327. &-left{
  328. width: 130rpx;
  329. font-family: PingFang-SC, PingFang-SC;
  330. font-weight: bold;
  331. font-size: 30rpx;
  332. color: #002846;
  333. line-height: 42rpx;
  334. }
  335. &-right{
  336. width: calc(100% - 130rpx);
  337. }
  338. }
  339. .zt_btn{
  340. margin-top: 149rpx;
  341. font-size: 32rpx;
  342. letter-spacing: 2rpx
  343. }
  344. .qx_btn{
  345. margin-top: 40rpx;
  346. background: #FFFFFF;
  347. border: 1rpx solid #E0E4E7;
  348. color: #002846;
  349. font-size: 32rpx;
  350. letter-spacing: 2rpx;
  351. }
  352. }
  353. }
  354. </style>