openpictrue.vue 4.3 KB

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