password.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <template>
  2. <view class="container login">
  3. <view class="login-main">
  4. <view class="line"></view>
  5. <view class="nav-item"
  6. :class="{ current: tabCurrentIndex === 1 }"
  7. @click="tabClick(1)">
  8. 使用手机修改
  9. </view>
  10. <view class="nav-item"
  11. :class="{ current: tabCurrentIndex === 2 }"
  12. @click="tabClick(2)">
  13. 使用邮箱修改
  14. </view>
  15. </view>
  16. <!-- 手机修改 -->
  17. <view class="content" v-if="tabCurrentIndex === 1">
  18. <view class="login-form clearfix">
  19. <view class="login-input">
  20. <input type="number" v-model="bindLinkPhone" maxlength="11" class="input" @blur="onBlurInput" placeholder="请输入手机号"/>
  21. </view>
  22. </view>
  23. <view class="login-form clearfix">
  24. <view class="login-input code">
  25. <input type="number" v-model="bindGraphiCode" maxlength="4" class="input" placeholder="请输入右侧图形验证码" />
  26. </view>
  27. <view class="login-input img-btn">
  28. <view class="vscodeimg">
  29. <image src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2158189919,2752757953&fm=26&gp=0.jpg" mode=""></image>
  30. </view>
  31. <view class="vscod-refresh">
  32. <text class="iconfont icon-shuaxin"></text>
  33. <text class="ref-text">刷新</text>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="login-form clearfix">
  38. <view class="login-input code">
  39. <input type="number" v-model="bindPhoneCode" maxlength="6" class="input" placeholder="请输入短信验证码"/>
  40. </view>
  41. <view class="login-input btn" :class="[isDisabled === true ? 'disabled' : 'none']">
  42. <button type="button" @click.stop="getEmailCode" :disabled="isDisabled" class="input" >获取验证码</button>
  43. </view>
  44. </view>
  45. <view class="login-form clearfix">
  46. <view class="login-input pwd">
  47. <input v-show="isShowEye" type="text" v-model="password" maxlength="18" class="input" placeholder="请输入新密码,必须为8-16位字母数字的组合" autocomplete="new-password"/>
  48. <input v-show="!isShowEye" type="password" v-model="password" :password="true" maxlength="18" class="input" placeholder="请输入新密码,必须为8-16位字母数字的组合" autocomplete="new-password"/>
  49. <view class="iconfont" :class="isShowEye ? iconEyen : iconEyes" @click="passwordEye"></view>
  50. </view>
  51. </view>
  52. <view class="login-form clearfix">
  53. <view class="login-input pwd">
  54. <input v-show="isShowEyes" type="text" v-model="passwordCheck" maxlength="18" class="input" placeholder="请确认密码" autocomplete="new-password"/>
  55. <input v-show="!isShowEyes" type="password" v-model="passwordCheck" :password="true" maxlength="18" class="input" placeholder="请确认密码" autocomplete="new-password"/>
  56. <view class="iconfont" :class="isShowEyes ? iconEyen : iconEyes" @click="passwordEyes"></view>
  57. </view>
  58. </view>
  59. <view class="login-form clearfix">
  60. <view class="login-btn" @click="goLogin">修改密码</view>
  61. </view>
  62. </view>
  63. <!-- 邮箱修改 -->
  64. <view class="content" v-else>
  65. <view class="login-form clearfix">
  66. <view class="login-input">
  67. <input class="input" type="number" v-model="bindLinkPhone" maxlength="30" @blur="onBlurInput" placeholder="请输入邮箱地址"/>
  68. </view>
  69. </view>
  70. <view class="login-form clearfix">
  71. <view class="login-input code">
  72. <input class="input" type="number" v-model="bindPhoneCode" maxlength="6" placeholder="请输入邮箱验证码" />
  73. </view>
  74. <view class="login-input btn" :class="[isDisabled === true ? 'disabled' : 'none']">
  75. <button class="input" type="button" @click.stop="getEmailCode" :disabled="isDisabled">获取验证码</button>
  76. </view>
  77. </view>
  78. <view class="login-form clearfix">
  79. <view class="login-input pwd">
  80. <input v-show="isShowEye" type="text" v-model="password" maxlength="18" class="input" placeholder="请输入新密码,必须为8-16位字母数字的组合" autocomplete="new-password"/>
  81. <input v-show="!isShowEye" type="password" v-model="password" :password="true" maxlength="18" class="input" placeholder="请输入新密码,必须为8-16位字母数字的组合" autocomplete="new-password"/>
  82. <view class="iconfont" :class="isShowEye ? iconEyen : iconEyes" @click="passwordEye"></view>
  83. </view>
  84. </view>
  85. <view class="login-form clearfix">
  86. <view class="login-input pwd">
  87. <input v-show="isShowEyes" type="text" v-model="passwordCheck" maxlength="18" class="input" placeholder="请确认密码" autocomplete="new-password"/>
  88. <input v-show="!isShowEyes" type="password" v-model="passwordCheck" :password="true" maxlength="18" class="input" placeholder="请确认密码" autocomplete="new-password"/>
  89. <view class="iconfont" :class="isShowEyes ? iconEyen : iconEyes" @click="passwordEyes"></view>
  90. </view>
  91. </view>
  92. <view class="login-form clearfix">
  93. <view class="login-btn" @click="goLogin">修改密码</view>
  94. </view>
  95. </view>
  96. <view v-if="isToast" class="model-warp" >
  97. <view class="model-alert clearfix">
  98. <view class="alert-content">
  99. <view class="t-h1">{{toestText}}</view>
  100. <view class="t-p">请联系客服获取{{alertText}}后再登录,联系电话{{telPhone}}</view>
  101. </view>
  102. <view class="alert-btn">
  103. <view class="btn btn-confirm" @click="hideToast">确定</view>
  104. </view>
  105. </view>
  106. </view>
  107. <!-- 授权按钮 -->
  108. <view class="model-warp" :class="[isUserInfo===false ? 'none':'show']">
  109. <view class="model-alert">
  110. <view class="alert-content">
  111. <view class="t-p">采美采购商城需要获取您的微信授权才能正常提供服务</view>
  112. </view>
  113. <view class="alert-btn">
  114. <view class="btn btn-cancel" @click="hideModel">取消</view>
  115. <button type="primary" size="small" open-type="getUserInfo" lang="zh_CN" @getuserinfo="getuserinfo" class="btn btn-confirm">授权</button>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </template>
  121. <script>
  122. import { mapMutations } from 'vuex';
  123. import authorize from '@/common/config/authorize.js'
  124. var self;
  125. export default{
  126. data() {
  127. return{
  128. tabCurrentIndex: 1,
  129. mobile:'', //用户手机号
  130. bindGraphiCode:'', //图形验证
  131. bindPhoneCode:'', //手机验证码
  132. password:'', //新密码
  133. passwordCheck:'', //二次校验新密码
  134. isShowEye:false, //控显
  135. isShowEyes:false, //控显
  136. iconEyes:'icon-yanjing_yincang_o',
  137. iconEyen:'icon-yanjing_xianshi_o',
  138. isDisabled:true, //获取验证码按钮
  139. isToast:false, //控制显示未输入邀请码提示
  140. isUserInfo:false, //控制显示授权弹窗
  141. nickName:'', //存储用户名
  142. userInfo:'', //存储微信用户授权信息
  143. isSuccess:false,
  144. toestText:'',
  145. telPhone:'',
  146. loginType:'', //跳转类型
  147. alertText:'',
  148. listType: '',
  149. listVal: '',
  150. detilType:'',
  151. id:''//商品ID
  152. }
  153. },
  154. onLoad(option) {
  155. console.log(option)
  156. },
  157. methods:{
  158. ...mapMutations(['login']),
  159. goLogin() {
  160. self.$api.get('/login/isEnabled',{userOrganizeID:self.userOrganizeID,invitationCode:self.invitationCode}, res => {
  161. if (res.code == "1") {
  162. //查看此微信用户是否已经授权过
  163. authorize.getSetting().then(res =>{
  164. // console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  165. if(res == 2){
  166. self.isUserInfo = true
  167. }else{
  168. self.isUserInfo = false
  169. self.wxGetUserInfo()
  170. }
  171. })
  172. }else if(res.code =='0'){
  173. self.toestText ='请输入邀请码';
  174. self.alertText ='邀请码';
  175. self.telPhone = res.msg;
  176. self.isToast = true;
  177. }else if(res.code =='-2'){
  178. self.toestText ='邀请码已失效';
  179. self.alertText ='新邀请码';
  180. self.telPhone = res.msg;
  181. self.isToast = true;
  182. }else if(res.code =='-3'){
  183. self.toestText ='邀请码已被使用';
  184. self.alertText ='新邀请码';
  185. self.telPhone = res.msg;
  186. self.isToast = true;
  187. }else{
  188. uni.showToast({icon:'none', title: res.msg, duration: 3000});
  189. self.isUserInfo = false
  190. }
  191. })
  192. },
  193. onBlurInput(e){//邮箱输入框失去焦点设置按钮
  194. if(e.detail.value ===''){
  195. this.isDisabled = true
  196. }else{
  197. this.isDisabled = false
  198. }
  199. },
  200. getEmailCode(){
  201. this.isDisabled = true
  202. },
  203. tabClick(index) {//tab切换
  204. this.tabCurrentIndex = index;
  205. },
  206. passwordEye() {//密码显隐操作
  207. this.isShowEye = !this.isShowEye;
  208. },
  209. passwordEyes() {//密码显隐操作
  210. this.isShowEyes = !this.isShowEyes;
  211. },
  212. //关闭未填邀请码弹窗
  213. hideToast(){
  214. self.isToast = false;
  215. },
  216. //关闭未授权用户授权提示弹窗
  217. hideModel(){
  218. self.isUserInfo = false;
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss">
  224. .login{
  225. width: 100%;
  226. height: auto;
  227. .model-warp.none{
  228. display: none;
  229. }
  230. .model-warp.show{
  231. display: block;
  232. }
  233. .login-main{
  234. width: 100%;
  235. display: flex;
  236. height: 80rpx;
  237. border-top: 1px solid #F7F7F7;
  238. margin-bottom: 112rpx;
  239. position: relative;
  240. .line{
  241. position: absolute;
  242. top: 0;
  243. left: 50%;
  244. margin-left: -80rpx;
  245. width: 0;
  246. height: 0;
  247. border-left: 80rpx solid transparent;
  248. border-right: 80rpx solid transparent;
  249. border-bottom: 160rpx solid #FFFFFF;
  250. }
  251. .nav-item{
  252. display: flex;
  253. flex: 1;
  254. flex-direction: column;
  255. align-items: center;
  256. line-height: 80rpx;
  257. color: $text-color;
  258. font-size: $font-size-24;
  259. background: #F7F7F7;
  260. &.current{
  261. color:$color-system;
  262. background: #FFFFFF;
  263. }
  264. }
  265. }
  266. .login-form{
  267. width: 702rpx;
  268. height: auto;
  269. padding: 0 24rpx;
  270. .login-input{
  271. width: 654rpx;
  272. height: 40rpx;
  273. padding: 24rpx;
  274. margin-bottom: 20rpx;
  275. background: #F7F7F7;
  276. border-radius: 14rpx;
  277. display: flex;
  278. flex-direction: column;
  279. align-items: center;
  280. position: relative;
  281. &.pwd{
  282. .iconfont{
  283. position: absolute;
  284. right: 0;
  285. top: 0;
  286. font-size: 46rpx;
  287. color: $color-system;
  288. font-weight: bold;
  289. z-index: 99;
  290. width: 96rpx;
  291. height: 96rpx;
  292. line-height: 96rpx;
  293. text-align: center;
  294. }
  295. }
  296. &.code{
  297. width: 370rpx;
  298. float: left;
  299. margin-right: 20rpx;
  300. }
  301. &.btn{
  302. width: 215rpx;
  303. float: left;
  304. &.none{
  305. background: $color-system;
  306. .input{
  307. color: #FFFFFF;
  308. background: $color-system;
  309. }
  310. }
  311. &.disabled{
  312. .input{
  313. color: #999999;
  314. }
  315. }
  316. }
  317. &.img-btn{
  318. width: 250rpx;
  319. height: 88rpx;
  320. padding: 0;
  321. float: left;
  322. background: #FFFFFF;
  323. display: block;
  324. .vscodeimg{
  325. width: 180rpx;
  326. height: 88rpx;
  327. float: left;
  328. display: flex;
  329. flex-direction: column;
  330. align-items: center;
  331. border-radius: 14rpx;
  332. image{
  333. width: 180rpx;
  334. height: 88rpx;
  335. border-radius: 14rpx;
  336. }
  337. }
  338. .vscod-refresh{
  339. width: 70rpx;
  340. float: right;
  341. display: flex;
  342. flex-direction: column;
  343. align-items: center;
  344. .icon-shuaxin{
  345. font-size: 48rpx;
  346. color: #333333;
  347. }
  348. .ref-text{
  349. font-size: 24rpx;
  350. color: #333333;
  351. }
  352. }
  353. }
  354. .input{
  355. width: 100%;
  356. height: 100%;
  357. background: #F7F7F7;
  358. font-size: $font-size-28;
  359. line-height: 40rpx;
  360. color: #333333;
  361. border-radius: 14rpx;
  362. }
  363. }
  364. }
  365. .login-btn{
  366. width: 702rpx;
  367. height: 88rpx;
  368. border-radius: 14rpx;
  369. font-size: $font-size-28;
  370. line-height: 88rpx;
  371. color: #FFFFFF;
  372. margin: 0 auto;
  373. text-align: center;
  374. background: $btn-confirm;
  375. margin-top: 100rpx;
  376. }
  377. .model-authorization{
  378. width: 100%;
  379. height: 100%;
  380. position: fixed;
  381. top: 0;
  382. left: 0;
  383. z-index: 999;
  384. .authorization{
  385. width: 518rpx;
  386. height: 320rpx;
  387. position: absolute;
  388. background: rgba(255,255,255,.7);
  389. left: 0;
  390. right: 0;
  391. bottom: 0;
  392. top: 0;
  393. margin: auto;
  394. .to-btn{
  395. position: absolute;
  396. top: 0;
  397. left: 0;
  398. right: 0;
  399. bottom: 0;
  400. margin: auto;
  401. width: 70%;
  402. height: 88rpx;
  403. font-size: $font-size-28;
  404. line-height: 88rpx;
  405. color: #FFFFFF;
  406. text-align: center;
  407. border-radius: 44rpx;
  408. }
  409. }
  410. }
  411. }
  412. </style>