setting.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <view class="item" v-for="(item,index) in list" :key="index" @click="goPage(item.path)">
  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. <DialogBox ref="DialogBox"></DialogBox>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. components: {},
  21. data() {
  22. return {
  23. title: '',
  24. sel: 1,
  25. myinfo: {},
  26. list: [{
  27. 'name': '实名认证',
  28. 'desc': '',
  29. 'path': '/pages/my/idcheck'
  30. },
  31. {
  32. 'name': '修改密码',
  33. 'desc': '',
  34. 'path': '/pages/my/forgetPass'
  35. },
  36. {
  37. 'name': '修改手机号',
  38. 'desc': '',
  39. 'path': '/pages/my/editMobile'
  40. },
  41. // {
  42. // 'name': '打赏设置',
  43. // 'desc': '',
  44. // 'path': '/pages/my/dashang'
  45. // },
  46. {
  47. 'name': '收款账户设置',
  48. 'desc': '',
  49. 'path': '/pages/my/alipaySet'
  50. },
  51. {
  52. 'name': '收货地址设置',
  53. 'desc': '',
  54. 'path': '/pages/my/addressSet'
  55. },
  56. // {
  57. // 'name': '举报记录',
  58. // 'desc': '',
  59. // 'path': ''
  60. // },
  61. {
  62. 'name': '用户协议',
  63. 'desc': '',
  64. 'path': '/pages/AboutUs/yhxy'
  65. },
  66. {
  67. 'name': '隐私政策',
  68. 'desc': '',
  69. 'path': '/pages/AboutUs/yszc'
  70. },
  71. {
  72. 'name': '注销账号',
  73. 'desc': '',
  74. 'path': 'delete'
  75. },
  76. // {
  77. // 'name': '青少年模式',
  78. // 'switch': 1,
  79. // 'desc': '',
  80. // 'path': ''
  81. // },
  82. {
  83. 'name': '企业客服',
  84. 'desc': '',
  85. 'path': 'kefu'
  86. },
  87. ]
  88. }
  89. },
  90. onLoad() {
  91. this.getAppVersion()
  92. },
  93. onShow() {
  94. this.loadData();
  95. },
  96. methods: {
  97. getAppVersion() {
  98. uni.getSystemInfo({
  99. success: (info) => {
  100. // app系统环境
  101. let appPlatform = info.platform;
  102. console.log("appPlatform", info)
  103. // #ifdef H5
  104. this.list.push({
  105. 'name': '版本号',
  106. 'desc': 'V' + info.appVersion,
  107. 'path': ''
  108. })
  109. // #endif
  110. // #ifdef APP-PLUS
  111. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  112. this.list.push({
  113. 'name': '版本号',
  114. 'desc': 'V' + wgtinfo.version,
  115. 'path': ''
  116. })
  117. });
  118. // #endif
  119. }
  120. });
  121. },
  122. onBack() {},
  123. chkSel() {
  124. if (this.sel == 1) {
  125. this.sel = 0;
  126. } else {
  127. this.sel = 1;
  128. }
  129. },
  130. goPage(page) {
  131. if (page == 'delete') {
  132. this.DelMem();
  133. } else if (page == 'kefu') {
  134. let that = this;
  135. // #ifdef APP-PLUS
  136. plus.share.getServices(res => {
  137. const wechat = res.find(i => i.id === 'weixin')
  138. if (wechat) {
  139. wechat.openCustomerServiceChat({
  140. corpid: 'wwbc06aa8311b6ac08',
  141. // url: 'https://work.weixin.qq.com/kfid/kfc4b0bcb4038d00a50'
  142. url: that.myinfo.wxkf
  143. }, src => {
  144. console.log("success:")
  145. }, err => {
  146. console.log("error:")
  147. })
  148. } else {
  149. uni.showToast({
  150. title: '没有检测到微信,请先安装',
  151. icon: "error"
  152. });
  153. }
  154. });
  155. // #endif
  156. } else if (page != '') {
  157. uni.navigateTo({
  158. url: page,
  159. })
  160. }
  161. },
  162. DelMem() {
  163. var that = this;
  164. this.$refs['DialogBox'].confirm({
  165. title: '警告',
  166. content: '1、注销账号是不可逆操作,该账号下所有一切资料一旦注销无法恢复;\n2、注销后,你账号下所有权益将被清除。',
  167. DialogType: 'inquiry',
  168. btn1: '否',
  169. btn2: '是',
  170. animation: 0
  171. }).then(() => {
  172. uni.request({
  173. url: that.$apiHost + '/My/delete', //检测是否已绑定
  174. data: {
  175. uuid: getApp().globalData.uuid
  176. },
  177. header: {
  178. 'content-type': 'application/json' //自定义请求头信息
  179. },
  180. success: (res) => {
  181. uni.removeStorageSync("wapptoken");
  182. uni.redirectTo({
  183. url: '/pages/login/login',
  184. })
  185. }
  186. });
  187. })
  188. },
  189. loadData() {
  190. console.log({
  191. uuid: getApp().globalData.uuid,
  192. skey: getApp().globalData.skey
  193. });
  194. uni.request({
  195. url: this.$apiHost + '/Web/getinfo',
  196. data: {
  197. uuid: getApp().globalData.uuid
  198. },
  199. header: {
  200. "content-type": "application/json",
  201. 'sign': getApp().globalData.headerSign
  202. },
  203. success: (res) => {
  204. console.log("----:", res.data);
  205. this.myinfo = res.data;
  206. },
  207. complete: (com) => {
  208. // uni.hideLoading();
  209. },
  210. fail: (e) => {
  211. console.log("----e:", e);
  212. }
  213. });
  214. },
  215. EditNickname() {
  216. let that = this;
  217. this.$refs['DialogBox'].confirm({
  218. title: '更改昵称',
  219. placeholder: '请输入修改的昵称',
  220. value: that.myinfo.nickname,
  221. DialogType: 'input',
  222. animation: 0
  223. }).then((res) => {
  224. if (res.value.length < 1) {
  225. uni.showToast({
  226. title: "请输入有效的昵称",
  227. icon: 'none'
  228. });
  229. return;
  230. }
  231. that.myinfo.nickname = res.value;
  232. let obj2 = {
  233. nickname: res.value
  234. }
  235. const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
  236. uni.request({
  237. url: that.$apiHost + '/Gushi/editinfo', //检测是否已绑定
  238. data: postData,
  239. method: 'POST',
  240. header: {
  241. 'content-type': 'application/json', //自定义请求头信息
  242. 'Access-Control-Allow-Origin': '*'
  243. },
  244. success: (res) => {
  245. uni.showToast({
  246. title: res.data.str,
  247. icon: 'none'
  248. });
  249. }
  250. });
  251. })
  252. },
  253. }
  254. }
  255. </script>
  256. <style scoped lang="scss">
  257. @import 'setting.scss';
  258. </style>