mine.vue 9.1 KB

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