login-old-account.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="container">
  3. <view class="login-wrap">
  4. <view class="login-form">
  5. <u--form
  6. labelPosition="left"
  7. :model="reqParm"
  8. :rules="rules"
  9. ref="form1"
  10. >
  11. <u-form-item
  12. label="账号密码"
  13. prop="password"
  14. borderBottom
  15. labelWidth="auto"
  16. labelAlign="right"
  17. >
  18. <u--input
  19. v-model="reqParm.password"
  20. placeholder="请输入账号密码"
  21. border="bottom"
  22. type="password"
  23. ></u--input>
  24. </u-form-item>
  25. </u--form>
  26. </view>
  27. </view>
  28. <view @click="submitAccountPasswordVerify()" class="op-btn-wrap">
  29. <view class="h-btn">
  30. <text>确定</text>
  31. </view>
  32. </view>
  33. <!-- 密码正确 -->
  34. <u-popup :show="show" :round="10" mode="center" @close="close" @open="open">
  35. <view class="h-popo-content">
  36. <view class="h-img">
  37. <u-icon name="checkbox-mark" color="green" size="40"></u-icon>
  38. </view>
  39. <view class="text">
  40. <text>账号找回成功</text>
  41. </view>
  42. <view class="text">
  43. <text> 是否立即绑定新的微信号</text>
  44. </view>
  45. <view class="h-btn-wrap">
  46. <view @click="show = false" class="h-left-btn">
  47. <text>取消</text>
  48. </view>
  49. <view @click="gotoBindWechat()" class="h-right-btn">
  50. <text>立即绑定</text>
  51. </view>
  52. </view>
  53. </view>
  54. </u-popup>
  55. <!-- 密码正确 -->
  56. <u-popup :show="passwordErrShow" :round="10" mode="center" @close="close" @open="open">
  57. <view class="h-popo-content">
  58. <view class="h-img">
  59. <u-icon name="close" color="red" size="40"></u-icon>
  60. </view>
  61. <view class="h-text">
  62. <text>密码错误</text>
  63. </view>
  64. <view class="h-btn-wrap">
  65. <view @click="passwordErrShow = false" class="h-right-btn">
  66. <text>确定</text>
  67. </view>
  68. </view>
  69. </view>
  70. </u-popup>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data() {
  76. return {
  77. passwordErrShow: false,
  78. show: false,
  79. reqParm: {
  80. phone: '',
  81. password: '',
  82. },
  83. rules: {
  84. password:{
  85. required: true,
  86. message: '请输入账号密码',
  87. trigger: ['blur', 'change'],
  88. },
  89. },
  90. }
  91. },
  92. onLoad(option) {
  93. // 判断Openid是否为空
  94. this.reqParm.phone = option.phone;
  95. },
  96. onReady() {
  97. },
  98. methods: {
  99. // 提交账号密码验证
  100. submitAccountPasswordVerify(){
  101. this.$refs.form1.validate().then(res => {
  102. // 验证找回
  103. this.wechatRetrieveAccountPwdLogin();
  104. }).catch(errors => {
  105. uni.$u.toast('校验失败,请认真填写')
  106. })
  107. },
  108. // 账号密码找回登录
  109. wechatRetrieveAccountPwdLogin(){
  110. let that = this;
  111. // 根据手机和密码找回账号,成功自动登录
  112. this.$api.wechatRetrieveAccountPwdLogin(this.reqParm).then((res)=>{
  113. uni.setStorageSync('userInfo',res.userInfo)
  114. uni.setStorageSync('accessToken',res.access_token)
  115. uni.switchTab({
  116. url: '/pages/index/index',
  117. })
  118. }).catch(() =>{
  119. uni.showToast({
  120. title: "操作失败"
  121. })
  122. });
  123. },
  124. // 去绑定微信
  125. gotoBindWechat(){
  126. this.show = false;
  127. uni.$u.route({
  128. url: '/pages/setting/setting-wechat',
  129. params: {
  130. name: 'lisa'
  131. }
  132. })
  133. },
  134. }
  135. }
  136. </script>
  137. <style lang="scss">
  138. page,body{
  139. background: #fff;
  140. }
  141. .container{
  142. background: #fff;
  143. height: 300px;
  144. .login-wrap {
  145. display: flex;
  146. justify-content: center;
  147. .login-form{
  148. width: 90%;
  149. }
  150. .account{
  151. display: flex;
  152. }
  153. .identifying-code{
  154. }
  155. }
  156. .op-btn-wrap{
  157. margin-top: 30px;
  158. display: flex;
  159. justify-content: center;
  160. align-items: center;
  161. .h-btn{
  162. text-align: center;
  163. width: 343px;
  164. height: 42px;
  165. background: #FFE05C;
  166. border-radius: 27px;
  167. line-height: 42px;
  168. }
  169. }
  170. }
  171. .h-popo-content{
  172. height: 170px;
  173. padding: 12px;
  174. width: 300px;
  175. text-align: center;
  176. font-size: 14px;
  177. font-family: PingFangSC-Semibold, PingFang SC;
  178. .h-img{
  179. display: flex;
  180. justify-content: center;
  181. }
  182. .h-text{
  183. margin-top: 12px;
  184. font-weight: 400;
  185. color: #666666;
  186. }
  187. .text{
  188. margin-top: 6px;
  189. font-weight: 400;
  190. color: #666666;
  191. }
  192. .h-btn-wrap{
  193. display: flex;
  194. justify-content: space-between;
  195. color: #333333;
  196. text-align: center;
  197. margin-top: 14px;
  198. .h-left-btn{
  199. height: 32px;
  200. line-height: 30px;
  201. background: #EEEEEE;
  202. width: 100px;
  203. text-align: center;
  204. border-radius: 16px;
  205. margin: 0 auto;
  206. }
  207. .h-right-btn{
  208. height: 32px;
  209. line-height: 30px;
  210. background: #FFE05C;
  211. width: 100px;
  212. border-radius: 16px;
  213. margin: 0 auto;
  214. }
  215. }
  216. }
  217. </style>