openpictrue.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view>
  3. <view class="example" @click="togglePopup('')">
  4. <uniPopup :show="types" position="middle" mode="insert" >
  5. <view class="uni-center center-box">
  6. <img mode="widthFix" :src="images" style="width: 100%;"/>
  7. <!-- <img @bindload="imageLoad" :src="images" style="width: images[index].widthrpx; height:images[index].heightrpx;"/> -->
  8. </view>
  9. </uniPopup>
  10. </view>
  11. </view>
  12. <!--
  13. <view v-if="types" style="width: 100vw;
  14. height:100vh;
  15. position: fixed;
  16. z-index: 99;
  17. top: 0;
  18. right: 0;
  19. bottom: 0;
  20. left: 0;
  21. background-color: black;">
  22. <view style="position: absolute;
  23. width: 0px;
  24. top: 50%;
  25. width: 100%;height: 100%;
  26. left: 50%;
  27. transform: translate(-50%, -50%);">
  28. <img mode='widthFix' :src="images" />
  29. </view> -->
  30. </view>
  31. </template>
  32. <script>
  33. import uniPopup from './uni-popup.vue'
  34. export default {
  35. props: {
  36. show: {
  37. default: false,
  38. type: Boolean
  39. },
  40. images: {
  41. default: '',
  42. type: String
  43. }
  44. },
  45. components: {
  46. uniPopup
  47. },
  48. watch: {
  49. 'show':function(val) {
  50. console.log(val)
  51. if(val) {
  52. this.types = true;
  53. }else {
  54. this.types = false;
  55. }
  56. },
  57. },
  58. data() {
  59. return {
  60. types: false,
  61. pictureUrl: this.pictureUrl,
  62. images:[],
  63. list: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
  64. };
  65. },
  66. // onBackPress() {
  67. // if (this.type !== '') {
  68. // this.type = '';
  69. // return true;
  70. // }
  71. // },
  72. methods: {
  73. // imageLoad() {
  74. // console.log("999");
  75. // let $width=e.detail.width; //获取图片真实宽度
  76. // let $height=e.detail.height;
  77. // let ratio=$width/$height; //图片的真实宽高比例
  78. // let viewWidth=718; //设置图片显示宽度,左右留有16rpx边距
  79. // let viewHeight=718/ratio; //计算的高度值
  80. // let image= this.data.images;
  81. // //将图片的datadata-index作为image对象的key,然后存储图片的宽高值
  82. // image[e.target.dataset.index]={
  83. // width:viewWidth,
  84. // height:viewHeight
  85. // }
  86. // this.data.images = images;
  87. // },
  88. togglePopup() {
  89. this.type = false;
  90. uni.$emit('changshow')
  91. },
  92. gomoney() {
  93. // uni.navigateTo({
  94. // url:'/pages/myCenter/definite'
  95. // })
  96. }
  97. }
  98. };
  99. </script>
  100. <style>
  101. page {
  102. display: flex;
  103. flex-direction: column;
  104. box-sizing: border-box;
  105. background-color: #fff
  106. }
  107. view {
  108. font-size: 28upx;
  109. line-height: inherit
  110. }
  111. .example {
  112. padding: 0 30upx 30upx
  113. }
  114. .example-title {
  115. font-size: 32upx;
  116. line-height: 32upx;
  117. color: #777;
  118. margin: 40upx 25upx;
  119. position: relative
  120. }
  121. .example .example-title {
  122. margin: 40upx 0
  123. }
  124. .example-body {
  125. padding: 0 40upx
  126. }
  127. .uni-padding-wrap {
  128. padding: 0 30upx;
  129. }
  130. button {
  131. margin: 20upx 0;
  132. }
  133. .uni-helllo-text {
  134. height: 100upx;
  135. line-height: 100upx;
  136. text-align: center;
  137. }
  138. .center-box {
  139. width: 100vw;
  140. }
  141. .uni-list-item {
  142. text-align: left;
  143. line-height: 80upx;
  144. border-bottom: 1px #f5f5f5 solid;
  145. }
  146. .uni-list-item:last-child {
  147. border: none;
  148. }
  149. .center-box .image {
  150. width: 100%;
  151. height: 100%;
  152. }
  153. .bottom-title {
  154. line-height: 60upx;
  155. font-size: 24upx;
  156. padding: 15upx 0;
  157. }
  158. .bottom-content {
  159. display: flex;
  160. flex-wrap: wrap;
  161. padding: 0 35upx;
  162. }
  163. .bottom-content-box {
  164. display: flex;
  165. flex-direction: column;
  166. align-items: center;
  167. margin-bottom: 15upx;
  168. width: 25%;
  169. box-sizing: border-box;
  170. }
  171. .bottom-content-image {
  172. display: flex;
  173. justify-content: center;
  174. align-items: center;
  175. width: 90upx;
  176. height: 90upx;
  177. overflow: hidden;
  178. background: #007aff;
  179. border-radius: 10upx;
  180. }
  181. .bottom-content-text {
  182. font-size: 26upx;
  183. color: #333;
  184. margin-top: 10upx;
  185. }
  186. .bottom-btn {
  187. height: 90upx;
  188. line-height: 90upx;
  189. border-top: 1px #f5f5f5 solid;
  190. }
  191. .bottom-content-image.wx {
  192. background: #00ce47;
  193. }
  194. .bottom-content-image.qq {
  195. background: #00b6f6;
  196. }
  197. .bottom-content-image.sina {
  198. background: #ff766a;
  199. }
  200. .bottom-content-image.copy {
  201. background: #07ccd0;
  202. }
  203. @font-face {
  204. font-family: 'iconfont';
  205. /* project id 1028200 */
  206. src: url('https://at.alicdn.com/t/font_1028200_47ewtwy4t04.ttf') format('truetype');
  207. }
  208. .icon {
  209. font-family: 'iconfont';
  210. font-size: 40upx;
  211. color: #fff;
  212. }
  213. </style>