index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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" @tap="$u.throttle(inPage(0), 1000)" mode="widthFix"
  21. class="u-skeleton-fillet"></u-image>
  22. <u-image width="350rpx" src="../../static/sailun/scan_out.png" @tap="$u.throttle(inPage(1), 1000)" mode="widthFix"
  23. class="u-skeleton-fillet"></u-image>
  24. </view>
  25. <view class="u-m-t-20">
  26. <view class="u-m-l-30" style="font-size: 34rpx;">
  27. 快捷服务
  28. </view>
  29. <view class="u-flex u-flex-wrap u-row-center">
  30. <u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/task.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
  31. @click="inPage(5)"></u-image>
  32. <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;"
  33. @click="inPage(3)"></u-image>
  34. <u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/inquire.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
  35. @click="inPage(4)"></u-image>
  36. <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;"
  37. @click="inPage(2)"></u-image>
  38. </view>
  39. </view>
  40. <view class="u-flex u-row-center u-m-t-30">
  41. <u-image class="u-skeleton-fillet" width="680rpx" src="../../static/sailun/88reward.png" mode="widthFix"></u-image>
  42. </view>
  43. </view>
  44. <!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
  45. <!-- <u-tabbar v-model="current" :list="list"></u-tabbar> -->
  46. <u-skeleton :loading="loading" :animation="true"></u-skeleton>
  47. <u-toast ref="ulogin" />
  48. <luo-version-upgrade v-if="show_s == true" version="1.0.1" :url="url" :is_force="is_force" :describe="Copywriting"></luo-version-upgrade>
  49. </view>
  50. </template>
  51. <script>
  52. import versionUpgrade from "../../components/luo-version-upgrade/luo-version-upgrade.vue";
  53. import {
  54. mapState,
  55. mapMutations
  56. } from 'vuex'
  57. import {
  58. request
  59. } from '../../common/request/request'
  60. require("promise.prototype.finally").shim()
  61. import axios from 'axios'
  62. export default {
  63. components: {
  64. versionUpgrade
  65. },
  66. data() {
  67. return {
  68. bannersList: [],
  69. noticebarList: [],
  70. loading: true, // 是否显示骨架屏组件
  71. list: [
  72. '../../static/sailun/swiper1.png'
  73. ],
  74. show_s: false,
  75. url: '',
  76. is_force: false,
  77. Copywriting: '',
  78. }
  79. },
  80. onLoad() {
  81. uni.$on('login', (data) => {
  82. this.loginStatus = data.msg
  83. })
  84. },
  85. onReady() {
  86. if (this.loginStatus == "登录成功") {
  87. this.$refs.ulogin.show({
  88. title: "登录成功",
  89. })
  90. }
  91. },
  92. created() {
  93. if (this.hasLogin) {
  94. uni.showLoading({
  95. title: '加载中...'
  96. });
  97. axios.all([this.getBanners(), this.getTiceList()])
  98. .then(axios.spread((one, two) => {
  99. this.bannersList = one.data.data.map(t => t.imgPath)
  100. this.noticebarList = two.data.data.map(t => t.msgContent)
  101. }))
  102. .catch(err => {
  103. })
  104. .finally(() => {
  105. this.loading = false;
  106. uni.hideLoading();
  107. })
  108. }
  109. },
  110. onShow() {
  111. this.system()
  112. },
  113. computed: {
  114. ...mapState(['hasLogin'])
  115. },
  116. methods: {
  117. system() {
  118. uni.getSystemInfo({
  119. success: res => {
  120. //
  121. },
  122. complete: err => {
  123. if (err.platform == 'android') {
  124. this.onLaunch_s()
  125. } else if (err.platform == 'ios') {
  126. //
  127. this.iosstartup()
  128. }
  129. }
  130. });
  131. },
  132. iosstartup() {
  133. request({
  134. url: '/baseReq/apkUpgrade',
  135. method: 'get',
  136. params: {
  137. osType: 1
  138. }
  139. }).then(res => {
  140. //
  141. //
  142. // //最低版本
  143. // //更新文案
  144. // //最新版本
  145. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  146. //
  147. //版本号
  148. if (wgtinfo.version == res.data.version) {
  149. this.show_s = true
  150. // uni.showToast({
  151. // icon: 'none',
  152. // title: '已是最新版本',
  153. // position: "bottom"
  154. // })
  155. //
  156. } else if (wgtinfo.version != res.data.forceVersion) {
  157. //
  158. res.data.msg = res.data.msg.replace(/\\n/g, "\n")
  159. uni.showModal({
  160. title: "发现新版本",
  161. content: res.data.msg,
  162. showCancel: false,
  163. confirmText: "立即去AppStore更新",
  164. success: function(res) {
  165. if (res.confirm) {
  166. //
  167. let appleId = 1518555723
  168. plus.runtime.launchApplication({
  169. action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
  170. }, function(e) {
  171. });
  172. } else if (res.cancel) {
  173. }
  174. }
  175. })
  176. } else if (wgtinfo.version == res.data.forceVersion) {
  177. res.data.msg = res.data.msg.replace(/\\n/g, "\n")
  178. uni.showModal({
  179. title: "发现新版本",
  180. content: res.data.msg,
  181. showCancel: true,
  182. confirmText: "立即去AppStore更新",
  183. success: function(res) {
  184. if (res.confirm) {
  185. let appleId = 1518555723
  186. plus.runtime.launchApplication({
  187. action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
  188. }, function(e) {
  189. });
  190. } else if (res.cancel) {
  191. }
  192. }
  193. })
  194. }
  195. })
  196. }).catch(err => {
  197. })
  198. .finally(() => {
  199. // Loading.close()
  200. })
  201. },
  202. //升级调用的接口
  203. onLaunch_s() {
  204. request({
  205. url: '/baseReq/apkUpgrade',
  206. method: 'get',
  207. params: {
  208. osType: 0
  209. }
  210. }).then(res => {
  211. //最低版本
  212. //更新文案
  213. //下载最新版地址
  214. //最新版本
  215. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  216. //版本号
  217. if (wgtinfo.version == res.data.version) {
  218. this.show_s = false
  219. // uni.showToast({
  220. // icon: 'none',
  221. // title: '已是最新版本',
  222. // position: "bottom"
  223. // })
  224. } else if (wgtinfo.version != res.data.forceVersion) {
  225. this.Copywriting = res.data.msg
  226. this.show_s = true
  227. this.url = res.data.url
  228. this.is_force = true
  229. } else if (wgtinfo.version == res.data.forceVersion) {
  230. this.Copywriting = res.data.msg
  231. this.is_force = false
  232. this.show_s = true
  233. this.url = res.data.url
  234. }
  235. })
  236. }).catch(err => {
  237. })
  238. .finally(() => {
  239. // Loading.close()
  240. })
  241. },
  242. //轮播图
  243. getBanners() {
  244. return request({
  245. url: '/homepage/getBanners',
  246. method: 'post',
  247. data: {
  248. "storeId": this.$store.state.storeInfo.storeId,
  249. "showPosition": 0, //门店0
  250. }
  251. })
  252. },
  253. //消息文字跑马灯
  254. getTiceList() {
  255. return request({
  256. url: '/homepage/noticeList',
  257. method: 'post',
  258. data: {
  259. "storeId": this.$store.state.storeInfo.storeId,
  260. "contentType": "1" //门店1
  261. }
  262. })
  263. },
  264. inPage(index) {
  265. switch (index) {
  266. case 0:
  267. {
  268. this.$u.route({
  269. url: 'pages/home/scancode/index',
  270. })
  271. break;
  272. }
  273. case 1:
  274. {
  275. this.$u.route({
  276. url: 'pages/home/scancode/scancodeout',
  277. })
  278. break;
  279. }
  280. case 2:
  281. {
  282. this.$u.route({
  283. url: 'pages/home/my-stock/my-stock',
  284. })
  285. break;
  286. }
  287. case 3:
  288. {
  289. this.$u.route({
  290. url: 'pages/home/monthly-policy/monthly-policy',
  291. })
  292. break;
  293. }
  294. case 4:
  295. {
  296. this.$u.route({
  297. url: 'pages/home/scancodequery/result',
  298. })
  299. break;
  300. }
  301. case 5:
  302. {
  303. this.$u.route({
  304. url: 'pages/home/Statistical-task/index',
  305. })
  306. break;
  307. }
  308. }
  309. },
  310. inInlineshop() {
  311. this.$u.toast('线上订货暂不开放');
  312. // this.$u.route({
  313. // url: 'pages/home/inline-shop/inline_shop',
  314. // })
  315. },
  316. inIntegral() {
  317. this.$u.toast('积分商城暂不开放');
  318. // this.$u.route({
  319. // url: 'pages/home/integral-mall/integral_mall',
  320. // })
  321. }
  322. },
  323. }
  324. </script>
  325. <style lang="scss" scoped>
  326. .status_bar {
  327. height: var(--status-bar-height);
  328. width: 100%;
  329. background-color: #FFF;
  330. }
  331. </style>