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

306 lines
8.3 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
2 months 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
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
1 month ago
2 months 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
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. <view class="title-box">基础信息</view>
  7. <view class="form-box">
  8. <view class="form-box-line">
  9. <view class="label-box">用户名称</view>
  10. <view class="value-box">
  11. <uv-input placeholder="请输入用户名称" inputAlign="right" v-model="info.nickName" border="none" color="#CCCCCC"></uv-input>
  12. </view>
  13. </view>
  14. <view class="form-box-line">
  15. <view class="label-box">邮箱</view>
  16. <view class="value-box">
  17. <uv-input placeholder="请输入邮箱" inputAlign="right" v-model="info.email" border="none" color="#CCCCCC"></uv-input>
  18. </view>
  19. </view>
  20. <view class="form-box-line">
  21. <view class="label-box">手机号</view>
  22. <view class="value-box">
  23. <uv-input placeholder="请输入手机号" inputAlign="right" v-model="info.phone" border="none" color="#CCCCCC"></uv-input>
  24. </view>
  25. </view>
  26. <view class="form-box-line">
  27. <view class="label-box">性别</view>
  28. <view class="value-box" @click="$refs.sexPicker.open();">
  29. <uv-input placeholder="请选择性别" readonly inputAlign="right" v-model="info.sex" border="none" color="#CCCCCC"></uv-input>
  30. </view>
  31. </view>
  32. <view class="form-box-line">
  33. <view class="label-box">国籍</view>
  34. <view class="value-box" @click="$refs.cityPicker.open()">
  35. <uv-input placeholder="请输入国籍" readonly inputAlign="right" v-model="info.city" border="none" color="#CCCCCC"></uv-input>
  36. </view>
  37. </view>
  38. <view class="form-box-line">
  39. <view class="label-box">生日</view>
  40. <view class="value-box" @click="$refs.datetimePicker.open()">
  41. <uv-input placeholder="请输入生日" readonly inputAlign="right" v-model="info.yearDate" border="none" color="#CCCCCC"></uv-input>
  42. </view>
  43. </view>
  44. <view class="form-box-line">
  45. <view class="label-box">现居住址</view>
  46. <view class="value-box">
  47. <uv-input placeholder="请输入现居住址" inputAlign="right" v-model="info.address" border="none" color="#CCCCCC"></uv-input>
  48. </view>
  49. </view>
  50. <view class="form-box-line">
  51. <view class="label-box">个人状态</view>
  52. <view class="value-box">
  53. <uv-input placeholder="请输入个人状态" inputAlign="right" v-model="info.state" border="none" color="#CCCCCC"></uv-input>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="title-box">教育</view>
  58. <view class="form-box">
  59. <view class="form-title">学历</view>
  60. <view class="choose-box">
  61. <view class="choose-item" :class="info.shcool == item ? 'choose-class' :''" v-for="(item,i) in xueliList" :key="i" @click="info.shcool = item">{{item}}</view>
  62. </view>
  63. <view class="form-title">院校</view>
  64. <view class="choose-box">
  65. <view class="choose-item" :class="info.shcoolType == item.title ? 'choose-class' :''" v-for="(item,i) in yuanxiaoList" :key="i" @click="info.shcoolType = item.title">{{item.title}}</view>
  66. </view>
  67. </view>
  68. <view class="title-box">工作</view>
  69. <view class="form-box">
  70. <view class="form-box-line">
  71. <view class="label-box">行业</view>
  72. <view class="value-box">
  73. <uv-input placeholder="请输入行业" inputAlign="right" v-model="info.workValue" border="none" color="#CCCCCC"></uv-input>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="title-box">关于我</view>
  78. <view class="form-box">
  79. <uv-textarea v-model="info.details" :customStyle="{background: 'transparent',border:'none'}" height="380rpx" placeholder="请输入自我介绍..."></uv-textarea>
  80. </view>
  81. </view>
  82. <view class="btn-box">
  83. <uv-button text="保存" @click="saveClick" color="#381615" shape="circle" :customStyle="btnCustomStyle"></uv-button>
  84. </view>
  85. <uv-picker ref="sexPicker" :columns="sexcolumns" @confirm="sexConfirm"></uv-picker>
  86. <uv-picker ref="cityPicker" keyName="country" :columns="citycolumns" @confirm="cityConfirm"></uv-picker>
  87. <uv-datetime-picker ref="datetimePicker" :minDate="0" :maxDate="maxDate" :formatter="formatter" v-model="value" mode="date" @confirm="dateConfirm"></uv-datetime-picker>
  88. </view>
  89. </template>
  90. <script>
  91. export default{
  92. data() {
  93. return {
  94. bgColor:'transparent',
  95. btnCustomStyle:{
  96. color:'#FF5858'
  97. },
  98. info:{
  99. nickName:'',
  100. headImage:'',
  101. phone:'',
  102. email:'',
  103. sex:'',
  104. city:'',
  105. yearDate:'',
  106. address:'',
  107. state:'',
  108. shcool:'',
  109. shcoolType:'',
  110. workValue:'',
  111. details:'',
  112. },
  113. xueliIndex:0,
  114. yuanxiaoIndex:0,
  115. xueliList:['本科','硕士','博士','其他'],
  116. yuanxiaoList:[],
  117. sexcolumns:[
  118. ['男','女']
  119. ],
  120. citycolumns:[],
  121. maxDate:new Date().getTime(),
  122. value: Number(new Date())
  123. }
  124. },
  125. onPageScroll(e) {
  126. if(e.scrollTop > 50) {
  127. this.bgColor = '#49070c'
  128. }else{
  129. this.bgColor = 'transparent'
  130. }
  131. },
  132. onLoad() {
  133. this.getUserInfo()
  134. this.getnationalityPageList()
  135. this.getlabelPageList()
  136. },
  137. methods:{
  138. getlabelPageList() {
  139. this.$api('labelPageList',{pageNo:1,pageSize:999},res=>{
  140. this.yuanxiaoList = res.result.records
  141. })
  142. },
  143. getnationalityPageList() {
  144. this.$api('nationalityPageList',{pageNo:1,pageSize:999},res=>{
  145. this.citycolumns = [res.result.records]
  146. })
  147. },
  148. formatter(type, value) {
  149. if (type === 'year') {
  150. return `${value}`
  151. }
  152. if (type === 'month') {
  153. return `${value}`
  154. }
  155. if (type === 'day') {
  156. return `${value}`
  157. }
  158. return value
  159. },
  160. saveClick() {
  161. for (let k in this.info) {
  162. if((!this.info[k] && this.info[k] != 0)
  163. || this.info[k] == 'null'){
  164. this.info[k] = ''
  165. }
  166. }
  167. this.$api('updateInfo',this.info, res => {
  168. if (res.code == 200) {
  169. uni.showToast({
  170. title:'保存成功',
  171. icon:'none'
  172. })
  173. setTimeout(()=>{
  174. uni.navigateBack()
  175. },1500)
  176. }
  177. })
  178. },
  179. getUserInfo() {
  180. this.$api('getInfo', res => {
  181. if (res.code == 200 && res.result) {
  182. this.info = res.result
  183. }
  184. })
  185. },
  186. sexConfirm(val) {
  187. this.info.sex = val.value[0]
  188. },
  189. cityConfirm(val) {
  190. this.info.city = val.value[0].country
  191. },
  192. dateConfirm(val) {
  193. const date = new Date(val.value);
  194. const year = date.getFullYear();
  195. const month = String(date.getMonth() + 1).padStart(2, '0');
  196. const day = String(date.getDate()).padStart(2, '0');
  197. this.info.yearDate = `${year}-${month}-${day}`;
  198. }
  199. }
  200. }
  201. </script>
  202. <style lang="scss">
  203. page {
  204. background-color: #060504;
  205. }
  206. </style>
  207. <style lang="scss" scoped>
  208. .head-box {
  209. background: url('@/static/image/nav-bg.png') no-repeat;
  210. background-size: 100% 100%;
  211. width: 100%;
  212. height: 534rpx;
  213. position: absolute;
  214. z-index: -1;
  215. }
  216. .content {
  217. margin-top: 40rpx;
  218. padding: 0 30rpx 170rpx;
  219. padding-top: calc(var(--status-bar-height) + 110rpx);
  220. .title-box {
  221. font-weight: 500;
  222. font-size: 27rpx;
  223. color: #666666;
  224. }
  225. .form-box {
  226. background: #1B1713;
  227. border-radius: 27rpx;
  228. padding:0 40rpx;
  229. margin-top: 20rpx;
  230. margin-bottom: 44rpx;
  231. .form-box-line {
  232. height: 112rpx;
  233. border-bottom: 1px solid #403D3A;
  234. display: flex;
  235. align-items: center;
  236. &:last-child {
  237. border: none;
  238. }
  239. .label-box {
  240. font-weight: 500;
  241. font-size: 29rpx;
  242. color: #CCCCCC;
  243. margin-right: 34rpx;
  244. }
  245. .value-box {
  246. display: flex;
  247. align-items: center;
  248. justify-content: space-between;
  249. flex: 1;
  250. .uv-input {
  251. }
  252. }
  253. }
  254. .form-title {
  255. font-weight: 500;
  256. font-size: 28rpx;
  257. color: #CCCCCC;
  258. padding-top: 32rpx;
  259. }
  260. .choose-box {
  261. margin-top: 28rpx;
  262. display: flex;
  263. flex-wrap: wrap;
  264. .choose-item {
  265. width: 137rpx;
  266. height: 67rpx;
  267. border-radius: 13rpx;
  268. border: 1rpx solid #CCCCCC;
  269. text-align: center;
  270. line-height: 67rpx;
  271. font-weight: 500;
  272. font-size: 26rpx;
  273. color: #CCCCCC;
  274. margin-right: 15rpx;
  275. margin-bottom: 24rpx;
  276. &:nth-child(4n){
  277. margin-right: 0;
  278. }
  279. }
  280. .choose-class {
  281. background-color: #341616;
  282. color: #FF4747;
  283. border: 1rpx solid #FF4747;
  284. }
  285. }
  286. }
  287. }
  288. .btn-box {
  289. background-color: #060504;
  290. position: fixed;
  291. bottom: 0;
  292. left: 0;
  293. right: 0;
  294. padding: 20rpx 40rpx;
  295. height: 150rpx;
  296. z-index: 999;
  297. box-sizing: border-box;
  298. }
  299. </style>