index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <div>
  3. <div class="tabbar" :class="{dark: handleType}">
  4. <div
  5. class="tabbarItem"
  6. @click="handleItem(item, index)"
  7. :class="{ activeMenu: active == index }"
  8. v-for="(item, index) in list"
  9. :key="index"
  10. >
  11. <div :class="{ aotoImg: index == 2 }">
  12. <img
  13. :src="active == index ? item.active : handleType ? item.dark : item.light"
  14. :width="index == 2 ? '50px' : '48px'"
  15. :height="index == 2 ? '50px' : '48px'"
  16. ></img>
  17. </div>
  18. <div class="hightImg" v-show="active == index">
  19. <img
  20. src="/static/img/icon_active@2x.png"
  21. width="68px"
  22. height="81px"
  23. ></img>
  24. </div>
  25. <div class="tabbarItemText" :class="{ active: active == index }">{{
  26. item.name
  27. }}</div>
  28. </div>
  29. </div>
  30. <van-popup
  31. closeIconPos="bottom-right"
  32. v-model="show"
  33. position="center"
  34. round
  35. bgColor="transparent"
  36. style="background: transparent"
  37. @close="close"
  38. @open="open"
  39. >
  40. <div class="codeData" ref="downDiv">
  41. <div class="close" @click="close">
  42. <img
  43. width="42px"
  44. height="42px"
  45. src="/static/img/icon_cancel@2x.png"
  46. ></img>
  47. </div>
  48. <div class="text">
  49. <img
  50. width="100%"
  51. height="185px"
  52. src="https://4dscene.4dage.com/new4dkk/v2/lang/images/solutions/government/survey1.png"
  53. ></img>
  54. <div class="text-center pt-20px pb-8px text-2xl">一花五叶</div>
  55. <img
  56. width="100%"
  57. height="10px"
  58. src="https://4dscene.4dage.com/new4dkk/deng/static/img/line@2x.png"
  59. ></img>
  60. <div class="codeDataText">
  61. 此灯组以禅宗“一花五叶”为主题,传承禅宗经典。您可欣赏花开五叶的意象,感受南宗禅衍化出临济、曹洞、法眼、沩仰和云门五家,发展壮大的辉煌历史,领悟慧能大师法脉的深邃智慧。
  62. </div>
  63. <div class="codeImg flex justify-end items-center">
  64. <div class="qrcode" ref="qrCodeUrl1"></div>
  65. <div class="qrcode" ref="qrCodeUrl2"></div>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="codebutList">
  70. <!-- <div class="downText" v-if="false">
  71. <div class="img flex justify-center items-center">
  72. <div style="width: 36px; height: 36px">
  73. <img
  74. width="36px"
  75. height="36px"
  76. src="https://4dscene.4dage.com/new4dkk/deng/static/img/icon_download@2x.png"
  77. ></img>
  78. </div>
  79. <div class="pl-10">下载图片</div>
  80. </div>
  81. <div class="tips">完成6处打卡,即可点灯祈愿</div>
  82. </div> -->
  83. <div class="downButtom flex justify-center">
  84. <div class="downButtomItem" @click="handleDown">下载图片</div>
  85. <div class="downButtomItem" @click="handleqiyuan">去祈愿</div>
  86. </div>
  87. </div>
  88. </van-popup>
  89. </div>
  90. </template>
  91. <script>
  92. import { mapState } from 'vuex'
  93. import QRCode from 'qrcodejs2'
  94. let wx = window.wx
  95. // import QiyanQrcode from '@/components/qiyan-qrcode/qiyan-qrcode.vue'
  96. // import uButton from "udiv-ui/components/u-button/u-button.vue";
  97. export default {
  98. components: {
  99. // QiyanQrcode
  100. },
  101. data() {
  102. return {
  103. show: false,
  104. qrcode1: null,
  105. qrcode2: null,
  106. title1: '1.现在时间戳:' + Date.now(),
  107. list: [
  108. {
  109. active: '/static/img/icon_home_active.png',
  110. dark: '/static/img/icon_home_dark.png',
  111. light: '/static/img/icon_home_light.png',
  112. name: '首页',
  113. path: '/home'
  114. },
  115. {
  116. active: '/static/img/icon_scan_active@2x.png',
  117. dark: '/static/img/icon_scan_dark@2x.png',
  118. light: '/static/img/icon_scan_light@2x.png',
  119. name: '扫码打卡'
  120. },
  121. {
  122. active: '/static/img/icon_map_active@2x.png',
  123. dark: '/static/img/icon_map_dark@2x.png',
  124. light: '/static/img/icon_map_light@2x.png',
  125. name: '地图',
  126. path: '/map'
  127. },
  128. {
  129. active: '/static/img/icon_ai_active@2x.png',
  130. dark: '/static/img/icon_ai_dark@2x.png',
  131. light: '/static/img/icon_ai_light@2x.png',
  132. name: '妙笔生花',
  133. path: '/composite'
  134. },
  135. {
  136. active: '/static/img/icon_lotus_active@2x.png',
  137. dark: '/static/img/icon_lotus_dark@2x.png',
  138. light: '/static/img/icon_lotus_light@2x.png',
  139. name: '点亮',
  140. path: '/prayers/clocked'
  141. },
  142. // {
  143. // active: '/static/img/icon_user_active@2x.png',
  144. // dark: '/static/img/icon_user_dark@2x.png',
  145. // light: '/static/img/icon_user_light@2x.png',
  146. // name: '我的',
  147. // path: '/my'
  148. // }
  149. ],
  150. title: 'Hello'
  151. }
  152. },
  153. computed: {
  154. ...mapState('home', ['active']),
  155. handleType() {
  156. return this.$route.name == 'PrayersClocked'? true : false
  157. }
  158. },
  159. watch: {
  160. $route(to, from) {
  161. let path = to.path
  162. console.log('handleItem', path)
  163. this.list.map((item, index) => {
  164. if (to.path == item.path) {
  165. this.$store.commit('home/changeActive', index)
  166. }
  167. })
  168. }
  169. },
  170. mounted() {
  171. // let path = this.$route.path
  172. // this.list.map((item, index) => {
  173. // if (path == item.path) {
  174. // console.log('path', path, item, index)
  175. // this.$store.commit('home/changeActive', index)
  176. // }
  177. // })
  178. },
  179. methods: {
  180. handleItem(item, index) {
  181. console.log('handleItem', item, index)
  182. let that = this
  183. if (item.name == '扫码打卡') {
  184. // 只允许通过相机扫码
  185. // uni.scanCode({
  186. // onlyFromCamera: true,
  187. // success: function (res) {
  188. // console.log('条码类型:' + res.scanType)
  189. // console.log('条码内容:' + res.result)
  190. // wx.miniProgram.postMessage({ data: { foo: 'scanCode', type: 'tabbar' } })
  191. wx.miniProgram.navigateTo({
  192. url: '/pages/my/index?scanCode=true'
  193. })
  194. // that.show = true
  195. // that.$store.commit('home/changeActive', index)
  196. // setTimeout(() => {
  197. // this.creatQrCode()
  198. // }, 200)
  199. // },
  200. // fail: function (e) {
  201. // console.log('扫码失败', e)
  202. // that.show = true
  203. // }
  204. // })
  205. return
  206. }else if (item.name == '我的') {
  207. this.$store.commit('home/changeActive', 4)
  208. wx.miniProgram.navigateTo({
  209. url: '/pages/my/index',
  210. active: 4
  211. })
  212. return
  213. }
  214. console.log('handleItem', item, index, this.active)
  215. if(this.active == index) return
  216. // that.$store.commit('home/changeActive', index)
  217. if (item.path) {
  218. this.$router.push(item.path)
  219. }
  220. },
  221. handleHome() {
  222. console.log('开启云上观灯', uni)
  223. // uni.$u.route('/pages/home/home')
  224. },
  225. handleDown() {
  226. this.$store.dispatch('home/saveImage', this.$refs.downDiv)
  227. },
  228. handleqiyuan() {
  229. this.show = false
  230. this.$router.push('/prayers/list')
  231. },
  232. close() {
  233. console.log('close', this.qrcode1, this.qrcode2)
  234. this.show = false
  235. // console.log('close');
  236. },
  237. open() {},
  238. creatQrCode() {
  239. if (this.qrcode1) {
  240. this.qrcode1 && this.qrcode1.clear() //清除二维码
  241. this.qrcode2 && this.qrcode2.clear() //清除二维码
  242. this.qrcode1.makeCode('xxxxx')
  243. this.qrcode2.makeCode('ssssss')
  244. } else {
  245. this.qrcode1 = new QRCode(this.$refs.qrCodeUrl1, {
  246. text: 'xxxx', // 需要转换为二维码的内容
  247. width: 72,
  248. height: 72,
  249. colorDark: '#000000',
  250. colorLight: '#ffffff',
  251. correctLevel: QRCode.CorrectLevel.H
  252. })
  253. this.qrcode2 = new QRCode(this.$refs.qrCodeUrl2, {
  254. text: 'xxxx', // 需要转换为二维码的内容
  255. width: 72,
  256. height: 72,
  257. colorDark: '#000000',
  258. colorLight: '#ffffff',
  259. correctLevel: QRCode.CorrectLevel.H
  260. })
  261. }
  262. }
  263. }
  264. }
  265. </script>
  266. <style lang="scss" scoped>
  267. .tabbar {
  268. display: flex;
  269. align-items: center;
  270. justify-content: space-around;
  271. position: fixed;
  272. bottom: 0;
  273. width: 100vw;
  274. z-index: 1000;
  275. height: 81px;
  276. left: 0;
  277. padding: -2px 0 16px 0;
  278. background-image: url(https://4dscene.4dage.com/new4dkk/deng/static/img/menu_light@2x.png);
  279. background-size: 100% 100%;
  280. background-repeat: no-repeat;
  281. .tabbarbg {
  282. position: absolute;
  283. left: 0;
  284. right: 0;
  285. bottom: 0;
  286. }
  287. .tabbarItem {
  288. text-align: center;
  289. width: 50px;
  290. font-weight: 400;
  291. font-size: 11px;
  292. color: #303030;
  293. line-height: 13px;
  294. text-align: center;
  295. position: relative;
  296. z-index: 1;
  297. .hightImg {
  298. position: absolute;
  299. z-index: 2;
  300. top: 0;
  301. left: -10px;
  302. }
  303. .aotoImg {
  304. position: relative;
  305. top: -5px;
  306. }
  307. }
  308. }
  309. .dark {
  310. background-image: url(https://4dscene.4dage.com/new4dkk/deng/static/img/menu_dark@2x.png);
  311. .tabbarItem{
  312. color: #fff;
  313. }
  314. }
  315. .codebutList {
  316. text-align: center;
  317. position: relative;
  318. width: 100%;
  319. // top: 76px;
  320. .downText {
  321. .img {
  322. margin-right: 10px;
  323. font-weight: 400;
  324. font-size: 16px;
  325. color: #ffffff;
  326. line-height: 19px;
  327. text-align: center;
  328. }
  329. .tips {
  330. padding-top: 10px;
  331. font-weight: 400;
  332. font-size: 16px;
  333. color: #a49d94;
  334. line-height: 19px;
  335. text-align: center;
  336. }
  337. }
  338. .downButtom {
  339. .downButtomItem {
  340. width: 140px;
  341. height: 42px;
  342. background: url(https://4dscene.4dage.com/new4dkk/deng/static/img/btn01@2x.png) 100% 100%
  343. no-repeat;
  344. background-size: cover;
  345. font-weight: 400;
  346. font-size: 16px;
  347. color: #ffffff;
  348. line-height: 19px;
  349. font-style: normal;
  350. margin: 0 5px;
  351. line-height: 42px;
  352. text-align: center;
  353. }
  354. }
  355. }
  356. .codeData {
  357. // background: url(https://4dscene.4dage.com/new4dkk/deng/static/img/pop2@2x.png) no-repeat cover;
  358. background: url(https://4dscene.4dage.com/new4dkk/deng/static/img/pop2@2x.png) 100% 100% no-repeat;
  359. background-size: 100% 100%;
  360. width: calc(100vw - 108px);
  361. height: 490px;
  362. padding: 48px 52px 30px 36px;
  363. position: relative;
  364. .close {
  365. position: absolute;
  366. right: -0px;
  367. top: -0px;
  368. width: 42px;
  369. height: 42px;
  370. }
  371. .text {
  372. font-weight: 400;
  373. font-size: 24px;
  374. color: #d86332;
  375. line-height: 29px;
  376. position: relative;
  377. padding-bottom: 72px;
  378. .codeDataText {
  379. padding: 8px 0 16px 0;
  380. font-weight: 400;
  381. font-size: 14px;
  382. color: #b1967b;
  383. line-height: 18px;
  384. text-align: left;
  385. }
  386. .codeImg {
  387. text-align: right;
  388. width: 100%;
  389. height: 72px;
  390. // float: right;
  391. .qrcode {
  392. padding: 5px;
  393. margin: 0 5px;
  394. background: #fff;
  395. }
  396. }
  397. }
  398. }
  399. </style>