setUp.vue 13 KB

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