set.vue 13 KB

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