forgotPassword.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. <template>
  2. <view class="app">
  3. <view class="top-view">
  4. <image class="bg" src="/static/img/login-bg.png"></image>
  5. <view class="inner">
  6. <view class="statusBar" :style="'height:' + statusBarHeight + 'px'"></view>
  7. <view class="inner-body fx-h fx-bc fx-ac">
  8. <view class="prv" @tap="utils.navigateBack()">
  9. <image src="/static/img/ic_back_white.png" class="icon-back"></image>
  10. </view>
  11. <view class="logo">
  12. <image src="/static/img/cbb_white.png"></image>
  13. </view>
  14. <view class="label-text">忘记密码</view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="body">
  19. <view class="h120"></view>
  20. <view class="input-view">
  21. <view class="login-input fx-r">
  22. <view class="left fx-r fx-bc ">
  23. <view class="label">+86</view>
  24. <image class="loginv" src="/static/img/login-v.png"></image>
  25. </view>
  26. <input type="number" v-model="form.mobile" placeholder="请输入手机号" />
  27. </view>
  28. <view class="login-input yzm fx-r fx-bc">
  29. <view class="left fx-h fx-ac">
  30. <image class="icon" style="margin-left: 20rpx;" src="/static/img/login-password.png"></image>
  31. </view>
  32. <input type="text" v-model="form.verify" placeholder="请输入验证码" />
  33. <view class="line"></view>
  34. <view v-if="verifyCount <= 0" class="sbtn" @tap="getVcode">验证码</view>
  35. <view v-else class="no-sbtn">{{ verifyCount }} S</view>
  36. </view>
  37. <view class="login-input pass fx-r fx-bc">
  38. <view class="left fx-h fx-ac">
  39. <image class="icon" style="margin-left: 20rpx;" src="/static/img/login-password.png"></image>
  40. </view>
  41. <input type="text" v-model="form.password" password="*" placeholder="请输入密码" />
  42. <view class="fx-g1"></view>
  43. <image @tap="showPass = !showPass" :src="showPass ? '/static/img/mis_pass.png' : '/static/img/ck_pass.png' " class="miss-pass"></image>
  44. </view>
  45. <view class="btn ihover" @tap="tapSubmit">确认修改</view>
  46. <view id="captcha"></view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <style lang="scss">
  52. page{background: #fff;}
  53. .top-view{
  54. position: relative;
  55. width: 100vw;
  56. height: 62vw;
  57. .bg{width: 100vw;height: 62vw;}
  58. .inner{
  59. position: absolute;
  60. width: 100%;
  61. height: 100%;
  62. top: 0;
  63. left: 0;
  64. .inner-body{
  65. position:relative;
  66. .prv{
  67. position: absolute;
  68. left: 20rpx;
  69. top: 20rpx;
  70. .icon-back{
  71. width: 60rpx;
  72. height: 60rpx;
  73. }
  74. }
  75. .logo{
  76. width: 200rpx;
  77. height: 119rpx;
  78. margin-bottom: 40rpx;
  79. margin-top: 60rpx;
  80. image{width: 100%;height: 100%;}
  81. }
  82. .label-text{
  83. font-size: 42rpx;
  84. color: #FFFFFF;
  85. }
  86. }
  87. }
  88. }
  89. .body{
  90. position: relative;
  91. background: #fff;
  92. border-radius: 80rpx 80rpx 0px 0px;
  93. top: -120rpx;
  94. z-index: 9;
  95. height: 500px;
  96. .h120{height: 100rpx;}
  97. .input-view{
  98. padding: 0px 60rpx;
  99. .login-input{
  100. border-radius: 70rpx;
  101. border: 1px solid #E0E0E0;
  102. padding: 30rpx 46rpx;
  103. margin-bottom: 50rpx;
  104. .left{
  105. .label{
  106. font-size: 28rpx;
  107. color: #DB292B;
  108. font-weight: bold;
  109. }
  110. .loginv{width: 15rpx;height: 12rpx;margin-left: 14rpx;}
  111. .icon{width: 30rpx;height: 33rpx;}
  112. width: 90rpx;
  113. }
  114. input{
  115. width: calc(100% - 90rpx);
  116. }
  117. &.yzm{
  118. input{
  119. width: calc(100% - 90rpx - 22rpx - 80rpx);
  120. }
  121. .line{
  122. width: 1px;
  123. height: 36rpx;
  124. background: #eee;
  125. margin-right: 20rpx;
  126. }
  127. .sbtn{
  128. font-size: 12px;
  129. color: #DB292B;
  130. }
  131. .no-sbtn{
  132. font-size: 12px;
  133. color: #999999;
  134. }
  135. }
  136. &.pass{
  137. input{
  138. width: calc(100% - 180rpx);
  139. }
  140. .miss-pass{width: 60rpx;height: 60rpx}
  141. }
  142. }
  143. }
  144. .btn{
  145. background: #DB292B;
  146. border-radius: 60rpx;
  147. text-align: center;
  148. font-weight: bold;
  149. font-size: 28rpx;
  150. padding: 30rpx 0;
  151. color: #FAFAFA;
  152. }
  153. .agament{
  154. margin-top: 40rpx;
  155. image{width: 36rpx;height: 36rpx;margin-right: 20rpx;}
  156. color: #999999;
  157. font-size:24rpx;
  158. text{color: #DB292B;}
  159. }
  160. }
  161. .miss-pass{width: 30px;height: 30px;}
  162. .mb-view{font-size: 14px; margin-top: 30px;padding: 0px 5px;}
  163. .mb-view .link{color: #DB292B;}
  164. </style>
  165. <script>
  166. import uParse from '@/components/gaoyia-parse/parse.vue';
  167. import maoScroll from '@/components/mao-scroll/mao-scroll.vue';
  168. import customerWiget from '@/components/ui-public/customer-wiget.vue';
  169. import { mapState, mapMutations } from 'vuex';
  170. export default {
  171. components: {
  172. uParse,
  173. maoScroll,
  174. customerWiget
  175. },
  176. data() {
  177. return {
  178. statusBarHeight: 20,
  179. form:{
  180. mobile : "",
  181. password : "",
  182. verify : ""
  183. },
  184. isRead : false,
  185. verifyCount : 0,
  186. showPass : false,
  187. captchaIns : null,
  188. validate : ""
  189. }
  190. },
  191. onLoad() {
  192. this.initView();
  193. this.$nextTick(()=>{
  194. this.initNeCaptcha();
  195. });
  196. },
  197. methods: {
  198. ...mapMutations(['setSys','setUser']),
  199. initView: function() {
  200. uni.getSystemInfo({
  201. success: (res) => {
  202. this.statusBarHeight = res.statusBarHeight;
  203. }
  204. });
  205. },
  206. initNeCaptcha () {
  207. // #ifdef H5
  208. const options = {
  209. captchaId: 'c6af8490405544f8a169504b11c86fdc',
  210. element: '#captcha',
  211. protocol: 'https',
  212. onVerify: (err, data) => {
  213. if(data != null || data != "") {
  214. this.validate = data.validate;
  215. this.getVcode2();
  216. }
  217. }
  218. }
  219. options.mode = 'popup';
  220. initNECaptcha({ ...options }, ins => {
  221. this.captchaIns = ins
  222. })
  223. // #endif
  224. // #ifdef APP
  225. this.captchaIns = uni.requireNativePlugin('YD-Captcha')
  226. this.captchaIns.init({
  227. captcha_id: 'c6af8490405544f8a169504b11c86fdc',
  228. is_no_sense_mode: false
  229. });
  230. // #endif
  231. },
  232. /**
  233. * 注册
  234. */
  235. tapReg:function(){
  236. uni.navigateTo({ url:"./register" });
  237. },
  238. getVcode:function(){
  239. if (this.verifyCount > 0) return;
  240. if (!this.utils.isPoneAvailable(this.form.mobile)) {
  241. return uni.showToast({
  242. title: '请输入正确的手机号码!',
  243. mask: true,
  244. icon: 'none'
  245. });
  246. }
  247. // #ifdef H5
  248. this.captchaIns.popUp();
  249. // #endif
  250. // #ifdef APP
  251. this.captchaIns.showCaptcha((data)=>{
  252. var method = data.method;
  253. if(method == "onSuccess"){
  254. var data = data.data;
  255. this.validate = data.validate;
  256. this.getVcode2();
  257. }
  258. })
  259. // #endif
  260. },
  261. getVcode2: function() {
  262. uni.showLoading({
  263. title: "获取中..."
  264. });
  265. this
  266. .request
  267. .post("findYzm", { mobile: this.form.mobile,validate : this.validate})
  268. .then(res => {
  269. uni.hideLoading();
  270. if (res.code == 200) {
  271. if (res.data.status == 2) {
  272. this.utils.CountDowm(res.data.time, (e, s) => {
  273. this.verifyCount = e;
  274. });
  275. }
  276. if (res.data.status == 1) {
  277. this.utils.CountDowm(120, (e, s) => {
  278. this.verifyCount = e;
  279. });
  280. }
  281. } else {
  282. uni.showToast({
  283. title: res.msg,
  284. mask: true,
  285. icon: 'none'
  286. });
  287. }
  288. })
  289. .catch(err => {
  290. uni.showToast({
  291. title: '获取失败',
  292. mask: true,
  293. icon: 'none'
  294. });
  295. uni.hideLoading();
  296. });
  297. },
  298. /**
  299. * 提交数据
  300. */
  301. tapSubmit:function(){
  302. //手机号码
  303. if(this.form.mobile == ""){
  304. uni.showToast({
  305. title:"请输入手机号码",icon:"none",mask:true
  306. })
  307. return;
  308. }
  309. //手机验证号码
  310. //this.form.mobile
  311. if(!this.utils.isPoneAvailable(this.form.mobile) ){
  312. uni.showToast({
  313. title:"请输入正确的手机号码",icon:"none",mask:true
  314. })
  315. return;
  316. }
  317. if (this.form.password == '') {
  318. uni.showToast({
  319. title: '请输入密码',
  320. mask: true,
  321. icon: 'none'
  322. });
  323. return;
  324. }
  325. uni.showLoading({ title: '登录中..' });
  326. this.request
  327. .post("findPassword",this.form)
  328. .then(res=>{
  329. uni.hideLoading();
  330. if(res.code == 200) {
  331. this.setUser(res.data);
  332. this.webSocket.connect();
  333. uni.reLaunch({ url:"../index/index"});
  334. } else {
  335. uni.showToast({ title:res.msg,icon:"none",mask:true});
  336. }
  337. })
  338. .catch(res=>{
  339. uni.hideLoading();
  340. uni.showModal({title: '系统提示',content: '加载失败,重新点击尝试!',showCancel: false});
  341. });
  342. }
  343. }
  344. }
  345. </script>