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

404 lines
9.0 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
2 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
2 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
2 months ago
4 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. top: 0;
  199. }
  200. .content {
  201. margin-top: 40rpx;
  202. padding: 0 30rpx 170rpx;
  203. padding-top: calc(var(--status-bar-height) + 110rpx);
  204. .img-box {
  205. display: flex;
  206. flex-direction: column;
  207. align-items: center;
  208. justify-content: center;
  209. margin-bottom: 40rpx;
  210. image {
  211. width: 176rpx;
  212. height: 176rpx;
  213. border-radius: 50%;
  214. }
  215. view {
  216. font-weight: 400;
  217. font-size: 24rpx;
  218. color: #CCCCCC;
  219. margin-top: 20rpx;
  220. }
  221. }
  222. .name-box {
  223. display: flex;
  224. align-items: center;
  225. .name-val {
  226. font-weight: 600;
  227. font-size: 32rpx;
  228. color: #E6E6E6;
  229. margin-right: 18rpx;
  230. }
  231. .sex-box {
  232. background-color: #0D1A20;
  233. width: 69rpx;
  234. height: 36rpx;
  235. border-radius: 18rpx;
  236. display: flex;
  237. align-items: center;
  238. justify-content: center;
  239. margin-right: 10rpx;
  240. image {
  241. width: 25rpx;
  242. height: 25rpx;
  243. }
  244. }
  245. .age-box {
  246. width: 85rpx;
  247. height: 36rpx;
  248. background: #261705;
  249. border-radius: 18rpx;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. font-weight: 400;
  254. font-size: 23rpx;
  255. color: #FFA200;
  256. }
  257. }
  258. .form-box {
  259. background: #1B1713;
  260. border-radius: 27rpx;
  261. padding:0 40rpx;
  262. margin-top: 25rpx;
  263. margin-bottom: 44rpx;
  264. .form-box-line {
  265. height: 112rpx;
  266. border-bottom: 1px solid #403D3A;
  267. display: flex;
  268. align-items: center;
  269. justify-content: space-between;
  270. &:last-child {
  271. border: none;
  272. }
  273. .label-box {
  274. font-weight: 400;
  275. font-size: 31rpx;
  276. color: #CCCCCC;
  277. display: flex;
  278. align-items: center;
  279. image {
  280. width: 35rpx;
  281. height: 35rpx;
  282. margin-right: 23rpx;
  283. }
  284. }
  285. .value-box {
  286. font-weight: 400;
  287. font-size: 28rpx;
  288. color: #CCCCCC;
  289. }
  290. }
  291. .form-title {
  292. font-weight: 500;
  293. font-size: 28rpx;
  294. color: #CCCCCC;
  295. padding-top: 32rpx;
  296. }
  297. .choose-box {
  298. margin-top: 28rpx;
  299. display: flex;
  300. flex-wrap: wrap;
  301. .choose-item {
  302. width: 137rpx;
  303. height: 67rpx;
  304. border-radius: 13rpx;
  305. border: 1rpx solid #CCCCCC;
  306. text-align: center;
  307. line-height: 67rpx;
  308. font-weight: 500;
  309. font-size: 26rpx;
  310. color: #CCCCCC;
  311. margin-right: 15rpx;
  312. margin-bottom: 24rpx;
  313. &:nth-child(4n){
  314. margin-right: 0;
  315. }
  316. }
  317. .choose-class {
  318. background-color: #341616;
  319. color: #FF4747;
  320. border: 1rpx solid #FF4747;
  321. }
  322. }
  323. }
  324. .title-box {
  325. font-weight: 500;
  326. font-size: 27rpx;
  327. color: #666666;
  328. }
  329. .tips-box {
  330. margin-top: 30rpx;
  331. margin-bottom: 27rpx;
  332. .tips-val {
  333. display: flex;
  334. align-items: center;
  335. margin-top: 27rpx;
  336. .tips-item {
  337. width: 147rpx;
  338. height: 72rpx;
  339. border-radius: 13rpx;
  340. font-weight: 500;
  341. font-size: 28rpx;
  342. line-height: 72rpx;
  343. text-align: center;
  344. margin-right: 20rpx;
  345. margin-bottom: 10rpx;
  346. flex-wrap: wrap;
  347. &:nth-child(4n) {
  348. margin-right: 0;
  349. }
  350. }
  351. .tips-1 {
  352. background-color: #1F1404;
  353. color: #E17E09;
  354. }
  355. .tips-2 {
  356. background-color: #1F0E0D;
  357. color: #FF4747;
  358. }
  359. .tips-3 {
  360. background-color: #051529;
  361. color: #0979E1;
  362. }
  363. .tips-4 {
  364. background-color: #191F0E;
  365. color: #4EB477;
  366. }
  367. }
  368. }
  369. .about-box {
  370. .about-box-val {
  371. margin-top: 36rpx;
  372. background: #171310;
  373. border-radius: 20rpx;
  374. padding: 60rpx 40rpx;
  375. font-weight: 400;
  376. font-size: 28rpx;
  377. color: #CCCCCC;
  378. line-height: 46rpx;
  379. }
  380. }
  381. }
  382. .btn-box {
  383. background-color: #060504;
  384. position: fixed;
  385. bottom: 0;
  386. left: 0;
  387. right: 0;
  388. padding: 20rpx 40rpx;
  389. height: 150rpx;
  390. z-index: 999;
  391. box-sizing: border-box;
  392. }
  393. </style>