user.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="avater">
  5. <image :src="userInfo.avatar" class="avater-img" mode=""></image>
  6. </view>
  7. <view class="name-box">
  8. <view class="name-top">
  9. {{userInfo.nickname}}
  10. </view>
  11. </view>
  12. </view>
  13. <view class="nav-box">
  14. <view class="nav-item" @click="tohelp">
  15. <view class="tt-icon1">
  16. <image src="../../static/icon/icon-05.png" class="img1" mode=""></image>
  17. </view>
  18. <view class="tt-txt">
  19. 求救记录
  20. </view>
  21. <image src="../../static/icon/next.png" class="next-icon" mode=""></image>
  22. </view>
  23. <view class="nav-item" @click="torreco">
  24. <view class="tt-icon1">
  25. <image src="../../static/icon/icon-06.png" class="img1" mode=""></image>
  26. </view>
  27. <view class="tt-txt">
  28. 救援记录
  29. </view>
  30. <image src="../../static/icon/next.png" class="next-icon" mode=""></image>
  31. </view>
  32. <view class="nav-item" @click="commonaddress">
  33. <view class="tt-icon1">
  34. <image src="../../static/icon/icon-07.png" class="img1" mode=""></image>
  35. </view>
  36. <view class="tt-txt">
  37. 常用地址
  38. </view>
  39. <image src="../../static/icon/next.png" class="next-icon" mode=""></image>
  40. </view>
  41. <view class="nav-item" @click="tocertificates">
  42. <view class="tt-icon1">
  43. <image src="../../static/icon/icon-08.png" class="img1" mode=""></image>
  44. </view>
  45. <view class="tt-txt">
  46. 我的证书
  47. </view>
  48. <image src="../../static/icon/next.png" class="next-icon" mode=""></image>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import {
  55. mapState,
  56. mapMutations
  57. } from 'vuex';
  58. import {
  59. saveUrl,
  60. interceptor
  61. } from '@/utils/loginUtils.js';
  62. import { detail_training } from '@/api/train.js';
  63. import {
  64. userinfo
  65. } from '@/api/user.js';
  66. // #ifdef H5
  67. import {
  68. weixindata
  69. } from '@/utils/wxAuthorized';
  70. // #endif
  71. export default {
  72. data() {
  73. return {
  74. common_address:'',
  75. name:'',
  76. signDate:'',
  77. id:0,
  78. is_over:0
  79. }
  80. },
  81. onShow() {
  82. console.log(this);
  83. // 判断是否已经登录
  84. if (this.hasLogin) {
  85. this.loadBaseData();
  86. } else {
  87. saveUrl();
  88. uni.showModal({
  89. title: '登录',
  90. content: '您未登录,是否马上登陆?',
  91. success: e => {
  92. if (e.confirm) {
  93. interceptor();
  94. }
  95. },
  96. fail: e => {
  97. console.log(e);
  98. }
  99. });
  100. }
  101. this.type = this.userInfo.type;
  102. this.common_address = this.userInfo.common_address
  103. console.log('点前保存的地址',this.common_address)
  104. // 保存当前页面
  105. },
  106. onReady() {
  107. console.log(99999)
  108. detail_training({
  109. id:this.id,
  110. }).then(({data}) => {
  111. console.log(999,data)
  112. this.name = data.name
  113. this.signDate = data.add_time
  114. this.is_over = data.is_over
  115. })
  116. },
  117. computed: {
  118. ...mapState('user', ['hasLogin', 'userInfo'])
  119. },
  120. methods: {
  121. ...mapMutations('user', ['setUserInfo']),
  122. loadBaseData() {
  123. userinfo({}).then(({
  124. data
  125. }) => {
  126. this.setUserInfo(data);
  127. });
  128. // #ifdef H5
  129. weixindata();
  130. // #endif
  131. detail_training({
  132. id:this.id,
  133. }).then(({data}) => {
  134. console.log(9,data)
  135. this.name = data.name
  136. this.signDate = data.add_time
  137. this.is_over = data.is_over
  138. })
  139. },
  140. torreco() {
  141. uni.navigateTo({
  142. url: '/pages/applic/rescuerecords'
  143. })
  144. },
  145. tohelp() {
  146. uni.navigateTo({
  147. url: '/pages/applic/helprecords'
  148. })
  149. },
  150. commonaddress() {
  151. uni.navigateTo({
  152. url: '/pages/applic/commonaddress?add=' + this.common_address
  153. })
  154. },
  155. tocertificates() {
  156. uni.navigateTo({
  157. // pages/form/certificatesList
  158. // url: '/pages/form/certificates?name=' + this.name + '&signDate=' + this.signDate
  159. url: '/pages/form/certificatesList'
  160. })
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="scss">
  166. page {
  167. height: 100%;
  168. background-color: #fff;
  169. }
  170. .content {
  171. line-height: 1;
  172. background-color: #fff;
  173. .top {
  174. width: 750rpx;
  175. height: 399rpx;
  176. // background-color: #CB131B;
  177. background: url(../../static/images/bgi2.png)no-repeat top left;
  178. // background-image: url();
  179. background-size: 750rpx 399rpx;
  180. display: flex;
  181. flex-direction: column;
  182. align-items: center;
  183. padding-left: 55rpx;
  184. align-items: center;
  185. justify-content: center;
  186. .avater {
  187. width: 150rpx;
  188. height: 150rpx;
  189. margin-right: 28rpx;
  190. .avater-img {
  191. width: 100%;
  192. height: 100%;
  193. border-radius: 50%;
  194. background-color: #fff;
  195. }
  196. }
  197. .name-box {
  198. // flex: 1;
  199. padding-top: 25rpx;
  200. .name-top {
  201. font-size: 42rpx;
  202. font-weight: 400;
  203. color: #FFFFFF;
  204. margin-bottom: 15rpx;
  205. }
  206. .name-bottom{
  207. margin-top: 16rpx;
  208. display: flex;
  209. align-items: center;
  210. // justify-content: center;
  211. .nameInfo{
  212. color: #FFFFFF;
  213. padding: 6rpx 16rpx;
  214. border: 1rpx solid #FFFFFF;
  215. border-radius: 12rpx;
  216. // background-color: pink;
  217. }
  218. }
  219. .name-footbox {
  220. .name-foot {
  221. text-align: center;
  222. font-size: 22rpx;
  223. font-weight: 400;
  224. color: #FFFFFF;
  225. background: rgba(255, 255, 255, 0.2);
  226. border: 1px solid #FFFFFF;
  227. border-radius: 20rpx;
  228. padding: 3rpx 13rpx;
  229. }
  230. }
  231. }
  232. }
  233. .center-box {
  234. width: 687rpx;
  235. // height: 235px;
  236. background: #FFE8E8;
  237. border-radius: 16rpx;
  238. margin: -90rpx auto 0;
  239. .center-top {
  240. width: 687rpx;
  241. height: 80rpx;
  242. background: #FFFFFF;
  243. border-radius: 16rpx 16rpx 0 0;
  244. display: flex;
  245. align-items: center;
  246. padding-left: 30rpx;
  247. .top-left {
  248. width: 126rpx;
  249. line-height: 32rpx;
  250. text-align: center;
  251. background: linear-gradient(0deg, #C90F1B, #F14D33);
  252. font-size: 22rpx;
  253. font-weight: 400;
  254. color: #FFFFFF;
  255. border-radius: 20rpx;
  256. margin-right: 10rpx;
  257. }
  258. .top-right {
  259. font-size: 22rpx;
  260. font-weight: 400;
  261. color: #CB151D;
  262. }
  263. }
  264. .center-foot {
  265. height: 155rpx;
  266. display: flex;
  267. .foot-list {
  268. flex: 1;
  269. text-align: center;
  270. padding-top: 20rpx;
  271. .list-top {
  272. font-size: 39rpx;
  273. font-weight: 400;
  274. color: #CB141D;
  275. line-height: 58rpx;
  276. }
  277. .list-foot {
  278. font-size: 39rpx;
  279. font-weight: 400;
  280. color: #666666;
  281. line-height: 58rpx;
  282. }
  283. }
  284. }
  285. }
  286. }
  287. .nav-box {
  288. width: 670rpx;
  289. height: 360rpx;
  290. background: #FFFFFF;
  291. box-shadow: 0px 0px 16rpx 0px rgba(0, 0, 0, 0.04);
  292. border-radius: 20rpx;
  293. margin: 0 auto;
  294. padding-top: 40rpx;
  295. .nav-item {
  296. height: 40rpx;
  297. display: flex;
  298. padding: 0 25rpx 0 32rpx;
  299. position: relative;
  300. margin-bottom: 43rpx;
  301. .tt-icon1 {
  302. display: inline-block;
  303. width: 40rpx;
  304. height: 40rpx;
  305. display: flex;
  306. justify-content: space-around;
  307. margin-right: 23rpx;
  308. .img1 {
  309. width: 36rpx;
  310. height: 40rpx;
  311. }
  312. .img2 {
  313. width: 40rpx;
  314. height: 40rpx;
  315. }
  316. .img3 {
  317. width: 34rpx;
  318. height: 40rpx;
  319. }
  320. .img4 {
  321. width: 38rpx;
  322. height: 40rpx;
  323. }
  324. }
  325. .tt-txt {
  326. display: inline-block;
  327. font-size: 28rpx;
  328. font-family: PingFang SC;
  329. font-weight: 500;
  330. color: #333333;
  331. line-height: 40rpx;
  332. }
  333. .next-icon {
  334. display: inline-block;
  335. width: 40rpx;
  336. height: 40rpx;
  337. position: absolute;
  338. right: 40rpx;
  339. }
  340. }
  341. }
  342. </style>