bindemail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view class="container login">
  3. <view class="login-main">
  4. <text class="logo-text">您的账号尚未绑定机构邮箱,请填写机构邮箱地址进行绑定。邮箱可用于登录和修改密码。</text>
  5. </view>
  6. <view class="login-form clearfix">
  7. <view class="login-input">
  8. <input type="number"
  9. v-model="bindEmail"
  10. maxlength="30"
  11. class="input"
  12. @blur="onBlurInput"
  13. placeholder="请输入邮箱地址"
  14. />
  15. </view>
  16. </view>
  17. <view class="login-form clearfix">
  18. <view class="login-input code">
  19. <input type="number"
  20. v-model="bindEmailCode"
  21. maxlength="6"
  22. class="input"
  23. placeholder="请输入邮箱验证码"
  24. />
  25. </view>
  26. <view class="login-input btn" :class="[isDisabled === true ? 'disabled' : 'none']">
  27. <button type="button"
  28. @click.stop="getEmailCode" :disabled="isDisabled"
  29. class="input"
  30. >获取验证码</button>
  31. </view>
  32. </view>
  33. <view class="login-form clearfix">
  34. <view class="login-btn" @click="goLogin">绑定</view>
  35. </view>
  36. <view v-if="isToast" class="model-warp" >
  37. <view class="model-alert clearfix">
  38. <view class="alert-content">
  39. <view class="t-h1">{{toestText}}</view>
  40. <view class="t-p">请联系客服获取{{alertText}}后再登录,联系电话{{telPhone}}</view>
  41. </view>
  42. <view class="alert-btn">
  43. <view class="btn btn-confirm" @click="hideToast">确定</view>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 授权按钮 -->
  48. <view class="model-warp" :class="[isUserInfo===false ? 'none':'show']">
  49. <view class="model-alert">
  50. <view class="alert-content">
  51. <view class="t-p">采美采购商城需要获取您的微信授权才能正常提供服务</view>
  52. </view>
  53. <view class="alert-btn">
  54. <view class="btn btn-cancel" @click="hideModel">取消</view>
  55. <button type="primary" size="small" open-type="getUserInfo" lang="zh_CN" @getuserinfo="getuserinfo" class="btn btn-confirm">授权</button>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import { mapMutations } from 'vuex';
  63. import authorize from '@/common/config/authorize.js'
  64. var self;
  65. export default{
  66. data() {
  67. return{
  68. bindEmail:'', //用户绑定邮箱
  69. bindEmailCode:'', //用户绑定邮箱验证码
  70. isDisabled:true, //获取验证码按钮
  71. isToast:false, //控制显示未输入邀请码提示
  72. isUserInfo:false, //控制显示授权弹窗
  73. nickName:'', //存储用户名
  74. userInfo:'', //存储微信用户授权信息
  75. isSuccess:false,
  76. toestText:'',
  77. telPhone:'',
  78. loginType:'', //跳转类型
  79. alertText:'',
  80. listType: '',
  81. listVal: '',
  82. detilType:'',
  83. id:''//商品ID
  84. }
  85. },
  86. onLoad(option) {
  87. console.log(option)
  88. },
  89. methods:{
  90. ...mapMutations(['login']),
  91. goLogin() {
  92. self.$api.get('/login/isEnabled',{userOrganizeID:self.userOrganizeID,invitationCode:self.invitationCode}, res => {
  93. if (res.code == "1") {
  94. //查看此微信用户是否已经授权过
  95. authorize.getSetting().then(res =>{
  96. // console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  97. if(res == 2){
  98. self.isUserInfo = true
  99. }else{
  100. self.isUserInfo = false
  101. self.wxGetUserInfo()
  102. }
  103. })
  104. }else if(res.code =='0'){
  105. self.toestText ='请输入邀请码';
  106. self.alertText ='邀请码';
  107. self.telPhone = res.msg;
  108. self.isToast = true;
  109. }else if(res.code =='-2'){
  110. self.toestText ='邀请码已失效';
  111. self.alertText ='新邀请码';
  112. self.telPhone = res.msg;
  113. self.isToast = true;
  114. }else if(res.code =='-3'){
  115. self.toestText ='邀请码已被使用';
  116. self.alertText ='新邀请码';
  117. self.telPhone = res.msg;
  118. self.isToast = true;
  119. }else{
  120. uni.showToast({icon:'none', title: res.msg, duration: 3000});
  121. self.isUserInfo = false
  122. }
  123. })
  124. },
  125. onBlurInput(e){//邮箱输入框失去焦点设置按钮
  126. if(e.detail.value ===''){
  127. this.isDisabled = true
  128. }else{
  129. this.isDisabled = false
  130. }
  131. },
  132. getEmailCode(){
  133. this.isDisabled = true
  134. },
  135. //关闭未填邀请码弹窗
  136. hideToast(){
  137. self.isToast = false;
  138. },
  139. //关闭未授权用户授权提示弹窗
  140. hideModel(){
  141. self.isUserInfo = false;
  142. }
  143. }
  144. }
  145. </script>
  146. <style lang="scss">
  147. .login{
  148. width: 100%;
  149. height: auto;
  150. border-top: 1px solid #F7F7F7;
  151. .model-warp.none{
  152. display: none;
  153. }
  154. .model-warp.show{
  155. display: block;
  156. }
  157. .login-main{
  158. width: 702rpx;
  159. background: rgba(225, 86, 22, 0.1);
  160. display: flex;
  161. flex-direction: column;
  162. align-items: center;
  163. height: 68rpx;
  164. padding: 20rpx 24rpx;
  165. margin: 24rpx 0 118rpx 0;
  166. .logo-text{
  167. font-size: 24rpx;
  168. line-height: 34rpx;
  169. color: $color-system;
  170. }
  171. }
  172. .login-form{
  173. width: 702rpx;
  174. height: auto;
  175. padding: 0 24rpx;
  176. .login-input{
  177. width: 654rpx;
  178. height: 40rpx;
  179. padding: 24rpx;
  180. margin-bottom: 20rpx;
  181. background: #F7F7F7;
  182. border-radius: 14rpx;
  183. display: flex;
  184. flex-direction: column;
  185. align-items: center;
  186. &.code{
  187. width: 380rpx;
  188. float: left;
  189. margin-right: 20rpx;
  190. }
  191. &.btn{
  192. width: 210rpx;
  193. float: left;
  194. &.none{
  195. background: $btn-confirm;
  196. .input{
  197. color: #FFFFFF;
  198. background: $btn-confirm;
  199. }
  200. }
  201. &.disabled{
  202. .input{
  203. color: #999999;
  204. }
  205. }
  206. }
  207. .input{
  208. width: 100%;
  209. height: 100%;
  210. background: #F7F7F7;
  211. font-size: $font-size-28;
  212. line-height: 40rpx;
  213. color: #333333;
  214. border-radius: 14rpx;
  215. }
  216. }
  217. }
  218. .login-btn{
  219. width: 702rpx;
  220. height: 88rpx;
  221. border-radius: 14rpx;
  222. font-size: $font-size-28;
  223. line-height: 88rpx;
  224. color: #FFFFFF;
  225. margin: 0 auto;
  226. text-align: center;
  227. background: $btn-confirm;
  228. margin-top: 100rpx;
  229. }
  230. .model-authorization{
  231. width: 100%;
  232. height: 100%;
  233. position: fixed;
  234. top: 0;
  235. left: 0;
  236. z-index: 999;
  237. .authorization{
  238. width: 518rpx;
  239. height: 320rpx;
  240. position: absolute;
  241. background: rgba(255,255,255,.7);
  242. left: 0;
  243. right: 0;
  244. bottom: 0;
  245. top: 0;
  246. margin: auto;
  247. .to-btn{
  248. position: absolute;
  249. top: 0;
  250. left: 0;
  251. right: 0;
  252. bottom: 0;
  253. margin: auto;
  254. width: 70%;
  255. height: 88rpx;
  256. font-size: $font-size-28;
  257. line-height: 88rpx;
  258. color: #FFFFFF;
  259. text-align: center;
  260. border-radius: 44rpx;
  261. }
  262. }
  263. }
  264. }
  265. </style>