shareApp.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view>
  3. <u-overlay :show="ishow">
  4. <view class="dialog">
  5. <view class="dialog-top">
  6. <view class="dialog-title">
  7. <view>
  8. <view class="">
  9. 辉南渣土车运输
  10. </view>
  11. <view class="" style="font-weight: 400; font-size:30rpx;margin-top: 20rpx;">
  12. V{{newVersion}}
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="dialog-bottom">
  18. <view class="textBox">
  19. <uqrcode ref="uqrcode" canvas-id="qrcode" :value="appUrl" :options="{ margin: 10 }"></uqrcode>
  20. <view style="color: #FC5536;margin-top: 37rpx;">浏览器扫描二维码下载APP</view>
  21. <view style="color: #FC5536;">仅支持安卓手机下载应用</view>
  22. </view>
  23. <u-button class="dialog-button" @click="saveImage"
  24. color="linear-gradient(to top, #F59A02, #FFD334 )" shape="circle" type="warning" text="">
  25. 保存图片
  26. </u-button>
  27. </view>
  28. <view class="update-close" @tap="close(true)">
  29. <u-icon size="66" color="#ffffff" name="close-circle"></u-icon>
  30. </view>
  31. </view>
  32. </u-overlay>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. versionList
  38. } from "../../api/company/my.js"
  39. export default {
  40. name: 'HomeHint',
  41. props: {
  42. show: {
  43. type: Boolean,
  44. default: "",
  45. }
  46. },
  47. data() {
  48. return {
  49. appUrl: '',
  50. ishow: false,
  51. version: null,
  52. newVersion: null,
  53. userId: this.$store.state.user.userId,
  54. // url: ''
  55. }
  56. },
  57. methods: {
  58. // 保存二维码
  59. saveImage() {
  60. // uqrcode为组件的ref名称,为了保证方法调用成功,请在 complete 事件返回success=true后调用。
  61. this.$refs.uqrcode.save({
  62. success: () => {
  63. uni.showToast({
  64. icon: 'success',
  65. title: '保存成功'
  66. });
  67. }
  68. });
  69. },
  70. close(is) {
  71. if (is) {
  72. this.$emit('close', true)
  73. } else {
  74. this.$emit('close')
  75. }
  76. },
  77. // 获取版本信息
  78. getVersion() {
  79. //#ifdef APP-PLUS
  80. // 获取本地应用资源版本号
  81. plus.runtime.getProperty(plus.runtime.appid, (info) => {
  82. console.log(JSON.stringify(info));
  83. this.version = info.version
  84. console.log(this.version);
  85. })
  86. //#endif
  87. },
  88. getVersionList() {
  89. let obj = {}
  90. obj.versionNo = 'admin'
  91. obj.userId = ''
  92. console.log(obj);
  93. versionList(obj).then(res => {
  94. console.log('版本', res);
  95. this.appUrl = res.data.url
  96. this.newVersion = res.data.versionNo
  97. // this.versionCode = info.versionCode ;
  98. })
  99. }
  100. },
  101. mounted() {
  102. this.getVersion()
  103. },
  104. watch: {
  105. show: {
  106. handler(value) {
  107. this.ishow = value;
  108. },
  109. immediate: true, //设置为 true 时,第一次进入页面时即监听
  110. deep: true, // 深度监听父组件传过来对象变化
  111. },
  112. version(newVal) {
  113. if (newVal) {
  114. this.getVersionList()
  115. }
  116. }
  117. },
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .dialog {
  122. position: fixed;
  123. width: 80%;
  124. /* height: 462rpx; */
  125. padding: 0 0 20rpx 0;
  126. background: rgba(255, 255, 255, 0.75);
  127. border: 2rpx solid #77A8FF;
  128. box-shadow: 0rpx 0rpx 24rpx 6rpx rgba(109, 160, 251, 0.6);
  129. border-radius: 28rpx;
  130. top: 50%;
  131. left: 50%;
  132. transform: translate(-50%, -50%);
  133. }
  134. .dialog-top {
  135. position: relative;
  136. height: 338rpx;
  137. top: -90rpx;
  138. width: 100%;
  139. background: url('@/static/images/tooltip5.png');
  140. background-size: 100% 100%;
  141. }
  142. .dialog-title {
  143. text-align: center;
  144. position: absolute;
  145. bottom: 31rpx;
  146. left: 50%;
  147. transform: translate(-50%);
  148. font-weight: bold;
  149. color: #2F4173;
  150. font-size: 34rpx;
  151. }
  152. .dialog-bottom {
  153. /* width: 542rpx; */
  154. /* height: 200rpx; */
  155. /* position: absolute; */
  156. /* bottom: 15rpx; */
  157. display: flex;
  158. flex-direction: column;
  159. align-items: center;
  160. margin-top: -70rpx;
  161. }
  162. .textBox {
  163. font-size: 30rpx;
  164. font-weight: bold;
  165. color: #485B93;
  166. line-height: 60rpx;
  167. text-align: center;
  168. display: flex;
  169. flex-direction: column;
  170. align-items: center;
  171. }
  172. .dialog-button {
  173. width: 238rpx;
  174. height: 75rpx;
  175. margin-top: 42rpx;
  176. margin-bottom: 42rpx;
  177. font-size: 28rpx;
  178. font-weight: bold;
  179. }
  180. .update-close {
  181. position: absolute;
  182. text-align: center;
  183. left: 50%;
  184. transform: translate(-50%);
  185. bottom: -100rpx;
  186. }
  187. </style>