当前位置:   article > 正文

uniapp创建支付密码实现(初始密码,第二次密码)

uniapp创建支付密码实现(初始密码,第二次密码)

示例:

插件地址:自定义数字/身份证/密码输入框,键盘密码框可分离使 - DCloud 插件市场

1.下载插件并导入HBuilderX,找到文件夹,copy number-keyboard.vue一份为number-keyboard2.vue(number-keyboard.vue是键盘,password-input.vue是密码输入框)

2.修改插件键盘和密码框样式,已写好,直接copy下面代码

password-input.vue

  1. <template>
  2. <view class="psdIptBx">
  3. <block v-for="(item , index) in psdIptNum" :key='index'>
  4. <view class="psdTtem">
  5. <text v-if="numLng.length > index" class="psdTtemTxt">
  6. <text v-if="plaintext"></text>
  7. <text v-else>{{numLng[index]}}</text>
  8. </text>
  9. <text v-if="numLng.length ==index" class="focus_move">|</text>
  10. </view>
  11. </block>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. //是否明文 默认密文
  18. plaintext: {
  19. type: Boolean,
  20. default: true
  21. },
  22. //键盘输入的val
  23. numLng: {
  24. type: [String, Number],
  25. default: ''
  26. },
  27. //密码框的个数
  28. psdIptNum: {
  29. type: [String, Number],
  30. default: 6
  31. }
  32. },
  33. data() {
  34. return {}
  35. },
  36. created() {},
  37. methods: {
  38. }
  39. }
  40. </script>
  41. <style scoped>
  42. .psdIptBx {
  43. display: flex;
  44. justify-content: space-between;
  45. width: 100%;
  46. text-align: center;
  47. box-sizing: border-box;
  48. }
  49. .psdTtem {
  50. width: 86rpx;
  51. height: 86rpx;
  52. background: #F2F2F2;
  53. border-radius: 20rpx 20rpx 20rpx 20rpx;
  54. }
  55. .psdTtemTxt {
  56. text-align: center;
  57. line-height: 80rpx;
  58. font-size: 30rpx;
  59. }
  60. .focus_move {
  61. /* color: #E6240F; */
  62. font-size: 30rpx;
  63. line-height: 80rpx;
  64. animation: focus 0.8s infinite;
  65. }
  66. @keyframes focus {
  67. from {
  68. opacity: 1;
  69. }
  70. to {
  71. opacity: 0;
  72. }
  73. }
  74. </style>

number-keyboard.vue

  1. <template>
  2. <view :class="['KeyboarBody','bottomMove', 'bodMove', bodMove]" v-if="KeyboarHid">
  3. <view @click="close" class="dowmImgBx">
  4. <view class="dowmImg"></view>
  5. <view v-if="confirmBtn" class="complete" @click.stop="complete">完成</view>
  6. </view>
  7. <view class="KeyboarBx">
  8. <view v-for="(num , index) in keyboardNum " :key='index' @click="clickBoard(num)" hover-class="hover"
  9. :hover-stay-time='20' class="keyboar">
  10. {{num}}
  11. </view>
  12. <view @click="clickBoard(otherNum)" :class="['keyboar',otherNum==''?'empty':'']" :hover-stay-time='20'
  13. hover-class="hover">{{otherNum}}</view>
  14. <view @click="clickBoard('0')" hover-class="hover" :hover-stay-time='20' class="keyboar">0</view>
  15. <view @click="deleteKeyboar()" class="keyboar keyboarflex" :hover-stay-time='20' hover-class="hover">
  16. <view class="keyboarDel"></view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. props: {
  24. //限制输入框的长度 空值不限制
  25. psdLength: {
  26. type: [Number, String],
  27. default: ''
  28. },
  29. //键盘码
  30. keyboardNum: {
  31. type: [Array, Object],
  32. default: () => {
  33. return [1, 2, 3, 4, 5, 6, 7, 8, 9]
  34. }
  35. },
  36. //特殊键盘码 .或者X 默空
  37. otherNum: {
  38. type: String,
  39. default: ''
  40. },
  41. //是否显示完成按钮
  42. confirmBtn:{
  43. type: Boolean,
  44. default: false
  45. },
  46. //是否在需要打开键盘时隐藏底部tabBar关闭键盘展示tabBar功能
  47. tabBar: {
  48. type: Boolean,
  49. default: false
  50. },
  51. value: {
  52. type: String,
  53. default: ''
  54. }
  55. },
  56. data() {
  57. return {
  58. bodMove: '',
  59. password: '', //要返回的结果
  60. iptNum: [], //输入的内容
  61. KeyboarHid: false, //键盘影藏和显示
  62. }
  63. },
  64. watch: {
  65. iptNum(newVal, oldVal) {
  66. this.$emit('input', newVal.join(''))
  67. },
  68. value(newVal, oldVal) {
  69. this.iptNum = newVal.split('')
  70. }
  71. },
  72. created() {
  73. },
  74. methods: {
  75. open() {
  76. this.KeyboarHid = true;
  77. if (this.tabBar) {
  78. uni.hideTabBar()
  79. }
  80. this.$nextTick(() => {
  81. setTimeout(() => {
  82. this.bodMove = 'moveShow'
  83. }, 30)
  84. })
  85. },
  86. close() {
  87. if (this.tabBar) {
  88. uni.showTabBar()
  89. }
  90. this.bodMove = '';
  91. this.$nextTick(() => {
  92. setTimeout(() => {
  93. this.KeyboarHid = false
  94. }, 300)
  95. })
  96. },
  97. // 密码框
  98. clickBoard(num) {
  99. if (num == '') return;
  100. let iptNum = this.iptNum.filter(item => item != '');
  101. //判断是否限制长度
  102. if (this.psdLength != '') {
  103. if (iptNum.length >= this.psdLength) {
  104. return
  105. };
  106. this.iptNum.push(num);
  107. } else {
  108. this.iptNum.push(num);
  109. }
  110. },
  111. //完成
  112. complete(){
  113. this.$emit('confirm', this.iptNum.join(''))
  114. },
  115. //重置 清空
  116. reset() {
  117. this.iptNum = [];
  118. },
  119. //删除
  120. deleteKeyboar() {
  121. this.iptNum.pop();
  122. }
  123. }
  124. }
  125. </script>
  126. <style scoped>
  127. .bodMove {
  128. transition: all .3s
  129. }
  130. .bottomMove {
  131. bottom: 0;
  132. left: 0;
  133. width: 100%;
  134. transform: translateY(100%)
  135. }
  136. .moveShow {
  137. transform: translateY(0)
  138. }
  139. .KeyboarBody {
  140. position: fixed;
  141. bottom: 0;
  142. left: 0;
  143. right: 0;
  144. z-index: 99;
  145. background-color: #FFFFFF;
  146. }
  147. .KeyboarBx {
  148. display: flex;
  149. flex-wrap: wrap;
  150. text-align: center;
  151. background-color: rgba(3, 3, 3, 0.1);
  152. padding: 10rpx 6rpx 0rpx 6rpx;
  153. margin-left: -12rpx;
  154. }
  155. .keyboar {
  156. width: 20%;
  157. flex-grow: 1;
  158. padding: 3%;
  159. font-size: 40rpx;
  160. background-color: #FFFFFF;
  161. border-radius: 10rpx;
  162. margin-left: 12rpx;
  163. margin-bottom: 10rpx;
  164. }
  165. .dian {
  166. margin-top: -10rpx;
  167. }
  168. .keyboarBtn {
  169. background: linear-gradient(45deg, rgba(242, 131, 9, 1) 0%, rgba(230, 36, 15, 1) 100%);
  170. color: #fff;
  171. }
  172. .hover {
  173. background: #ebedf0;
  174. }
  175. .bot {
  176. bottom: 0;
  177. }
  178. .empty {
  179. background-color: #EEEEEE;
  180. }
  181. .dowmImgBx {
  182. display: flex;
  183. justify-content: center;
  184. align-items: center;
  185. width: 100%;
  186. position: relative;
  187. }
  188. .complete {
  189. position: absolute;
  190. right: 0rpx;
  191. bottom: 5rpx;
  192. font-size: 28rpx;
  193. padding-right: 30rpx;
  194. padding-left: 20rpx;
  195. }
  196. .dowmImg {
  197. width: 35rpx;
  198. height: 35rpx;
  199. margin-bottom: 10rpx;
  200. background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACT0lEQVRYR+2UPWgTYRjH/8/dpdZCpVhU/BoEB8FBEBFt7tJe7i5CbAXhrg6CQ8HBQXAQHBzq5CA4CA4OgoNgr0GQIhQTUkJqCPEDBEEQBAdBQSoVlIakXvLIofmopMnlizjkxuN9nt/v/b/v+xB6/FGP+egL9BPoJ/D/JLC8/Hp33sl9AXDOCMqRbsyH6NLzGwLR7BapuDMQCKy4jHICi5nMNinrpAk4DOC8EZQfdVKiBGemxyHNb5V6bziCaDRxSPT5bAaOCAJd0Cb8DzshUYIT4cnqit+anqZCTQH357NE+qDIhXmAjoJpxtD8D9qRqOwcT538DyscDuer+9W8hNFo8oDok2wGHxcIFzVVvt+KRAkOYDG3NmhNTR3L/ttn01eQTL7cv+6sz4NwkhmXQpp8rxmJ8s6B2NAATFmWf9aqr/sMY7HUHsEHmxkKGJcNTb7rRaKyc1rKZ4vW5KTyfbO6hnMgHo/vYmHQBjBBxFd0VblTT6IC56REjqmq6rd66xsKuMXx+ItRFn/ZYOhMfDWkKrdrNa068xQVJVPXT3xtlJgnAbdJIpEYcViyATpFoGt60H+runkVPCOwYGra2OdG8A2DyMvihYXU8NAwzQF8moDrelC+6daV4YRXcNg0DOWTl35NC7gF6XR661qu6N6JMwzMMrPgjlcw3hCzqevKR6/wlgTcokjk3cDI6KpNRGf/wt6yWDBD4+MfmoG3LPBHIiJu37F3jsH7JAgzqjr2vll4WwKtwJoeRJ2CtD0HuinieQ50S6Iv0E+g5wn8Bo+vyyFXaYw2AAAAAElFTkSuQmCC');
  201. background-repeat: no-repeat;
  202. background-position: center center;
  203. background-size: 100%;
  204. }
  205. .keyboarDel {
  206. width: 50rpx;
  207. height: 36rpx;
  208. margin-bottom: 10rpx;
  209. background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABqUlEQVRYR+2WPUvEQBCGZze1/8DKUnsrEcVaLhvwCgULCy1sLGzFE8RKC0EsBLGwEBRuhmChlTb+hCu0vU4Ff4H3SkKCOS4fezHnNUkXQuZ58s7sbhSN+VJj5lMtUCdglYDrurNKqSMiWqpoaD+IaI6Z3woFjDErRHRJRBMVweMyz8y8mCsQwW8rBtsJjBgeSGQn8A/wbAFbOIBHpdQnEa2ltKijlHoBsJnTvsEEbOFR0SYz37mu21JK7SdAnV6v1wzutdYda4Eh4XHdDWa+Skgk4cHwzlgJlISHtQHsiMhpIAEgXDFa6yL47wx4njcJoPuXpQZgT0QOG43GtCW8fwiNMYFxsOGUucLYAXz7vv+aMhNZNfuHsKRECHcc5wvAAxFdM/OxpUTqKhgmifjLu47j3BPRfDQTWyJyYSGRvhHZJgHgQERanuf5AJaTOQNYFZEbY8wTES1k9CB3JxwmiTJzk78VB09tkyhLzz0L4qIjlig+jkechJ1AJHFGRNt/iHvgVQC7InJS+EeUaMc6gKkqJLTW7+12+zyoZS1QBTitRi1QJzD2BH4AtrHfITKVMwgAAAAASUVORK5CYII=');
  210. background-repeat: no-repeat;
  211. background-position: center center;
  212. background-size: 100%;
  213. margin-top: 11rpx;
  214. }
  215. .keyboarflex {
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. }
  220. </style>

number-keyboard2.vue

  1. <template>
  2. <view :class="['KeyboarBody','bottomMove', 'bodMove', bodMove]" v-if="KeyboarHid">
  3. <view class="KeyboarBx">
  4. <view v-for="(num , index) in keyboardNum " :key='index' @click="clickBoard(num)" hover-class="hover"
  5. :hover-stay-time='20' class="keyboar">
  6. {{num}}
  7. </view>
  8. <view @click="clickBoard(otherNum)" :class="['keyboar',otherNum==''?'empty':'']" :hover-stay-time='20'
  9. hover-class="hover">{{otherNum}}</view>
  10. <view @click="clickBoard('0')" hover-class="hover" :hover-stay-time='20' class="keyboar">0</view>
  11. <view @click="deleteKeyboar()" class="keyboar keyboarflex" :hover-stay-time='20' hover-class="hover">
  12. <view class="keyboarDel"></view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. props: {
  20. //限制输入框的长度 空值不限制
  21. psdLength: {
  22. type: [Number, String],
  23. default: ''
  24. },
  25. //键盘码
  26. keyboardNum: {
  27. type: [Array, Object],
  28. default: () => {
  29. return [1, 2, 3, 4, 5, 6, 7, 8, 9]
  30. }
  31. },
  32. //特殊键盘码 .或者X 默空
  33. otherNum: {
  34. type: String,
  35. default: ''
  36. },
  37. //是否显示完成按钮
  38. confirmBtn:{
  39. type: Boolean,
  40. default: false
  41. },
  42. //是否在需要打开键盘时隐藏底部tabBar关闭键盘展示tabBar功能
  43. tabBar: {
  44. type: Boolean,
  45. default: false
  46. },
  47. value: {
  48. type: String,
  49. default: ''
  50. }
  51. },
  52. data() {
  53. return {
  54. bodMove: '',
  55. password: '', //要返回的结果
  56. iptNum: [], //输入的内容
  57. KeyboarHid: false, //键盘影藏和显示
  58. }
  59. },
  60. watch: {
  61. iptNum(newVal, oldVal) {
  62. this.$emit('input', newVal.join(''))
  63. },
  64. value(newVal, oldVal) {
  65. this.iptNum = newVal.split('')
  66. }
  67. },
  68. created() {
  69. },
  70. methods: {
  71. open() {
  72. this.KeyboarHid = true;
  73. if (this.tabBar) {
  74. uni.hideTabBar()
  75. }
  76. this.$nextTick(() => {
  77. setTimeout(() => {
  78. this.bodMove = 'moveShow'
  79. }, 30)
  80. })
  81. },
  82. close() {
  83. if (this.tabBar) {
  84. uni.showTabBar()
  85. }
  86. this.bodMove = '';
  87. this.$nextTick(() => {
  88. setTimeout(() => {
  89. this.KeyboarHid = false
  90. }, 300)
  91. })
  92. },
  93. // 密码框
  94. clickBoard(num) {
  95. if (num == '') return;
  96. let iptNum = this.iptNum.filter(item => item != '');
  97. //判断是否限制长度
  98. if (this.psdLength != '') {
  99. if (iptNum.length >= this.psdLength) {
  100. return
  101. };
  102. this.iptNum.push(num);
  103. } else {
  104. this.iptNum.push(num);
  105. }
  106. },
  107. //完成
  108. complete(){
  109. this.$emit('confirm', this.iptNum.join(''))
  110. },
  111. //重置 清空
  112. reset() {
  113. this.iptNum = [];
  114. },
  115. //删除
  116. deleteKeyboar() {
  117. this.iptNum.pop();
  118. }
  119. }
  120. }
  121. </script>
  122. <style scoped>
  123. .bodMove {
  124. transition: all .3s
  125. }
  126. .bottomMove {
  127. bottom: 0;
  128. left: 0;
  129. width: 100%;
  130. transform: translateY(100%)
  131. }
  132. .moveShow {
  133. transform: translateY(0)
  134. }
  135. .KeyboarBody {
  136. background-color: #FFFFFF;
  137. }
  138. .KeyboarBx {
  139. display: flex;
  140. flex-wrap: wrap;
  141. text-align: center;
  142. background-color: rgba(3, 3, 3, 0.1);
  143. padding: 10rpx 6rpx 0rpx 6rpx;
  144. margin-left: -12rpx;
  145. }
  146. .keyboar {
  147. width: 20%;
  148. flex-grow: 1;
  149. padding: 3%;
  150. font-size: 40rpx;
  151. background-color: #FFFFFF;
  152. border-radius: 10rpx;
  153. margin-left: 12rpx;
  154. margin-bottom: 10rpx;
  155. }
  156. .dian {
  157. margin-top: -10rpx;
  158. }
  159. .keyboarBtn {
  160. background: linear-gradient(45deg, rgba(242, 131, 9, 1) 0%, rgba(230, 36, 15, 1) 100%);
  161. color: #fff;
  162. }
  163. .hover {
  164. background: #ebedf0;
  165. }
  166. .bot {
  167. bottom: 0;
  168. }
  169. .empty {
  170. background-color: #EEEEEE;
  171. }
  172. .dowmImgBx {
  173. display: flex;
  174. justify-content: center;
  175. align-items: center;
  176. width: 100%;
  177. position: relative;
  178. }
  179. .complete {
  180. position: absolute;
  181. right: 0rpx;
  182. bottom: 5rpx;
  183. font-size: 28rpx;
  184. padding-right: 30rpx;
  185. padding-left: 20rpx;
  186. }
  187. .dowmImg {
  188. width: 35rpx;
  189. height: 35rpx;
  190. margin-bottom: 10rpx;
  191. background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACT0lEQVRYR+2UPWgTYRjH/8/dpdZCpVhU/BoEB8FBEBFt7tJe7i5CbAXhrg6CQ8HBQXAQHBzq5CA4CA4OgoNgr0GQIhQTUkJqCPEDBEEQBAdBQSoVlIakXvLIofmopMnlizjkxuN9nt/v/b/v+xB6/FGP+egL9BPoJ/D/JLC8/Hp33sl9AXDOCMqRbsyH6NLzGwLR7BapuDMQCKy4jHICi5nMNinrpAk4DOC8EZQfdVKiBGemxyHNb5V6bziCaDRxSPT5bAaOCAJd0Cb8DzshUYIT4cnqit+anqZCTQH357NE+qDIhXmAjoJpxtD8D9qRqOwcT538DyscDuer+9W8hNFo8oDok2wGHxcIFzVVvt+KRAkOYDG3NmhNTR3L/ttn01eQTL7cv+6sz4NwkhmXQpp8rxmJ8s6B2NAATFmWf9aqr/sMY7HUHsEHmxkKGJcNTb7rRaKyc1rKZ4vW5KTyfbO6hnMgHo/vYmHQBjBBxFd0VblTT6IC56REjqmq6rd66xsKuMXx+ItRFn/ZYOhMfDWkKrdrNa068xQVJVPXT3xtlJgnAbdJIpEYcViyATpFoGt60H+runkVPCOwYGra2OdG8A2DyMvihYXU8NAwzQF8moDrelC+6daV4YRXcNg0DOWTl35NC7gF6XR661qu6N6JMwzMMrPgjlcw3hCzqevKR6/wlgTcokjk3cDI6KpNRGf/wt6yWDBD4+MfmoG3LPBHIiJu37F3jsH7JAgzqjr2vll4WwKtwJoeRJ2CtD0HuinieQ50S6Iv0E+g5wn8Bo+vyyFXaYw2AAAAAElFTkSuQmCC');
  192. background-repeat: no-repeat;
  193. background-position: center center;
  194. background-size: 100%;
  195. }
  196. .keyboarDel {
  197. width: 50rpx;
  198. height: 36rpx;
  199. margin-bottom: 10rpx;
  200. background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABqUlEQVRYR+2WPUvEQBCGZze1/8DKUnsrEcVaLhvwCgULCy1sLGzFE8RKC0EsBLGwEBRuhmChlTb+hCu0vU4Ff4H3SkKCOS4fezHnNUkXQuZ58s7sbhSN+VJj5lMtUCdglYDrurNKqSMiWqpoaD+IaI6Z3woFjDErRHRJRBMVweMyz8y8mCsQwW8rBtsJjBgeSGQn8A/wbAFbOIBHpdQnEa2ltKijlHoBsJnTvsEEbOFR0SYz37mu21JK7SdAnV6v1wzutdYda4Eh4XHdDWa+Skgk4cHwzlgJlISHtQHsiMhpIAEgXDFa6yL47wx4njcJoPuXpQZgT0QOG43GtCW8fwiNMYFxsOGUucLYAXz7vv+aMhNZNfuHsKRECHcc5wvAAxFdM/OxpUTqKhgmifjLu47j3BPRfDQTWyJyYSGRvhHZJgHgQERanuf5AJaTOQNYFZEbY8wTES1k9CB3JxwmiTJzk78VB09tkyhLzz0L4qIjlig+jkechJ1AJHFGRNt/iHvgVQC7InJS+EeUaMc6gKkqJLTW7+12+zyoZS1QBTitRi1QJzD2BH4AtrHfITKVMwgAAAAASUVORK5CYII=');
  201. background-repeat: no-repeat;
  202. background-position: center center;
  203. background-size: 100%;
  204. margin-top: 11rpx;
  205. }
  206. .keyboarflex {
  207. display: flex;
  208. justify-content: center;
  209. align-items: center;
  210. }
  211. </style>

editPayPassword.vue

  1. <template>
  2. <view class="editPayPassword">
  3. <view class="topApp">
  4. <image class="return" src="https://res.qyjpay.cn/static/res/jiangcunyinxiang-return.png" @click="leftClick"/>
  5. <view class="title">{{!flag ? '身份认证' : '设置支付密码'}}</view>
  6. </view>
  7. <view class="content">{{!flag ? '输入支付密码' : '再次输入支付密码'}}</view>
  8. <view class="item" @tap='KeyboarOpen' v-if="!flag">
  9. <password-input :numLng='password'></password-input>
  10. </view>
  11. <view class="item" @tap='KeyboarOpen2' v-else>
  12. <password-input2 :numLng='changePassword'></password-input2>
  13. </view>
  14. <view class="errMsg" v-if="errMsg">{{errMsg}}</view>
  15. <number-keyboard tabBar ref='KeyboarHid' @input='onInput' psdLength='6' v-if="!flag"></number-keyboard>
  16. <number-keyboard2 tabBar ref='KeyboarHid' @input='onInput2' psdLength='6' v-else></number-keyboard2>
  17. </view>
  18. </template>
  19. <script>
  20. import numberKeyboard from '@/components/number-keyboard/number-keyboard.vue'
  21. import numberKeyboard2 from '@/components/number-keyboard/number-keyboard.vue'
  22. import passwordInput from '@/components/password-input/password-input.vue'
  23. import passwordInput2 from '@/components/password-input/password-input.vue'
  24. export default {
  25. data () {
  26. return {
  27. flag: false,
  28. password: "",
  29. changePassword: '',
  30. errMsg: '',
  31. }
  32. },
  33. components: {
  34. numberKeyboard,
  35. numberKeyboard2,
  36. passwordInput,
  37. passwordInput2
  38. },
  39. watch:{
  40. errMsg(newVal,oldVal){
  41. if(newVal){
  42. setTimeout(()=>{
  43. this.errMsg = ''
  44. },2000)
  45. }
  46. }
  47. },
  48. onLoad(option) {
  49. console.log('接收到的数据',option);
  50. //因为此时实例没有挂载完成,需要延迟操作
  51. setTimeout(() => {
  52. this.$refs.KeyboarHid.open()
  53. }, 50)
  54. },
  55. methods:{
  56. leftClick(){
  57. uni.navigateBack({})
  58. },
  59. //打开键盘
  60. KeyboarOpen(e) {
  61. this.$refs.KeyboarHid.open();
  62. },
  63. KeyboarOpen2(e) {
  64. this.$refs.KeyboarHid.open();
  65. },
  66. //输入的值
  67. onInput(val) {
  68. this.password = val;
  69. if(this.password.length == 6){
  70. this.flag = true
  71. setTimeout(()=>{
  72. this.KeyboarOpen2()
  73. },100)
  74. }
  75. },
  76. async onInput2(val){
  77. this.changePassword = val;
  78. if(this.changePassword.length == 6){
  79. console.log('第一次输入的密码是',this.password);
  80. console.log('第二次输入的密码是',this.changePassword);
  81. if(this.password != this.changePassword){
  82. this.errMsg = '两次输入密码不一致'
  83. }else{
  84. this.errMsg = ''
  85. try{
  86. //调接口处理
  87. }catch(err){
  88. // uni.showToast({
  89. // title: err.msg,
  90. // icon: 'none'
  91. // })
  92. this.errMsg = err.msg
  93. return
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang='scss' scoped>
  102. .editPayPassword{
  103. min-height: 100vh;
  104. background-color: #fff;
  105. .topApp{
  106. display: flex;
  107. align-items: center;
  108. // justify-content: flex-start;
  109. background-color: #fff;
  110. padding: 60rpx 0 30rpx 26rpx;
  111. // #ifdef APP-PLUS
  112. padding: 110rpx 0 30rpx 26rpx;
  113. // #endif
  114. box-sizing: border-box;
  115. width: 100%;
  116. .return{
  117. width: 36rpx;
  118. height: 36rpx;
  119. margin-right: 20rpx;
  120. }
  121. .title{
  122. position: absolute;
  123. // top: 100rpx;
  124. left: 50%;
  125. transform: translate(-50%,0);
  126. font-weight: 500;
  127. font-size: 32rpx;
  128. color: #111111;
  129. }
  130. }
  131. .content{
  132. margin: 140rpx 0 40rpx 0;
  133. font-weight: 500;
  134. font-size: 46rpx;
  135. color: #111111;
  136. text-align: center;
  137. }
  138. .errMsg{
  139. font-weight: normal;
  140. font-size: 22rpx;
  141. color: #F72323;
  142. margin-top: 20rpx;
  143. text-align: center;
  144. }
  145. }
  146. .main {
  147. padding: 0rpx 40rpx;
  148. }
  149. .ipt {
  150. border-bottom: 1rpx solid #CCCCCC;
  151. }
  152. .item {
  153. padding: 10rpx 87rpx;
  154. }
  155. .title {
  156. margin: 30rpx 0;
  157. }
  158. </style>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/656488
推荐阅读
相关标签
  

闽ICP备14008679号