mine.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <view>
  3. <img src="../../static/mine/banner.png" class="banner" />
  4. <div class="info">
  5. <div class="headerandwelcome">
  6. <img src="../../static/mine/head.png" alt="" class="header" />
  7. <div class="weltxt">
  8. <span style="font-size: 48rpx; font-weight: 600">欢迎您!</span>
  9. <span style="font-size: 32rpx; margin-top: 5rpx">{{
  10. getUserLocalStorageInfo.username
  11. ? getUserLocalStorageInfo.username
  12. : "游客"
  13. }}</span>
  14. </div>
  15. </div>
  16. <!-- <div class="cardBox" @tap="toMineMsg">
  17. <div class="cardLeft">
  18. <span style="color: #ffc97c; font-size: 28rpx">我的消息</span>
  19. <span style="color: #ffffff; font-size: 40rpx; margin-left: 18rpx"
  20. >0</span
  21. >
  22. </div>
  23. <img src="./image/rightIcon.png" class="rightIcon" />
  24. </div> -->
  25. <!-- <div class="mineMenuBody">
  26. <div v-for="item in menuList" class="mineMenuItem" @tap="toPath(item)">
  27. <div class="redDoll" v-show="item.isNew"></div>
  28. <img :src="item.img" class="menuImg" />
  29. <span class="menuName">{{ item.name }}</span>
  30. </div>
  31. </div> -->
  32. <div class="labelpage">
  33. <!-- <div class="labelpage_row" @click="toMineInfo">
  34. <div class="labelpage_text">
  35. <div class="labelpage_name">企业信息</div>
  36. <div class="labelpage_value">
  37. <img
  38. src="../../static/mine/youjiantou.png"
  39. style="width: 44rpx; height: 44rpx"
  40. alt=""
  41. />
  42. </div>
  43. <div class="border"></div>
  44. </div>
  45. </div> -->
  46. <div class="labelpage_row">
  47. <div class="labelpage_text">
  48. <div class="labelpage_name">当前版本号</div>
  49. <div class="labelpage_value">v1.0.1</div>
  50. <div class="border"></div>
  51. </div>
  52. </div>
  53. <div
  54. class="labelpage_row"
  55. style="margin-top: 48rpx"
  56. @click="editPassWord()"
  57. >
  58. <div class="labelpage_text">
  59. <div class="labelpage_name">密码修改</div>
  60. <div class="labelpage_value">
  61. <img
  62. src="../../static/mine/youjiantou.png"
  63. style="width: 44rpx; height: 44rpx"
  64. alt=""
  65. />
  66. </div>
  67. <div class="border"></div>
  68. </div>
  69. </div>
  70. <!-- <div
  71. class="labelpage_row"
  72. style="margin-top: 48rpx"
  73. @click="changeUserType"
  74. >
  75. <div class="labelpage_text">
  76. <div class="labelpage_name">切换账号</div>
  77. <div class="labelpage_value">
  78. <img
  79. src="../../static/mine/youjiantou.png"
  80. style="width: 44rpx; height: 44rpx"
  81. alt=""
  82. />
  83. </div>
  84. <div class="border"></div>
  85. </div>
  86. </div> -->
  87. <div
  88. class="labelpage_row"
  89. style="margin-top: 48rpx"
  90. @click="outLogin()"
  91. >
  92. <div class="labelpage_text">
  93. <div class="labelpage_name">退出账号</div>
  94. <div class="labelpage_value">
  95. <img
  96. src="../../static/mine/youjiantou.png"
  97. style="width: 44rpx; height: 44rpx"
  98. alt=""
  99. />
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <van-popup :show="show" position="bottom" custom-style="height: 40%;">
  106. <van-picker
  107. :columns="columns"
  108. @cancel="onCancel"
  109. @confirm="onConfirm"
  110. show-toolbar
  111. />
  112. </van-popup>
  113. </view>
  114. </template>
  115. <script>
  116. import {
  117. getUserInfo,
  118. getUserLocalStorageInfo,
  119. switchCommonUser,
  120. } from "@/js_sdk/http";
  121. export default {
  122. data() {
  123. return {
  124. userInfo: {},
  125. getUserLocalStorageInfo: getUserLocalStorageInfo(),
  126. userType: true,
  127. show: false,
  128. columns: ["普通用户", "企业用户", "管理用户"],
  129. menuList: [
  130. {
  131. name: "我的收藏",
  132. img: require("./image/sc.png"),
  133. isNew: false,
  134. path: "/myCollection",
  135. },
  136. {
  137. name: "我的活动",
  138. img: require("./image/hd.png"),
  139. isNew: false,
  140. path: "/myActivities",
  141. },
  142. {
  143. name: "我的订单",
  144. img: require("./image/dd.png"),
  145. isNew: false,
  146. path: "/myOrder",
  147. },
  148. {
  149. name: "我的反馈",
  150. img: require("./image/fk.png"),
  151. isNew: false,
  152. path: "/feedback",
  153. },
  154. ],
  155. };
  156. },
  157. onLoad() {
  158. //option为object类型,会序列化上个页面传递的参数
  159. // this.getUserInfo(); //打印出上个页面传递的参数。
  160. },
  161. methods: {
  162. toPath(item) {
  163. if (item.path) {
  164. uni.navigateTo({
  165. url: "/pages/subPackages/minePages" + item.path,
  166. });
  167. }
  168. },
  169. toMineInfo() {
  170. uni.navigateTo({
  171. url: "/pages/subPackages/minePages/mineInfo",
  172. });
  173. },
  174. toMineMsg() {
  175. uni.navigateTo({
  176. url: "/pages/subPackages/minePages/mineMessage",
  177. });
  178. },
  179. onCancel() {
  180. this.show = false;
  181. },
  182. onConfirm(e) {
  183. if (e.detail.value !== "普通用户") {
  184. uni.navigateTo({
  185. url: "/pages/login2/login?loginType=" + e.detail.value,
  186. success: function (e) {
  187. // uni.$emit('userType', 'OK')
  188. },
  189. });
  190. } else {
  191. let data = {
  192. id: this.getUserLocalStorageInfo.id,
  193. };
  194. switchCommonUser(data).then((e) => {
  195. if (e.errno === 0) {
  196. delete this.getUserLocalStorageInfo.userId;
  197. this.getUserLocalStorageInfo.userType = "3";
  198. this.getUserLocalStorageInfo.username = "";
  199. console.log(this.getUserLocalStorageInfo);
  200. wx.setStorageSync(
  201. "USERINFO",
  202. JSON.stringify(this.getUserLocalStorageInfo)
  203. );
  204. }
  205. // console.log(e.data.user);
  206. // uni.clearStorageSync();
  207. });
  208. }
  209. this.show = false;
  210. },
  211. changeUserType() {
  212. this.show = true;
  213. // uni.navigateTo({
  214. // url: "/pages/login2/login",
  215. // success: function (e) {
  216. // // uni.$emit('userType', 'OK')
  217. // },
  218. // });
  219. },
  220. outLogin() {
  221. wx.showModal({
  222. title: "提示!",
  223. content: "是否确认退出登录?",
  224. success: function (res) {
  225. if (res.confirm) {
  226. uni.clearStorageSync();
  227. uni.reLaunch({
  228. url: "/pages/login2/login",
  229. });
  230. }
  231. },
  232. });
  233. },
  234. editPassWord() {
  235. uni.navigateBack();
  236. },
  237. async getUserInfo() {
  238. let data = await getUserInfo();
  239. this.userInfo = data.data;
  240. },
  241. },
  242. };
  243. </script>
  244. <style lang="scss">
  245. .banner {
  246. width: 100%;
  247. height: 100%;
  248. position: absolute;
  249. z-index: 1;
  250. }
  251. .headerandwelcome {
  252. margin-bottom: 60rpx;
  253. height: 120rpx;
  254. width: 100%;
  255. padding-left: 60rpx;
  256. }
  257. .info {
  258. position: absolute;
  259. //width: calc(100% - 64rpx);
  260. margin: 60rpx 0 0 0;
  261. z-index: 2;
  262. }
  263. .header {
  264. height: 120rpx;
  265. width: 120rpx;
  266. //margin-left: 15rpx;
  267. border-radius: 50%;
  268. float: left;
  269. }
  270. .weltxt {
  271. height: 120rpx;
  272. color: #ffffff;
  273. margin-left: 32rpx;
  274. display: flex;
  275. flex-direction: column;
  276. justify-content: center;
  277. float: left;
  278. color: black;
  279. }
  280. .cardBox {
  281. width: 686rpx;
  282. height: 100rpx;
  283. box-sizing: border-box;
  284. background: rgba(20, 33, 76, 1);
  285. border-radius: 16rpx 16rpx 0 0;
  286. display: flex;
  287. align-items: center;
  288. justify-content: space-between;
  289. padding: 0 32rpx;
  290. margin-left: 32rpx;
  291. .rightIcon {
  292. width: 36rpx;
  293. height: 36rpx;
  294. }
  295. .cardLeft {
  296. display: flex;
  297. align-items: center;
  298. }
  299. }
  300. .labelpage {
  301. width: 686rpx;
  302. margin-left: 32rpx;
  303. box-sizing: border-box;
  304. padding: 32rpx;
  305. border-radius: 12rpx 12rpx 12rpx 12rpx;
  306. background: #ffffff;
  307. }
  308. .labelpage_row {
  309. display: flex;
  310. align-items: center;
  311. height: 83rpx;
  312. width: 100%;
  313. img {
  314. height: 44rpx;
  315. width: 44rpx;
  316. float: left;
  317. margin-right: 12rpx;
  318. }
  319. .labelpage_text {
  320. width: 100%;
  321. height: 44rpx;
  322. line-height: 44rpx;
  323. float: left;
  324. }
  325. .labelpage_name {
  326. height: 44rpx;
  327. // line-height: 44rpx;
  328. float: left;
  329. font-size: 34rpx;
  330. color: #081640;
  331. font-weight: 400;
  332. }
  333. .labelpage_value {
  334. height: 44rpx;
  335. line-height: 44rpx;
  336. float: right;
  337. font-size: 34rpx;
  338. color: #666666;
  339. font-weight: 400;
  340. }
  341. .border {
  342. margin-top: 48rpx;
  343. width: 100%;
  344. height: 1rpx;
  345. border-bottom: 2rpx solid #e6e6e6;
  346. float: left;
  347. }
  348. }
  349. .mineMenuBody {
  350. width: 686rpx;
  351. box-sizing: border-box;
  352. display: flex;
  353. justify-content: space-around;
  354. background: white;
  355. padding: 24rpx 0;
  356. margin: 24rpx 32rpx;
  357. border-radius: 2vw;
  358. .mineMenuItem {
  359. position: relative;
  360. display: flex;
  361. flex-direction: column;
  362. align-items: center;
  363. .redDoll {
  364. position: absolute;
  365. right: 0;
  366. top: 0;
  367. width: 16rpx;
  368. height: 16rpx;
  369. background: #f25551;
  370. border-radius: 50%;
  371. }
  372. .menuImg {
  373. width: 80rpx;
  374. height: 80rpx;
  375. }
  376. .menuName {
  377. color: #333333;
  378. font-size: 28rpx;
  379. margin-top: 8rpx;
  380. }
  381. }
  382. }
  383. </style>