detail.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <extend name="public@base"/>
  2. <block name="css">
  3. <link rel="stylesheet" href="__TMPL__/public/assets/css/userwall.css">
  4. <style>
  5. </style>
  6. </block>
  7. <block name="body">
  8. <!--头图-->
  9. <div class="image_box">
  10. <div class="back_box">
  11. <span>
  12. <van-icon name="arrow-left" class="text-white" @click="toBack" size="30px"></van-icon>
  13. </span>
  14. </div>
  15. <div class="rq">
  16. <img src="__TMPL__/public/assets/images/userwall/rq.svg">
  17. 人气:{{user.star}}
  18. </div>
  19. <img :src="main_image" class="image" @click="toIntro"/>
  20. </div>
  21. <!--简介-->
  22. <div class="detail_describe">
  23. <div class="fl">
  24. <h3 class="ws">
  25. <span class="fz22">{{user.realname ? user.realname : user.username}}</span>
  26. <span class="fz16 text-gray">(ID:{{user.id}})</span>
  27. </h3>
  28. <p class="fz16 mt10">
  29. <van-icon
  30. :class="[user.sex == 1 ? 'icon-xingbie-nan text-blue' : 'icon-xingbie-nv text-pink','iconfont']"></van-icon>
  31. {{user.age}}岁
  32. ·
  33. {{user.high}}CM
  34. </p>
  35. </div>
  36. <div class="fr mr20" @click="clickFavorite">
  37. <van-icon name="star" :style="{color: is_favorite ? '#FF589B' : '#AAB8C2'}" size="35px"></van-icon>
  38. <p class="fz14 text-center">收藏</p>
  39. </div>
  40. <div class="clear"></div>
  41. </div>
  42. <van-tabs v-model="active" class="mt10">
  43. <!--基本资料-->
  44. <van-tab :key="0">
  45. <template #title>
  46. <span class="fz16">资料</span>
  47. </template>
  48. <div class="plr5 mt10 pb10">
  49. <div class="br8 bg-white bsd">
  50. <dl class="p15 pb10 cursor">
  51. <dt class="fb fz16 pb5 pr" @click="showDetail">
  52. <span class="bg-pink inline_block vam mr5 t_1 pr dian br"></span> 基本资料
  53. <span class="pa rt">
  54. <van-icon name="arrow"></van-icon>
  55. </span>
  56. </dt>
  57. <dd class="fz14 pt10">
  58. <span class="ptb5 bg_span plr8 br mb5 dib">{{user.high ? user.high + 'CM' : '身高保密'}}</span>
  59. <span class="ptb5 bg_span plr8 br mb5 dib">{{user.weight ? user.weight + 'KG' : '体重保密'}}</span>
  60. <span class="ptb5 bg_span plr8 br mb5 dib">{{user.education}}</span>
  61. </dd>
  62. </dl>
  63. <dl class="p15 pb10">
  64. <dt class="fb fz16 pb5 pr" f="but_open_dialog" data-dialog="more">
  65. <span class="bg-pink inline_block vam mr5 t_1 pr dian br"></span> 择偶要求
  66. </dt>
  67. <dd class="fz14 pt10">
  68. <span class="ptb5 bg_span plr8 br mb5 dib">年龄:{{mating_age}}</span>
  69. <span class="ptb5 bg_span plr8 br mb5 dib">身高:{{mating_high}}</span>
  70. <span class="ptb5 bg_span plr8 br mb5 dib">体重:{{mating_weight}}</span>
  71. <span class="ptb5 bg_span plr8 br mb5 dib" v-if="mating.native">籍贯:{{mating.native}}</span>
  72. <span class="ptb5 bg_span plr8 br mb5 dib"
  73. v-if="mating.education">学历:{{mating.education}}</span>
  74. <span class="ptb5 bg_span plr8 br mb5 dib" v-if="mating.job">职业:{{mating.job}}</span>
  75. </dd>
  76. </dl>
  77. <dl class="p15 pb10">
  78. <dt class="fb fz16 pb5 pr" f="but_open_dialog" data-dialog="more">
  79. <span class="bg-pink inline_block vam mr5 t_1 pr dian br"></span> 爱情宣言
  80. </dt>
  81. <dd class="fz14 pb10 pt10 p-textarea">{{user.signature}}</dd>
  82. </dl>
  83. </div>
  84. </div>
  85. </van-tab>
  86. <!--相册-->
  87. <van-tab :key="0">
  88. <template #title>
  89. <span class="fz16">相册</span>
  90. </template>
  91. <div class="bg-white">
  92. <van-grid :border="false" :column-num="3">
  93. <van-grid-item v-for="(image,index) in images">
  94. <van-image :src="image" @click="photos(index)"></van-image>
  95. </van-grid-item>
  96. </van-grid>
  97. </div>
  98. </van-tab>
  99. </van-tabs>
  100. <!--收到的礼物-->
  101. <div class="plr5 mt10 pb10">
  102. <div class="br8 bg-white bsd">
  103. <dl class="p15 pb10 cursor">
  104. <dt class="fb fz16 pb5 pr" @click="showGift">
  105. <span class="bg-pink inline_block vam mr5 t_1 pr dian br"></span> 收到礼物
  106. <span class="pa rt">
  107. <van-icon name="arrow"></van-icon>
  108. </span>
  109. </dt>
  110. <dd class="fz14 pt10">
  111. <van-grid :column-num="5" :border="false">
  112. <van-grid-item @click="showGift">
  113. <van-icon name="point-gift" size="45" color="#FF589B"></van-icon>
  114. <span>送礼物</span>
  115. </van-grid-item>
  116. <van-grid-item v-for="value in user_gift">
  117. <van-image :src="value.gift.image"></van-image>
  118. <span>{{value.gift.name}}</span>
  119. </van-grid-item>
  120. </van-grid>
  121. </dd>
  122. </dl>
  123. </div>
  124. </div>
  125. <!--基本资料-->
  126. <van-popup v-model="detail_show" position="right" :style="{width: '100%',height: '100%'}">
  127. <van-nav-bar
  128. left-text="返回"
  129. @click-left="onClickLeft"
  130. >
  131. <template #title>
  132. <span class="fz18">{{user.username}}资料</span>
  133. </template>
  134. </van-nav-bar>
  135. <h3 class="fn fz16 color_red mb10 pt20 plr12">详细资料</h3>
  136. <van-cell-group>
  137. <van-cell title="UID" :value="user.id"></van-cell>
  138. <van-cell title="用户名" :value="user.username ? user.username : '对方还未填写'"></van-cell>
  139. <van-cell title="年龄" :value="user.age + '岁'"></van-cell>
  140. <van-cell title="身高" :value="user.high ? user.high + 'CM' : '保密'"></van-cell>
  141. <van-cell title="体重" :value="user.weight ? user.weight + 'KG' : '保密'"></van-cell>
  142. <van-cell title="学历" :value="user.education"></van-cell>
  143. <van-cell title="年收入" :value="user.income"></van-cell>
  144. <van-cell title="民族" :value="user.nation"></van-cell>
  145. <van-cell title="工作单位" :value="user.company"></van-cell>
  146. <van-cell title="职务" :value="user.job"></van-cell>
  147. <van-cell title="兴趣爱好" :value="user.hobby"></van-cell>
  148. </van-cell-group>
  149. <div class="split-block"></div>
  150. <h3 class="fn fz16 color_red mb10 pt20 plr12">工作生活</h3>
  151. <van-cell-group>
  152. <van-cell title="宗教信仰" :value="user.faith"></van-cell>
  153. <van-cell title="是否吸烟" :value="user.smoke"></van-cell>
  154. <van-cell title="是否喝酒" :value="user.drink"></van-cell>
  155. </van-cell-group>
  156. </van-popup>
  157. <!--送礼物-->
  158. <van-popup v-model="gift_show" round position="bottom">
  159. <div class="br8 bg-white bsd">
  160. <dl>
  161. <dt class="fz16 p15" style="border-bottom:1px solid #eee;">
  162. 送TA礼物,更好地表达你的心意
  163. </dt>
  164. <dd class="fz14 plr8 gift-grid">
  165. <van-grid :column-num="4" :border="false">
  166. <van-grid-item v-for="(item) in gift" @click="giveGift(item.id)">
  167. <van-image :src="item.image"></van-image>
  168. <span class="mt5 fz12">{{item.name}}</span>
  169. <p class="color_red ws mt10 fz12">{{item.money == 0 ? '免费' : item.money}}</p>
  170. </van-grid-item>
  171. </van-grid>
  172. </dd>
  173. </dl>
  174. </div>
  175. </van-popup>
  176. <!--底部-->
  177. <div style="width:100%;height:50px;"></div>
  178. <div class="detail_bottom bg-white">
  179. <div class="bottom_grid" @click="toHome">
  180. <van-icon name="home-o" size="25px"></van-icon>
  181. <span>首页</span>
  182. </div>
  183. <div class="bottom_grid" @click="clickSelect">
  184. <van-icon name="like" :style="{color: is_select ? '#FF589B' : '#AAB8C2'}" size="25px"></van-icon>
  185. <span>表明心意</span>
  186. </div>
  187. <div class="bottom_grid" @click="showGift">
  188. <van-icon name="point-gift-o" size="25px"></van-icon>
  189. <span>送礼物</span>
  190. </div>
  191. <div class="bottom_chat bg-pink" @click="chat">
  192. <van-icon name="chat-o" size="25px"></van-icon>
  193. {{is_friend ? '开始聊天' : '聊天邀请'}}
  194. </div>
  195. </div>
  196. <!--图片预览-->
  197. <van-image-preview
  198. v-model="image_show"
  199. :images="images"
  200. :start-position="image_index"
  201. >
  202. </van-image-preview>
  203. </block>
  204. <block name="script">
  205. <script>
  206. new Vue({
  207. el: '#app',
  208. data() {
  209. return {
  210. user: {$user},
  211. mating: {$mating},
  212. gift: {$gift},
  213. user_gift: {$user_gift},
  214. active: 0,
  215. image_show: false,
  216. image_index: 0,
  217. gift_show: false,
  218. detail_show: false,
  219. is_favorite: {$is_favorite},
  220. is_select: {$is_select},
  221. is_friend: {$is_friend},
  222. };
  223. },
  224. methods: {
  225. photos(index) {
  226. this.image_index = index;
  227. this.image_show = true;
  228. },
  229. showGift() {
  230. this.gift_show = true;
  231. },
  232. toHome() {
  233. location.href = '/';
  234. },
  235. showDetail() {
  236. this.detail_show = true;
  237. },
  238. onClickLeft() {
  239. this.detail_show = false;
  240. },
  241. toBack() {
  242. history.back();
  243. },
  244. chat() {
  245. if ("{$user_id}" == this.user.id) {
  246. this.$toast('不能与自己聊天');
  247. return false;
  248. }
  249. let self = this;
  250. $.post("{:url('chat')}", {id: this.user.id}, function (json) {
  251. if (json.code == 1) {
  252. location.href = json.url;
  253. } else {
  254. self.$toast(json.msg);
  255. }
  256. }, 'json');
  257. },
  258. toIntro() {
  259. if ("{$user_id}" == this.user.id) {
  260. location.href = "{:url('my/intro')}";
  261. }
  262. },
  263. clickSelect() {
  264. let self = this;
  265. $.post("{:url('select')}", {id: self.user.id}, function (json) {
  266. self.$toast(json.msg);
  267. if (json.code == 1) {
  268. self.is_select = !self.is_select;
  269. }
  270. }, 'json');
  271. },
  272. clickFavorite() {
  273. let self = this;
  274. $.post("{:url('favorite')}", {id: self.user.id}, function (json) {
  275. self.$toast(json.msg);
  276. if (json.code == 1) {
  277. self.is_favorite = !self.is_favorite;
  278. }
  279. }, 'json');
  280. },
  281. giveGift(id) {
  282. let self = this;
  283. $.post("{:url('giveGift')}", {to_id: self.user.id, gift_id: id}, function (json) {
  284. self.$toast(json.msg);
  285. $.post("{:url('userGift')}", {id: self.user.id}, function (json) {
  286. self.gift_show = false;
  287. self.user_gift = json.data;
  288. }, 'json')
  289. }, 'json');
  290. },
  291. //多列选择器值
  292. getMatingValue(min, max, ext) {
  293. if (min === '' || max === '') {
  294. return '';
  295. }
  296. if (min === 0 && max === 0) {
  297. return '不限';
  298. }
  299. let min_ext = min + ext;
  300. if (min === 0) {
  301. min_ext = '不限';
  302. }
  303. let max_ext = max + ext;
  304. if (max === 0) {
  305. max_ext = '不限';
  306. }
  307. return `${min_ext}-${max_ext}`;
  308. },
  309. },
  310. computed: {
  311. main_image() {
  312. if (this.user.main_image) {
  313. return this.user.main_image
  314. } else {
  315. if ("{$user_id}" == this.user.id) {
  316. return '__TMPL__/public/assets/images/userwall/my_header.jpg';
  317. } else {
  318. return '__TMPL__/public/assets/images/userwall/no_image.png';
  319. }
  320. }
  321. },
  322. //年龄
  323. mating_age() {
  324. return this.getMatingValue(this.mating.min_age, this.mating.max_age, '岁');
  325. },
  326. //身高
  327. mating_high() {
  328. return this.getMatingValue(this.mating.min_high, this.mating.max_high, 'CM');
  329. },
  330. //体重
  331. mating_weight() {
  332. return this.getMatingValue(this.mating.min_weight, this.mating.max_weight, 'KG');
  333. },
  334. images() {
  335. let images = [];
  336. for (let i = 0; i < this.user.more.length; i++) {
  337. if (this.user.more[i]) {
  338. images.push(this.user.more[i].url);
  339. }
  340. }
  341. return images;
  342. },
  343. }
  344. });
  345. </script>
  346. </block>