index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <view class="container" :style="{background:`url(${picUrl+'/static/other/indexB.png'}) no-repeat;`}">
  3. <navBar title="GIGESI 吉格斯" :navImg="navImg" :back="false" color="#333333" background="#FFFFFF" />
  4. <!-- 轮播和订购区 -->
  5. <view class="swiperAndBook">
  6. <view class="tab">
  7. <view class="item" v-for="(item,index) in tabList" :class="[currTabIndex==index?'itemA':'']"
  8. @click="tabChange(item,index)">
  9. {{item}}
  10. </view>
  11. </view>
  12. <view class="bottomBtn">
  13. <swiper :current="currTabIndex" @change="bindChange" class='swiperImg'>
  14. <swiper-item class="swiperImg">
  15. <image class="swiperImg" :src="picBase+bannerList11[0].cover" mode="widthFix"></image>
  16. </swiper-item class="swiperImg">
  17. <swiper-item>
  18. <image class="swiperImg" :src="picBase+bannerList22[0].cover" mode="widthFix"></image>
  19. </swiper-item>
  20. <swiper-item class="swiperImg">
  21. <image class="swiperImg" :src="picBase+bannerList33[0].cover" mode="widthFix"></image>
  22. </swiper-item>
  23. </swiper>
  24. <view class="bookingAndIndicator">
  25. <view class="btn" @click="toList">
  26. <text class="btnTxt">一键定制</text>
  27. <image :src="picUrl+'/static/other/halfRight.png'" mode="" style="width: 30rpx;height: 20rpx;">
  28. </image>
  29. </view>
  30. <view class="indicatorBox">
  31. <view class="indicator">
  32. <view class="indicator__dot" style="" v-for="(item, index) in tabList" :key="index"
  33. :class="[index === currTabIndex ?'indicator__dot--active':'']">
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="bg" style="">
  41. <view class="controlPart" @click="toPage(1)">
  42. <view class="top">
  43. <view class="left">
  44. <image src="/static/index/part1_icon.png" mode="" style="width: 56rpx;height: 28rpx;">
  45. </image>
  46. <view class="title">
  47. 智能控制系统
  48. </view>
  49. </view>
  50. <image src="/static/index/more.png" mode="" style="width: 48rpx;height: 48rpx;"></image>
  51. </view>
  52. <view class="con">
  53. <image :src="picBase+bannerList44[0].cover" mode="aspectFill"></image>
  54. </view>
  55. </view>
  56. <view class="controlPart" @click="toPage(2)">
  57. <view class="top">
  58. <view class="left">
  59. <image src="/static/index/part1_icon.png" mode="" style="width: 56rpx;height: 28rpx;">
  60. </image>
  61. <view class="title">
  62. 网络规划-全屋WiFi
  63. </view>
  64. </view>
  65. <image src="/static/index/more.png" mode="" style="width: 48rpx;height: 48rpx;"></image>
  66. </view>
  67. <view class="con">
  68. <image :src="picBase+bannerList55[0].cover" mode="aspectFill"></image>
  69. </view>
  70. </view>
  71. <!-- 产品指南 -->
  72. <view class="productLead">
  73. <view class="top" @click="toPage(3)">
  74. <view class="left">
  75. <view class="bottomEng">
  76. PRODUCT GUIDE
  77. </view>
  78. <view class="bt">
  79. <view class="title">
  80. 产品指南
  81. </view>
  82. <image src="/static/index/zhinan.png" mode="" style="width: 32rpx;height: 32rpx;">
  83. </image>
  84. </view>
  85. </view>
  86. <image src="/static/index/more.png" mode="" style="width: 48rpx;height: 48rpx;"></image>
  87. </view>
  88. <view class="con">
  89. <view class="item" v-for="(item,index) in leadList" @click="toLeadDetail(item)">
  90. <image :src="picBase+item.image" mode=""></image>
  91. <view class="bottom">
  92. {{item.title}}
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 展厅地址 -->
  98. <view class="productLead" style="padding-left: 0;">
  99. <view class="top" style="padding-left: 32rpx;" @click="toAddrList">
  100. <view class="left">
  101. <view class="bottomEng">
  102. ADDRESS
  103. </view>
  104. <view class="bt">
  105. <view class="title">
  106. 城市展厅
  107. </view>
  108. <image src="/static/index/addr.png" mode="" style="width: 26rpx;height: 36rpx;"></image>
  109. </view>
  110. </view>
  111. <image src="/static/index/more.png" mode="" style="width: 48rpx;height: 48rpx;"></image>
  112. </view>
  113. <view class="conLast">
  114. <u-swiper type='def' class="swiper" :defList="bannerList1" keyName="img_url" indicator
  115. indicatorMode="line" :autoplay="true" previousMargin="30" nextMargin="30" height="490rpx"
  116. radius="40rpx" imgMode="scaleToFill" bgColor="rgba(255,255,255,0)" circular
  117. @change="e => currentNum1 = e.current" @click1="jumpLink">
  118. <view slot="indicator">
  119. </view>
  120. <view slot="defCon">
  121. </view>
  122. </u-swiper>
  123. <!-- 自定义轮播图指示器 -->
  124. <view class="indicatorBox1">
  125. <view class="indicator1">
  126. <view class="indicator1__dot1" style="" v-for="(item, index) in bannerList1" :key="index"
  127. :class="[index === currentNum1 ?'indicator1__dot1--active1':'']">
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <u-loadmore style="" loadmoreText="已经到底啦" color="#CCCCCC" lineColor="#CCCCCC" line />
  134. </view>
  135. <u-loading-page :loading="loading" image="/static/index/logo.png" loading-text="页面加载中..."></u-loading-page>
  136. <!-- 隐私弹框 -->
  137. <privacy-popup @confirmP="confirmP" @cancleP="cancleP" :showPrivateBox="showPop"></privacy-popup>
  138. </view>
  139. </template>
  140. <script>
  141. import PrivacyPopup from "@/components/privacyPopup/index.vue";
  142. import {
  143. getBannerDataReq,
  144. getAddressDataReq,
  145. getGuideDataReq,
  146. } from '@/api/index/index.js'
  147. import {
  148. getPricePercentReq,
  149. getAfterSaleCon,
  150. getIndexTopPics,
  151. addInviteReq
  152. } from '@/api/test/index.js'
  153. export default {
  154. components: {
  155. PrivacyPopup
  156. },
  157. data() {
  158. return {
  159. showPop: false,
  160. picUrl: this.$picUrl,
  161. picBase: this.$picBase,
  162. leadList: [],
  163. bannerList11: [],
  164. bannerList22: [],
  165. bannerList33: [],
  166. bannerList44: [],
  167. bannerList55: [],
  168. bannerList66: [],
  169. bannerList1: [],
  170. currentNum: 0,
  171. currentNum1: 0,
  172. tabList: ['无主灯', '主灯', '吸顶灯'],
  173. currTabIndex: 0,
  174. navImg: require('@/static/index/logo.png'),
  175. list: [],
  176. loading: true
  177. }
  178. },
  179. async onLoad(o) {
  180. // o.inviteId = ''
  181. let res55 = await getBannerDataReq()
  182. if (res55.code == 0) {
  183. console.log('首页全局配置数据:', res55);
  184. this.bannerList11 = [res55.data.find((item, index) => {
  185. return item.title == '无主灯'
  186. })]
  187. this.bannerList22 = [res55.data.find((item, index) => {
  188. return item.title == '主灯'
  189. })]
  190. this.bannerList33 = [res55.data.find((item, index) => {
  191. return item.title == '吸顶灯'
  192. })]
  193. this.bannerList44 = [res55.data.find((item, index) => {
  194. return item.title == '智能控制系统'
  195. })]
  196. this.bannerList55 = [res55.data.find((item, index) => {
  197. return item.title == '网络规划-全屋WiFi'
  198. })]
  199. console.log('全局静态资源数据', this.bannerList11, this.bannerList22, this.bannerList33, this
  200. .bannerList44, this.bannerList55);
  201. this.loading = false
  202. } else {
  203. this.loading = false
  204. this.$toast(res55.message)
  205. }
  206. if (o.inviteId) {
  207. uni.setStorageSync('inviteId', o.inviteId)
  208. console.log('接收到的o.inviteId', o.inviteId);
  209. }
  210. if (o.scene) {
  211. uni.setStorageSync('afterSaleId', o.scene)
  212. console.log('接收到的o.afterSaleId', o.scene);
  213. }
  214. // o.scene = 'b3f48188b03b54aeb32256c825044e35'
  215. if (uni.getStorageSync('token') && o.scene) {
  216. let res88 = await getAfterSaleCon({
  217. id: o.scene
  218. })
  219. if (res88.code == 0) {
  220. console.log('测试邀请:', res88);
  221. } else {
  222. this.$toast(res88.message)
  223. }
  224. }
  225. if (uni.getStorageSync('token') && o.inviteId) {
  226. let res99 = await addInviteReq({
  227. // id: o.inviteId
  228. inviteId: o.inviteId
  229. })
  230. if (res99.code == 0) {
  231. console.log('测试邀请登录态-----o.inviteId:', res99);
  232. } else {
  233. this.$toast(res99.message)
  234. }
  235. }
  236. console.log('首页收到的o:', JSON.stringify(o));
  237. let res1 = await getAddressDataReq()
  238. if (res1.code == 0) {
  239. this.bannerList1 = res1.data
  240. console.log('地址轮播图数据', this.bannerList1);
  241. } else {
  242. this.$toast(res1.message)
  243. }
  244. let res2 = await getGuideDataReq()
  245. if (res2.code == 0) {
  246. this.leadList = res2.data
  247. console.log('首页产品指南列表返回值:', this.leadList);
  248. } else {
  249. uni.showToast({
  250. title: res2.message,
  251. icon: 'none'
  252. })
  253. }
  254. },
  255. onShow() {
  256. this.handlePrivate()
  257. },
  258. methods: {
  259. confirmP() {
  260. this.showPop = false
  261. uni.showTabBar({
  262. animation: true, // 是否需要滚动动画,默认false
  263. success: function(res) {
  264. }
  265. })
  266. },
  267. cancleP() {
  268. console.log('cancelP()------');
  269. this.showPop = false
  270. uni.showTabBar({
  271. animation: true, // 是否需要滚动动画,默认false
  272. success: function(res) {
  273. }
  274. })
  275. },
  276. handlePrivate() {
  277. uni.hideTabBar()
  278. let _this = this
  279. if (uni.getPrivacySetting) {
  280. uni.getPrivacySetting({
  281. success: res => {
  282. console.log("是否需要授权--首页:", res.needAuthorization, "隐私协议的名称为:", res
  283. .privacyContractName)
  284. if (res.needAuthorization) {
  285. getApp().globalData.showPrivacy = true;
  286. _this.showPop = true
  287. } else {
  288. getApp().globalData.showPrivacy = false;
  289. uni.showTabBar({
  290. animation: true, // 是否需要滚动动画,默认false
  291. success: function(res) {}
  292. })
  293. }
  294. },
  295. fail: () => {},
  296. complete: () => {},
  297. })
  298. }
  299. },
  300. bindChange(e) {
  301. this.currTabIndex = e.detail.current
  302. console.log('e-----------', e.detail.current);
  303. },
  304. tabChange(item, index) {
  305. this.currTabIndex = index
  306. },
  307. toAddrList() {
  308. uni.navigateTo({
  309. url: '/pages/index/addrList/index'
  310. })
  311. },
  312. toLeadDetail(item) {
  313. getApp().Litem = item
  314. uni.navigateTo({
  315. url: '/pages/index/productLeadDetail/index'
  316. })
  317. },
  318. toList() {
  319. if (this.currTabIndex == 0) {
  320. getApp().noMainImg = this.bannerList11[0]
  321. uni.navigateTo({
  322. url: '/pages/index/customNoMian_step1/index'
  323. })
  324. } else if (this.currTabIndex == 1) {
  325. getApp().noMainImg = this.bannerList22[0]
  326. uni.navigateTo({
  327. url: '/pages/index/customMian_step1/index'
  328. })
  329. } else {
  330. getApp().noMainImg = this.bannerList33[0]
  331. uni.navigateTo({
  332. url: '/pages/index/customMian_step1/index?type=5'
  333. })
  334. }
  335. },
  336. toPage(i) {
  337. if (i == 2) {
  338. getApp().noMainImg = this.bannerList55[0]
  339. uni.navigateTo({
  340. url: '/pages/index/fullHouseWifi/index'
  341. })
  342. } else if (i == 1) {
  343. getApp().noMainImg = this.bannerList44[0]
  344. uni.navigateTo({
  345. url: '/pages/index/aiControlSys/index'
  346. })
  347. } else {
  348. uni.navigateTo({
  349. url: '/pages/index/productLead/index'
  350. })
  351. }
  352. },
  353. async testReq() {
  354. let res = await getBannerDataReq()
  355. this.$toast(res.msg)
  356. console.log('返回值', res);
  357. }
  358. }
  359. }
  360. </script>
  361. <style lang="scss" scoped>
  362. @import "./index.scss";
  363. </style>