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

305 lines
8.3 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
9 months ago
10 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. padding: 0 30rpx 170rpx;
  218. padding-top: calc(var(--status-bar-height) + 110rpx);
  219. .title-box {
  220. font-weight: 500;
  221. font-size: 27rpx;
  222. color: #666666;
  223. }
  224. .form-box {
  225. background: #1B1713;
  226. border-radius: 27rpx;
  227. padding:0 40rpx;
  228. margin-top: 20rpx;
  229. margin-bottom: 44rpx;
  230. .form-box-line {
  231. height: 112rpx;
  232. border-bottom: 1px solid #403D3A;
  233. display: flex;
  234. align-items: center;
  235. &:last-child {
  236. border: none;
  237. }
  238. .label-box {
  239. font-weight: 500;
  240. font-size: 29rpx;
  241. color: #CCCCCC;
  242. margin-right: 34rpx;
  243. }
  244. .value-box {
  245. display: flex;
  246. align-items: center;
  247. justify-content: space-between;
  248. flex: 1;
  249. .uv-input {
  250. }
  251. }
  252. }
  253. .form-title {
  254. font-weight: 500;
  255. font-size: 28rpx;
  256. color: #CCCCCC;
  257. padding-top: 32rpx;
  258. }
  259. .choose-box {
  260. margin-top: 28rpx;
  261. display: flex;
  262. flex-wrap: wrap;
  263. .choose-item {
  264. width: 137rpx;
  265. height: 67rpx;
  266. border-radius: 13rpx;
  267. border: 1rpx solid #CCCCCC;
  268. text-align: center;
  269. line-height: 67rpx;
  270. font-weight: 500;
  271. font-size: 26rpx;
  272. color: #CCCCCC;
  273. margin-right: 15rpx;
  274. margin-bottom: 24rpx;
  275. &:nth-child(4n){
  276. margin-right: 0;
  277. }
  278. }
  279. .choose-class {
  280. background-color: #341616;
  281. color: #FF4747;
  282. border: 1rpx solid #FF4747;
  283. }
  284. }
  285. }
  286. }
  287. .btn-box {
  288. background-color: #060504;
  289. position: fixed;
  290. bottom: 0;
  291. left: 0;
  292. right: 0;
  293. padding: 20rpx 40rpx;
  294. height: 150rpx;
  295. z-index: 999;
  296. box-sizing: border-box;
  297. }
  298. </style>