login-old-account.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. if (res.data.code == 200){
  114. uni.setStorageSync('userInfo',res.userInfo)
  115. uni.setStorageSync('accessToken',res.access_token)
  116. uni.switchTab({
  117. url: '/pages/index/index',
  118. })
  119. }else {
  120. uni.showToast({
  121. icon: 'error',
  122. title: "操作失败"
  123. })
  124. }
  125. }).catch(() =>{
  126. uni.showToast({
  127. title: "操作失败"
  128. })
  129. });
  130. },
  131. // 去绑定微信
  132. gotoBindWechat(){
  133. this.show = false;
  134. uni.$u.route({
  135. url: '/pages/setting/setting-wechat',
  136. params: {
  137. name: 'lisa'
  138. }
  139. })
  140. },
  141. }
  142. }
  143. </script>
  144. <style lang="scss">
  145. page,body{
  146. background: #fff;
  147. }
  148. .container{
  149. background: #fff;
  150. height: 300px;
  151. .login-wrap {
  152. display: flex;
  153. justify-content: center;
  154. .login-form{
  155. width: 90%;
  156. }
  157. .account{
  158. display: flex;
  159. }
  160. .identifying-code{
  161. }
  162. }
  163. .op-btn-wrap{
  164. margin-top: 30px;
  165. display: flex;
  166. justify-content: center;
  167. align-items: center;
  168. .h-btn{
  169. text-align: center;
  170. width: 343px;
  171. height: 42px;
  172. background: #FFE05C;
  173. border-radius: 27px;
  174. line-height: 42px;
  175. }
  176. }
  177. }
  178. .h-popo-content{
  179. height: 170px;
  180. padding: 12px;
  181. width: 300px;
  182. text-align: center;
  183. font-size: 14px;
  184. font-family: PingFangSC-Semibold, PingFang SC;
  185. .h-img{
  186. display: flex;
  187. justify-content: center;
  188. }
  189. .h-text{
  190. margin-top: 12px;
  191. font-weight: 400;
  192. color: #666666;
  193. }
  194. .text{
  195. margin-top: 6px;
  196. font-weight: 400;
  197. color: #666666;
  198. }
  199. .h-btn-wrap{
  200. display: flex;
  201. justify-content: space-between;
  202. color: #333333;
  203. text-align: center;
  204. margin-top: 14px;
  205. .h-left-btn{
  206. height: 32px;
  207. line-height: 30px;
  208. background: #EEEEEE;
  209. width: 100px;
  210. text-align: center;
  211. border-radius: 16px;
  212. margin: 0 auto;
  213. }
  214. .h-right-btn{
  215. height: 32px;
  216. line-height: 30px;
  217. background: #FFE05C;
  218. width: 100px;
  219. border-radius: 16px;
  220. margin: 0 auto;
  221. }
  222. }
  223. }
  224. </style>