工单小程序2024-11-20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

176 lines
3.2 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <!-- 修改成员 -->
  3. <view class="page">
  4. <navbar title="修改成员" leftClick @leftClick="$utils.navigateBack" />
  5. <view class="box">
  6. <view class="ChangeheadPortrait">
  7. <view
  8. @click="upload"
  9. class="headPortrait">
  10. <!-- 如果有就显示数据的头像 -->
  11. <image
  12. v-if="detail.image"
  13. :src="detail.image"
  14. mode=""></image>
  15. <!-- 如果没有就显示默认的 -->
  16. <image
  17. v-else
  18. src="/pages_order/static/auth/headImage.png"
  19. mode=""></image>
  20. </view>
  21. </view>
  22. <view class="ChangeAccountpassword">
  23. <view class="ChangeName">
  24. 员工账号
  25. <uv-input placeholder="请输入员工账号"
  26. v-model="detail.name"
  27. border="bottom"></uv-input>
  28. <!-- <view class="Bo">
  29. <uv-icon name="edit-pen" size="60"></uv-icon>
  30. </view> -->
  31. </view>
  32. <view class="Changepassword">
  33. 员工密码
  34. <uv-input placeholder="请输入员工密码"
  35. v-model="detail.password"
  36. border="bottom"></uv-input>
  37. <!-- <view class="Bo">
  38. <uv-icon name="edit-pen" size="60"></uv-icon>
  39. </view> -->
  40. </view>
  41. </view>
  42. <view class="uni-color-btn"
  43. @click="submit"
  44. style="width: 70%;">
  45. 保存
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script >
  51. export default {
  52. data() {
  53. return {
  54. id : 0,
  55. detail : {
  56. },
  57. }
  58. },
  59. onLoad(args) {
  60. this.id = args.id
  61. },
  62. onShow() {
  63. this.getDetail()
  64. },
  65. methods: {
  66. upload(){
  67. this.$Oss.ossUploadImage({
  68. success : url => {
  69. console.log(url);
  70. this.detail.image = url
  71. }
  72. })
  73. },
  74. getDetail(){
  75. this.$api('queryUserById', {
  76. userId : this.id
  77. }, res =>{
  78. if(res.code == 200){
  79. this.detail = res.result
  80. }
  81. })
  82. },
  83. submit(){
  84. // 效验数据合法性
  85. if(this.$utils
  86. .verificationAll(this.detail, {
  87. image : '请上传员工头像',
  88. name : '请输入员工账号',
  89. password : '请输入员工密码',
  90. })){
  91. return
  92. }
  93. // 保存数据
  94. this.$api('updateUser', {
  95. id : this.detail.id,
  96. image : this.detail.image,
  97. name : this.detail.name,
  98. password : this.detail.password,
  99. roleId : this.detail.roleId,
  100. }, res =>{
  101. if(res.code == 200){
  102. uni.showToast({
  103. title: '保存成功',
  104. icon: 'none'
  105. })
  106. // 延时1秒,返回到上一个页面
  107. setTimeout(uni.navigateBack, 1000, -1)
  108. }
  109. })
  110. },
  111. }
  112. }
  113. </script>
  114. <style scoped lang="scss">
  115. .page {
  116. .box {
  117. display: flex;
  118. flex-direction: column;
  119. justify-content: center;
  120. align-items: center;
  121. justify-content: space-around;
  122. height: 1300rpx;
  123. .ChangeheadPortrait {
  124. display: flex;
  125. align-items: center;
  126. .headPortrait {
  127. height: 150rpx;
  128. width: 150rpx;
  129. image{
  130. width: 100%;
  131. height: 100%;
  132. border-radius: 20rpx;
  133. }
  134. }
  135. }
  136. .ChangeAccountpassword {
  137. .ChangeName {
  138. display: flex;
  139. align-items: center;
  140. margin: 25rpx 0rpx;
  141. font-size: 35rpx;
  142. .Bo {
  143. margin-right: 50rpx;
  144. }
  145. }
  146. .Changepassword {
  147. display: flex;
  148. align-items: center;
  149. font-size: 35rpx;
  150. .Bo {
  151. margin-right: 50rpx;
  152. }
  153. }
  154. }
  155. }
  156. }
  157. </style>