setUp.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  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. plus.runtime.getProperty(plus.runtime.appid, (info) => {
  132. //版本号
  133. this.version = info.version;
  134. console.log("当前版本为:", this.version)
  135. this.checkVersion()
  136. // #endif
  137. },
  138. onLoad() {},
  139. methods: {
  140. // 检查APP是否有新版本
  141. onAPPUpdate() {
  142. // true 没有新版本的时候有提示,默认:false
  143. if (this.version == "发现新版本,立即更新") {
  144. // #ifdef APP-PLUS
  145. APPUpdate(true);
  146. // #endif
  147. }
  148. },
  149. checkVersion() {
  150. const baseUrlNew = config.def().baseUrlNew
  151. uni.request({
  152. url: baseUrlNew + '/appVersion/selectInfo',
  153. data: {
  154. appid: plus.runtime.appid,
  155. version: this.version,
  156. imei: "1",
  157. },
  158. method: 'GET',
  159. success: (res) => {
  160. console.log("查看--------", this.version)
  161. console.log("查看--------", res)
  162. if (!res.data.data.version) {
  163. this.version = "当前为最新版" + this.version
  164. } else {
  165. this.version = "发现新版本,立即更新"
  166. }
  167. }
  168. })
  169. },
  170. updataEdition() {
  171. // #ifdef APP-PLUS
  172. let type = uni.getSystemInfoSync().platform
  173. if (type == "android") {
  174. uni.request({
  175. url: 'https://api2.eliangeyun.com/appVersion/selectInfo',
  176. data: {
  177. appid: plus.runtime.appid,
  178. version: this.version,
  179. imei: "1"
  180. },
  181. method: 'GET',
  182. success: (res) => {
  183. if (res.statusCode === 200) {
  184. console.log("uni.request update success", res)
  185. plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
  186. let client_version = wgtinfo.version
  187. var flag_update = client_version.split(".").splice(0, 2).join(
  188. ".") != res.data.data.version.split(".").splice(0, 2)
  189. .join(".")
  190. var flag_hot = (Number(client_version.split(".")[2]) < Number(res
  191. .data.data.version.split(".")[2])) & !flag_update
  192. console.log("client_version", client_version)
  193. console.log("flag_update", flag_update)
  194. console.log("flag_hot", flag_hot)
  195. if (flag_update) {
  196. console.log("更新弹窗")
  197. // 提醒用户更新
  198. uni.showModal({
  199. title: '更新提示',
  200. content: res.data.data.note,
  201. success: (showResult) => {
  202. if (showResult.confirm) {
  203. plus.nativeUI.toast("正在准备环境,请稍后!");
  204. console.log(res.data.data.url, )
  205. var dtask = plus.downloader
  206. .createDownload(res.data.data
  207. .url, {
  208. method: 'GET',
  209. filename: '_doc/update/'
  210. },
  211. function(d, status) {
  212. if (status == 200) {
  213. var path = d
  214. .filename; //下载apk
  215. plus.runtime.install(
  216. path); // 自动安装apk文件
  217. } else {
  218. plus.nativeUI.alert(
  219. '版本更新失败:' +
  220. status);
  221. }
  222. });
  223. dtask.start();
  224. }
  225. }
  226. })
  227. } else if (flag_hot) {
  228. console.log("热更新")
  229. uni.showLoading({
  230. title: '正在热更新'
  231. })
  232. uni.downloadFile({
  233. url: res.data.data.wgtUrl,
  234. success: (downloadResult) => {
  235. console.log(downloadResult.tempFilePath)
  236. if (downloadResult.statusCode === 200) {
  237. plus.nativeUI.toast(
  238. `正在热更新!${res.data.data.versionCode}`
  239. );
  240. plus.runtime.install(downloadResult
  241. .tempFilePath, {
  242. force: false
  243. },
  244. function() {
  245. uni.hideLoading()
  246. plus.nativeUI.toast(
  247. "热更新成功");
  248. uni.clearStorageSync();
  249. plus.nativeUI.toast(
  250. "缓存清除成功");
  251. that.$api.doRequest('post',
  252. '/auth/api/logout')
  253. .then(res => {
  254. if (res.data
  255. .data) {
  256. that.$store
  257. .commit(
  258. 'logout'
  259. )
  260. that.$api
  261. .logout()
  262. plus.nativeUI
  263. .toast(
  264. "登出成功"
  265. );
  266. plus.runtime
  267. .restart();
  268. plus.nativeUI
  269. .toast(
  270. "重启成功"
  271. );
  272. }
  273. })
  274. plus.runtime.restart();
  275. },
  276. function(e) {
  277. uni.hideLoading()
  278. console.log(e)
  279. plus.nativeUI.toast(
  280. `热更新失败:${e.message}`
  281. );
  282. });
  283. }
  284. }
  285. });
  286. } else {
  287. this.content = '您当前版本为最新版本'
  288. this.isShowAlert = true
  289. }
  290. });
  291. }
  292. }
  293. })
  294. }
  295. // #endif
  296. },
  297. UpdataPassword() {
  298. uni.navigateTo({
  299. url: `/pages/public/reset?phone=${this.userInfo.phone}`
  300. })
  301. },
  302. clearStorage() {
  303. let that = this
  304. uni.clearStorage({
  305. success: function(res) {
  306. console.log('success');
  307. that.goOpenService()
  308. }
  309. })
  310. },
  311. cancelClick() {
  312. this.isShowAlert = false
  313. },
  314. goOpenService() {
  315. if (this.content == '您当前版本为最新版本') {
  316. this.isShowAlert = false
  317. return
  318. }
  319. uni.hideTabBarRedDot({
  320. index: 3
  321. })
  322. // uni.clearStorageSync();
  323. var that = this
  324. this.$api.doRequest('post', '/auth/api/logout').then(res => {
  325. if (res.data.data) {
  326. }
  327. })
  328. this.$store.commit('logout')
  329. this.$api.logout()
  330. uni.navigateTo({
  331. url: `/pages/public/login`
  332. })
  333. },
  334. getList() {
  335. this.userInfo = uni.getStorageSync('userInfo')
  336. this.headUrl = this.userInfo.avatarUrl
  337. if (this.headUrl == null || this.headUrl == "") {
  338. this.headUrl = "../../static/img/myimg/YongHu@3x.png"
  339. }
  340. this.username = this.userInfo.userName
  341. if (!uni.getStorageSync('userInfo').wechatNo) {
  342. this.wechatNo = this.userInfo.userName
  343. } else {
  344. this.wechatNo = this.userInfo.wechatNo
  345. }
  346. },
  347. switchPicture() {
  348. uni.navigateTo({
  349. url: `/pages/user/set_picture`
  350. })
  351. },
  352. nickname(username) {
  353. uni.navigateTo({
  354. url: `/pages/user/set_nickname?nickname=${username}`
  355. })
  356. },
  357. nickname1(username) {
  358. uni.navigateTo({
  359. url: `/pages/user/set_wechatNo?nickname=${username}`
  360. })
  361. },
  362. exitlogin() {
  363. },
  364. fankui() {
  365. uni.navigateTo({
  366. url: `/pages/user/fankui`
  367. })
  368. },
  369. unsubscribe() {
  370. var that = this
  371. uni.clearStorage({
  372. success: function(res) {
  373. console.log('success');
  374. uni.hideTabBarRedDot({
  375. index: 3
  376. })
  377. that.$api.doRequest('post', '/auth/api/logout').then(res => {
  378. if (res.data.data) {
  379. }
  380. })
  381. that.$store.commit('logout')
  382. that.$api.logout()
  383. // plus.nativeUI.toast(
  384. // "注销成功");
  385. uni.navigateTo({
  386. url: `/pages/public/login`
  387. })
  388. }
  389. })
  390. },
  391. logout() {
  392. // const that = this
  393. this.isShowAlert = true
  394. // uni.showModal({
  395. // title: '询问',
  396. // content: '您确定要退出吗?',
  397. // cancelText: '取消',
  398. // confirmText: '确定',
  399. // success: (e) => {
  400. // if (e.confirm) {
  401. // uni.hideTabBarRedDot({
  402. // index: 3
  403. // })
  404. // uni.clearStorageSync();
  405. // that.$store.commit('logout')
  406. // that.$api.logout()
  407. // uni.navigateTo({
  408. // url: `/pages/public/login`
  409. // })
  410. // }
  411. // }
  412. // })
  413. },
  414. }
  415. }
  416. </script>
  417. <style lang="scss" scoped>
  418. page {
  419. background-color: #F5F6FA;
  420. }
  421. .container {
  422. padding: 10px 0 0px;
  423. }
  424. .headPortrait {
  425. width: 100%;
  426. height: 52px;
  427. margin-top: 15px;
  428. background-color: #FFFFFF;
  429. border-radius: 6px;
  430. // justify-content: flex-end;
  431. }
  432. .title {
  433. font-size: 16px;
  434. line-height: 50px;
  435. font-weight: 600;
  436. margin-left: 10px;
  437. }
  438. .pictures {
  439. justify-content: flex-end;
  440. width: 35px;
  441. height: 35px;
  442. background-color: #E0FAF6;
  443. border-radius: 18px;
  444. }
  445. .picture {
  446. width: 35px;
  447. height: 35px;
  448. }
  449. .arrow {
  450. margin-left: 15px;
  451. width: 8px;
  452. height: 12px;
  453. // justify-content: flex-end
  454. }
  455. .username {
  456. line-height: 50px;
  457. color: #6D6D72;
  458. }
  459. .sign {
  460. width: 18px;
  461. height: 18px;
  462. top: 4px;
  463. margin-right: 6px;
  464. }
  465. .cu-list>.cu-item:after {
  466. border: none;
  467. }
  468. .exitloginwrap {
  469. position: fixed;
  470. bottom: 0;
  471. left: 0;
  472. width: 100%;
  473. padding-bottom: 20px;
  474. }
  475. .exitlogin {
  476. width: 90%;
  477. background: #fff;
  478. border-radius: 30px;
  479. color: #FB1E1E;
  480. font-size: 17px;
  481. }
  482. .exitlogin:after {
  483. border: none;
  484. }
  485. .version_css {
  486. // margin-right: 10rpx;
  487. color: #9D9D9D;
  488. font-size: 32rpx;
  489. text-align: center;
  490. }
  491. .agreement {
  492. display: flex;
  493. margin: 0 auto;
  494. text-align: center;
  495. .text {
  496. margin: 0 auto;
  497. text-align: center;
  498. display: flex;
  499. }
  500. .path {
  501. color: #22C572;
  502. text-align: center;
  503. }
  504. }
  505. </style>