login.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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. isRegister:res.data.data.isRegister,
  129. referrerId:res.data.data.referrerId||that.referrerId||'',
  130. teamQuestionnaireId:res.data.data.teamQuestionnaireId||that.teamQuestionnaireId||'',
  131. userId:res.data.data.id||'',
  132. openId:res.data.data.openId||'',
  133. },
  134. user:{
  135. token:res.data.data.token,
  136. openId:res.data.data.openId,
  137. id:res.data.data.id,
  138. gender:res.data.data.gender,
  139. realName:res.data.data.realName,
  140. mobile:res.data.data.mobile,
  141. headUrl:res.data.data.headUrl,
  142. teamId:res.data.data.teamId,
  143. enterpriseId:res.data.data.enterpriseId,
  144. enterpriseName:res.data.data.enterpriseName,
  145. teamName:res.data.data.teamName,
  146. channelType:that.channelType||'',
  147. referrerId:res.data.data.referrerId||that.referrerId||'',
  148. teamQuestionnaireId:res.data.data.teamQuestionnaireId||that.teamQuestionnaireId||'',
  149. isRegister:res.data.data.isRegister
  150. }
  151. }))
  152. })
  153. }
  154. }else that.$showToast(res.data.msg)
  155. })
  156. }
  157. })
  158. },
  159. loginSuccessFn(res){
  160. uni.setStorageSync('token',res.data.data.token);
  161. uni.setStorageSync('userInfo',JSON.stringify({
  162. id:res.data.data.id,
  163. openId:res.data.data.openId,
  164. gender:res.data.data.gender,
  165. realName:res.data.data.realName,
  166. mobile:res.data.data.mobile,
  167. headUrl:res.data.data.headUrl,
  168. teamId:res.data.data.teamId,
  169. enterpriseId:res.data.data.enterpriseId,
  170. enterpriseName:res.data.data.enterpriseName,
  171. teamName:res.data.data.teamName,
  172. channelType:this.channelType||'',
  173. referrerId:res.data.data.referrerId||this.referrerId||'',
  174. teamQuestionnaireId:res.data.data.teamQuestionnaireId||this.teamQuestionnaireId||'',
  175. isRegister:res.data.data.isRegister
  176. }));
  177. uni.hideLoading();
  178. this.$showToast('登录成功');
  179. setTimeout(()=>{
  180. uni.reLaunch({ url:'/pages/home' })
  181. },1500)
  182. },
  183. changeAgree(){
  184. this.agree = !this.agree
  185. },
  186. turnPage(url){
  187. uni.navigateTo({
  188. url
  189. })
  190. },
  191. }
  192. }
  193. </script>
  194. <style scoped lang="scss">
  195. .page{
  196. background: #FFFFFF;
  197. display: flex;
  198. flex-direction: column;
  199. box-sizing: border-box;
  200. .topbg{
  201. width: 100%;
  202. height: 584rpx;
  203. position: fixed;
  204. top: 0;
  205. left: 0;
  206. }
  207. .content{
  208. padding: 0 45rpx;
  209. flex: 1;
  210. overflow-y: auto;
  211. display: flex;
  212. flex-direction: column;
  213. justify-content: space-between;
  214. position: relative;
  215. .c_top{
  216. padding: 0 20rpx;
  217. &>image{
  218. width: 500rpx;
  219. height: 72rpx;
  220. margin-top: 87rpx;
  221. }
  222. .title{
  223. font-family: PingFang-SC, PingFang-SC;
  224. font-weight: bold;
  225. font-size: 30rpx;
  226. color: #002846;
  227. line-height: 40rpx;
  228. margin-top: 51rpx;
  229. }
  230. .tip{
  231. font-family: PingFangSC, PingFang SC;
  232. font-weight: 400;
  233. font-size: 24rpx;
  234. color: #667E90;
  235. line-height: 40rpx;
  236. margin-top: 9rpx;
  237. }
  238. .item{
  239. margin-top: 40rpx;
  240. .qa{
  241. box-sizing: border-box;
  242. p{
  243. font-family: PingFang-SC, PingFang-SC;
  244. font-weight: bold;
  245. font-size: 30rpx;
  246. color: #002846;
  247. line-height: 42rpx;
  248. &:last-child{
  249. font-weight: 400;
  250. font-size: 24rpx;
  251. color: #667E90;
  252. line-height: 40rpx;
  253. margin-top: 12rpx;
  254. }
  255. }
  256. }
  257. }
  258. }
  259. .c_bottom{
  260. .qx_btn{
  261. margin-top: 36rpx;
  262. background: #FFFFFF;
  263. border: 1rpx solid #E0E4E7;
  264. font-family: PingFang-SC, PingFang-SC;
  265. font-weight: bold;
  266. font-size: 32rpx;
  267. color: #002846;
  268. }
  269. .agree{
  270. margin-top: 64rpx;
  271. image{
  272. width: 30rpx;
  273. height: 30rpx;
  274. }
  275. .text{
  276. margin-left: 8rpx;
  277. font-family: PingFangSC, PingFang SC;
  278. font-weight: 400;
  279. font-size: 24rpx;
  280. color: #95A5B1;
  281. line-height: 44rpx;
  282. span{
  283. color: #002846;
  284. }
  285. }
  286. }
  287. }
  288. }
  289. }
  290. .code{
  291. width: 100%;
  292. padding: 48rpx 30rpx 88rpx;
  293. box-sizing: border-box;
  294. border-radius: 32rpx 32rpx 0 0;
  295. position: relative;
  296. &>image{
  297. width: 100%;
  298. height: 514rpx;
  299. border-radius: 32rpx 32rpx 0 0;
  300. position: absolute;
  301. left: 0;
  302. top: 0;
  303. }
  304. .code-box{
  305. position: relative;
  306. p{
  307. font-family: PingFang-SC, PingFang-SC;
  308. font-weight: bold;
  309. font-size: 36rpx;
  310. color: #002846;
  311. line-height: 36rpx;
  312. text-align: center;
  313. }
  314. &-inp{
  315. width: 100%;
  316. height: 120rpx;
  317. background: #FFFFFF;
  318. border-radius: 24rpx;
  319. padding: 0 24rpx;
  320. box-sizing: border-box;
  321. margin-top: 20rpx;
  322. &-left{
  323. width: 130rpx;
  324. font-family: PingFang-SC, PingFang-SC;
  325. font-weight: bold;
  326. font-size: 30rpx;
  327. color: #002846;
  328. line-height: 42rpx;
  329. }
  330. &-right{
  331. width: calc(100% - 130rpx);
  332. }
  333. }
  334. .zt_btn{
  335. margin-top: 149rpx;
  336. font-size: 32rpx;
  337. letter-spacing: 2rpx
  338. }
  339. .qx_btn{
  340. margin-top: 40rpx;
  341. background: #FFFFFF;
  342. border: 1rpx solid #E0E4E7;
  343. color: #002846;
  344. font-size: 32rpx;
  345. letter-spacing: 2rpx;
  346. }
  347. }
  348. }
  349. </style>