setUp.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. <template>
  2. <view class="container">
  3. <view class="cu-list menu text-left solid-top indexlow">
  4. <view class='cu-item' style='margin-bottom:10px;' @click="switchPicture">
  5. <view>
  6. <text>头像</text>
  7. </view>
  8. <view style='align-items: center;' class="flex">
  9. <view class="pictures">
  10. <image :src="headUrl" class="picture"></image>
  11. </view>
  12. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  13. </view>
  14. </view>
  15. <view class='cu-item' style='margin-bottom:10px;' @click="nickname(username)">
  16. <view>
  17. <text>用户名</text>
  18. </view>
  19. <view style='align-items: center;' class="flex">
  20. <view class="username">
  21. {{username}}
  22. </view>
  23. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  24. </view>
  25. </view>
  26. <view class='cu-item' style='margin-bottom:10px;' @click="nickname1(wechatNo)">
  27. <view>
  28. <text>昵称</text>
  29. </view>
  30. <view style='align-items: center;' class="flex">
  31. <view class="username">
  32. {{wechatNo}}
  33. </view>
  34. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  35. </view>
  36. </view>
  37. <view class='cu-item' style='margin-bottom:10px;' @click='fankui'>
  38. <view>
  39. <text>意见反馈</text>
  40. </view>
  41. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  42. </view>
  43. <view class='cu-item' style='margin-bottom:10px;' @click='clearStorage'>
  44. <view>
  45. <text>清除缓存</text>
  46. </view>
  47. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  48. </view>
  49. <view class='cu-item' style='margin-bottom:10px;' @click='UpdataPassword'>
  50. <view>
  51. <text>修改密码</text>
  52. </view>
  53. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  54. </view>
  55. <!-- <view class='cu-item' style='margin-bottom:10px;' @click='updataEdition'>
  56. <view>
  57. <text>检查新版本</text>
  58. </view>
  59. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  60. </view> -->
  61. <view class='cu-item' style='margin-bottom:10px;' @click='unsubscribe'>
  62. <view>
  63. <text>注销账户</text>
  64. </view>
  65. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  66. </view>
  67. <view class='cu-item' style='margin-bottom:10px;'>
  68. <view>
  69. <text>检查更新</text>
  70. </view>
  71. <view class="version_css" @click="onAPPUpdate">
  72. {{version}}
  73. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="agreement">
  78. <view class="text">
  79. <navigator
  80. url="/pages/sale/webview?can_share=false&url=https://liangxin.zthymaoyi.com/userAgreement.html"
  81. class="path" hover-class="navigator-hover">《服务协议》</navigator>和<navigator
  82. url="/pages/sale/webview?can_share=false&url=https://liangxin.zthymaoyi.com/screctAgreement.html"
  83. class="path" hover-class="navigator-hover">《隐私政策》</navigator>
  84. </view>
  85. </view>
  86. <view class='exitloginwrap'>
  87. <button @click='logout()' class='exitlogin'>退出登录</button>
  88. </view>
  89. <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
  90. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='温馨提示'
  91. showCancelButton='false' :content="content" @confirm="goOpenService" @cancel="cancelClick"></u-modal>
  92. </view>
  93. </template>
  94. <script>
  95. import appUpdate from 'common/appUpdate.js'
  96. import {
  97. mapState
  98. } from 'vuex';
  99. // #ifdef APP-PLUS
  100. import APPUpdate, {
  101. getCurrentNo
  102. } from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
  103. import * as config from '@/config/index.js'
  104. // #endif
  105. export default {
  106. data() {
  107. return {
  108. isShowAlert: false,
  109. content: '您确定要退出吗?',
  110. headUrl: "../../static/img/myimg/YongHu@3x.png",
  111. username: "",
  112. wechatNo:'',
  113. gridList: [{
  114. num: 0,
  115. name: '退出登录',
  116. // icon:'cuIcon-exit',
  117. src: '../../static/img/sign/return@3x.png',
  118. tips: 0,
  119. url: '',
  120. show: true
  121. }, ],
  122. version: "1.1.0"
  123. }
  124. },
  125. computed: {
  126. // ...mapState(['hasLogin', 'userInfo'])
  127. },
  128. onShow() {
  129. this.getList()
  130. // #ifdef APP-PLUS
  131. this.version = plus.runtime.version
  132. console.log("当前版本为:", plus.runtime.version)
  133. this.checkVersion()
  134. // #endif
  135. },
  136. onLoad() {},
  137. methods: {
  138. // 检查APP是否有新版本
  139. onAPPUpdate() {
  140. // true 没有新版本的时候有提示,默认:false
  141. if (this.version == "发现新版本,立即更新") {
  142. // #ifdef APP-PLUS
  143. APPUpdate(true);
  144. // #endif
  145. }
  146. },
  147. checkVersion() {
  148. const baseUrlNew = config.def().baseUrlNew
  149. uni.request({
  150. url: baseUrlNew + '/appVersion/selectInfo',
  151. data: {
  152. appid: plus.runtime.appid,
  153. version: plus.runtime.version,
  154. imei: "1",
  155. },
  156. method: 'GET',
  157. success: (res) => {
  158. var versionNo = plus.runtime.version
  159. if (versionNo == res.data.data.version) {
  160. this.version = "当前为最新版" + res.data.data.version
  161. } else {
  162. this.version = "发现新版本,立即更新"
  163. }
  164. }
  165. })
  166. },
  167. updataEdition() {
  168. // #ifdef APP-PLUS
  169. let type = uni.getSystemInfoSync().platform
  170. if (type == "android") {
  171. uni.request({
  172. url: 'https://api2.eliangeyun.com/appVersion/selectInfo',
  173. data: {
  174. appid: plus.runtime.appid,
  175. version: plus.runtime.version,
  176. imei: "1"
  177. },
  178. method: 'GET',
  179. success: (res) => {
  180. if (res.statusCode === 200) {
  181. console.log("uni.request update success", res)
  182. plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
  183. let client_version = wgtinfo.version
  184. var flag_update = client_version.split(".").splice(0, 2).join(
  185. ".") != res.data.data.version.split(".").splice(0, 2)
  186. .join(".")
  187. var flag_hot = (Number(client_version.split(".")[2]) < Number(res
  188. .data.data.version.split(".")[2])) & !flag_update
  189. console.log("client_version", client_version)
  190. console.log("flag_update", flag_update)
  191. console.log("flag_hot", flag_hot)
  192. if (flag_update) {
  193. console.log("更新弹窗")
  194. // 提醒用户更新
  195. uni.showModal({
  196. title: '更新提示',
  197. content: res.data.data.note,
  198. success: (showResult) => {
  199. if (showResult.confirm) {
  200. plus.nativeUI.toast("正在准备环境,请稍后!");
  201. console.log(res.data.data.url, )
  202. var dtask = plus.downloader
  203. .createDownload(res.data.data
  204. .url, {
  205. method: 'GET',
  206. filename: '_doc/update/'
  207. },
  208. function(d, status) {
  209. if (status == 200) {
  210. var path = d
  211. .filename; //下载apk
  212. plus.runtime.install(
  213. path); // 自动安装apk文件
  214. } else {
  215. plus.nativeUI.alert(
  216. '版本更新失败:' +
  217. status);
  218. }
  219. });
  220. dtask.start();
  221. }
  222. }
  223. })
  224. } else if (flag_hot) {
  225. console.log("热更新")
  226. uni.showLoading({
  227. title: '正在热更新'
  228. })
  229. uni.downloadFile({
  230. url: res.data.data.wgtUrl,
  231. success: (downloadResult) => {
  232. console.log(downloadResult.tempFilePath)
  233. if (downloadResult.statusCode === 200) {
  234. plus.nativeUI.toast(
  235. `正在热更新!${res.data.data.versionCode}`
  236. );
  237. plus.runtime.install(downloadResult
  238. .tempFilePath, {
  239. force: false
  240. },
  241. function() {
  242. uni.hideLoading()
  243. plus.nativeUI.toast(
  244. "热更新成功");
  245. uni.clearStorageSync();
  246. plus.nativeUI.toast(
  247. "缓存清除成功");
  248. that.$api.doRequest('post',
  249. '/auth/api/logout')
  250. .then(res => {
  251. if (res.data
  252. .data) {
  253. that.$store
  254. .commit(
  255. 'logout'
  256. )
  257. that.$api
  258. .logout()
  259. plus.nativeUI
  260. .toast(
  261. "登出成功"
  262. );
  263. plus.runtime
  264. .restart();
  265. plus.nativeUI
  266. .toast(
  267. "重启成功"
  268. );
  269. }
  270. })
  271. plus.runtime.restart();
  272. },
  273. function(e) {
  274. uni.hideLoading()
  275. console.log(e)
  276. plus.nativeUI.toast(
  277. `热更新失败:${e.message}`
  278. );
  279. });
  280. }
  281. }
  282. });
  283. } else {
  284. this.content = '您当前版本为最新版本'
  285. this.isShowAlert = true
  286. }
  287. });
  288. }
  289. }
  290. })
  291. }
  292. // #endif
  293. },
  294. UpdataPassword() {
  295. uni.navigateTo({
  296. url: `/pages/public/reset?phone=${this.userInfo.phone}`
  297. })
  298. },
  299. clearStorage() {
  300. let that = this
  301. uni.clearStorage({
  302. success: function(res) {
  303. console.log('success');
  304. that.goOpenService()
  305. }
  306. })
  307. },
  308. cancelClick() {
  309. this.isShowAlert = false
  310. },
  311. goOpenService() {
  312. if (this.content == '您当前版本为最新版本') {
  313. this.isShowAlert = false
  314. return
  315. }
  316. uni.hideTabBarRedDot({
  317. index: 3
  318. })
  319. // uni.clearStorageSync();
  320. var that = this
  321. this.$api.doRequest('post', '/auth/api/logout').then(res => {
  322. if (res.data.data) {
  323. }
  324. })
  325. this.$store.commit('logout')
  326. this.$api.logout()
  327. uni.navigateTo({
  328. url: `/pages/public/login`
  329. })
  330. },
  331. getList() {
  332. this.userInfo = uni.getStorageSync('userInfo')
  333. this.headUrl = this.userInfo.avatarUrl
  334. if (this.headUrl == null || this.headUrl == "") {
  335. this.headUrl = "../../static/img/myimg/YongHu@3x.png"
  336. }
  337. this.username = this.userInfo.userName
  338. if(!uni.getStorageSync('userInfo').wechatNo){
  339. this.wechatNo = this.userInfo.userName
  340. }else{
  341. this.wechatNo = this.userInfo.wechatNo
  342. }
  343. },
  344. switchPicture() {
  345. uni.navigateTo({
  346. url: `/pages/user/set_picture`
  347. })
  348. },
  349. nickname(username) {
  350. uni.navigateTo({
  351. url: `/pages/user/set_nickname?nickname=${username}`
  352. })
  353. },
  354. nickname1(username) {
  355. uni.navigateTo({
  356. url: `/pages/user/set_wechatNo?nickname=${username}`
  357. })
  358. },
  359. exitlogin() {
  360. },
  361. fankui() {
  362. uni.navigateTo({
  363. url: `/pages/user/fankui`
  364. })
  365. },
  366. unsubscribe() {
  367. var that = this
  368. uni.clearStorage({
  369. success: function(res) {
  370. console.log('success');
  371. uni.hideTabBarRedDot({
  372. index: 3
  373. })
  374. that.$api.doRequest('post', '/auth/api/logout').then(res => {
  375. if (res.data.data) {
  376. }
  377. })
  378. that.$store.commit('logout')
  379. that.$api.logout()
  380. // plus.nativeUI.toast(
  381. // "注销成功");
  382. uni.navigateTo({
  383. url: `/pages/public/login`
  384. })
  385. }
  386. })
  387. },
  388. logout() {
  389. // const that = this
  390. this.isShowAlert = true
  391. // uni.showModal({
  392. // title: '询问',
  393. // content: '您确定要退出吗?',
  394. // cancelText: '取消',
  395. // confirmText: '确定',
  396. // success: (e) => {
  397. // if (e.confirm) {
  398. // uni.hideTabBarRedDot({
  399. // index: 3
  400. // })
  401. // uni.clearStorageSync();
  402. // that.$store.commit('logout')
  403. // that.$api.logout()
  404. // uni.navigateTo({
  405. // url: `/pages/public/login`
  406. // })
  407. // }
  408. // }
  409. // })
  410. },
  411. }
  412. }
  413. </script>
  414. <style lang="scss" scoped>
  415. page {
  416. background-color: #F5F6FA;
  417. }
  418. .container {
  419. padding: 10px 0 0px;
  420. }
  421. .headPortrait {
  422. width: 100%;
  423. height: 52px;
  424. margin-top: 15px;
  425. background-color: #FFFFFF;
  426. border-radius: 6px;
  427. // justify-content: flex-end;
  428. }
  429. .title {
  430. font-size: 16px;
  431. line-height: 50px;
  432. font-weight: 600;
  433. margin-left: 10px;
  434. }
  435. .pictures {
  436. justify-content: flex-end;
  437. width: 35px;
  438. height: 35px;
  439. background-color: #E0FAF6;
  440. border-radius: 18px;
  441. }
  442. .picture {
  443. width: 35px;
  444. height: 35px;
  445. }
  446. .arrow {
  447. margin-left: 15px;
  448. width: 8px;
  449. height: 12px;
  450. // justify-content: flex-end
  451. }
  452. .username {
  453. line-height: 50px;
  454. color: #6D6D72;
  455. }
  456. .sign {
  457. width: 18px;
  458. height: 18px;
  459. top: 4px;
  460. margin-right: 6px;
  461. }
  462. .cu-list>.cu-item:after {
  463. border: none;
  464. }
  465. .exitloginwrap {
  466. position: fixed;
  467. bottom: 0;
  468. left: 0;
  469. width: 100%;
  470. padding-bottom: 20px;
  471. }
  472. .exitlogin {
  473. width: 90%;
  474. background: #fff;
  475. border-radius: 30px;
  476. color: #FB1E1E;
  477. font-size: 17px;
  478. }
  479. .exitlogin:after {
  480. border: none;
  481. }
  482. .version_css {
  483. // margin-right: 10rpx;
  484. color: #9D9D9D;
  485. font-size: 32rpx;
  486. text-align: center;
  487. }
  488. .agreement {
  489. display: flex;
  490. margin: 0 auto;
  491. text-align: center;
  492. .text {
  493. margin: 0 auto;
  494. text-align: center;
  495. display: flex;
  496. }
  497. .path {
  498. color: #22C572;
  499. text-align: center;
  500. }
  501. }
  502. </style>