commit 4e2a2e52ff1fd5de0754634afcee0fff5409d34d Author: ahbmz Date: Sat Aug 13 17:59:06 2022 +0800 安徽骏飞微信小程序 正式第一版本 diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5c7fbe5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +miniprogram_npm/ +node_modules/ diff --git a/api/home.js b/api/home.js new file mode 100644 index 0000000..a4abf00 --- /dev/null +++ b/api/home.js @@ -0,0 +1,50 @@ +import service from '../utils/request' + +// 获取首页数据 +const getHome = (options) => { + return service({ + url: 'index', + method: 'POST', + data: options, + }) +} +// 获取片场展示数据 +const getDisplay = (options) => { + return service({ + url: 'cate', + method: 'GET', + data: options + }) +} +//产品列表 +const getDisplayProduct = (options) => { + return service({ + url: 'product', + method: 'GET', + data: options, + }) +} +//产品详情 +const getDetailProduct = (options) => { + return service({ + url: 'detail_product', + method: 'GET', + data: options, + }) +} +//联系我们 +const getAbout = (options) => { + return service({ + url: 'about', + method: 'GET', + data: options, + }) +} + + + + + +module.exports = { + getHome,getDisplay,getDisplayProduct,getDetailProduct,getAbout +} \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..437495d --- /dev/null +++ b/app.js @@ -0,0 +1,53 @@ +// app.js +App({ + globalData: { + id: 0 + }, + onLaunch() { + // 展示本地存储能力 + /* const logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) */ + this.globalData.userInfo = wx.getStorageSync('userInfo') || '' + + wx.getSystemInfo({ + success: res => { + this.globalData.brand = res.model + }, + }) + + + let menuButtonObject = wx.getMenuButtonBoundingClientRect(); + wx.getSystemInfo({ + success: res => { + + //导航高度 + let statusBarHeight = res.statusBarHeight, + navTop = menuButtonObject.top, + navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight)*2; + this.globalData.navHeight = navHeight; + this.globalData.navTop = navTop; + this.globalData.windowHeight = res.windowHeight; + }, + fail(err) { + console.log(err); + } + }) + }, + globalData: { + baseurl: 'https://api.junfei.iiixo.com/api/Content/', + userInfo: '', + version: '1.0', // 版本号 常量 + loginClient: 3, // 客户端类型 0:web 1:安卓 2:iOS 3:小程序 + brand: null, // 设备型号 + themeVars: { + rateIconFullColor: '#07c160', + sliderBarHeight: '4px', + sliderButtonWidth: '20px', + sliderButtonHeight: '20px', + sliderActiveBackgroundColor: '#07c160', + buttonPrimaryBorderColor: '#07c160', + buttonPrimaryBackgroundColor: '#07c160', + }, + } +}) diff --git a/app.json b/app.json new file mode 100644 index 0000000..f82c25a --- /dev/null +++ b/app.json @@ -0,0 +1,46 @@ +{ + "tabBar": { + "custom": true, + "color": "#000000", + "selectedColor": "#000000", + "backgroundColor": "#000000", + "list": [ + { + "pagePath": "pages/home/home", + "text": "首页" + }, + { + "pagePath": "pages/setDisplay/setDisplay", + "text": "片场展示" + }, + { + "pagePath": "pages/contactUs/contactUs", + "text": "联系我们" + } + ] + }, + "usingComponents": { + "van-config-provider": "@vant/weapp/config-provider/index" + }, + "lazyCodeLoading": "requiredComponents", + "pages": [ + + "pages/home/home", + "pages/contactUs/contactUs", + "pages/setDisplay/setDisplay", + "pages/details/details", + "pages/logs/logs" + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black" + }, + + "permission": { + "scope.userLocation": { + "desc": "导航需要" + } + }, + "sitemapLocation": "sitemap.json" +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..bd2fa30 --- /dev/null +++ b/app.wxss @@ -0,0 +1,12 @@ +/**app.wxss**/ +@import './miniprogram_npm/@vant/weapp/common/index.wxss'; +.container { + height: 100%; + box-sizing: border-box; + font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, + Segoe UI, Arial, Roboto, 'PingFang SC', 'miui', 'Hiragino Sans GB', 'Microsoft Yahei', + sans-serif; +} + + + diff --git a/assets/imgs/banner.png b/assets/imgs/banner.png new file mode 100644 index 0000000..96ca442 Binary files /dev/null and b/assets/imgs/banner.png differ diff --git a/assets/imgs/icon1.png b/assets/imgs/icon1.png new file mode 100644 index 0000000..5d6186f Binary files /dev/null and b/assets/imgs/icon1.png differ diff --git a/assets/imgs/icon2.png b/assets/imgs/icon2.png new file mode 100644 index 0000000..dcca0ad Binary files /dev/null and b/assets/imgs/icon2.png differ diff --git a/assets/imgs/icon3.png b/assets/imgs/icon3.png new file mode 100644 index 0000000..5e29c97 Binary files /dev/null and b/assets/imgs/icon3.png differ diff --git a/assets/imgs/icon4.png b/assets/imgs/icon4.png new file mode 100644 index 0000000..2b8d696 Binary files /dev/null and b/assets/imgs/icon4.png differ diff --git a/assets/imgs/img1.png b/assets/imgs/img1.png new file mode 100644 index 0000000..d98ca4f Binary files /dev/null and b/assets/imgs/img1.png differ diff --git a/assets/imgs/img2.png b/assets/imgs/img2.png new file mode 100644 index 0000000..733365f Binary files /dev/null and b/assets/imgs/img2.png differ diff --git a/assets/imgs/img3.png b/assets/imgs/img3.png new file mode 100644 index 0000000..82be15c Binary files /dev/null and b/assets/imgs/img3.png differ diff --git a/assets/imgs/phone.png b/assets/imgs/phone.png new file mode 100644 index 0000000..2c3851f Binary files /dev/null and b/assets/imgs/phone.png differ diff --git a/assets/imgs/tabbar/tab1_blur.png b/assets/imgs/tabbar/tab1_blur.png new file mode 100644 index 0000000..0ed6fd1 Binary files /dev/null and b/assets/imgs/tabbar/tab1_blur.png differ diff --git a/assets/imgs/tabbar/tab1_focus.png b/assets/imgs/tabbar/tab1_focus.png new file mode 100644 index 0000000..2f5caf2 Binary files /dev/null and b/assets/imgs/tabbar/tab1_focus.png differ diff --git a/assets/imgs/tabbar/tab2_blur.png b/assets/imgs/tabbar/tab2_blur.png new file mode 100644 index 0000000..a9da454 Binary files /dev/null and b/assets/imgs/tabbar/tab2_blur.png differ diff --git a/assets/imgs/tabbar/tab2_focus.png b/assets/imgs/tabbar/tab2_focus.png new file mode 100644 index 0000000..27a6db8 Binary files /dev/null and b/assets/imgs/tabbar/tab2_focus.png differ diff --git a/assets/imgs/tabbar/tab3_blur.png b/assets/imgs/tabbar/tab3_blur.png new file mode 100644 index 0000000..ce2d07e Binary files /dev/null and b/assets/imgs/tabbar/tab3_blur.png differ diff --git a/assets/imgs/tabbar/tab3_focus.png b/assets/imgs/tabbar/tab3_focus.png new file mode 100644 index 0000000..a627ba1 Binary files /dev/null and b/assets/imgs/tabbar/tab3_focus.png differ diff --git a/assets/imgs/组 24@2x.png b/assets/imgs/组 24@2x.png new file mode 100644 index 0000000..113e87e Binary files /dev/null and b/assets/imgs/组 24@2x.png differ diff --git a/components/icon/index.js b/components/icon/index.js new file mode 100644 index 0000000..f37d26b --- /dev/null +++ b/components/icon/index.js @@ -0,0 +1,24 @@ +Component({ + options: { + addGlobalClass: true + }, + + externalClasses: ['custom-class'], + + properties: { + info: null, + name: String, + size: String, + color: String, + block:{ + type:Boolean, + value:false + } + }, + + methods: { + onClick() { + this.triggerEvent('click'); + } + } +}); diff --git a/components/icon/index.json b/components/icon/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/components/icon/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/components/icon/index.wxml b/components/icon/index.wxml new file mode 100644 index 0000000..afaeecb --- /dev/null +++ b/components/icon/index.wxml @@ -0,0 +1,7 @@ + + {{ info }} + diff --git a/components/icon/index.wxss b/components/icon/index.wxss new file mode 100644 index 0000000..e6fea25 --- /dev/null +++ b/components/icon/index.wxss @@ -0,0 +1,52 @@ +/* @font-face { + font-family: 'ss-font'; + src: url('https://www.52cxy.cn/wxapp/teacher/font/iconfont.eot'); + src: url('https://www.52cxy.cn/wxapp/teacher/font/iconfont.woff') format('woff'), + url('https://www.52cxy.cn/wxapp/teacher/font/iconfont.ttf') format('truetype'), + url('https://www.52cxy.cn/wxapp/teacher/font/iconfont.svg') format('svg'); +} */ + +@font-face { + font-family: 'ss-font'; /* project id 1360796 */ + src: url('//at.alicdn.com/t/font_1360796_62vxgaud7d6.eot'); + src: url('//at.alicdn.com/t/font_1360796_62vxgaud7d6.eot?#iefix') format('embedded-opentype'), + url('//at.alicdn.com/t/font_1360796_62vxgaud7d6.woff2') format('woff2'), + url('//at.alicdn.com/t/font_1360796_62vxgaud7d6.woff') format('woff'), + url('//at.alicdn.com/t/font_1360796_62vxgaud7d6.ttf') format('truetype'), + url('//at.alicdn.com/t/font_1360796_62vxgaud7d6.svg#ss-font') format('svg'); +} +.ss-icon__info { + position: absolute; + right: 0; + top: -8px; + color: #fff; + font-size: 12px; + font-family: PingFang SC, Helvetica Neue, Arial, sans-serif; + text-align: center; + box-sizing: border-box; + padding: 0 3px; + min-width: 16px; + line-height: 14px; + border-radius: 16px; + background-color: #f44; + -webkit-transform: translateX(50%); + transform: translateX(50%); + -webkit-transform-origin: 100%; + transform-origin: 100%; + white-space: nowrap; +} + +.ss-font { + font-family: "ss-font" !important; + display: inline-block; + font: normal normal normal 14px/1 ss-icon; + font-size: inherit; + text-rendering: auto; + position: relative; +} +.ss-icon-index:before { + content: "\e688"; +} +.ss-icon-back:before { + content: "\e9c9"; +} \ No newline at end of file diff --git a/components/navbar/index.js b/components/navbar/index.js new file mode 100644 index 0000000..6409b64 --- /dev/null +++ b/components/navbar/index.js @@ -0,0 +1,59 @@ +// components/navbar/index.js +const App = getApp(); + +Component({ + options: { + addGlobalClass: true, + }, + externalClasses: ['custom-class'], + /** + * 组件的属性列表 + */ + properties: { + pageName:String, + showNav: { + type: Boolean, + value: true + }, + bgColor:{ + type: String, + value: '#fff' + }, + iconColor:{ + type: String, + value: '#000' + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + lifetimes: { + attached: function () { + this.setData({ + navHeight: App.globalData.navHeight, + navTop: App.globalData.navTop + }) + } + }, + /** + * 组件的方法列表 + */ + methods: { + //回退 + _navBack: function () { + wx.navigateBack({ + delta: 1 + }) + }, + //回主页 + _toIndex: function () { + wx.switchTab({ + url: '/pages/tabBar/index/index' + }) + }, + } +}) diff --git a/components/navbar/index.json b/components/navbar/index.json new file mode 100644 index 0000000..5a98a73 --- /dev/null +++ b/components/navbar/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "ss-icon": "../icon/index" + } +} \ No newline at end of file diff --git a/components/navbar/index.wxml b/components/navbar/index.wxml new file mode 100644 index 0000000..b21be48 --- /dev/null +++ b/components/navbar/index.wxml @@ -0,0 +1,9 @@ + + + + + + + + {{pageName}} + diff --git a/components/navbar/index.wxss b/components/navbar/index.wxss new file mode 100644 index 0000000..ddce7d3 --- /dev/null +++ b/components/navbar/index.wxss @@ -0,0 +1,65 @@ +/* components/navbar/index.wxss */ + +.navbar { + width: 100%; + overflow: hidden; + position: relative; + top: 0; + left: 0; + z-index: 10; + flex-shrink: 0; +} + +.navbar-title { + width: 100%; + box-sizing: border-box; + padding-left: 115px; + padding-right: 115px; + height: 32px; + line-height: 32px; + text-align: center; + position: fixed; + left: 0; + z-index: 10; + color: #333; + font-size: 13px; + font-weight: normal; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +.navbar-action-wrap { + display: -webkit-flex; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + -webkit-align-items: center; + align-items: center; + position: fixed; + left: 10px; + z-index: 11; + line-height: 1; + padding-top: 4px; + padding-bottom: 4px; +} + +/* .navbar-action-group { + border: 1px solid #f0f0f0; + border-radius: 20px; + overflow: hidden; +} */ + +.navbar-action_item { + padding: 3px 0; + color: #333; +} + +.navbar-action-group .navbar-action_item { + /* border-right: 1px solid #f0f0f0; */ + padding: 3px 14px; +} + +.navbar-action-group .last { + border-right: none; +} diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js new file mode 100644 index 0000000..0a236e4 --- /dev/null +++ b/custom-tab-bar/index.js @@ -0,0 +1,51 @@ +Component({ + data: { + active: 0, + list: [ + { + blur: '../assets/imgs/tabbar/tab1_blur.png', + focus: '../assets/imgs/tabbar/tab1_focus.png', + text: '首页', + url: '/pages/home/home' + }, + { + blur: '../assets/imgs/tabbar/tab2_blur.png', + focus: '../assets/imgs/tabbar/tab2_focus.png', + text: '片场展示', + url: '/pages/setDisplay/setDisplay' + }, + { + blur: '../assets/imgs/tabbar/tab3_blur.png', + focus: '../assets/imgs/tabbar/tab3_focus.png', + text: '联系我们', + url: '/pages/contactUs/contactUs' + } + ], + }, + + attached() { + const tab = this.createSelectorQuery() + tab.select('.myTabbar').boundingClientRect((rect) => { + // console.log(rect) + wx.setStorageSync('tabHeight', rect.height) + }).exec() + }, + + methods: { + onChange(event) { + this.setData({ active: event.detail }); + wx.switchTab({ + url: this.data.list[event.detail].url + + }); + }, + + init() { + const page = getCurrentPages().pop(); + this.setData({ + active: this.data.list.findIndex(item => item.url === `/${page.route}`) + }); + + } + } +}); diff --git a/custom-tab-bar/index.json b/custom-tab-bar/index.json new file mode 100644 index 0000000..216ef9d --- /dev/null +++ b/custom-tab-bar/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-tabbar": "@vant/weapp/tabbar/index", + "van-tabbar-item": "@vant/weapp/tabbar-item/index" + } +} \ No newline at end of file diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml new file mode 100644 index 0000000..ac9d795 --- /dev/null +++ b/custom-tab-bar/index.wxml @@ -0,0 +1,24 @@ + + + + + {{ item.text }} + + diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss new file mode 100644 index 0000000..8b751d4 --- /dev/null +++ b/custom-tab-bar/index.wxss @@ -0,0 +1,9 @@ +.myTabbar .tabbarItem { + background-color: #fff; + border-top: 1px solid #eee; +} + +.tabbarIcon { + width: 47rpx; + height: 49rpx; +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..9b9430c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,16 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@vant/area-data": { + "version": "1.2.3", + "resolved": "https://registry.npmmirror.com/@vant/area-data/-/area-data-1.2.3.tgz", + "integrity": "sha512-9bDgEsFnTjdaYXPvsYKRQmxzKDdLCl0c1dOo4JGE6RhaIcq2kR2f5cK0LUdGK+U/SuBz9NfW5ejL1lejcFiP1Q==" + }, + "@vant/weapp": { + "version": "1.10.2", + "resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.2.tgz", + "integrity": "sha512-caqA0xQxM4lMRncFsRPPVMDdEzUBCJ4xdFXuKReXpEU3qwnVIP/WIjVDIi7mWyS7xqz8C9WfSW5JL4PrlSq31w==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..4b05f9f --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "@vant/area-data": "^1.2.3", + "@vant/weapp": "^1.10.2" + } +} diff --git a/pages/contactUs/contactUs.js b/pages/contactUs/contactUs.js new file mode 100644 index 0000000..a51e6bf --- /dev/null +++ b/pages/contactUs/contactUs.js @@ -0,0 +1,145 @@ +// pages/signIn/signIn.js +var app = getApp() +import { getAbout } from "../../api/home" +let that + + +Page({ + + data: { + activeKey: 0, + latitude: 31.462191, //纬度 + longitude: 104.75028, //经度 + markers: [{ + id: 1, + width: 22, //标记宽 + height: 43, //标记高 + latitude: 31.462191, + longitude: 104.75028, + address:'', + tel:'', + phone:'', + userPhone:'', + }] + }, + + biaoji(e) { + console.log("标记目的地点击", that.data.latitude) + wx.getLocation({//获取当前地址信息 + type: 'wgs84', + success(res) { + const latitude = res.latitude + const longitude = res.longitude + const speed = res.speed + const accuracy = res.accuracy + wx.openLocation({//跳转腾讯地图查看并可以进行导航 + latitude: that.data.latitude, + longitude: that.data.longitude + }) + },fail(res){//未授权地理位置处理 + wx.showModal({ + title: '请授权', + content: '若未授权地理位置,您将不能正常使用导航功能', + confirmText:"授权", + success (res) { + if (res.confirm) { + console.log('用户点击确定') + wx.openSetting({//跳转设置授权界面 + }) + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + } + }) + }, + + callPhone (e) { + console.log(e.currentTarget.dataset.phone) + let mobile = e.currentTarget.dataset.phone; //获取data-phone的手机号 + wx.makePhoneCall({ + phoneNumber: mobile + }) + }, + + getAboutDetails() { + getAbout({}).then(res => { + console.log(res.data.map.split(',')[1]) + that.setData({ + address: res.data.address, + tel:res.data.tel, + phone:res.data.phone, + longitude:res.data.map.split(',')[0], + latitude:res.data.map.split(',')[1], + markers: [{ + longitude:res.data.map.split(',')[0], + latitude:res.data.map.split(',')[1], + }], + userPhone: res.data.contact_phone + }) + + + + }) + }, + + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + that = this + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + that.getTabBar().init(); + that.getAboutDetails() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/contactUs/contactUs.json b/pages/contactUs/contactUs.json new file mode 100644 index 0000000..e95d266 --- /dev/null +++ b/pages/contactUs/contactUs.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "联系我们", + "usingComponents": { + "van-icon": "@vant/weapp/icon/index" + + } + +} \ No newline at end of file diff --git a/pages/contactUs/contactUs.wxml b/pages/contactUs/contactUs.wxml new file mode 100644 index 0000000..3e6931b --- /dev/null +++ b/pages/contactUs/contactUs.wxml @@ -0,0 +1,24 @@ + + + + + + 公司地址:{{address}} + + + + 公司电话:{{tel}} + + + + {{phone}} + + + + + + + + + + \ No newline at end of file diff --git a/pages/contactUs/contactUs.wxss b/pages/contactUs/contactUs.wxss new file mode 100644 index 0000000..e69c9e4 --- /dev/null +++ b/pages/contactUs/contactUs.wxss @@ -0,0 +1,49 @@ +/* pages/signIn/signIn.wxss */ +.container { + width: 100%; + min-height: 100vh; + background: #fff; + padding-top: 30rpx; +} +.van-icon { + float: left; + width: 48rpx; +height: 48rpx; +background: #666; +border-radius: 50%; +margin: 0 26rpx 0 0; +} +.van-icon:before { + display: block; + text-align: center; + line-height: 48rpx; +} +.contact_info { + + padding: 25rpx 45rpx 0; + font-size: 26rpx; + color: #333; + clear: both; +} +.contact_info text { + line-height: 48rpx; + display: inline-block; + width: 580rpx; +} +map { + width: 100%; + height: 641rpx; + margin-top: 80rpx; +} +.van-icon { + text-align: center; +} +.telPhone { + position: fixed; + right: 10px; + top: 70%; +} +.telPhone image { + width: 110rpx; + height: 110rpx; +} \ No newline at end of file diff --git a/pages/details/details.js b/pages/details/details.js new file mode 100644 index 0000000..b284489 --- /dev/null +++ b/pages/details/details.js @@ -0,0 +1,177 @@ +// pages/home/home.js +var app = getApp() +var WxParse = require('../../wxParse/wxParse.js'); +import { getDetailProduct } from "../../api/home" +import { getAbout } from "../../api/home" + +let that +Page({ + + /** + * 页面的初始数据 + */ + data: { + + fileList: [ + { + url: '', + deletable: false, + }, + ], + id:10, + detailsList:[], + userPhone:'', + article:'', + title:'', + source:'', + + }, + + // // 跳转发布 + // openPub() { + // wx.switchTab({ + // url: '/pages/publish/publish', + // }) + // }, + + getAboutDetails() { + getAbout({}).then(res => { + that.setData({ + userPhone: res.data.contact_phone , + }) + + }) + }, + // 获取产品详情 + getProductDetails() { + getDetailProduct({ + id:that.data.id, + }).then(res => { + + that.setData({ + detailsList: res.data.postion, + title:res.data.detail.title, + source:res.data.detail.source, + fileList:[{ + url:res.data.detail.image + }], + + + article: WxParse.wxParse('article', 'html', res.data.detail.content, that, 5) + }) + console.log(that.data.detailsList) + }) + + }, + + callPhone (e) { + console.log(e.currentTarget.dataset.phone) + let mobile = e.currentTarget.dataset.phone; //获取data-phone的手机号 + wx.makePhoneCall({ + phoneNumber: mobile + }) + }, + + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + that = this + wx.setNavigationBarTitle({ + title: '首页', + }) + // console.log(options.id) //options.参数名就可以取到 + that.setData({ + id: options.id + }) + // var article = `< !DOCTYPE HTML >`+that.data.content; + // WxParse.wxParse('article', 'html', that.data.content, that, 5); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + // that.getTabBar().init(); + + that.getProductDetails() + that.getAboutDetails() + /* that.getList({ + page: that.data.page, + limit: that.data.limit + }) + + that.getTypeList() + that.setData({ + minDate: new Date(new Date().getFullYear(), new Date().getMonth(), 1).getTime(), + maxDate: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).getTime(), + today: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()).getTime() + }) */ + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + // console.log("下拉刷新") + // that.setData({ + // page: 1, // 每次触发下拉事件page=1 + // }) + // that.getList({ + // page: 1, + // limit: that.data.limit, + // adCode: that.data.address ? that.data.address[1].code : '', + // labelId: that.data.curCate + // }) + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + // console.log("上拉加载") + // if(that.data.list.length < that.data.total) { + // that.setData({ + // page: that.data.page + 1 + // }) + // that.getList({ + // page: that.data.page, + // limit: that.data.limit, + // adCode: that.data.address ? that.data.address[1].code : '', + // labelId: value.detail ? value.detail : '' + // }) + // }else { + // Toast('没有更多数据了') + // } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/details/details.json b/pages/details/details.json new file mode 100644 index 0000000..a246e55 --- /dev/null +++ b/pages/details/details.json @@ -0,0 +1,11 @@ +{ + "usingComponents": { + "van-uploader": "@vant/weapp/uploader/index", + "van-row": "@vant/weapp/row/index", + "van-col": "@vant/weapp/col/index", + "van-icon": "@vant/weapp/icon/index", + "van-share-sheet": "@vant/weapp/share-sheet/index" + }, + "navigationBarTitleText": "详情页" + +} \ No newline at end of file diff --git a/pages/details/details.wxml b/pages/details/details.wxml new file mode 100644 index 0000000..d798a2f --- /dev/null +++ b/pages/details/details.wxml @@ -0,0 +1,60 @@ + + + +