【PT.SCC实名制管理系统】24.10.01 -30天,考勤打卡小程序
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.

168 lines
3.5 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. <!-- 用户信息 -->
  2. <template>
  3. <view class="login">
  4. <!-- logo -->
  5. <div class="logo">
  6. 打卡系统
  7. </div>
  8. <!-- 标题 -->
  9. <view class="login-title">工程项目打卡系统</view>
  10. <view class="title">
  11. 申请获取你的头像昵称
  12. </view>
  13. <button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  14. <view class="line">
  15. <view class="">
  16. 头像
  17. </view>
  18. <view class="">
  19. <image
  20. :src="userInfo.headImage ? userInfo.headImage : 'https://tennis-oss.xzaiyp.top/2024-10-22/29ce46a1-33f2-4fda-8203-aaf441c678aa.png'"
  21. style="width: 70rpx;height: 70rpx;border-radius: 50%;" mode="widthFix"></image>
  22. <!-- <image src="@/static/login/logo.png" v-else style="width: 70rpx;height: 70rpx;border-radius: 50%;" mode="widthFix"></image> -->
  23. </view>
  24. </view>
  25. </button>
  26. <view class="line">
  27. <view class="">
  28. 昵称
  29. </view>
  30. <view class="">
  31. <input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
  32. v-model="userInfo.nickName" />
  33. </view>
  34. </view>
  35. <view class="btn" @click="submit">
  36. 确认
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. userInfo: {
  45. headImage: '', //设置了一个本地默认头像
  46. nickName: '',
  47. name: ''
  48. }
  49. };
  50. },
  51. onShow() {},
  52. computed: {},
  53. methods: {
  54. onChooseAvatar(res) {
  55. let self = this
  56. self.$Oss.ossUpload(res.target.avatarUrl)
  57. .then(url => {
  58. self.userInfo.headImage = url
  59. })
  60. },
  61. submit() {
  62. let self = this
  63. uni.createSelectorQuery().in(this)
  64. .select("#nickName")
  65. .fields({
  66. properties: ["value"],
  67. })
  68. .exec((res) => {
  69. const nickName = res?.[0]?.value
  70. self.userInfo.nickName = nickName
  71. self.userInfo.name = nickName
  72. if (self.$utils.verificationAll(self.userInfo, {
  73. headImage: '请更换默认头像',
  74. nickName: '请填写昵称',
  75. })) {
  76. return
  77. }
  78. // self.$api('updateInfo', self.userInfo, res => {
  79. // if (res.code == 200) {
  80. // this.replushUserInfo()
  81. // uni.switchTab({
  82. // url: '/pages/repair/repair'
  83. // })
  84. // }
  85. // })
  86. uni.reLaunch({
  87. url: "/pages/subPack/team/team"
  88. })
  89. })
  90. },
  91. //刷新存放在vuex的用户信息
  92. replushUserInfo() {
  93. this.$api('getUserInfo', res => {
  94. if (res.code == 200) {
  95. this.$store.commit('setUserInfo', res.result)
  96. }
  97. })
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. .login {
  104. display: flex;
  105. flex-direction: column;
  106. justify-content: center;
  107. align-items: center;
  108. height: 100vh;
  109. // logo
  110. .logo {
  111. display: flex;
  112. align-items: center;
  113. justify-content: center;
  114. padding: 20rpx 0rpx;
  115. width: 40%;
  116. color: white;
  117. background: linear-gradient(180deg, #4C9EEA, #6DB9FF);
  118. border-radius: 45rpx 13rpx 45rpx 13rpx;
  119. font-size: 60rpx;
  120. }
  121. // 标题
  122. .login-title {
  123. font-size: 40rpx;
  124. font-weight: bold;
  125. margin: 20rpx 0rpx;
  126. }
  127. .line {
  128. display: flex;
  129. justify-content: space-between;
  130. align-items: center;
  131. width: 80%;
  132. border-bottom: 1px solid #00000023;
  133. padding: 30rpx 0;
  134. margin: 0 auto;
  135. }
  136. .chooseAvatar {
  137. width: 100%;
  138. padding: 0;
  139. margin: 0;
  140. margin-top: 10vh;
  141. border: none;
  142. }
  143. .btn {
  144. // background: $uni-linear-gradient-btn-color;
  145. background: $main-color;
  146. color: #fff;
  147. width: 80%;
  148. padding: 30rpx 0;
  149. border-radius: 100rpx;
  150. text-align: center;
  151. margin-top: 10vh;
  152. }
  153. }
  154. </style>