set.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <view class="template-set">
  3. <!-- 顶部自定义导航 -->
  4. <tn-nav-bar fixed alpha customBack>
  5. <view slot="back" class='tn-custom-nav-bar__back'
  6. @click="goBack">
  7. <text class='icon tn-icon-left'></text>
  8. </view>
  9. </tn-nav-bar>
  10. <view class="tn-margin-top" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  11. <view style="text-align: center;">
  12. <uni-file-picker
  13. v-model="value" mode="list" :auto-upload="false" @select="select" @success="success">
  14. <image v-if="!userInfo.profilePhotoUrl" src="../static/me2.png" style="width: 100px;height: 100px;"></image>
  15. <image v-if="userInfo.profilePhotoUrl" :src="userInfo.profilePhotoUrl" style="width: 100px;height: 100px;border-radius: 50%;"></image>
  16. <view><text class="tn-color-grey">点击修改</text></view>
  17. </uni-file-picker>
  18. </view>
  19. <!-- <view class="tn-flex tn-flex-row-between tn-strip-bottom-min tn-padding" @click="tn('/minePages/avatar')">
  20. <view class="justify-content-item">
  21. <view class="tn-text-bold tn-text-lg">
  22. 用户头像
  23. </view>
  24. <view class="tn-color-gray tn-padding-top-xs">
  25. 有趣的头像,百里挑一
  26. </view>
  27. </view>
  28. <view class="justify-content-item tn-text-lg tn-color-grey">
  29. <view class="logo-pic tn-shadow">
  30. <view class="logo-image">
  31. <view class="tn-shadow-blur" style="background-image:url('https://cdn.nlark.com/yuque/0/2022/jpeg/280373/1664005699053-assets/web-upload/8645ea3a-e0a9-4422-8364-cc5ede305c9f.jpeg');width: 80rpx;height: 80rpx;background-size: cover;">
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view> -->
  37. <view class="" style="padding: 16px;
  38. margin-top: 16px;">
  39. <uni-forms :modelValue="formData" label-width="100px">
  40. <uni-forms-item label="用户昵称" name="name">
  41. <uni-easyinput type="text" :clearable="false" v-model="userInfo.contactNickName" placeholder="请输入昵称" />
  42. </uni-forms-item>
  43. <uni-forms-item label="真实姓名" name="realName">
  44. <uni-easyinput type="text" :clearable="false" v-model="userInfo.userRealName" placeholder="请输入姓名" />
  45. </uni-forms-item>
  46. <uni-forms-item label="联系方式" name="contactMethod">
  47. <uni-easyinput type="text" v-model="userInfo.contactMethod" :clearable="false" placeholder="请输入手机号码/邮箱/微信" />
  48. </uni-forms-item>
  49. <uni-forms-item label="手机号" name="phone">
  50. <uni-easyinput type="text" disabled v-model="userInfo.userName" placeholder=" " />
  51. </uni-forms-item>
  52. </uni-forms>
  53. <button shape="round" style="background-color: #1d60b1;border-radius: 30px;" type="primary" @click="saveForm">保存修改</button>
  54. </view>
  55. <!-- <view class="tn-flex tn-flex-row-between tn-strip-bottom-min tn-padding" @click="showModal1">
  56. <view class="justify-content-item">
  57. <view class="tn-text-bold tn-text-lg">
  58. 用户名
  59. </view>
  60. <view class="tn-color-gray tn-padding-top-xs">
  61. --
  62. </view>
  63. </view>
  64. <view class="justify-content-item tn-text-lg tn-color-grey">
  65. <view class="tn-icon-right tn-padding-top"></view>
  66. </view>
  67. </view>
  68. <view class="tn-flex tn-flex-row-between tn-strip-bottom tn-padding" @click="showModal2">
  69. <view class="justify-content-item">
  70. <view class="tn-text-bold tn-text-lg">
  71. 手机号
  72. </view>
  73. <view class="tn-color-gray tn-padding-top-xs">
  74. 13911111193
  75. </view>
  76. </view>
  77. <view class="justify-content-item tn-text-lg tn-color-grey">
  78. <view class="tn-icon-right tn-padding-top"></view>
  79. </view>
  80. </view>
  81. <view class="tn-flex tn-flex-row-between tn-strip-bottom-min tn-padding" @click="showModal3">
  82. <view class="justify-content-item">
  83. <view class="tn-text-bold tn-text-lg">
  84. 联系方式
  85. </view>
  86. <view class="tn-color-gray tn-padding-top-xs">
  87. 未填写
  88. </view>
  89. </view>
  90. <view class="justify-content-item tn-text-lg tn-color-grey">
  91. <view class="tn-icon-right tn-padding-top"></view>
  92. </view>
  93. </view>
  94. <picker @change="bindPickerChange1" :value="index1" :range="array1">
  95. <view class="tn-flex tn-flex-row-between tn-strip-bottom-min tn-padding">
  96. <view class="justify-content-item">
  97. <view class="tn-text-bold tn-text-lg">
  98. 所属公司
  99. </view>
  100. <view class="tn-color-gray tn-padding-top-xs">
  101. {{array1[index1]}}
  102. </view>
  103. </view>
  104. <view class="justify-content-item tn-text-lg tn-color-grey">
  105. <view class="tn-icon-right tn-padding-top"></view>
  106. </view>
  107. </view>
  108. </picker> -->
  109. <tn-modal v-model="show1" :custom="true" :showCloseBtn="true">
  110. <view class="custom-modal-content">
  111. <view class="">
  112. <view class="tn-text-lg tn-text-bold tn-color-purplered tn-text-center tn-padding">修改昵称</view>
  113. <view class="tn-bg-gray--light" style="border-radius: 10rpx;padding: 20rpx 30rpx;margin: 50rpx 0 60rpx 0;">
  114. <input placeholder="==" name="input" placeholder-style="color:#AAAAAA" maxlength="20"></input>
  115. </view>
  116. </view>
  117. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  118. <tn-button backgroundColor="#3668FC" padding="40rpx 0" width="60%" shadow fontBold>
  119. <text class="tn-color-white">保 存</text>
  120. </tn-button>
  121. </view>
  122. </view>
  123. </tn-modal>
  124. <tn-modal v-model="show2" :custom="true" :showCloseBtn="true">
  125. <view class="custom-modal-content">
  126. <view class="">
  127. <view class="tn-text-lg tn-text-bold tn-color-purplered tn-text-center tn-padding">变更手机号码</view>
  128. <view class="tn-bg-gray--light tn-color-gray" style="border-radius: 10rpx;padding: 20rpx 30rpx;margin: 50rpx 0 60rpx 0;">
  129. 13911111193
  130. </view>
  131. </view>
  132. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  133. <tn-button backgroundColor="#3668FC" padding="40rpx 0" width="60%" shadow fontBold>
  134. <text class="tn-color-white">获取手机号</text>
  135. </tn-button>
  136. <!-- <tn-button backgroundColor="#3668FC" padding="40rpx 0" width="60%" shadow fontBold open-type="getPhoneNumber">
  137. <text class="tn-color-white">获取手机号</text>
  138. </tn-button> -->
  139. <view class="tn-padding-top-sm">因为获取手机号api收费了,所以这里注释掉,需要的自行展示出来即可</view>
  140. </view>
  141. </view>
  142. </tn-modal>
  143. <tn-modal v-model="show3" :custom="true" :showCloseBtn="true">
  144. <view class="custom-modal-content">
  145. <view class="">
  146. <view class="tn-text-lg tn-text-bold tn-color-purplered tn-text-center tn-padding">请输入真实姓名</view>
  147. <view class="tn-bg-gray--light" style="border-radius: 10rpx;padding: 20rpx 30rpx;margin: 50rpx 0 60rpx 0;">
  148. <input placeholder="请填写姓名" name="input" placeholder-style="color:#AAAAAA" maxlength="20"></input>
  149. </view>
  150. </view>
  151. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  152. <tn-button backgroundColor="#3668FC" padding="40rpx 0" width="60%" shadow fontBold @click="saveForm()">
  153. <text class="tn-color-white">保 存</text>
  154. </tn-button>
  155. </view>
  156. </view>
  157. </tn-modal>
  158. </view>
  159. </view>
  160. </template>
  161. <script>
  162. import template_page_mixin from '@/libs/mixin/template_page_mixin.js'
  163. import request from '../utils/request';
  164. export default {
  165. name: 'TemplateSet',
  166. mixins: [template_page_mixin],
  167. data(){
  168. return {
  169. show1: false,
  170. show2: false,
  171. show3: false,
  172. index: 0,
  173. array: ['女', '男', '保密'],
  174. date: '2000-01-29',
  175. index1: 1,
  176. array1: ['计算机/电子', '广告/媒体', '会计/金融', '政府/非盈利组织/其他'],
  177. userInfo:{
  178. profilePhotoUrl:uni.getStorageSync('userInfo')?JSON.parse(uni.getStorageSync('userInfo')).profilePhotoUrl:'',
  179. contactNickName:uni.getStorageSync('userInfo')?JSON.parse(uni.getStorageSync('userInfo')).contactNickName:'',
  180. contactMethod:uni.getStorageSync('userInfo')?JSON.parse(uni.getStorageSync('userInfo')).contactMethod:'',
  181. userName:uni.getStorageSync('userInfo')?JSON.parse(uni.getStorageSync('userInfo')).userName:''
  182. },
  183. }
  184. },
  185. computed: {
  186. startDate() {
  187. return this.getDate('start');
  188. },
  189. endDate() {
  190. return this.getDate('end');
  191. }
  192. },
  193. onLoad(){
  194. this.getInfo();
  195. },
  196. methods: {
  197. // 跳转
  198. tn(e) {
  199. uni.navigateTo({
  200. url: e,
  201. });
  202. },
  203. // 弹出模态框
  204. showModal1(event) {
  205. this.openModal1()
  206. },
  207. // 打开模态框
  208. openModal1() {
  209. this.show1 = true
  210. },
  211. // 弹出模态框
  212. showModal2(event) {
  213. this.openModal2()
  214. },
  215. // 打开模态框
  216. openModal2() {
  217. this.show2 = true
  218. },
  219. // 弹出模态框
  220. showModal3(event) {
  221. this.openModal3()
  222. },
  223. // 打开模态框
  224. openModal3() {
  225. this.show3 = true
  226. },
  227. bindPickerChange: function(e) {
  228. this.index = e.detail.value
  229. },
  230. bindPickerChange1: function(e) {
  231. this.index1 = e.detail.value
  232. },
  233. bindDateChange: function(e) {
  234. this.date = e.detail.value
  235. },
  236. getDate(type) {
  237. const date = new Date();
  238. let year = date.getFullYear();
  239. let month = date.getMonth() + 1;
  240. let day = date.getDate();
  241. if (type === 'start') {
  242. year = year - 60;
  243. } else if (type === 'end') {
  244. year = year + 2;
  245. }
  246. month = month > 9 ? month : '0' + month;
  247. day = day > 9 ? day : '0' + day;
  248. return `${year}-${month}-${day}`;
  249. },
  250. getInfo(){
  251. request.post('/slbWxma/getPersonlInfo',{}).then(res=>{
  252. if(res&&res.success){
  253. this.userInfo = res.resultMap.userInfo||{}
  254. }
  255. })
  256. },
  257. saveForm(){
  258. const that = this;
  259. let params= this.userInfo;
  260. request.post('/slbWxma/changePersonlInfo',{userInfo:JSON.stringify(params)},{
  261. headers: {
  262. 'Content-Type': 'application/json', // 默认值
  263. },
  264. }).then(res=>{
  265. if(res.success){
  266. uni.showToast({
  267. title:'修改成功'
  268. })
  269. uni.navigateBack();
  270. }
  271. })
  272. },
  273. // 获取上传状态
  274. select(e) {
  275. console.log('选择文件:', e)
  276. let tempFiles = e.tempFiles;
  277. for (let i in tempFiles) {
  278. this.upfile(tempFiles[i])
  279. }
  280. },
  281. upfile(file) {
  282. let that = this;
  283. console.warn(file);
  284. uni.uploadFile({
  285. url: 'https://slb-m.lx-device.com/oss/upload/userFeedback', //仅为示例,非真实的接口地址
  286. filePath: file.url,
  287. name: 'file',
  288. success: (uploadFileRes) => {
  289. console.warn(JSON.parse(uploadFileRes.data));
  290. let resultMap = JSON.parse(uploadFileRes.data).resultMap;
  291. that.userInfo.profilePhotoUrl= resultMap.uploadUrl;
  292. }
  293. });
  294. },
  295. // 上传成功
  296. success(e) {
  297. console.log('上传成功')
  298. },
  299. }
  300. }
  301. </script>
  302. <style lang="scss" scoped>
  303. /* 胶囊*/
  304. .tn-custom-nav-bar__back {
  305. width: 60%;
  306. height: 100%;
  307. position: relative;
  308. display: flex;
  309. justify-content: space-evenly;
  310. align-items: center;
  311. box-sizing: border-box;
  312. // background-color: rgba(0, 0, 0, 0.15);
  313. border-radius: 1000rpx;
  314. border: 1rpx solid rgba(255, 255, 255, 0.5);
  315. // color: #FFFFFF;
  316. font-size: 18px;
  317. .icon {
  318. display: block;
  319. flex: 1;
  320. margin: auto;
  321. text-align: center;
  322. }
  323. }
  324. /* 间隔线 start*/
  325. .tn-strip-bottom-min {
  326. width: 100%;
  327. border-bottom: 1rpx solid #F8F9FB;
  328. }
  329. .tn-strip-bottom {
  330. width: 100%;
  331. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  332. }
  333. /* 间隔线 end*/
  334. /* 用户头像 start */
  335. .logo-image {
  336. width: 80rpx;
  337. height: 80rpx;
  338. position: relative;
  339. }
  340. .logo-pic {
  341. background-size: cover;
  342. background-repeat: no-repeat;
  343. // background-attachment:fixed;
  344. background-position: top;
  345. border: 2rpx solid rgba(255,255,255,0.05);
  346. box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15);
  347. border-radius: 50%;
  348. overflow: hidden;
  349. // background-color: #FFFFFF;
  350. }
  351. /* 底部悬浮按钮 start*/
  352. .tn-tabbar-height {
  353. min-height: 100rpx;
  354. height: calc(120rpx + env(safe-area-inset-bottom) / 2);
  355. }
  356. .tn-footerfixed {
  357. position: fixed;
  358. width: 100%;
  359. bottom: calc(30rpx + env(safe-area-inset-bottom));
  360. z-index: 1024;
  361. box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0);
  362. }
  363. /deep/ .uni-file-picker__container {
  364. justify-content: center;
  365. }
  366. /deep/ .file-picker__box-content {
  367. border: none !important;
  368. }
  369. /deep/ .uni-file-picker__lists{
  370. display: none;
  371. }
  372. /deep/ .uni-forms-item__label {
  373. font-size: 16px;
  374. }
  375. /* 底部悬浮按钮 end*/
  376. </style>