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

403 lines
9.0 KiB

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