mine.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <view class="mine">
  3. <img src="../../static/mine/banner.png" class="banner" />
  4. <div class="title-mine">我的</div>
  5. <div class="info">
  6. <div class="headerandwelcome">
  7. <img src="../../static/mine/head.png" alt="" class="header" />
  8. <div class="welcome">
  9. <div class="title">欢迎您!</div>
  10. <div class="weltxt">
  11. {{ phone }}
  12. <!-- {{ getUserLocalStorageInfo.user.phone }} -->
  13. </div>
  14. </div>
  15. </div>
  16. <div style="border-radius: 2rem; padding: 6rpx 32rpx; background: white">
  17. <div class="labelpage_row">
  18. <img height="44rpx" src="../../static/mine/versionicon.png" alt="" />
  19. <div class="labelpage_text">
  20. <div class="labelpage_name">当前版本号</div>
  21. <div class="labelpage_value">v1.0.1</div>
  22. </div>
  23. </div>
  24. <!-- <div class="labelpage_row" @click="bindPush()">
  25. <img src="../../static/mine/versionicon.png" alt="" />
  26. <div class="labelpage_text">
  27. <div class="labelpage_name">绑定消息推送</div>
  28. </div>
  29. </div> -->
  30. <div class="labelpage_row" @click="editPassWord()">
  31. <img height="44rpx" src="../../static/mine/editpassword.png" alt="" />
  32. <div class="labelpage_text">
  33. <div class="labelpage_name">密码修改</div>
  34. <div class="labelpage_value">
  35. <img
  36. src="../../static/mine/youjiantou.png"
  37. height="44rpx"
  38. alt=""
  39. />
  40. </div>
  41. <!-- <div class="border"></div> -->
  42. </div>
  43. </div>
  44. <div class="labelpage_row" @click="outLogin()" style="border: none">
  45. <img height="44rpx" src="../../static/mine/outicon.png" alt="" />
  46. <div class="labelpage_text">
  47. <div class="labelpage_name">退出账号</div>
  48. <div class="labelpage_value">
  49. <img
  50. src="../../static/mine/youjiantou.png"
  51. height="44rpx"
  52. alt=""
  53. />
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </view>
  60. </template>
  61. <script>
  62. import {
  63. getUserInfo,
  64. bindWxOpenId,
  65. getWxUserById,
  66. unbindWxId,
  67. } from "@/js_sdk/http";
  68. import { getUserLocalStorageInfo } from "@/js_sdk/localUserInfo.js";
  69. export default {
  70. data() {
  71. return {
  72. userInfo: {},
  73. bindFlag: 1,
  74. phone: "",
  75. getUserLocalStorageInfo: getUserLocalStorageInfo(),
  76. };
  77. },
  78. onLoad() {
  79. let key = getUserLocalStorageInfo().userType == "USER" ? "user" : "biz";
  80. let key1 =
  81. getUserLocalStorageInfo().userType == "USER"
  82. ? "username"
  83. : "userNameDefault";
  84. console.log(getUserLocalStorageInfo()["biz"]);
  85. let phone = getUserLocalStorageInfo()[key][key1];
  86. this.phone =
  87. key == "biz" ? phone : phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
  88. },
  89. methods: {
  90. bindPush() {
  91. let that = this;
  92. // wx.requestSubscribeMessage({
  93. // tmplIds: [
  94. // "HL4csSthBOnLbntYxrs4QE_Nb94Im8lN62t4lvl65XY",
  95. // "Zt7a0xK-gy0aBe0owXmHi98t46n9vxrlkiQwz3ThnfQ",
  96. // "iwqrwmxwjgQrGXFdZ3_kqYXOU52bfREK1cQJGwreKRE",
  97. // ],
  98. // success(res) {
  99. // console.log(res);
  100. // },
  101. // });
  102. wx.getSetting({
  103. withSubscriptions: true,
  104. success(res) {
  105. var itemSettings = res.subscriptionsSetting.itemSettings;
  106. console.log(itemSettings);
  107. if (
  108. itemSettings["HL4csSthBOnLbntYxrs4QE_Nb94Im8lN62t4lvl65XY"] ==
  109. "accept"
  110. ) {
  111. that.$showToast("请勿重复绑定");
  112. }
  113. if (
  114. itemSettings &&
  115. itemSettings["HL4csSthBOnLbntYxrs4QE_Nb94Im8lN62t4lvl65XY"] ==
  116. "accept"
  117. ) {
  118. return false;
  119. } else {
  120. wx.showModal({
  121. title: "授权",
  122. content: "是否进行订阅授权?",
  123. success(res) {
  124. if (res.confirm) {
  125. //获取订阅权限
  126. wx.requestSubscribeMessage({
  127. tmplIds: [
  128. "HL4csSthBOnLbntYxrs4QE_Nb94Im8lN62t4lvl65XY",
  129. "Zt7a0xK-gy0aBe0owXmHi98t46n9vxrlkiQwz3ThnfQ",
  130. "iwqrwmxwjgQrGXFdZ3_kqYXOU52bfREK1cQJGwreKRE",
  131. ],
  132. success: (res) => {
  133. console.log("成功!!!!!!!!!!!!_:", res);
  134. },
  135. fail(err) {
  136. console.log("失败!!!!!!!!!!!!_:", err);
  137. },
  138. });
  139. } else if (res.cancel) {
  140. console.log("用户点击取消");
  141. }
  142. },
  143. });
  144. }
  145. },
  146. });
  147. },
  148. outLogin() {
  149. wx.showModal({
  150. title: "提示!",
  151. content: "是否确认退出登录?",
  152. success: function (res) {
  153. if (res.confirm) {
  154. uni.clearStorageSync();
  155. uni.reLaunch({
  156. url: "/pages/chooseIdentity/index",
  157. });
  158. }
  159. },
  160. });
  161. },
  162. editPassWord() {
  163. uni.navigateTo({
  164. url: "/pages/subPackages/password/index",
  165. });
  166. },
  167. async getUserInfo() {
  168. let data = await getUserInfo();
  169. this.userInfo = data.data;
  170. },
  171. },
  172. };
  173. </script>
  174. <style scoped lang="scss">
  175. .mine {
  176. .welcome {
  177. margin-left: 32rpx;
  178. .title {
  179. font-weight: bold;
  180. font-size: 48rpx;
  181. color: #18172a;
  182. }
  183. }
  184. .banner {
  185. width: 100%;
  186. height: 100vh;
  187. position: absolute;
  188. z-index: 1;
  189. }
  190. .headerandwelcome {
  191. display: flex;
  192. align-items: center;
  193. margin-bottom: 60rpx;
  194. height: 120rpx;
  195. width: 100%;
  196. }
  197. .title-mine {
  198. position: absolute;
  199. top: 110rpx;
  200. width: 100%;
  201. text-align: center;
  202. color: #18172a;
  203. font-weight: 400;
  204. font-size: 36rpx;
  205. }
  206. .info {
  207. position: absolute;
  208. top: 260rpx;
  209. width: calc(100% - 64rpx);
  210. margin: 0 32rpx 0 32rpx;
  211. z-index: 2;
  212. }
  213. .header {
  214. height: 120rpx;
  215. width: 120rpx;
  216. margin-left: 15rpx;
  217. border-radius: 50%;
  218. }
  219. .weltxt {
  220. font-weight: 400;
  221. font-size: 32rpx;
  222. color: #333333;
  223. margin-top: 12rpx;
  224. }
  225. .labelpage {
  226. // width: calc(100% - 96rpx);
  227. // height: 308rpx;
  228. // padding: 96rpx 48rpx;
  229. border-radius: 12rpx 12rpx 12rpx 12rpx;
  230. background: #ffffff;
  231. }
  232. .labelpage_row {
  233. border-bottom: 1px solid rgba(230, 230, 230, 1);
  234. display: flex;
  235. // width: 686rpx;
  236. padding: 32rpx;
  237. padding-left: 0;
  238. padding-right: 0;
  239. box-sizing: border-box;
  240. background: white;
  241. // padding: 32rpx;
  242. // height: 83rpx;
  243. // width: 100%;
  244. img {
  245. height: 44rpx;
  246. width: 44rpx;
  247. margin-right: 24rpx;
  248. }
  249. .labelpage_text {
  250. display: flex;
  251. justify-content: space-between;
  252. // height: 44rpx;
  253. align-items: center;
  254. width: 580rpx;
  255. // line-height: 44rpx;
  256. }
  257. .labelpage_name {
  258. // height: 44rpx;
  259. // line-height: 44rpx;
  260. // width: 440rpx;
  261. font-size: 28rpx;
  262. color: #081640;
  263. font-weight: 400;
  264. }
  265. .labelpage_value {
  266. height: 44rpx;
  267. // line-height: 44rpx;
  268. float: right;
  269. font-size: 28rpx;
  270. color: #1d18bc;
  271. font-weight: 400;
  272. }
  273. // .border {
  274. // margin-top: 48rpx;
  275. // width: 100%;
  276. // height: 1rpx;
  277. // border-bottom: 2rpx solid #e6e6e6;
  278. // }
  279. }
  280. }
  281. </style>