cards.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="pass-box">
  3. <en-nav ></en-nav>
  4. <view class="login-box" :style="{'height':'calc(100vh - '+navHeight+'px)'}" >
  5. <view class="login-top">
  6. <view class="login-title">
  7. <text class="title-item sys-color-black sys-weight-600">个性卡牌</text>
  8. </view>
  9. <view class="card-text">
  10. <text class="sys-color-gray-9">请使用本人</text>
  11. <text class="sys-color-green">真实照片</text>
  12. <text class="sys-color-gray-9">,否则部分功能可能会受限</text>
  13. </view>
  14. <view class="card-img" :class="{'open-img':imgBg}" @click="openPopup" :style="{'height':'calc(100vh - '+navHeight+'px - 278rpx - 270rpx - env(safe-area-inset-bottom)','background-image':'url('+imgBg+')'}">
  15. <view class="add-box" v-if="!imgBg">
  16. <image class="add-img" src="/static/img/common/add.png" mode="aspectFill"></image>
  17. </view>
  18. </view>
  19. <view class="card-agreement">
  20. <login-agreement :type="2"></login-agreement>
  21. </view>
  22. </view>
  23. <view class="login-bottom">
  24. <view class="login-but sys-color-white sys-background-black sys-selected-but" @click="setNextStep" :class="{'sys-unselected-but':!isOK,'apply-shake':isShakeBut}">下一步</view>
  25. </view>
  26. </view>
  27. <en-popup ref="cardPopup">
  28. <template v-slot:popupInfo="{pagingData}">
  29. <view class="img-popup">
  30. <view class="popup-title sys-weight-600 sys-color-black">上传清晰的本人照片</view>
  31. <view class="popup-text sys-color-gray-9 ">
  32. 展示你真实有趣的一面
  33. </view>
  34. <view class="popup-img">
  35. <view class="popup-item">
  36. <image class="item-img" src="/static/img/perfect/img3.png" mode="widthFix"></image>
  37. <view class="item-describe">
  38. <image class="describe-img" src="/static/img/perfect/ok.png" mode="widthFix"></image>
  39. <view class="describe-text sys-color-white sys-weight-600" >半身/全身</view>
  40. </view>
  41. </view>
  42. <view class="popup-item">
  43. <image class="item-img" src="/static/img/perfect/img1.png" mode="widthFix"></image>
  44. <view class="item-describe">
  45. <image class="describe-img" src="/static/img/perfect/no.png" mode="widthFix"></image>
  46. <view class="describe-text sys-color-white sys-weight-600" >怼脸自拍</view>
  47. </view>
  48. </view>
  49. <view class="popup-item">
  50. <image class="item-img" src="/static/img/perfect/img2.png" mode="widthFix"></image>
  51. <view class="item-describe">
  52. <image class="describe-img" src="/static/img/perfect/no.png" mode="widthFix"></image>
  53. <view class="describe-text sys-color-white sys-weight-600" >网红非人</view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="popup-but sys-color-white sys-background-black sys-selected-but" @click="openChooseImage">从相册中选择</view>
  58. </view>
  59. </template>
  60. </en-popup>
  61. </view>
  62. </template>
  63. <script>
  64. import EnNav from "@/components/en-utils/en-nav/en-nav";
  65. import tools from "@/service/tools";
  66. import LoginAgreement from "@/pages/login/model/loginAgreement";
  67. import EnPopup from "@/components/en-utils/en-popup/en-popup";
  68. export default {
  69. components: {EnPopup, LoginAgreement, EnNav},
  70. data() {
  71. return {
  72. navHeight:40,
  73. isOK:false,
  74. isShakeBut:false,
  75. nickname:'',
  76. password:'',
  77. imgList:[],
  78. imgBg:''
  79. }
  80. },
  81. watch:{
  82. },
  83. methods: {
  84. openChooseImage(){
  85. uni.chooseImage({
  86. count: 6, //默认9
  87. sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有
  88. sourceType: ['album'], //从相册选择
  89. success: (res) =>{
  90. if(res.tempFilePaths.length>0){
  91. this.imgBg=res.tempFilePaths[0]
  92. this.imgList=res.tempFilePaths
  93. this.isOK=true
  94. }
  95. console.log(JSON.stringify(res.tempFilePaths));
  96. this.$refs.cardPopup.close()
  97. }
  98. });
  99. },
  100. openPopup(){
  101. this.$refs.cardPopup.open()
  102. },
  103. setNextStep(){
  104. if(this.isOK){
  105. uni.navigateTo({
  106. 'url':'/pages/index/index'
  107. })
  108. }else {
  109. tools.error('请完善信息')
  110. this.isShakeBut=true
  111. setTimeout(()=>{
  112. this.isShakeBut=false
  113. },500)
  114. }
  115. },
  116. verifyIsOK(){
  117. this.isOK = this.nickname!=='' && this.password.length>=6;
  118. },
  119. setNavHeight(navHeight){
  120. this.navHeight=navHeight+41
  121. },
  122. }
  123. }
  124. </script>
  125. <style scoped lang="scss">
  126. @import "/static/css/shake.css";
  127. .pass-box{
  128. .login-box{
  129. padding: 82rpx 80rpx 0 80rpx;
  130. box-sizing: border-box;
  131. position: relative;
  132. .login-top{
  133. .login-title{
  134. padding-bottom: 24rpx;
  135. .title-item{
  136. font-size: 48rpx;
  137. }
  138. }
  139. .card-text{
  140. padding-bottom: 16rpx;
  141. text{
  142. font-size: 28rpx;
  143. }
  144. }
  145. .card-img{
  146. width: calc(100vw - 160rpx);
  147. background: #F6F6F6;
  148. border-radius: 20rpx;
  149. position: relative;
  150. .add-box{
  151. position: absolute;
  152. top: 50%;
  153. left: 50%;
  154. transform: translate(-50%,-50%);
  155. .add-img{
  156. margin: auto auto;
  157. width: 84rpx;
  158. height: 84rpx;
  159. }
  160. }
  161. }
  162. .open-img{
  163. background-repeat: no-repeat;//不平铺
  164. background-position: center center;//居中
  165. background-size: cover;//随容器大小
  166. }
  167. .card-agreement{
  168. margin-top: 32rpx;
  169. }
  170. }
  171. .login-bottom{
  172. padding-bottom: calc(58rpx + env(safe-area-inset-bottom));
  173. position: absolute;
  174. bottom: 0;
  175. left: 68rpx;
  176. width:calc(100vw - 136rpx);
  177. .login-but{
  178. margin-top: 120rpx;
  179. }
  180. }
  181. }
  182. .img-popup{
  183. margin-top: 40rpx;
  184. padding: 0 32rpx calc(58rpx + env(safe-area-inset-bottom)) 32rpx;
  185. .popup-title{
  186. font-size: 36rpx;
  187. }
  188. .popup-text{
  189. padding: 16rpx 0 32rpx;
  190. font-size: 28rpx;
  191. }
  192. .popup-img{
  193. display: flex;
  194. justify-content: space-between;
  195. .popup-item{
  196. display: inline-block;
  197. margin-right:10rpx;
  198. position: relative;
  199. .item-img{
  200. border-radius: 16rpx;
  201. width: calc((100vw - 80rpx)/3);
  202. height: 276rpx;
  203. }
  204. .item-describe{
  205. position: absolute;
  206. left: 32rpx;
  207. bottom: 20rpx;
  208. width: calc((100vw - 80rpx)/3 - 64rpx);
  209. height: 36rpx;
  210. border-radius: 200rpx;
  211. background: rgba(0,0,0,0.6);
  212. display: flex;
  213. justify-content: flex-start;
  214. .describe-img{
  215. width: 36rpx;
  216. height: 36rpx;
  217. }
  218. .describe-text{
  219. margin-left: 8rpx;
  220. font-size: 24rpx;
  221. line-height: 36rpx;
  222. }
  223. }
  224. }
  225. .popup-item:nth-of-type(3n+0){
  226. margin-right:0;
  227. }
  228. }
  229. .popup-but{
  230. margin-top: 58rpx;
  231. }
  232. }
  233. }
  234. </style>