cards.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. import {register} from "@/api/login";
  69. export default {
  70. components: {EnPopup, LoginAgreement, EnNav},
  71. data() {
  72. return {
  73. navHeight:40,
  74. isOK:false,
  75. isShakeBut:false,
  76. nickname:'',
  77. password:'',
  78. imgList:[],
  79. imgBg:''
  80. }
  81. },
  82. watch:{
  83. },
  84. methods: {
  85. openChooseImage(){
  86. uni.chooseImage({
  87. count: 6, //默认9
  88. sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有
  89. sourceType: ['album'], //从相册选择
  90. success: (res) =>{
  91. if(res.tempFilePaths.length>0){
  92. this.imgBg=res.tempFilePaths[0]
  93. this.imgList=res.tempFilePaths
  94. this.isOK=true
  95. }
  96. console.log(JSON.stringify(res.tempFilePaths));
  97. this.$refs.cardPopup.close()
  98. }
  99. });
  100. },
  101. openPopup(){
  102. this.$refs.cardPopup.open()
  103. },
  104. setNextStep(){
  105. if(this.isOK){
  106. uni.switchTab({
  107. 'url':'/pages/index/index'
  108. })
  109. }else {
  110. tools.error('请完善信息')
  111. this.isShakeBut=true
  112. setTimeout(()=>{
  113. this.isShakeBut=false
  114. },500)
  115. }
  116. },
  117. verifyIsOK(){
  118. this.isOK = this.nickname!=='' && this.password.length>=6;
  119. },
  120. setNavHeight(navHeight){
  121. this.navHeight=navHeight+41
  122. },
  123. }
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. @import "/static/css/shake.css";
  128. .pass-box{
  129. .login-box{
  130. padding: 82rpx 80rpx 0 80rpx;
  131. box-sizing: border-box;
  132. position: relative;
  133. .login-top{
  134. .login-title{
  135. padding-bottom: 24rpx;
  136. .title-item{
  137. font-size: 48rpx;
  138. }
  139. }
  140. .card-text{
  141. padding-bottom: 16rpx;
  142. text{
  143. font-size: 28rpx;
  144. }
  145. }
  146. .card-img{
  147. width: calc(100vw - 160rpx);
  148. background: #F6F6F6;
  149. border-radius: 20rpx;
  150. position: relative;
  151. .add-box{
  152. position: absolute;
  153. top: 50%;
  154. left: 50%;
  155. transform: translate(-50%,-50%);
  156. .add-img{
  157. margin: auto auto;
  158. width: 84rpx;
  159. height: 84rpx;
  160. }
  161. }
  162. }
  163. .open-img{
  164. background-repeat: no-repeat;//不平铺
  165. background-position: center center;//居中
  166. background-size: cover;//随容器大小
  167. }
  168. .card-agreement{
  169. margin-top: 32rpx;
  170. }
  171. }
  172. .login-bottom{
  173. padding-bottom: calc(58rpx + env(safe-area-inset-bottom));
  174. position: absolute;
  175. bottom: 0;
  176. left: 68rpx;
  177. width:calc(100vw - 136rpx);
  178. .login-but{
  179. margin-top: 120rpx;
  180. }
  181. }
  182. }
  183. .img-popup{
  184. margin-top: 40rpx;
  185. padding: 0 32rpx calc(58rpx + env(safe-area-inset-bottom)) 32rpx;
  186. .popup-title{
  187. font-size: 36rpx;
  188. }
  189. .popup-text{
  190. padding: 16rpx 0 32rpx;
  191. font-size: 28rpx;
  192. }
  193. .popup-img{
  194. display: flex;
  195. justify-content: space-between;
  196. .popup-item{
  197. display: inline-block;
  198. margin-right:10rpx;
  199. position: relative;
  200. .item-img{
  201. border-radius: 16rpx;
  202. width: calc((100vw - 80rpx)/3);
  203. height: 276rpx;
  204. }
  205. .item-describe{
  206. position: absolute;
  207. left: 32rpx;
  208. bottom: 20rpx;
  209. width: calc((100vw - 80rpx)/3 - 64rpx);
  210. height: 36rpx;
  211. border-radius: 200rpx;
  212. background: rgba(0,0,0,0.6);
  213. display: flex;
  214. justify-content: flex-start;
  215. .describe-img{
  216. width: 36rpx;
  217. height: 36rpx;
  218. }
  219. .describe-text{
  220. margin-left: 8rpx;
  221. font-size: 24rpx;
  222. line-height: 36rpx;
  223. }
  224. }
  225. }
  226. .popup-item:nth-of-type(3n+0){
  227. margin-right:0;
  228. }
  229. }
  230. .popup-but{
  231. margin-top: 58rpx;
  232. }
  233. }
  234. }
  235. </style>