瑶都万能墙
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.

322 lines
6.7 KiB

7 months ago
6 months ago
6 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
7 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
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
7 months ago
6 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
  1. <template>
  2. <view class="login">
  3. <!-- <view class="title">
  4. 瑶都万能墙
  5. </view>
  6. <view class="title">
  7. 申请获取你的头像昵称
  8. </view> -->
  9. <!-- <button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  10. <view class="line">
  11. <view class="">
  12. 头像
  13. </view>
  14. <view class="">
  15. <image :src="form.headImage" v-if="form.headImage" style="width: 60rpx;height: 60rpx;"
  16. mode=""></image>
  17. <image src="../static/auth/headImage.png" v-else style="width: 50rpx;height: 50rpx;" mode=""></image>
  18. </view>
  19. </view>
  20. </button>
  21. <view class="line">
  22. <view class="">
  23. 昵称
  24. </view>
  25. <view class="">
  26. <input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
  27. v-model="form.nickName" />
  28. </view>
  29. </view> -->
  30. <view class="bg1"></view>
  31. <view class="title">
  32. 定制自己的形象
  33. </view>
  34. <view
  35. v-if="back"
  36. @click="$utils.navigateBack"
  37. style="position: absolute;top: 120rpx;left: 20rpx;">
  38. <uv-icon
  39. size="30rpx"
  40. color="#000"
  41. name="arrow-left"></uv-icon>
  42. </view>
  43. <button class="chooseAvatar"
  44. open-type="chooseAvatar"
  45. @chooseavatar="onChooseAvatar">
  46. <image :src="form.headImage"
  47. mode="aspectFill"></image>
  48. </button>
  49. <input type="nickname"
  50. placeholder="给自己起一个响亮的名字"
  51. class="nickname" id="nickName"
  52. v-model="form.nickName" />
  53. <view class="sexSelect">
  54. <view
  55. @click="sexClick(item)"
  56. v-for="(item, index) in sexList"
  57. :key="index"
  58. :style="{color : form.sex == item.value ? item.actColor : '#333'}">
  59. <uv-icon
  60. size="30rpx"
  61. :color="form.sex == item.value ? item.actColor : '#333'"
  62. :name="item.icon"></uv-icon>
  63. {{ item.value }}
  64. </view>
  65. </view>
  66. <view class="address"
  67. @click="$refs.datetimePicker.open()">
  68. 您出生于{{ $dayjs(form.yearDate).format("YYYY") }}
  69. </view>
  70. <view class="address"
  71. @click="$refs.picker.open()">
  72. {{ form.address || '请选择居住地址'}}
  73. </view>
  74. <uv-datetime-picker
  75. ref="datetimePicker"
  76. v-model="form.yearDate"
  77. mode="year"
  78. :minDate="minDate"
  79. :maxDate="maxDate">
  80. </uv-datetime-picker>
  81. <uv-picker ref="picker"
  82. :columns="columns"
  83. keyName="name"
  84. @confirm="confirmAddress"></uv-picker>
  85. <view class="btn" @click="submit">
  86. 确认
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. import { mapState } from 'vuex'
  92. import mixinsSex from '@/mixins/sex.js'
  93. export default {
  94. mixins : [mixinsSex],
  95. data() {
  96. return {
  97. form: {
  98. headImage: '/static/image/logo.jpg',
  99. nickName: '',
  100. sex : '男',
  101. yearDate : this.$dayjs().add(-18, 'y').valueOf(),//默认满18岁
  102. address : '',
  103. },
  104. maxDate : this.$dayjs().valueOf(),
  105. minDate : this.$dayjs().add(-100, 'y').valueOf(),
  106. // sex : [
  107. // {
  108. // value : '男',
  109. // icon : 'man',
  110. // actColor : '#5baaff',
  111. // },
  112. // {
  113. // value : '女',
  114. // icon : 'woman',
  115. // actColor : '#ff50b3',
  116. // },
  117. // ],
  118. columns : [],
  119. back : '',
  120. };
  121. },
  122. computed: {
  123. ...mapState(['cityList', 'userInfo']),
  124. },
  125. onLoad({back}) {
  126. this.back = back
  127. // this.$nextTick(() => {
  128. // this.form.headImage = this.userInfo.headImage || this.form.headImage
  129. // this.form.nickName = this.userInfo.nickName || this.form.nickName
  130. // this.form.sex = this.userInfo.sex || this.form.sex
  131. // this.form.yearDate = this.userInfo.yearDate || this.form.yearDate
  132. // this.form.address = this.userInfo.address || this.form.address
  133. // })
  134. },
  135. onShow() {
  136. this.getCityList()
  137. },
  138. computed: {},
  139. methods: {
  140. onChooseAvatar(res) {
  141. let self = this
  142. self.$Oss.ossUpload(res.target.avatarUrl)
  143. .then(url => {
  144. self.form.headImage = url
  145. })
  146. },
  147. sexClick(item){
  148. this.form.sex = item.value
  149. },
  150. confirmAddress(e){
  151. this.form.address = e.value[0].name
  152. },
  153. // 获取城市
  154. getCityList(){
  155. this.$api('getCityList', res => {
  156. if(res.code == 200){
  157. this.columns = [
  158. res.result
  159. ]
  160. }
  161. })
  162. },
  163. submit() {
  164. let self = this
  165. uni.createSelectorQuery().in(this)
  166. .select("#nickName")
  167. .fields({
  168. properties: ["value"],
  169. })
  170. .exec((res) => {
  171. const nickName = res?.[0]?.value
  172. self.form.nickName = nickName
  173. if (self.$utils.verificationAll(self.form, {
  174. headImage: '请选择头像',
  175. nickName: '请填写昵称',
  176. address: '请选择居住地址',
  177. })) {
  178. return
  179. }
  180. let data = {
  181. ...self.form,
  182. yearDate : this.$dayjs(self.form.yearDate).format("YYYY")
  183. }
  184. self.$api('updateInfo', data, res => {
  185. if (res.code == 200) {
  186. uni.reLaunch({
  187. url:'/pages/index/index'
  188. })
  189. }
  190. })
  191. })
  192. },
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .login {
  198. display: flex;
  199. flex-direction: column;
  200. justify-content: center;
  201. align-items: center;
  202. height: 100vh;
  203. background-color: #fff;
  204. overflow: hidden;
  205. .bg1{
  206. width: 700rpx;
  207. height: 700rpx;
  208. border-radius: 50%;
  209. background-color: #ffc0b333;
  210. position: absolute;
  211. right: -300rpx;
  212. top: -300rpx;
  213. }
  214. .title {
  215. line-height: 45rpx;
  216. font-weight: 900;
  217. padding-bottom: 100rpx;
  218. font-size: 40rpx;
  219. }
  220. .chooseAvatar {
  221. width: 100%;
  222. padding: 0 !important;
  223. margin: 0 !important;
  224. border: none;
  225. background-color: #fff !important;
  226. width: 220rpx;
  227. height: 220rpx;
  228. border-radius: 50%;
  229. image{
  230. width: 200rpx;
  231. height: 200rpx;
  232. border-radius: 50%;
  233. box-shadow: 0 0 10rpx 10rpx #00000012;
  234. margin: 10rpx;
  235. }
  236. }
  237. .chooseAvatar::after{
  238. border: none;
  239. padding: 0 !important;
  240. margin: 0 !important;
  241. }
  242. .nickname{
  243. background-color: #f7f7f7;
  244. width: 600rpx;
  245. height: 80rpx;
  246. text-align: center;
  247. border-radius: 40rpx;
  248. margin-top: 30rpx;
  249. }
  250. .sexSelect{
  251. background-color: #f7f7f7;
  252. width: 600rpx;
  253. height: 80rpx;
  254. text-align: center;
  255. border-radius: 40rpx;
  256. margin-top: 30rpx;
  257. display: flex;
  258. align-items: center;
  259. font-size: 26rpx;
  260. line-height: 80rpx;
  261. overflow: hidden;
  262. &>view{
  263. flex: 1;
  264. display: flex;
  265. justify-content: center;
  266. align-content: center;
  267. height: 100%;
  268. }
  269. &>view:nth-child(1){
  270. border-right: 1px solid #000;
  271. }
  272. }
  273. .address{
  274. background-color: #f7f7f7;
  275. width: 600rpx;
  276. height: 80rpx;
  277. text-align: center;
  278. border-radius: 40rpx;
  279. margin-top: 30rpx;
  280. line-height: 80rpx;
  281. color: #555;
  282. }
  283. .btn {
  284. // background: $uni-linear-gradient-btn-color;
  285. background: $uni-color;
  286. color: #fff;
  287. width: 80%;
  288. padding: 20rpx 0;
  289. text-align: center;
  290. border-radius: 15rpx;
  291. margin-top: 10vh;
  292. }
  293. }
  294. </style>