cards.vue 7.7 KB

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