user.vue 7.2 KB

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