managePhoto.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <view class="item_tag">
  5. <view class="tag" v-for="(item,index) in list_tag">
  6. <image class="logo" src="../../static/logo.png" mode="widthFix"></image>
  7. <image class="close" src="../../static/me/close2.png" mode="widthFix" />
  8. </view>
  9. <view class="tagAdd">
  10. <image class="add" src="../../static/me/icon_add.png" mode="widthFix" />
  11. </view>
  12. </view>
  13. <view class="tips">*最多上传5张图片</view>
  14. <view class="blankHeight"></view>
  15. </view>
  16. <view class="btn_submit">提交</view>
  17. <!-- 提示框 -->
  18. <DialogBox ref="DialogBox"></DialogBox>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. components: {},
  24. data() {
  25. return {
  26. title: '',
  27. sel: 1,
  28. list_tag: [
  29. 'xx', 'ff', 'vv'
  30. ],
  31. myinfo: {
  32. nickname: '王思思',
  33. join_name: '注册日期:2024年5月',
  34. num_1: 0,
  35. num_2: 0,
  36. num_3: 0,
  37. num_4: 0,
  38. is_login: 'no',
  39. num_history: 0,
  40. num_collection: 0
  41. },
  42. }
  43. },
  44. onLoad() {
  45. setTimeout(function() {
  46. uni.setNavigationBarColor({
  47. frontColor: '#ffffff',
  48. backgroundColor: '#00000000',
  49. animation: {
  50. duration: 400,
  51. timingFunc: 'easeIn'
  52. }
  53. })
  54. }, 200);
  55. },
  56. onShow() {
  57. this.loadData();
  58. },
  59. methods: {
  60. onBack() {},
  61. chkSel() {
  62. if (this.sel == 1) {
  63. this.sel = 0;
  64. } else {
  65. this.sel = 1;
  66. }
  67. },
  68. loadData() {
  69. console.log("this.globalData", getApp().globalData);
  70. let obj2 = {
  71. is_first: 0
  72. }
  73. const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
  74. console.log(postData);
  75. uni.request({
  76. url: this.$apiHost + '/Gushi/getmyinfo', //仅为示例,并非真实接口地址。
  77. data: postData,
  78. method: 'POST',
  79. header: {
  80. 'content-type': 'application/json', //自定义请求头信息
  81. 'Access-Control-Allow-Origin': '*'
  82. },
  83. success: (res) => {
  84. console.log('data:', res.data);
  85. this.myinfo = res.data;
  86. }
  87. });
  88. },
  89. EditNickname() {
  90. let that = this;
  91. this.$refs['DialogBox'].confirm({
  92. title: '更改昵称',
  93. placeholder: '请输入修改的昵称',
  94. value: that.myinfo.nickname,
  95. DialogType: 'input',
  96. animation: 0
  97. }).then((res) => {
  98. if (res.value.length < 1) {
  99. uni.showToast({
  100. title: "请输入有效的昵称",
  101. icon: 'none'
  102. });
  103. return;
  104. }
  105. that.myinfo.nickname = res.value;
  106. let obj2 = {
  107. nickname: res.value
  108. }
  109. const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
  110. uni.request({
  111. url: that.$apiHost + '/Gushi/editinfo', //检测是否已绑定
  112. data: postData,
  113. method: 'POST',
  114. header: {
  115. 'content-type': 'application/json', //自定义请求头信息
  116. 'Access-Control-Allow-Origin': '*'
  117. },
  118. success: (res) => {
  119. uni.showToast({
  120. title: res.data.str,
  121. icon: 'none'
  122. });
  123. }
  124. });
  125. })
  126. },
  127. }
  128. }
  129. </script>
  130. <style scoped lang="scss">
  131. @import 'managePhoto.scss';
  132. </style>