工单小程序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.

180 lines
3.4 KiB

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