setting.vue 6.9 KB

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