推广小程序前端代码
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.

387 lines
8.5 KiB

2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
  1. <template>
  2. <view>
  3. <view class="head-box"></view>
  4. <uv-navbar autoBack title="个人资料" leftIconColor="#fff" :bgColor="bgColor" height="100rpx" :titleStyle="{color:'#fff'}"></uv-navbar>
  5. <view class="content">
  6. <button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  7. <view class="img-box">
  8. <image :src="info.headImage" mode=""></image>
  9. <view>点击更换头像</view>
  10. </view>
  11. <!-- <view class="line">
  12. <view class="">
  13. 头像
  14. </view>
  15. <view class="">
  16. <image :src="userInfoForm.headImage" v-if="userInfoForm.headImage" style="width: 60rpx;height: 60rpx;"
  17. mode=""></image>
  18. <image src="../static/auth/headImage.png" v-else style="width: 50rpx;height: 50rpx;" mode=""></image>
  19. </view>
  20. </view> -->
  21. </button>
  22. <view class="name-box">
  23. <view class="name-val">{{info.nickName}}</view>
  24. <view class="sex-box">
  25. <image v-if="info.sex == '男'" src="@/static/image/center/nan-icon.png" mode=""></image>
  26. <image v-else src="@/static/image/center/nv-icon.png" mode=""></image>
  27. </view>
  28. <view class="age-box">{{calculateAge}}</view>
  29. <!-- <image src="@/static/image/center/nv-icon.png" mode=""></image> -->
  30. </view>
  31. <view class="form-box">
  32. <view class="form-box-line">
  33. <view class="label-box">
  34. <image src="@/static/image/center/user-icon-1.png" mode="widthFix"></image>
  35. <view>国籍</view>
  36. </view>
  37. <view class="value-box">
  38. {{info.city}}
  39. </view>
  40. </view>
  41. <view class="form-box-line">
  42. <view class="label-box">
  43. <image src="@/static/image/center/user-icon-2.png" mode="widthFix"></image>
  44. <view>学历</view>
  45. </view>
  46. <view class="value-box">
  47. {{info.shcool}}
  48. </view>
  49. </view>
  50. <view class="form-box-line">
  51. <view class="label-box">
  52. <image src="@/static/image/center/user-icon-3.png" mode="widthFix"></image>
  53. <view>行业</view>
  54. </view>
  55. <view class="value-box">
  56. {{info.workValue}}
  57. </view>
  58. </view>
  59. <view class="form-box-line">
  60. <view class="label-box">
  61. <image src="@/static/image/center/user-icon-4.png" mode="widthFix"></image>
  62. <view>电话</view>
  63. </view>
  64. <view class="value-box">
  65. {{info.phone}}
  66. </view>
  67. </view>
  68. <view class="form-box-line">
  69. <view class="label-box">
  70. <image src="@/static/image/center/user-icon-5.png" mode="widthFix"></image>
  71. <view>性别</view>
  72. </view>
  73. <view class="value-box">
  74. {{info.sex}}
  75. </view>
  76. </view>
  77. </view>
  78. <view class="tips-box">
  79. <view class="title-box">标签</view>
  80. <view class="tips-val">
  81. <view class="tips-item tips-1" v-for="(val,i) in stateArr" :key="i">{{val}}</view>
  82. <!-- <view class="tips-item tips-2">985</view> -->
  83. <!-- <view class="tips-item tips-3">设计师</view> -->
  84. <!-- <view class="tips-item tips-4">行业大牛</view> -->
  85. </view>
  86. </view>
  87. <view class="about-box">
  88. <uv-divider text="关于我" textSize="28rpx"></uv-divider>
  89. <view class="about-box-val">{{info.details}}</view>
  90. </view>
  91. </view>
  92. <view class="btn-box">
  93. <uv-button text="编辑信息" @click="editClick" color="#381615" shape="circle" :customStyle="btnCustomStyle"></uv-button>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. export default{
  99. data() {
  100. return {
  101. btnCustomStyle:{
  102. color:'#FF5858'
  103. },
  104. bgColor:'transparent',
  105. info:{},
  106. }
  107. },
  108. onPageScroll(e) {
  109. if(e.scrollTop > 50) {
  110. this.bgColor = '#49070c'
  111. }else{
  112. this.bgColor = 'transparent'
  113. }
  114. },
  115. onShow() {
  116. this.getUserInfo()
  117. },
  118. computed:{
  119. calculateAge() {
  120. let today = new Date();
  121. let birthDate = new Date(this.info.yearDate);
  122. let age = today.getFullYear() - birthDate.getFullYear();
  123. let m = today.getMonth() - birthDate.getMonth();
  124. if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
  125. age--;
  126. }
  127. return age;
  128. },
  129. stateArr() {
  130. let arr = this.info.state.split(',')
  131. return arr
  132. }
  133. },
  134. methods:{
  135. onChooseAvatar(res) {
  136. let self = this
  137. self.$Oss.ossUpload(res.target.avatarUrl)
  138. .then(url => {
  139. self.info.headImage = url
  140. this.$api('updateInfo',this.info, res => {
  141. if (res.code == 200) {
  142. uni.showToast({
  143. title:'保存成功',
  144. icon:'none'
  145. })
  146. }
  147. })
  148. })
  149. },
  150. getUserInfo() {
  151. this.$api('getInfo', res => {
  152. if (res.code == 200) {
  153. this.info = res.result
  154. }
  155. })
  156. },
  157. editClick() {
  158. uni.navigateTo({
  159. url:'/pages_my/user-msg'
  160. })
  161. },
  162. }
  163. }
  164. </script>
  165. <style lang="scss">
  166. page {
  167. background-color: #060504;
  168. }
  169. </style>
  170. <style lang="scss" scoped>
  171. .chooseAvatar {
  172. width: 100%;
  173. padding: 0;
  174. margin: 0;
  175. border: none;
  176. background-color: transparent;
  177. }
  178. .head-box {
  179. background: url('@/static/image/nav-bg.png') no-repeat;
  180. background-size: 100% 100%;
  181. width: 100%;
  182. height: 534rpx;
  183. position: absolute;
  184. z-index: -1;
  185. }
  186. .content {
  187. padding: 0 30rpx 170rpx;
  188. padding-top: calc(var(--status-bar-height) + 110rpx);
  189. .img-box {
  190. display: flex;
  191. flex-direction: column;
  192. align-items: center;
  193. justify-content: center;
  194. margin-bottom: 40rpx;
  195. image {
  196. width: 176rpx;
  197. height: 176rpx;
  198. border-radius: 50%;
  199. }
  200. view {
  201. font-weight: 400;
  202. font-size: 24rpx;
  203. color: #CCCCCC;
  204. margin-top: 20rpx;
  205. }
  206. }
  207. .name-box {
  208. display: flex;
  209. align-items: center;
  210. .name-val {
  211. font-weight: 600;
  212. font-size: 32rpx;
  213. color: #E6E6E6;
  214. margin-right: 18rpx;
  215. }
  216. .sex-box {
  217. background-color: #0D1A20;
  218. width: 69rpx;
  219. height: 36rpx;
  220. border-radius: 18rpx;
  221. display: flex;
  222. align-items: center;
  223. justify-content: center;
  224. margin-right: 10rpx;
  225. image {
  226. width: 25rpx;
  227. height: 25rpx;
  228. }
  229. }
  230. .age-box {
  231. width: 85rpx;
  232. height: 36rpx;
  233. background: #261705;
  234. border-radius: 18rpx;
  235. display: flex;
  236. align-items: center;
  237. justify-content: center;
  238. font-weight: 400;
  239. font-size: 23rpx;
  240. color: #FFA200;
  241. }
  242. }
  243. .form-box {
  244. background: #1B1713;
  245. border-radius: 27rpx;
  246. padding:0 40rpx;
  247. margin-top: 25rpx;
  248. margin-bottom: 44rpx;
  249. .form-box-line {
  250. height: 112rpx;
  251. border-bottom: 1px solid #403D3A;
  252. display: flex;
  253. align-items: center;
  254. justify-content: space-between;
  255. &:last-child {
  256. border: none;
  257. }
  258. .label-box {
  259. font-weight: 400;
  260. font-size: 31rpx;
  261. color: #CCCCCC;
  262. display: flex;
  263. align-items: center;
  264. image {
  265. width: 35rpx;
  266. height: 35rpx;
  267. margin-right: 23rpx;
  268. }
  269. }
  270. .value-box {
  271. font-weight: 400;
  272. font-size: 28rpx;
  273. color: #CCCCCC;
  274. }
  275. }
  276. .form-title {
  277. font-weight: 500;
  278. font-size: 28rpx;
  279. color: #CCCCCC;
  280. padding-top: 32rpx;
  281. }
  282. .choose-box {
  283. margin-top: 28rpx;
  284. display: flex;
  285. flex-wrap: wrap;
  286. .choose-item {
  287. width: 137rpx;
  288. height: 67rpx;
  289. border-radius: 13rpx;
  290. border: 1rpx solid #CCCCCC;
  291. text-align: center;
  292. line-height: 67rpx;
  293. font-weight: 500;
  294. font-size: 26rpx;
  295. color: #CCCCCC;
  296. margin-right: 15rpx;
  297. margin-bottom: 24rpx;
  298. &:nth-child(4n){
  299. margin-right: 0;
  300. }
  301. }
  302. .choose-class {
  303. background-color: #341616;
  304. color: #FF4747;
  305. border: 1rpx solid #FF4747;
  306. }
  307. }
  308. }
  309. .title-box {
  310. font-weight: 500;
  311. font-size: 27rpx;
  312. color: #666666;
  313. }
  314. .tips-box {
  315. margin-top: 30rpx;
  316. margin-bottom: 27rpx;
  317. .tips-val {
  318. display: flex;
  319. align-items: center;
  320. margin-top: 27rpx;
  321. .tips-item {
  322. width: 147rpx;
  323. height: 72rpx;
  324. border-radius: 13rpx;
  325. font-weight: 500;
  326. font-size: 28rpx;
  327. line-height: 72rpx;
  328. text-align: center;
  329. margin-right: 20rpx;
  330. margin-bottom: 10rpx;
  331. flex-wrap: wrap;
  332. &:nth-child(4n) {
  333. margin-right: 0;
  334. }
  335. }
  336. .tips-1 {
  337. background-color: #1F1404;
  338. color: #E17E09;
  339. }
  340. .tips-2 {
  341. background-color: #1F0E0D;
  342. color: #FF4747;
  343. }
  344. .tips-3 {
  345. background-color: #051529;
  346. color: #0979E1;
  347. }
  348. .tips-4 {
  349. background-color: #191F0E;
  350. color: #4EB477;
  351. }
  352. }
  353. }
  354. .about-box {
  355. .about-box-val {
  356. margin-top: 36rpx;
  357. background: #171310;
  358. border-radius: 20rpx;
  359. padding: 60rpx 40rpx;
  360. font-weight: 400;
  361. font-size: 28rpx;
  362. color: #CCCCCC;
  363. line-height: 46rpx;
  364. }
  365. }
  366. }
  367. .btn-box {
  368. background-color: #060504;
  369. position: fixed;
  370. bottom: 0;
  371. left: 0;
  372. right: 0;
  373. padding: 20rpx 40rpx;
  374. height: 150rpx;
  375. z-index: 999;
  376. box-sizing: border-box;
  377. }
  378. </style>