mine.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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.navigateTo({
  226. url: "/pages/subPackages/password/index",
  227. });
  228. },
  229. async getUserInfo() {
  230. let data = await getUserInfo();
  231. this.userInfo = data.data;
  232. },
  233. },
  234. };
  235. </script>
  236. <style lang="scss">
  237. .banner {
  238. width: 100%;
  239. height: 100%;
  240. position: absolute;
  241. z-index: 1;
  242. }
  243. .headerandwelcome {
  244. margin-bottom: 60rpx;
  245. height: 120rpx;
  246. width: 100%;
  247. padding-left: 60rpx;
  248. }
  249. .info {
  250. position: absolute;
  251. //width: calc(100% - 64rpx);
  252. margin: 60rpx 0 0 0;
  253. z-index: 2;
  254. }
  255. .header {
  256. height: 120rpx;
  257. width: 120rpx;
  258. //margin-left: 15rpx;
  259. border-radius: 50%;
  260. float: left;
  261. }
  262. .weltxt {
  263. height: 120rpx;
  264. color: #ffffff;
  265. margin-left: 32rpx;
  266. display: flex;
  267. flex-direction: column;
  268. justify-content: center;
  269. float: left;
  270. color: black;
  271. }
  272. .cardBox{
  273. width: 686rpx;
  274. height: 100rpx;
  275. box-sizing: border-box;
  276. background: rgba(20, 33, 76, 1);
  277. border-radius: 16rpx 16rpx 0 0;
  278. display: flex;
  279. align-items: center;
  280. justify-content: space-between;
  281. padding:0 32rpx;
  282. margin-left: 32rpx;
  283. .rightIcon{
  284. width: 36rpx;
  285. height: 36rpx;
  286. }
  287. .cardLeft{
  288. display: flex;
  289. align-items: center;
  290. }
  291. }
  292. .labelpage {
  293. width: 686rpx;
  294. margin-left: 32rpx;
  295. box-sizing: border-box;
  296. padding: 32rpx;
  297. border-radius: 12rpx 12rpx 12rpx 12rpx;
  298. background: #ffffff;
  299. }
  300. .labelpage_row {
  301. display: flex;
  302. align-items: center;
  303. height: 83rpx;
  304. width: 100%;
  305. img {
  306. height: 44rpx;
  307. width: 44rpx;
  308. float: left;
  309. margin-right: 12rpx;
  310. }
  311. .labelpage_text {
  312. width: 100%;
  313. height: 44rpx;
  314. line-height: 44rpx;
  315. float: left;
  316. }
  317. .labelpage_name {
  318. height: 44rpx;
  319. line-height: 44rpx;
  320. float: left;
  321. font-size: 34rpx;
  322. color: #081640;
  323. font-weight: 400;
  324. }
  325. .labelpage_value {
  326. height: 44rpx;
  327. line-height: 44rpx;
  328. float: right;
  329. font-size: 34rpx;
  330. color: #666666;
  331. font-weight: 400;
  332. }
  333. .border {
  334. margin-top: 48rpx;
  335. width: 100%;
  336. height: 1rpx;
  337. border-bottom: 2rpx solid #e6e6e6;
  338. float: left;
  339. }
  340. }
  341. .mineMenuBody {
  342. width: 686rpx;
  343. box-sizing: border-box;
  344. display: flex;
  345. justify-content: space-around;
  346. background: white;
  347. padding: 24rpx 0;
  348. margin: 24rpx 32rpx;
  349. border-radius: 2vw;
  350. .mineMenuItem {
  351. position: relative;
  352. display: flex;
  353. flex-direction: column;
  354. align-items: center;
  355. .redDoll {
  356. position: absolute;
  357. right: 0;
  358. top: 0;
  359. width: 16rpx;
  360. height: 16rpx;
  361. background: #f25551;
  362. border-radius: 50%;
  363. }
  364. .menuImg {
  365. width: 80rpx;
  366. height: 80rpx;
  367. }
  368. .menuName {
  369. color: #333333;
  370. font-size: 28rpx;
  371. margin-top: 8rpx;
  372. }
  373. }
  374. }
  375. </style>