index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view style="background-color: #FFFFFF;height: 100vh;" class="u-skeleton">
  3. <view class="status_bar">
  4. <!-- 这里是状态栏 -->
  5. </view>
  6. <view class="u-page" style="margin-bottom: 20rpx;">
  7. <view class="u-m-t-20">
  8. <u-swiper :list="bannersList" :height="310" :effect3d="true" border-radius="20" effect3d-previous-margin="20"
  9. bg-color="#FFF" class="u-skeleton-fillet" v-if="bannersList.length!=0"></u-swiper>
  10. <u-swiper :list="list" :height="310" :effect3d="true" border-radius="20" effect3d-previous-margin="20" bg-color="#FFF"
  11. class="u-skeleton-fillet" v-else></u-swiper>
  12. </view>
  13. <view class="u-flex u-m-t-20 u-m-l-20 u-m-r-20 u-skeleton-fillet" style="width:710rpx;">
  14. <!-- <view class="u-flex u-row-center" style="width: 150rpx; height: 70rpx;border-radius: 50rpx;background: rgba(52,140,245,0.1);font-size: 20rpx;color: #348CF5; font-size: 500;">
  15. <u-image width="45rpx" height="35rpx" src="../../static/sailun/speaker.png" style="margin:10rpx;"></u-image>公告
  16. <u-notice-bar mode="horizontal" :list="noticebarList" :volume-icon="false" bg-color="#FFF" color="#2B2B2B" padding="18rpx 12rpx" :is-circular="false"></u-notice-bar> -->
  17. <u-notice-bar mode="vertical" :list="noticebarList" style="width: 710rpx;" type="primary"></u-notice-bar>
  18. </view>
  19. <view class="u-flex u-m-t-20 u-row-around u-m-l-10 u-m-r-10">
  20. <u-image width="350rpx" src="../../static/sailun/scan_in.png" @click="scancodeIn" mode="widthFix" class="u-skeleton-fillet"></u-image>
  21. <u-image width="350rpx" src="../../static/sailun/scan_out.png" @click="scancodeOut" mode="widthFix" class="u-skeleton-fillet"></u-image>
  22. </view>
  23. <view class="u-m-t-20">
  24. <view class="u-m-l-30" style="font-size: 34rpx;">
  25. 快捷服务
  26. </view>
  27. <view class="u-flex u-flex-wrap u-row-center">
  28. <u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/1.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
  29. @click="inStock"></u-image>
  30. <u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/2.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
  31. @click="inMonthlyPolicy"></u-image>
  32. <u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/3.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
  33. @click="inInlineshop"></u-image>
  34. <u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/4.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
  35. @click="inIntegral"></u-image>
  36. </view>
  37. </view>
  38. <view class="u-flex u-row-center u-m-t-30">
  39. <u-image class="u-skeleton-fillet" width="680rpx" src="../../static/sailun/88reward.png" mode="widthFix"></u-image>
  40. </view>
  41. </view>
  42. <!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
  43. <!-- <u-tabbar v-model="current" :list="list"></u-tabbar> -->
  44. <u-skeleton :loading="loading" :animation="true"></u-skeleton>
  45. <u-toast ref="ulogin" />
  46. <luo-version-upgrade v-if="show_s == true" version="1.0.1" :url="url" :is_force="is_force" :describe="Copywriting"></luo-version-upgrade>
  47. </view>
  48. </template>
  49. <script>
  50. import versionUpgrade from "../../components/luo-version-upgrade/luo-version-upgrade.vue";
  51. import {
  52. mapState,
  53. mapMutations
  54. } from 'vuex'
  55. import {
  56. request
  57. } from '../../common/request/request'
  58. require("promise.prototype.finally").shim()
  59. import axios from 'axios'
  60. export default {
  61. components: { versionUpgrade },
  62. data() {
  63. return {
  64. bannersList: [],
  65. noticebarList: [],
  66. loading: true, // 是否显示骨架屏组件
  67. list: [
  68. '../../static/sailun/swiper1.png'
  69. ],
  70. show_s: false,
  71. url: '',
  72. is_force:false,
  73. Copywriting:''
  74. }
  75. },
  76. onLoad() {
  77. uni.$on('login', (data) => {
  78. this.loginStatus = data.msg
  79. })
  80. },
  81. onReady() {
  82. if (this.loginStatus == "登录成功") {
  83. this.$refs.ulogin.show({
  84. title: "登录成功",
  85. })
  86. }
  87. this.onLaunch_s()
  88. },
  89. created() {
  90. if (this.hasLogin) {
  91. uni.showLoading({
  92. title: '加载中...'
  93. });
  94. axios.all([this.getBanners(), this.getTiceList()])
  95. .then(axios.spread((one, two) => {
  96. this.bannersList = one.data.data.map(t => t.imgPath)
  97. this.noticebarList = two.data.data.map(t => t.msgContent)
  98. }))
  99. .catch(err => {
  100. console.log(err)
  101. })
  102. .finally(() => {
  103. this.loading = false;
  104. uni.hideLoading();
  105. })
  106. }
  107. uni.getSystemInfo({
  108. success: function (res) {
  109. console.log(res.platform);
  110. if(res.platform == android){
  111. this.onLaunch_s()
  112. console.log("5896558596589658626565656615615512651561651561651")
  113. }else if(res.platform == ios){
  114. console.log("暂无数据")
  115. console.log("626515616561658158461586515686586641565847444598660351651965145985987456")
  116. }
  117. }
  118. });
  119. },
  120. computed: {
  121. ...mapState(['hasLogin'])
  122. },
  123. methods: {
  124. //升级调用的接口
  125. onLaunch_s() {
  126. request({
  127. url: '/baseReq/apkUpgrade',
  128. method: 'get',
  129. params: {
  130. osType: 0
  131. }
  132. }).then(res => {
  133. console.log(res.data.code)
  134. console.log(res.data.forceVersion) //最低版本
  135. console.log(res.data.msg) //更新文案
  136. console.log(res.data.url) //下载最新版地址
  137. console.log(res.data.version) //最新版本
  138. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  139. console.log(wgtinfo);
  140. console.log(wgtinfo.version); //版本号
  141. if(wgtinfo.version == res.data.version){
  142. this.show_s = false
  143. // uni.showToast({
  144. // icon: 'none',
  145. // title: '已是最新版本',
  146. // position: "bottom"
  147. // })
  148. console.log("已是最新版本")
  149. }else if (wgtinfo.version != res.data.forceVersion) {
  150. console.log("必须强制更新")
  151. this.Copywriting = res.data.msg
  152. console.log(this.Copywriting)
  153. this.show_s = true
  154. console.log(res.data.url)
  155. this.url = res.data.url
  156. this.is_force = true
  157. }else if(wgtinfo.version == res.data.forceVersion){
  158. console.log("达到最低版本")
  159. this.Copywriting = res.data.msg
  160. console.log(this.Copywriting)
  161. this.is_force = false
  162. this.show_s = true
  163. this.url = res.data.url
  164. }
  165. })
  166. }).catch(err => {
  167. console.log(err)
  168. })
  169. .finally(() => {
  170. // Loading.close()
  171. })
  172. },
  173. //轮播图
  174. getBanners() {
  175. return request({
  176. url: '/homepage/getBanners',
  177. method: 'post',
  178. data: {
  179. "storeId": this.$store.state.storeInfo.storeId,
  180. "showPosition": 0, //门店0
  181. }
  182. })
  183. },
  184. //消息文字跑马灯
  185. getTiceList() {
  186. return request({
  187. url: '/homepage/noticeList',
  188. method: 'post',
  189. data: {
  190. "storeId": this.$store.state.storeInfo.storeId,
  191. "contentType": "1" //门店1
  192. }
  193. })
  194. },
  195. scancodeIn() {
  196. this.$u.route({
  197. url: 'pages/home/scancode/index',
  198. })
  199. },
  200. scancodeOut() {
  201. this.$u.route({
  202. url: 'pages/home/scancode/scancodeout',
  203. })
  204. },
  205. inStock() {
  206. this.$u.route({
  207. url: 'pages/home/my-stock/my-stock',
  208. })
  209. },
  210. inMonthlyPolicy() {
  211. this.$u.route({
  212. url: 'pages/home/monthly-policy/monthly-policy',
  213. })
  214. },
  215. inInlineshop() {
  216. this.$u.toast('线下订货暂不开放');
  217. // this.$u.route({
  218. // url: 'pages/home/inline-shop/inline_shop',
  219. // })
  220. },
  221. inIntegral() {
  222. this.$u.toast('积分商城暂不开放');
  223. // this.$u.route({
  224. // url: 'pages/home/integral-mall/integral_mall',
  225. // })
  226. }
  227. },
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. .status_bar {
  232. height: var(--status-bar-height);
  233. width: 100%;
  234. background-color: #FFF;
  235. }
  236. </style>