login.vue 10 KB

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