特易招,招聘小程序
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.

211 lines
4.3 KiB

4 months ago
2 months ago
2 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
2 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
2 months ago
2 months ago
4 months ago
  1. <template>
  2. <view class="login">
  3. <!-- <view class="logo">
  4. <image :src="configList.config_logo" mode=""></image>
  5. </view> -->
  6. <view class="title">
  7. {{ configList.config_app_name }}
  8. </view>
  9. <view class="title">
  10. 申请获取你的头像昵称
  11. </view>
  12. <button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  13. <view class="line">
  14. <view class="">
  15. 头像
  16. </view>
  17. <view class="">
  18. <image :src="userInfoForm.headImage" v-if="userInfoForm.headImage" style="width: 60rpx;height: 60rpx;"
  19. mode=""></image>
  20. <image src="../static/auth/headImage.png" v-else style="width: 50rpx;height: 50rpx;" mode=""></image>
  21. </view>
  22. </view>
  23. </button>
  24. <view class="line">
  25. <view class="">
  26. 昵称
  27. </view>
  28. <view class="">
  29. <input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
  30. v-model="userInfoForm.nickName" />
  31. </view>
  32. </view>
  33. <view class="line">
  34. <view class="">
  35. 手机号
  36. </view>
  37. <view class=""
  38. v-if="userInfoForm.phone">
  39. <input placeholder="请输入手机号" style="text-align: right;"
  40. disabled
  41. v-model="userInfoForm.phone" />
  42. </view>
  43. <view class=""
  44. v-else>
  45. <button
  46. class="getPhoneNumber"
  47. open-type="getPhoneNumber"
  48. @getphonenumber="getPhone">
  49. 获取电话号码
  50. </button>
  51. </view>
  52. </view>
  53. <view class="btn" @click="submit">
  54. 确认
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. userInfoForm: {
  63. headImage: '',
  64. nickName: '',
  65. phone : '',
  66. }
  67. };
  68. },
  69. onShow() {},
  70. onLoad() {
  71. this.userInfoForm.phone = this.userInfo.phone || ''
  72. this.userInfoForm.nickName = this.userInfo.nickName || ''
  73. this.userInfoForm.headImage = this.userInfo.headImage || ''
  74. },
  75. computed: {},
  76. methods: {
  77. onChooseAvatar(res) {
  78. let self = this
  79. self.$Oss.ossUpload(res.target.avatarUrl)
  80. .then(url => {
  81. self.userInfoForm.headImage = url
  82. })
  83. },
  84. getPhone(e){
  85. this.$api('bindPhone', {
  86. phoneCode : e.detail.code
  87. }, res => {
  88. if(res.code == 200){
  89. let phoneObj = JSON.parse(res.result)
  90. if(phoneObj.errmsg == 'ok'){
  91. this.userInfoForm.phone = phoneObj.phone_info.phoneNumber
  92. }else{
  93. uni.showModal({
  94. title: phoneObj.errmsg
  95. })
  96. }
  97. console.log(phoneObj);
  98. }
  99. })
  100. },
  101. submit() {
  102. let self = this
  103. uni.createSelectorQuery().in(this)
  104. .select("#nickName")
  105. .fields({
  106. properties: ["value"],
  107. })
  108. .exec((res) => {
  109. const nickName = res?.[0]?.value
  110. self.userInfoForm.nickName = nickName
  111. if (self.$utils.verificationAll(self.userInfoForm, {
  112. headImage: '请选择头像',
  113. nickName: '请填写昵称',
  114. phone: '请填写昵称',
  115. })) {
  116. return
  117. }
  118. self.$api('updateInfo', {
  119. headImage : self.userInfoForm.headImage,
  120. nickName : self.userInfoForm.nickName,
  121. phone : self.userInfoForm.phone,
  122. }, res => {
  123. if (res.code == 200) {
  124. uni.reLaunch({
  125. url:'/pages/index/index'
  126. })
  127. }
  128. })
  129. })
  130. },
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. .login {
  136. display: flex;
  137. flex-direction: column;
  138. justify-content: center;
  139. align-items: center;
  140. height: 80vh;
  141. .logo{
  142. height: 140rpx;
  143. width: 140rpx;
  144. image{
  145. height: 140rpx;
  146. width: 140rpx;
  147. border-radius: 30rpx;
  148. }
  149. margin-bottom: 20rpx;
  150. }
  151. .title {
  152. line-height: 45rpx;
  153. font-weight: 900;
  154. }
  155. .line {
  156. display: flex;
  157. justify-content: space-between;
  158. align-items: center;
  159. width: 80%;
  160. border-bottom: 1px solid #00000023;
  161. padding: 30rpx 0;
  162. margin: 0 auto;
  163. }
  164. .chooseAvatar {
  165. width: 100%;
  166. padding: 0;
  167. margin: 0;
  168. margin-top: 10vh;
  169. border: none;
  170. }
  171. .btn {
  172. // background: $uni-linear-gradient-btn-color;
  173. background: $uni-color;
  174. color: #fff;
  175. width: 80%;
  176. padding: 20rpx 0;
  177. text-align: center;
  178. border-radius: 15rpx;
  179. margin-top: 10vh;
  180. }
  181. .getPhoneNumber{
  182. // all: unset;
  183. display: flex;
  184. justify-content: center;
  185. align-items: center;
  186. // background: $uni-linear-gradient-btn-color;
  187. background: $uni-color;
  188. color: #fff;
  189. width: 200rpx;
  190. height: 60rpx;
  191. border-radius: 30rpx;
  192. font-size: 24rpx;
  193. }
  194. }
  195. </style>