setting.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <view class="item" v-for="(item,index) in list" :key="index">
  5. <text>{{item.name}}</text>
  6. <image v-if="item.desc == '' && item.switch != 1" class="arrow"
  7. src="../../static/me/arrow_right_gray.png" mode="widthFix">
  8. </image>
  9. <text class="desc" v-else>{{item.desc}}</text>
  10. <switch v-if="item.switch == 1" checked color="#FFCC33" style="transform:scale(0.7)" />
  11. </view>
  12. <view class="blankHeight"></view>
  13. </view>
  14. <view class="btn_submit">退出登录</view>
  15. <!-- 提示框 -->
  16. <DialogBox ref="DialogBox"></DialogBox>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. components: {},
  22. data() {
  23. return {
  24. title: '',
  25. sel: 1,
  26. list: [{
  27. name: '实名认证',
  28. 'desc': '',
  29. 'path': ''
  30. },
  31. {
  32. name: '修改密码',
  33. 'desc': '',
  34. 'path': ''
  35. },
  36. {
  37. name: '修改手机号',
  38. 'desc': '',
  39. 'path': ''
  40. },
  41. {
  42. name: '打赏设置',
  43. 'desc': '',
  44. 'path': ''
  45. },
  46. {
  47. name: '收款账户设置',
  48. 'desc': '',
  49. 'path': ''
  50. },
  51. {
  52. name: '收货地址设置',
  53. 'desc': '',
  54. 'path': ''
  55. },
  56. {
  57. name: '举报记录',
  58. 'desc': '',
  59. 'path': ''
  60. },
  61. {
  62. name: '用户协议',
  63. 'desc': '',
  64. 'path': ''
  65. },
  66. {
  67. name: '隐私政策',
  68. 'desc': '',
  69. 'path': ''
  70. },
  71. {
  72. name: '注销账号',
  73. 'desc': '',
  74. 'path': ''
  75. },
  76. {
  77. name: '青少年模式',
  78. 'switch': 1,
  79. 'desc': '',
  80. 'path': ''
  81. },
  82. {
  83. name: '客服热线',
  84. 'desc': '400-888-1688',
  85. 'path': ''
  86. }
  87. ]
  88. }
  89. },
  90. onLoad() {
  91. setTimeout(function() {
  92. uni.setNavigationBarColor({
  93. frontColor: '#ffffff',
  94. backgroundColor: '#00000000',
  95. animation: {
  96. duration: 400,
  97. timingFunc: 'easeIn'
  98. }
  99. })
  100. }, 200);
  101. },
  102. onShow() {
  103. this.loadData();
  104. },
  105. methods: {
  106. onBack() {},
  107. chkSel() {
  108. if (this.sel == 1) {
  109. this.sel = 0;
  110. } else {
  111. this.sel = 1;
  112. }
  113. },
  114. loadData() {
  115. console.log("this.globalData", getApp().globalData);
  116. let obj2 = {
  117. is_first: 0
  118. }
  119. const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
  120. console.log(postData);
  121. uni.request({
  122. url: this.$apiHost + '/Gushi/getmyinfo', //仅为示例,并非真实接口地址。
  123. data: postData,
  124. method: 'POST',
  125. header: {
  126. 'content-type': 'application/json', //自定义请求头信息
  127. 'Access-Control-Allow-Origin': '*'
  128. },
  129. success: (res) => {
  130. console.log('data:', res.data);
  131. this.myinfo = res.data;
  132. }
  133. });
  134. },
  135. EditNickname() {
  136. let that = this;
  137. this.$refs['DialogBox'].confirm({
  138. title: '更改昵称',
  139. placeholder: '请输入修改的昵称',
  140. value: that.myinfo.nickname,
  141. DialogType: 'input',
  142. animation: 0
  143. }).then((res) => {
  144. if (res.value.length < 1) {
  145. uni.showToast({
  146. title: "请输入有效的昵称",
  147. icon: 'none'
  148. });
  149. return;
  150. }
  151. that.myinfo.nickname = res.value;
  152. let obj2 = {
  153. nickname: res.value
  154. }
  155. const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
  156. uni.request({
  157. url: that.$apiHost + '/Gushi/editinfo', //检测是否已绑定
  158. data: postData,
  159. method: 'POST',
  160. header: {
  161. 'content-type': 'application/json', //自定义请求头信息
  162. 'Access-Control-Allow-Origin': '*'
  163. },
  164. success: (res) => {
  165. uni.showToast({
  166. title: res.data.str,
  167. icon: 'none'
  168. });
  169. }
  170. });
  171. })
  172. },
  173. }
  174. }
  175. </script>
  176. <style scoped lang="scss">
  177. @import 'setting.scss';
  178. </style>