setting.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <view class="">
  5. <!-- 基础设置组 -->
  6. <view class="group-header">基础设置</view>
  7. <view class="item basic" v-for="(item, index) in basicSettings" :key="item.name + index"
  8. @click="goPage(item.path)">
  9. <view class="item-left">
  10. <image class="icon" :src="item.icon" mode="widthFix"></image>
  11. <text>{{ item.name }}</text>
  12. </view>
  13. <view class="item-right">
  14. <switch v-if="item.switch == 1" checked class="custom-switch" color="#acf934"
  15. style="transform:scale(0.7)" />
  16. <image v-else class="arrow" src="../../static/me/arrow_right_gray.png" mode="widthFix"></image>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="">
  21. <!-- 更多设置组 -->
  22. <view class="group-header" style="margin-top: 20rpx;">更多</view>
  23. <view class="item more" v-for="(item, index) in moreSettings" :key="index + item.name"
  24. @click=" goPage(item.path, item)">
  25. <view class="item-left">
  26. <image class="icon" :src="item.icon" mode="widthFix"></image>
  27. <text>{{ item.name }}</text>
  28. </view>
  29. <view class="item-right">
  30. <switch v-if="item.switch == 1" color="#acf934" @change="switch1Change" checked
  31. class="custom-switch" style="transform:scale(0.7)" />
  32. <image v-else class="arrow" src="../../static/me/arrow_right_gray.png" mode="widthFix"></image>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 版本信息 -->
  38. <view class="version-info">
  39. <text>版本号 {{ version }}</text>
  40. </view>
  41. <!-- 退出登录按钮 -->
  42. <view class="btn_submit" @click="logout">退出登录</view>
  43. <DialogBox ref="DialogBox"></DialogBox>
  44. <CustomerServicePopup ref="customerServicePopup"></CustomerServicePopup>
  45. </view>
  46. </template>
  47. <script>
  48. import CustomerServicePopup from '@/components/CustomerServicePopup/CustomerServicePopup.vue'
  49. export default {
  50. components: { CustomerServicePopup },
  51. data() {
  52. return {
  53. title: '',
  54. sel: 1,
  55. myinfo: {},
  56. version: '',
  57. basicSettings: [{
  58. 'name': '账户与安全',
  59. 'desc': '',
  60. 'path': '/pages/my/security',
  61. 'icon': '../../static/me/wd_icon_zhanghuyuanquan.png',
  62. 'propup': ''
  63. },
  64. {
  65. 'name': '基本资料',
  66. 'desc': '',
  67. 'path': '/pages/my/editInfo',
  68. 'icon': '../../static/me/wd_icon_jibenziliao.png',
  69. 'propup': ''
  70. },
  71. {
  72. 'name': '青少年模式',
  73. 'switch': 0,
  74. 'desc': '',
  75. 'path': '/pages/my/idcheck',
  76. 'icon': '../../static/me/wd_icon_qingshaonianmoshi.png',
  77. 'propup': ''
  78. }
  79. ],
  80. moreSettings: [{
  81. 'name': '通知设置',
  82. 'desc': '',
  83. 'path': '/pages/my/pushSet',
  84. 'icon': '../../static/me/wd_icon_tonzhishezhi.png',
  85. 'propup': ''
  86. },
  87. {
  88. 'name': '服务条款',
  89. 'desc': '',
  90. 'path': '/pages/AboutUs/xieyi',
  91. 'icon': '../../static/me/wd_icon_fuwutiaokuan.png',
  92. 'propup': ''
  93. },
  94. {
  95. 'name': '接收内容推荐',
  96. 'switch': 1,
  97. 'desc': '',
  98. 'path': '',
  99. 'icon': '../../static/me/wd_icon_jieshouneirongtuijian.png',
  100. 'propup': ''
  101. },
  102. {
  103. 'name': '联系客服',
  104. 'desc': '',
  105. 'path': 'kefu',
  106. 'icon': '../../static/me/wd_icon_lianxikefu.png',
  107. 'propup': 'customPopup'
  108. }
  109. ]
  110. }
  111. },
  112. onLoad() {
  113. this.getAppVersion()
  114. },
  115. onShow() {
  116. this.loadData();
  117. },
  118. methods: {
  119. openCustomPopup() {
  120. this.$refs.customerServicePopup.$refs.customPopup.open()
  121. },
  122. getAppVersion() {
  123. uni.getSystemInfo({
  124. success: (info) => {
  125. // app系统环境
  126. let appPlatform = info.platform;
  127. console.log("appPlatform", info)
  128. // #ifdef H5
  129. this.version = 'V' + info.appVersion;
  130. // #endif
  131. // #ifdef APP-PLUS
  132. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  133. this.version = 'V' + wgtinfo.version;
  134. });
  135. // #endif
  136. }
  137. });
  138. },
  139. switch1Change(e) {
  140. alert(e.detail.value, "改变了")
  141. },
  142. onBack() { },
  143. chkSel() {
  144. if (this.sel == 1) {
  145. this.sel = 0;
  146. } else {
  147. this.sel = 1;
  148. }
  149. },
  150. goPage(page) {
  151. if (page == 'delete') {
  152. this.DelMem();
  153. } else if (page == 'yszc') {
  154. // #ifdef APP-PLUS
  155. plus.runtime.openURL('https://e.zhichao.art/web/yszc.php') // plus.runtime.openWeb(href);
  156. // #endif
  157. // #ifdef H5
  158. window.open('https://e.zhichao.art/web/yszc.php')
  159. // #endif
  160. } else if (page == 'kefu') {
  161. // let that = this;
  162. // // #ifdef APP-PLUS
  163. // plus.share.getServices(res => {
  164. // const wechat = res.find(i => i.id === 'weixin')
  165. // if (wechat) {
  166. // wechat.openCustomerServiceChat({
  167. // corpid: 'wwbc06aa8311b6ac08',
  168. // // url: 'https://work.weixin.qq.com/kfid/kfc4b0bcb4038d00a50'
  169. // url: that.myinfo.wxkf
  170. // }, src => {
  171. // console.log("success:")
  172. // }, err => {
  173. // console.log("error:")
  174. // })
  175. // } else {
  176. // uni.showToast({
  177. // title: '没有检测到微信,请先安装',
  178. // icon: "error"
  179. // });
  180. // }
  181. // });
  182. // // #endif
  183. this.openCustomPopup()
  184. } else if (page != '') {
  185. uni.navigateTo({
  186. url: page,
  187. })
  188. }
  189. },
  190. DelMem() {
  191. var that = this;
  192. this.$refs['DialogBox'].confirm({
  193. title: '警告',
  194. content: '1、注销账号是不可逆操作,该账号下所有一切资料一旦注销无法恢复;\n2、注销后,你账号下所有权益将被清除。',
  195. DialogType: 'inquiry',
  196. btn1: '否',
  197. btn2: '是',
  198. animation: 0
  199. }).then(() => {
  200. uni.request({
  201. url: that.$apiHost + '/My/delete', //检测是否已绑定
  202. data: {
  203. uuid: getApp().globalData.uuid
  204. },
  205. header: {
  206. 'content-type': 'application/json' //自定义请求头信息
  207. },
  208. success: (res) => {
  209. uni.removeStorageSync("wapptoken");
  210. uni.redirectTo({
  211. url: '/pages/login/login',
  212. })
  213. }
  214. });
  215. })
  216. },
  217. loadData() {
  218. console.log({
  219. uuid: getApp().globalData.uuid,
  220. skey: getApp().globalData.skey
  221. });
  222. uni.request({
  223. url: this.$apiHost + '/Web/getinfo',
  224. data: {
  225. uuid: getApp().globalData.uuid
  226. },
  227. header: {
  228. "content-type": "application/json",
  229. 'sign': getApp().globalData.headerSign
  230. },
  231. success: (res) => {
  232. console.log("----:", res.data);
  233. this.myinfo = res.data;
  234. },
  235. complete: (com) => {
  236. // uni.hideLoading();
  237. },
  238. fail: (e) => {
  239. console.log("----e:", e);
  240. }
  241. });
  242. },
  243. EditNickname() {
  244. let that = this;
  245. this.$refs['DialogBox'].confirm({
  246. title: '更改昵称',
  247. placeholder: '请输入修改的昵称',
  248. value: that.myinfo.nickname,
  249. DialogType: 'input',
  250. animation: 0
  251. }).then((res) => {
  252. if (res.value.length < 1) {
  253. uni.showToast({
  254. title: "请输入有效的昵称",
  255. icon: 'none'
  256. });
  257. return;
  258. }
  259. that.myinfo.nickname = res.value;
  260. let obj2 = {
  261. nickname: res.value
  262. }
  263. const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
  264. uni.request({
  265. url: that.$apiHost + '/Gushi/editinfo', //检测是否已绑定
  266. data: postData,
  267. method: 'POST',
  268. header: {
  269. 'content-type': 'application/json', //自定义请求头信息
  270. 'Access-Control-Allow-Origin': '*'
  271. },
  272. success: (res) => {
  273. uni.showToast({
  274. title: res.data.str,
  275. icon: 'none'
  276. });
  277. }
  278. });
  279. })
  280. },
  281. logout() {
  282. this.$refs['DialogBox'].confirm({
  283. title: '提示',
  284. content: '确定要退出登录吗?',
  285. DialogType: 'inquiry',
  286. btn1: '取消',
  287. btn2: '确定',
  288. animation: 0
  289. }).then(() => {
  290. uni.removeStorageSync("wapptoken");
  291. uni.redirectTo({
  292. url: '/pages/login/login',
  293. })
  294. })
  295. }
  296. }
  297. }
  298. </script>
  299. <style scoped lang="scss">
  300. @import 'setting.scss';
  301. </style>