setpassword.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <view class="content">
  3. <view class="headbox">
  4. <view class="numbercat">账号 {{account}}</view>
  5. </view>
  6. <view class="acountbox" >
  7. <view class="inacount">
  8. <text class="acoutitle">原密码</text>
  9. <input type="text" v-model="form.oldPassword" class="checkword" placeholder="至少6位数的字母数字组合的密码"
  10. placeholder-style="font-size:30rpx;color:#BEBDBB" password="true"/>
  11. </view>
  12. <view class="inacount">
  13. <text class="acoutitle">密码</text>
  14. <input type="text" v-model="form.newPassword" class="checkword" placeholder="至少6位数的字母数字组合的密码"
  15. placeholder-style="font-size:30rpx;color:#BEBDBB" password="true"/>
  16. </view>
  17. <view class="inacount">
  18. <text class="acoutitle">确认密码</text>
  19. <input type="text" v-model="form.password" class="checkword" placeholder="至少6位数的字母数字组合的密码"
  20. placeholder-style="font-size:30rpx;color:#BEBDBB" password="true"/>
  21. </view>
  22. <view class=" fonas">
  23. <text>*密码必须是6-16位的英文字母、数字组合</text>
  24. <text @click="forgetPwd" style="color: #D8AB5A;">忘记原密码?</text>
  25. </view>
  26. <view class="logininbtn" @click="suerChange">
  27. <text>确认修改</text>
  28. </view>
  29. </view>
  30. <u-popup :show="show" @close="close" @open="open" mode="center">
  31. <view class="forgetbox">
  32. <!-- <view class="ciclebg">
  33. <image src="../../static/img/forpwdbg.png" mode="aspectFill"></image>
  34. </view> -->
  35. <view class="keybox">
  36. <image src="../../static/img/foricon.png" mode="aspectFill"></image>
  37. </view>
  38. <text class="keytitle">忘记密码</text>
  39. <text class="remindtitle">请电联系管理员,进行密码确定</text>
  40. <view class="surebtn" @click="close()">好的</view>
  41. </view>
  42. </u-popup>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. show: false,
  50. account:'',
  51. form: {
  52. oldPassword:'',
  53. newPassword:'',
  54. password:''
  55. },
  56. state:0
  57. }
  58. },
  59. onLoad(o) {
  60. this.state = this.$store.state.admin
  61. if (o.account) {
  62. this.account = o.account
  63. }
  64. },
  65. methods: {
  66. close() {
  67. this.show = false
  68. },
  69. suerChange(){
  70. if(this.form.oldPassword.length==0){
  71. this.$toast("请输入至少6位数的字母数字组合的密码")
  72. return
  73. }
  74. if(this.form.newPassword.length<6){
  75. this.$toast("请输入至少6位数的字母数字组合的密码")
  76. return
  77. }
  78. if(this.form.password.length<6){
  79. this.$toast("请输入至少6位数的字母数字组合的密码")
  80. return
  81. }
  82. if(this.form.newPassword!=this.form.password){
  83. this.$toast("两次密码输入不一样")
  84. return
  85. }
  86. uni.showLoading()
  87. let form=this.form
  88. delete form.password
  89. if(this.state==1){
  90. uni.$u.http.post('/api/Supplier/password',form, {
  91. custom: {
  92. auth: true
  93. }
  94. }).then((res) => {
  95. uni.hideLoading()
  96. this.form={
  97. oldPassword:'',
  98. newPassword:'',
  99. password:''
  100. }
  101. this.$toast("修改成功")
  102. }).catch((err) => {
  103. console.log(err)
  104. uni.hideLoading()
  105. this.$toast(err.msg)
  106. })
  107. }else{
  108. uni.$u.http.post('/api/Account/password',form, {
  109. custom: {
  110. auth: true
  111. }
  112. }).then((res) => {
  113. uni.hideLoading()
  114. this.form={
  115. oldPassword:'',
  116. newPassword:'',
  117. password:''
  118. }
  119. this.$toast("修改成功")
  120. }).catch((err) => {
  121. console.log(err)
  122. uni.hideLoading()
  123. this.$toast(err.msg)
  124. })
  125. }
  126. },
  127. forgetPwd(){
  128. this.show = true
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .content {
  135. padding: 0 30rpx;
  136. box-sizing: border-box;
  137. }
  138. .fonas{
  139. display: flex;
  140. justify-content: space-between;
  141. font-size: 24rpx;
  142. padding-top: 20rpx;
  143. }
  144. .headbox {
  145. display: flex;
  146. justify-content: center;
  147. margin: 60rpx auto;
  148. .numbercat{
  149. padding: 15rpx 20rpx;
  150. border-radius: 50rpx;
  151. background-color: #FFF8E5;
  152. color: #1F242A;
  153. font-size: 28rpx;
  154. }
  155. }
  156. .acountbox {
  157. .upmsg{
  158. margin-top: 20rpx;
  159. background-color: #F6F6F6;
  160. width: 690rpx;
  161. height: 399rpx;
  162. border-radius: 20rpx;
  163. display: flex;
  164. align-items: center;
  165. justify-content: center;
  166. }
  167. .uppic{
  168. display: flex;
  169. align-items: center;
  170. justify-content: center;
  171. width: 500rpx;
  172. height: 250rpx;
  173. background-image: url("@/static/img/upuer.png");
  174. background-size: 100%;
  175. }
  176. .inacount {
  177. flex: 1;
  178. display: flex;
  179. padding: 35rpx 20rpx;
  180. box-sizing: border-box;
  181. // width: 606rpx;
  182. margin-top: 40rpx;
  183. background-color: #F6F6F6;
  184. border-radius: 20rpx;
  185. font-size: 30rpx;
  186. color: #1F242A;
  187. input {
  188. width: 460rpx;
  189. }
  190. }
  191. .acoutitle {
  192. font-weight: 600;
  193. }
  194. .checkword {
  195. padding-left: 20rpx;
  196. color: #1F242A;
  197. font-size: 30rpx;
  198. }
  199. }
  200. .logininbtn {
  201. margin-top: 140rpx;
  202. // width: 606rpx;
  203. box-sizing: border-box;
  204. flex: 1;
  205. border-radius: 20rpx;
  206. background: linear-gradient(to right, #FFE1AD,#D8AB5A);
  207. box-shadow: 0 10rpx 20rpx 1rpx rgba(179, 116, 5, 0.2);
  208. height: 100rpx;
  209. text-align: center;
  210. color: #fff;
  211. line-height: 100rpx;
  212. margin-bottom: 100rpx;
  213. }
  214. .acountall {
  215. display: flex;
  216. justify-content: flex-end;
  217. margin-top: 30rpx;
  218. font-size: 24rpx;
  219. }
  220. .checkag {
  221. margin-top: 200rpx;
  222. font-size: 28rpx;
  223. margin-bottom: 150rpx;
  224. }
  225. .forgetbox{
  226. width: 600rpx;
  227. height: 600rpx;
  228. background-color: #fff;
  229. display: flex;
  230. flex-direction: column;
  231. align-items: center;
  232. position: relative;
  233. background-image: url("@/static/img/forpwdbg.png") ;
  234. background-repeat: no-repeat;
  235. background-position: right 0 top 0;
  236. background-size:367rpx 225rpx;
  237. .ciclebg{
  238. position: relative;
  239. right: 0;
  240. top: 0;
  241. width: 367rpx;
  242. height: 225rpx;
  243. }
  244. .keybox{
  245. margin-top: 84rpx;
  246. width: 196rpx;
  247. height: 161rpx;
  248. image{
  249. width: 100%;
  250. height: 100%;
  251. }
  252. }
  253. .keytitle{
  254. color: #1F242A;
  255. padding-top: 50rpx;
  256. font-size: 36rpx;
  257. font-weight: 600;
  258. }
  259. .remindtitle{
  260. color: #68625B;
  261. font-size: 28rpx;
  262. padding-top: 30rpx;
  263. }
  264. .surebtn{
  265. width: 314rpx;
  266. height: 84rpx;
  267. line-height: 84rpx;
  268. border-radius: 43rpx;
  269. background: linear-gradient(to right,#FFE1AD,#D8AB5A);
  270. color: #412900;
  271. margin-top: 86rpx;
  272. text-align: center;
  273. }
  274. }
  275. </style>