dashang.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view class="page">
  3. <view class="mainBody">
  4. <view class="menu">
  5. <view class="item" :class="{'active':tab===1}" @click="checkTab(1)">
  6. <text class="left">全部</text>
  7. <view class="line"></view>
  8. </view>
  9. <view class="item" :class="{'active':tab===2}" @click="checkTab(2)">
  10. <text class="left">进行中</text>
  11. <view class="line"></view>
  12. </view>
  13. <view class="item" :class="{'active':tab===3}" @click="checkTab(3)">
  14. <text class="left">已完成</text>
  15. <view class="line"></view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="list_info">
  20. <block v-for="(item,index) in 10" :key="index">
  21. <view class="item">
  22. <view class="avator">
  23. <image class="icon" src="../../static/me/sex_2.png" mode="widthFix">
  24. </image>
  25. </view>
  26. <view class="tit">
  27. <view class="name">原淑功</view>
  28. </view>
  29. <view class="state">
  30. <view class="status_1">进行中</view>
  31. <view class="status_9">已完成</view>
  32. </view>
  33. </view>
  34. <view class="huifu">
  35. <view class="left">
  36. <view class="imgBg">
  37. <image class="icon" src="../../static/me/sex_2.png" mode="widthFix">
  38. </view>
  39. <view class="name">
  40. <text class="title">99架飞机</text>
  41. <text class="price">¥1000.00</text>
  42. </view>
  43. </view>
  44. <view class="right">x1</view>
  45. </view>
  46. <view class="desc">
  47. 赠送于2023-10-10 15:00
  48. </view>
  49. </block>
  50. <view class="blankHeight"></view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. components: {},
  57. data() {
  58. return {
  59. tab: 1,
  60. list: [{
  61. name: '实名认证',
  62. 'desc': '',
  63. 'path': ''
  64. },
  65. {
  66. name: '修改密码',
  67. 'desc': '',
  68. 'path': ''
  69. },
  70. {
  71. name: '修改手机号',
  72. 'desc': '',
  73. 'path': ''
  74. },
  75. {
  76. name: '注销账号',
  77. 'desc': '',
  78. 'path': ''
  79. },
  80. {
  81. name: '青少年模式',
  82. 'switch': 1,
  83. 'desc': '',
  84. 'path': ''
  85. },
  86. {
  87. name: '客服热线',
  88. 'desc': '400-888-1688',
  89. 'path': ''
  90. }
  91. ],
  92. stype: 'get'
  93. }
  94. },
  95. onLoad() {},
  96. onShow() {
  97. let that = this;
  98. // uni.setNavigationBarTitle({
  99. // titleNView: that.titleNView
  100. // });
  101. this.setStyle(1, '我收到的')
  102. // this.loadData();
  103. },
  104. onNavigationBarButtonTap(e) {
  105. if (e.index === 0) {
  106. // 执行代码块
  107. console.log("ee", e.index)
  108. if (this.stype == 'get') {
  109. this.stype = 'put';
  110. this.setStyle(1, '我打赏的');
  111. uni.setNavigationBarTitle({
  112. title: "我收到的"
  113. })
  114. } else {
  115. this.stype = 'get';
  116. this.setStyle(1, '我收到的');
  117. uni.setNavigationBarTitle({
  118. title: "我打赏的"
  119. })
  120. }
  121. }
  122. },
  123. methods: {
  124. setStyle(index, text) {
  125. let pages = getCurrentPages();
  126. let page = pages[pages.length - 1];
  127. // if (text.length > 3) {
  128. // text = text.substr(0, 3) + '...';
  129. // }
  130. // #ifdef APP-PLUS
  131. let currentWebview = page.$getAppWebview();
  132. let titleNView = currentWebview.getStyle().titleNView;
  133. // 添加文字过长截取为3个字符,请根据自己业务需求更改
  134. titleNView.buttons[0].text = text;
  135. currentWebview.setStyle({
  136. titleNView: titleNView
  137. });
  138. // #endif
  139. // #ifdef H5
  140. // h5 临时方案
  141. const btn = document.getElementsByClassName('uni-btn-icon')[index]
  142. btn.innerText = text;
  143. // #endif
  144. },
  145. onClickButton1() {
  146. console.log('点击了按钮1')
  147. },
  148. onClickButton2() {
  149. console.log('点击了按钮2')
  150. },
  151. onBack() {},
  152. checkTab(tab) {
  153. this.tab = tab;
  154. // this.loadData();
  155. },
  156. loadData() {
  157. console.log("this.globalData", getApp().globalData);
  158. let obj2 = {
  159. is_first: 0
  160. }
  161. const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
  162. console.log(postData);
  163. uni.request({
  164. url: this.$apiHost + '/Gushi/getmyinfo', //仅为示例,并非真实接口地址。
  165. data: postData,
  166. method: 'POST',
  167. header: {
  168. 'content-type': 'application/json', //自定义请求头信息
  169. 'Access-Control-Allow-Origin': '*'
  170. },
  171. success: (res) => {
  172. console.log('data:', res.data);
  173. this.myinfo = res.data;
  174. }
  175. });
  176. },
  177. EditNickname() {
  178. let that = this;
  179. this.$refs['DialogBox'].confirm({
  180. title: '更改昵称',
  181. placeholder: '请输入修改的昵称',
  182. value: that.myinfo.nickname,
  183. DialogType: 'input',
  184. animation: 0
  185. }).then((res) => {
  186. if (res.value.length < 1) {
  187. uni.showToast({
  188. title: "请输入有效的昵称",
  189. icon: 'none'
  190. });
  191. return;
  192. }
  193. that.myinfo.nickname = res.value;
  194. let obj2 = {
  195. nickname: res.value
  196. }
  197. const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
  198. uni.request({
  199. url: that.$apiHost + '/Gushi/editinfo', //检测是否已绑定
  200. data: postData,
  201. method: 'POST',
  202. header: {
  203. 'content-type': 'application/json', //自定义请求头信息
  204. 'Access-Control-Allow-Origin': '*'
  205. },
  206. success: (res) => {
  207. uni.showToast({
  208. title: res.data.str,
  209. icon: 'none'
  210. });
  211. }
  212. });
  213. })
  214. },
  215. }
  216. }
  217. </script>
  218. <style scoped lang="scss">
  219. @import 'dashang.scss';
  220. </style>