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

317 lines
9.3 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
4 months ago
6 months ago
  1. <template>
  2. <view>
  3. <view class="head-box"></view>
  4. <uv-navbar autoBack :title="$t('pages_my.user_msg.title')" leftIconColor="#fff" :bgColor="bgColor" height="100rpx" :titleStyle="{color:'#fff'}"></uv-navbar>
  5. <view class="content">
  6. <view class="title-box">{{ $t('pages_my.user_msg.basic_info') }}</view>
  7. <view class="form-box">
  8. <view class="form-box-line">
  9. <view class="label-box">{{ $t('pages_my.user_msg.username') }}</view>
  10. <view class="value-box">
  11. <uv-input :placeholder="$t('pages_my.user_msg.enter_username')" 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">{{ $t('pages_my.user_msg.email') }}</view>
  16. <view class="value-box">
  17. <uv-input :placeholder="$t('pages_my.user_msg.enter_email')" 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">{{ $t('pages_my.user_msg.phone') }}</view>
  22. <view class="value-box">
  23. <uv-input :placeholder="$t('pages_my.user_msg.enter_phone')" 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">{{ $t('pages_my.user_msg.gender') }}</view>
  28. <view class="value-box" @click="$refs.sexPicker.open();">
  29. <uv-input :placeholder="$t('pages_my.user_msg.select_gender')" 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">{{ $t('pages_my.user_msg.nationality') }}</view>
  34. <view class="value-box" @click="$refs.cityPicker.open()">
  35. <uv-input :placeholder="$t('pages_my.user_msg.enter_nationality')" 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">{{ $t('pages_my.user_msg.birthday') }}</view>
  40. <view class="value-box" @click="$refs.datetimePicker.open()">
  41. <uv-input :placeholder="$t('pages_my.user_msg.enter_birthday')" 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">{{ $t('pages_my.user_msg.address') }}</view>
  46. <view class="value-box">
  47. <uv-input :placeholder="$t('pages_my.user_msg.enter_address')" 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">{{ $t('pages_my.user_msg.personal_status') }}</view>
  52. <view class="value-box">
  53. <uv-input :placeholder="$t('pages_my.user_msg.enter_status')" inputAlign="right" v-model="info.state" border="none" color="#CCCCCC"></uv-input>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="title-box">{{ $t('pages_my.user_msg.education') }}</view>
  58. <view class="form-box">
  59. <view class="form-title">{{ $t('pages_my.user_msg.degree') }}</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">{{ $t('pages_my.user_msg.school') }}</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">{{ $t('pages_my.user_msg.work') }}</view>
  69. <view class="form-box">
  70. <view class="form-box-line">
  71. <view class="label-box">{{ $t('pages_my.user_msg.industry') }}</view>
  72. <view class="value-box">
  73. <uv-input :placeholder="$t('pages_my.user_msg.enter_industry')" inputAlign="right" v-model="info.workValue" border="none" color="#CCCCCC"></uv-input>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="title-box">{{ $t('pages_my.user_msg.about_me') }}</view>
  78. <view class="form-box">
  79. <uv-textarea v-model="info.details" :customStyle="{background: 'transparent',border:'none'}" height="380rpx" :placeholder="$t('pages_my.user_msg.enter_about_me')"></uv-textarea>
  80. </view>
  81. </view>
  82. <view class="btn-box">
  83. <uv-button :text="$t('pages_my.user_msg.save')" @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. citycolumns:[],
  119. maxDate:new Date().getTime(),
  120. value: Number(new Date())
  121. }
  122. },
  123. onPageScroll(e) {
  124. if(e.scrollTop > 50) {
  125. this.bgColor = '#49070c'
  126. }else{
  127. this.bgColor = 'transparent'
  128. }
  129. },
  130. onLoad() {
  131. // 初始化国际化数据
  132. this.xueliList = [
  133. this.$t('pages_my.user_msg.bachelor'),
  134. this.$t('pages_my.user_msg.master'),
  135. this.$t('pages_my.user_msg.doctor'),
  136. this.$t('pages_my.user_msg.other')
  137. ]
  138. this.sexcolumns = [[
  139. this.$t('pages_my.user_msg.male'),
  140. this.$t('pages_my.user_msg.female')
  141. ]]
  142. this.getUserInfo()
  143. this.getnationalityPageList()
  144. this.getlabelPageList()
  145. },
  146. methods:{
  147. getlabelPageList() {
  148. this.$api('labelPageList',{pageNo:1,pageSize:999},res=>{
  149. this.yuanxiaoList = res.result.records
  150. })
  151. },
  152. getnationalityPageList() {
  153. this.$api('nationalityPageList',{pageNo:1,pageSize:999},res=>{
  154. this.citycolumns = [res.result.records]
  155. })
  156. },
  157. formatter(type, value) {
  158. if (type === 'year') {
  159. return `${value}`
  160. }
  161. if (type === 'month') {
  162. return `${value}`
  163. }
  164. if (type === 'day') {
  165. return `${value}`
  166. }
  167. return value
  168. },
  169. saveClick() {
  170. for (let k in this.info) {
  171. if((!this.info[k] && this.info[k] != 0)
  172. || this.info[k] == 'null'){
  173. this.info[k] = ''
  174. }
  175. }
  176. this.$api('updateInfo',this.info, res => {
  177. if (res.code == 200) {
  178. uni.showToast({
  179. title: this.$t('pages_my.user_msg.save_success'),
  180. icon:'none'
  181. })
  182. setTimeout(()=>{
  183. uni.navigateBack()
  184. },1500)
  185. }
  186. })
  187. },
  188. getUserInfo() {
  189. this.$api('getInfo', res => {
  190. if (res.code == 200 && res.result) {
  191. this.info = res.result
  192. }
  193. })
  194. },
  195. sexConfirm(val) {
  196. this.info.sex = val.value[0]
  197. },
  198. cityConfirm(val) {
  199. this.info.city = val.value[0].country
  200. },
  201. dateConfirm(val) {
  202. const date = new Date(val.value);
  203. const year = date.getFullYear();
  204. const month = String(date.getMonth() + 1).padStart(2, '0');
  205. const day = String(date.getDate()).padStart(2, '0');
  206. this.info.yearDate = `${year}-${month}-${day}`;
  207. }
  208. }
  209. }
  210. </script>
  211. <style lang="scss">
  212. page {
  213. background-color: #060504;
  214. }
  215. </style>
  216. <style lang="scss" scoped>
  217. .head-box {
  218. background: url('@/static/image/nav-bg.png') no-repeat;
  219. background-size: 100% 100%;
  220. width: 100%;
  221. height: 534rpx;
  222. position: absolute;
  223. z-index: -1;
  224. top: 0;
  225. }
  226. .content {
  227. margin-top: 40rpx;
  228. padding: 0 30rpx 170rpx;
  229. padding-top: calc(var(--status-bar-height) + 110rpx);
  230. .title-box {
  231. font-weight: 500;
  232. font-size: 27rpx;
  233. color: #666666;
  234. }
  235. .form-box {
  236. background: #1B1713;
  237. border-radius: 27rpx;
  238. padding:0 40rpx;
  239. margin-top: 20rpx;
  240. margin-bottom: 44rpx;
  241. .form-box-line {
  242. height: 112rpx;
  243. border-bottom: 1px solid #403D3A;
  244. display: flex;
  245. align-items: center;
  246. &:last-child {
  247. border: none;
  248. }
  249. .label-box {
  250. font-weight: 500;
  251. font-size: 29rpx;
  252. color: #CCCCCC;
  253. margin-right: 34rpx;
  254. }
  255. .value-box {
  256. display: flex;
  257. align-items: center;
  258. justify-content: space-between;
  259. flex: 1;
  260. .uv-input {
  261. }
  262. }
  263. }
  264. .form-title {
  265. font-weight: 500;
  266. font-size: 28rpx;
  267. color: #CCCCCC;
  268. padding-top: 32rpx;
  269. }
  270. .choose-box {
  271. margin-top: 28rpx;
  272. display: flex;
  273. flex-wrap: wrap;
  274. .choose-item {
  275. width: 137rpx;
  276. height: 67rpx;
  277. border-radius: 13rpx;
  278. border: 1rpx solid #CCCCCC;
  279. text-align: center;
  280. line-height: 67rpx;
  281. font-weight: 500;
  282. font-size: 26rpx;
  283. color: #CCCCCC;
  284. margin-right: 15rpx;
  285. margin-bottom: 24rpx;
  286. &:nth-child(4n){
  287. margin-right: 0;
  288. }
  289. }
  290. .choose-class {
  291. background-color: #341616;
  292. color: #FF4747;
  293. border: 1rpx solid #FF4747;
  294. }
  295. }
  296. }
  297. }
  298. .btn-box {
  299. background-color: #060504;
  300. position: fixed;
  301. bottom: 0;
  302. left: 0;
  303. right: 0;
  304. padding: 20rpx 40rpx;
  305. height: 150rpx;
  306. z-index: 999;
  307. box-sizing: border-box;
  308. }
  309. </style>