作者 郑喜程

junyao微信小程序#

正在显示 100 个修改的文件 包含 4127 行增加0 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

  1 +{
  2 + "extends": "standard",
  3 +
  4 + //插件
  5 + // "plugins": [
  6 + // "prettier"
  7 + // ],
  8 +
  9 + //配置解析器
  10 + "parser": "babel-eslint",
  11 + "parserOptions": {
  12 + "ecmaVersion": 6,
  13 + "sourceType": "module"
  14 + },
  15 + //插件
  16 + "plugins": ["prettier", "html"],
  17 + "settings": {
  18 + "html/html-extensions": [".wxml"]
  19 + },
  20 +
  21 + "env": {
  22 + //脚本目标的运行环境
  23 + "node": true
  24 + },
  25 +
  26 + //全局变量
  27 + "globals": {
  28 + "__DEV__": true,
  29 + "__WECHAT__": true,
  30 + "__ALIPAY__": true,
  31 + "App": true,
  32 + "Page": true,
  33 + "Component": true,
  34 + "Behavior": true,
  35 + "wx": true,
  36 + "getApp": true
  37 + },
  38 +
  39 + //规则,只用插件:插件名/规则
  40 + "rules": {
  41 + "indent": ["error", "tab", { "SwitchCase": 1 }],
  42 + "no-console": 0,
  43 + "no-tabs": 0,
  44 + "quotes": [
  45 + 2,
  46 + "single",
  47 + {
  48 + "avoidEscape": true,
  49 + "allowTemplateLiterals": true
  50 + }
  51 + ],
  52 + "semi": [
  53 + 2,
  54 + "never",
  55 + {
  56 + "beforeStatementContinuationChars": "never"
  57 + }
  58 + ],
  59 + "no-delete-var": 2,
  60 + "space-before-function-paren": 0,
  61 + "prefer-const": [
  62 + 2,
  63 + {
  64 + "ignoreReadBeforeAssign": false
  65 + }
  66 + ]
  67 + }
  68 +}
  1 +# DIY
  2 +target/
  3 +
  4 +# svn
  5 +.svn/
  6 +# Linux System
  7 +*~
  8 +
  9 +# KDE directory preferences
  10 +.directory
  11 +
  12 +# Linux trash folder which might appear on any partition or disk
  13 +.Trash-*
  14 +
  15 +# Windows System
  16 +# Windows image file caches
  17 +Thumbs.db
  18 +ehthumbs.db
  19 +
  20 +# Folder config file
  21 +Desktop.ini
  22 +
  23 +# Recycle Bin used on file shares
  24 +$RECYCLE.BIN/
  25 +
  26 +# Windows Installer files
  27 +*.cab
  28 +*.msi
  29 +*.msm
  30 +*.msp
  31 +
  32 +# Windows shortcuts
  33 +*.lnk
  34 +
  35 +# OSX System
  36 +.DS_Store
  37 +.AppleDouble
  38 +.LSOverride
  39 +
  40 +# Icon must end with two \r
  41 +Icon
  42 +
  43 +
  44 +# Thumbnails
  45 +._*
  46 +
  47 +# Files that might appear in the root of a volume
  48 +.DocumentRevisions-V100
  49 +.fseventsd
  50 +.Spotlight-V100
  51 +.TemporaryItems
  52 +.Trashes
  53 +.VolumeIcon.icns
  54 +
  55 +# Directories potentially created on remote AFP share
  56 +.AppleDB
  57 +.AppleDesktop
  58 +Network Trash Folder
  59 +Temporary Items
  60 +.apdisk
  61 +
  62 +# Eclipse
  63 +*.pydevproject
  64 +.metadata
  65 +.gradle
  66 +bin/
  67 +tmp/
  68 +*.tmp
  69 +*.bak
  70 +*.swp
  71 +*~.nib
  72 +local.properties
  73 +.settings/
  74 +.loadpath
  75 +
  76 +# Eclipse Core
  77 +.project
  78 +
  79 +# External tool builders
  80 +.externalToolBuilders/
  81 +
  82 +# Locally stored "Eclipse launch configurations"
  83 +*.launch
  84 +
  85 +# CDT-specific
  86 +.cproject
  87 +
  88 +# JDT-specific (Eclipse Java Development Tools)
  89 +.classpath
  90 +
  91 +# Java annotation processor (APT)
  92 +.factorypath
  93 +
  94 +# PDT-specific
  95 +.buildpath
  96 +
  97 +# sbteclipse plugin
  98 +.target
  99 +
  100 +# TeXlipse plugin
  101 +.texlipse
  102 +
  103 +# JetBrains
  104 +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
  105 +
  106 +*.iml
  107 +
  108 +## Directory-based project format:
  109 +.idea/
  110 +# if you remove the above rule, at least ignore the following:
  111 +
  112 +# User-specific stuff:
  113 +# .idea/workspace.xml
  114 +# .idea/tasks.xml
  115 +# .idea/dictionaries
  116 +
  117 +# Sensitive or high-churn files:
  118 +# .idea/dataSources.ids
  119 +# .idea/dataSources.xml
  120 +# .idea/sqlDataSources.xml
  121 +# .idea/dynamic.xml
  122 +# .idea/uiDesigner.xml
  123 +
  124 +# Gradle:
  125 +# .idea/gradle.xml
  126 +# .idea/libraries
  127 +
  128 +# Mongo Explorer plugin:
  129 +# .idea/mongoSettings.xml
  130 +
  131 +## File-based project format:
  132 +*.ipr
  133 +*.iws
  134 +
  135 +## Plugin-specific files:
  136 +
  137 +# IntelliJ
  138 +/out/
  139 +
  140 +# mpeltonen/sbt-idea plugin
  141 +.idea_modules/
  142 +
  143 +# JIRA plugin
  144 +atlassian-ide-plugin.xml
  145 +
  146 +# Crashlytics plugin (for Android Studio and IntelliJ)
  147 +com_crashlytics_export_strings.xml
  148 +crashlytics.properties
  149 +crashlytics-build.properties
  150 +
  151 +# JAVA
  152 +*.class
  153 +
  154 +# Mobile Tools for Java (J2ME)
  155 +.mtj.tmp/
  156 +
  157 +# Package Files #
  158 +*.jar
  159 +*.war
  160 +*.ear
  161 +
  162 +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
  163 +hs_err_pid*
  164 +
  165 +#Maven
  166 +target/
  167 +**/target/
  168 +pom.xml.tag
  169 +pom.xml.releaseBackup
  170 +pom.xml.versionsBackup
  171 +pom.xml.next
  172 +release.properties
  173 +dependency-reduced-pom.xml
  174 +buildNumber.properties
  175 +.mvn/timing.properties
  176 +
  177 +logs/
  178 +node_modules
  179 +project.private.config.json
  1 +/*
  2 + * @Autor: 李响
  3 + * @Date: 2022-08-11 13:45:55
  4 + * @LastEditors: 李响
  5 + * @LastEditTime: 2023-02-02 15:36:35
  6 + * @description:
  7 + */
  8 +// .prettierrc.js
  9 +module.exports = {
  10 + printWidth: 220,
  11 + tabWidth: 2,
  12 + useTabs: true,
  13 + semi: false,
  14 + singleQuote: true,
  15 +
  16 + // 对象的 key 仅在必要时用引号
  17 + quoteProps: 'as-needed',
  18 +
  19 + // jsx 不使用单引号,而使用双引号
  20 + jsxSingleQuote: false,
  21 +
  22 + // 末尾不需要逗号
  23 + trailingComma: 'none',
  24 +
  25 + // 大括号内的首尾需要空格
  26 + bracketSpacing: true,
  27 +
  28 + // jsx 标签的反尖括号需要换行
  29 + jsxBracketSameLine: false,
  30 +
  31 + // 箭头函数,只有一个参数的时候,无需括号
  32 + arrowParens: 'avoid',
  33 +
  34 + // 每个文件格式化的范围是文件的全部内容
  35 + rangeStart: 0,
  36 +
  37 + rangeEnd: Infinity,
  38 +
  39 + // 不需要写文件开头的 @prettier
  40 + requirePragma: false,
  41 +
  42 + // 不需要自动在文件开头插入 @prettier
  43 + insertPragma: false,
  44 +
  45 + // 使用默认的折行标准
  46 + proseWrap: 'preserve',
  47 +
  48 + // 根据显示样式决定 html 要不要折行
  49 + htmlWhitespaceSensitivity: 'css',
  50 +
  51 + // 换行符使用 lf
  52 + endOfLine: 'lf'
  53 +}
  1 +均瑶专属小程序
  1 +// app.js
  2 +import utils from './utils/util.js'
  3 +import api from './utils/api.js'
  4 +import config from './utils/config.js'
  5 +// import {init} from './utils/myPage'
  6 +const OssUploader = require('/utils/plugins/ossUpload.js')
  7 +let isGetCoupon = false
  8 +App({
  9 + onLaunch: function () {
  10 + // 登录
  11 + // 获取用户信息
  12 + // this.getSetting()
  13 + // init({})
  14 + // this.globalData.brandId = config.brandId
  15 + // console.log(this.globalData.brandId);
  16 + this.getSystemInfoSync()
  17 + // 获取nick
  18 + let nick = wx.getStorageSync('nick')
  19 + if(nick){
  20 + const {unionId,userId,wxappOpenId,wxappEcdOpenId,wxchatOpenId} = nick
  21 + wx.setStorageSync('subData', {
  22 + unionId,
  23 + userId,
  24 + openId:wxappOpenId ? wxappOpenId : wxappEcdOpenId ? wxappEcdOpenId : wxchatOpenId
  25 + })
  26 + }
  27 + // 可比克 字体
  28 + wx.loadFontFace({
  29 + family: 'PangMenZhengDao',
  30 + source: 'url("https://hbrand.oss-cn-hangzhou.aliyuncs.com/BUSINESS/SCAN/cpp/kebike/1635742999484228.ttf")',
  31 + global: true
  32 + })
  33 + if (wx.onNeedPrivacyAuthorization) {
  34 + wx.onNeedPrivacyAuthorization((resolve, eventInfo) => {
  35 + wx.removeStorageSync('nick')
  36 + utils.needLogin()
  37 + resolve({ event: 'exposureAuthorization' })
  38 + })
  39 + }
  40 + },
  41 +
  42 + getCode() {
  43 + return new Promise((resolve, reject) => {
  44 + wx.login({
  45 + success: res => {
  46 + if (res.code) {
  47 + // 防止获取两次code
  48 + if (res.code !== this.globalData.code) {
  49 + wx.checkSession({
  50 + success: () => {
  51 + this.globalData.code = res.code
  52 + resolve(res.code)
  53 + },
  54 + fail: () => {
  55 + wx.login({
  56 + success: res => {
  57 + this.globalData.code = res.code
  58 + resolve(res.code)
  59 + }
  60 + })
  61 + }
  62 + })
  63 + }
  64 + }
  65 + }
  66 + })
  67 + })
  68 + },
  69 +
  70 + getLocation(type = 'gcj02') {
  71 + const _this = this
  72 + return new Promise((resolve, reject) => {
  73 + wx.getFuzzyLocation({
  74 + type,
  75 + success(res) {
  76 + _this.globalData.locate = `${res.latitude},${res.longitude}`
  77 + resolve(res)
  78 + },
  79 + fail(res) {
  80 + wx.setStorageSync('isIndexClick', false)
  81 + wx.navigateTo({
  82 + url: '/pages/defaultError/defaultError?errorId=0&errorMsg=授权失败|我们需要您的位置信息来判断您能否参与活动, 请允许授权'
  83 + })
  84 + }
  85 + })
  86 + })
  87 + },
  88 +
  89 + updateUserInfo(code, memberInfo) {
  90 + return this.Login(code, memberInfo)
  91 + },
  92 + async updateUserInfoScan(code, memberInfo) {
  93 + await this.getLocation()
  94 + return this.LoginScan(code, memberInfo)
  95 + },
  96 +
  97 + getUserInfo() {
  98 + return new Promise((resolve, reject) => {
  99 + if (!wx.getUserProfile) {
  100 + resolve({})
  101 + return
  102 + }
  103 + wx.getUserProfile({
  104 + desc: '用于完善会员资料',
  105 + complete(res) {
  106 + resolve(res)
  107 + }
  108 + })
  109 + })
  110 + },
  111 +
  112 + Login(code, { encryptedData = '', iv = '' }) {
  113 + const _this = this
  114 + const params = {
  115 + encryptedData,
  116 + iv,
  117 + code
  118 + }
  119 + return new Promise((resolve, reject) => {
  120 + this.api.updateUserInfo(params).then(res => {
  121 + const {unionId,userId,wxappOpenId,wxappEcdOpenId,wxchatOpenId} = res.data
  122 + wx.setStorageSync('nick', res.data)
  123 + wx.setStorageSync('subData', {
  124 + unionId,
  125 + userId,
  126 + openId:wxappOpenId ? wxappOpenId : wxappEcdOpenId ? wxappEcdOpenId : wxchatOpenId
  127 + })
  128 + if (res.status === 1) {
  129 + resolve(res.data)
  130 + _this.globalData.token = res.data.token
  131 + _this.globalData.userId = res.data.userId
  132 + }
  133 + })
  134 + })
  135 + },
  136 + LoginScan(code, { encryptedData = '', iv = '' }) {
  137 + const _this = this
  138 + const { locate } = _this.globalData
  139 + const params = {
  140 + encryptedData,
  141 + iv,
  142 + code,
  143 + locate
  144 + }
  145 + return new Promise((resolve, reject) => {
  146 + this.api.updateUserInfoScan(params).then(res => {
  147 + const {unionId,userId,wxappOpenId,wxappEcdOpenId,wxchatOpenId} = res.data
  148 + wx.setStorageSync('nick', res.data)
  149 + wx.setStorageSync('subData', {
  150 + unionId,
  151 + userId,
  152 + openId:wxappOpenId ? wxappOpenId : wxappEcdOpenId ? wxappEcdOpenId : wxchatOpenId
  153 + })
  154 + if (res.status === 1) {
  155 + resolve(res.data)
  156 + _this.globalData.token = res.data.token
  157 + }
  158 + })
  159 + })
  160 + },
  161 +
  162 + getCoupon(locate, presentId, cb, linkId = '') {
  163 + if (isGetCoupon) {
  164 + wx.showToast({
  165 + title: '正在领取,请耐心等待',
  166 + icon: 'none'
  167 + })
  168 + return
  169 + } else {
  170 + isGetCoupon = true
  171 + }
  172 + this.api
  173 + .getCoupons({
  174 + locate: locate,
  175 + presentId: presentId,
  176 + linkId: linkId
  177 + })
  178 + .then(res => {
  179 + isGetCoupon = false
  180 + if (res.status === 1) {
  181 + setTimeout(() => {
  182 + wx.showToast({
  183 + title: `领取成功, 已领${wx.getStorageSync('couponForGetCount') + 1}张`,
  184 + icon: 'none',
  185 + duration: 3000
  186 + })
  187 + }, 1000)
  188 + } else {
  189 + }
  190 + if (cb) {
  191 + cb(res.data)
  192 + }
  193 + })
  194 + },
  195 + uploadFile(context, callBack, directory = 'fileData/') {
  196 + let filePath = context
  197 + if (typeof context === 'object') {
  198 + wx.showLoading({
  199 + title: context.msg
  200 + })
  201 + filePath = context.filePath
  202 + }
  203 + OssUploader(filePath, directory, res => {
  204 + wx.hideLoading()
  205 + callBack(res)
  206 + })
  207 + },
  208 + /**
  209 + * @param {*} path 链接
  210 + * @return {*}
  211 + * @author: swordman
  212 + * @description: 获取链接路径
  213 + * @example:
  214 + */
  215 + GetUrlParh(path) {
  216 + //获取type
  217 + if (!path) {
  218 + return ''
  219 + }
  220 + // return path.split('n/')[1].split('?')[0]
  221 + const parts = path.split('/'); // 以 '/' 为分隔符拆分字符串
  222 + return parts[3].toLowerCase();
  223 + },
  224 + uploadFile(context, callBack, directory = 'fileData/') {
  225 + let filePath = context
  226 + if (typeof context === 'object') {
  227 + wx.showLoading({
  228 + title: context.msg
  229 + })
  230 + filePath = context.filePath
  231 + }
  232 + OssUploader(filePath, directory, res => {
  233 + wx.hideLoading()
  234 + callBack(res)
  235 + })
  236 + },
  237 + // 订阅消息
  238 + sendSubscribeMessage(tmplIds = [], cb) {
  239 + if (wx.requestSubscribeMessage) {
  240 + wx.requestSubscribeMessage({
  241 + tmplIds,
  242 + success(res) {},
  243 + fail(res) {},
  244 + complete(res) {
  245 + if (cb) {
  246 + cb(res)
  247 + }
  248 + }
  249 + })
  250 + } else {
  251 + if (cb) {
  252 + cb()
  253 + }
  254 + }
  255 + },
  256 + // 获取设备信息
  257 + getSystemInfoSync() {
  258 + try {
  259 + const res = wx.getSystemInfoSync()
  260 + console.log(res, '设备信息')
  261 + this.globalData.systemInfo = res
  262 + } catch (e) {}
  263 + },
  264 + getStatusBarHeight() {
  265 + return this.globalData.systemInfo?.statusBarHeight || 20
  266 + },
  267 + getTitleBarHeight() {
  268 + return this.globalData.systemInfo?.model.indexOf('iPhone') !== -1 ? 44 : 48
  269 + },
  270 + globalData: {
  271 + userInfo: null,
  272 + token: '',
  273 + isUserInfoScope: false,
  274 + isEnableLocation: 0,
  275 + distance: 0,
  276 + payAmount: 0,
  277 + storeName: '',
  278 + storeId: '',
  279 + locate: '',
  280 + weiyiUserIdentity: false, // 唯怡一码双扫用户身份判断,true:服务员,false:消费者
  281 + qrCode: '', // 唯怡一码双扫页面调用的二维码
  282 + brandId: '117', // 唯怡一码双扫使用内容117、测试196
  283 + groupId: '', // 唯怡一码双扫使用内容
  284 + summary: '', // 唯怡一码双扫使用内容
  285 + thirdPhone: '', // 唯怡一码双扫使用内容
  286 + simpleCode: '', // 唯怡一码双扫使用内容
  287 + isUserPhone: '', // 唯怡一码双扫使用内容,判断用户是否需要填写手机号
  288 + scopeCamera: '',
  289 + systemInfo: null
  290 + },
  291 + utils: utils,
  292 + api: api,
  293 + config: config
  294 +})
  295 +
  296 +// eslint-disable-next-line no-extend-native
  297 +Date.prototype.pattern = function (fmt) {
  298 + // 日期处理
  299 + const o = {
  300 + 'M+': this.getMonth() + 1, // 月份
  301 + 'd+': this.getDate(), // 日
  302 + 'h+': this.getHours() % 12 === 0 ? 12 : this.getHours() % 12, // 小时
  303 + 'H+': this.getHours(), // 小时
  304 + 'm+': this.getMinutes(), // 分
  305 + 's+': this.getSeconds(), // 秒
  306 + 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
  307 + S: this.getMilliseconds() // 毫秒
  308 + }
  309 + const week = {
  310 + 0: '\u65e5',
  311 + 1: '\u4e00',
  312 + 2: '\u4e8c',
  313 + 3: '\u4e09',
  314 + 4: '\u56db',
  315 + 5: '\u4e94',
  316 + 6: '\u516d'
  317 + }
  318 + if (/(y+)/.test(fmt)) {
  319 + fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
  320 + }
  321 + if (/(E+)/.test(fmt)) {
  322 + fmt = fmt.replace(RegExp.$1, (RegExp.$1.length > 1 ? (RegExp.$1.length > 2 ? '\u661f\u671f' : '\u5468') : '') + week[this.getDay() + ''])
  323 + }
  324 + for (const k in o) {
  325 + if (new RegExp('(' + k + ')').test(fmt)) {
  326 + fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
  327 + }
  328 + }
  329 + return fmt
  330 +}
  1 +{
  2 + "pages": [
  3 + "custom-pages/custom-index/index",
  4 + "pages/index/index",
  5 + "pages/couponPack/couponPack",
  6 + "pages/login/login",
  7 + "pages/defaultError/defaultError",
  8 + "pages/scan/index/index",
  9 + "custom-pages/custom-product/index",
  10 + "custom-pages/custom-scan/index",
  11 + "pages/clearCode/index",
  12 + "pages/webView/index"
  13 + ],
  14 + "subPackages": [{
  15 + "root": "scanGroup",
  16 + "pages": ["index/index", "dahaoda/index/index", "dahaoda/record/index", "jyScan/index/index",
  17 + "jyScan/record/index"
  18 + ]
  19 + },
  20 + {
  21 + "root": "middlePage",
  22 + "pages": [
  23 + "pages/privacyGps/privacyGps",
  24 + "pages/scanCode/scanCode",
  25 + "pages/scan/scan",
  26 + "pages/scanTest/scanTest",
  27 + "pages/rule/rule"
  28 + ]
  29 + }
  30 + ],
  31 + "entryPagePath": "custom-pages/custom-index/index",
  32 + "window": {
  33 + "backgroundTextStyle": "light",
  34 + "navigationBarBackgroundColor": "#fff",
  35 + "navigationBarTitleText": "味动力乳酸菌",
  36 + "navigationBarTextStyle": "black"
  37 + },
  38 + "tabBar": {
  39 + "custom": true,
  40 + "list": [{
  41 + "pagePath": "custom-pages/custom-index/index",
  42 + "text": "首页",
  43 + "iconPath": "/images/icon_index_act.png"
  44 + },
  45 + {
  46 + "pagePath": "custom-pages/custom-scan/index",
  47 + "text": "扫码"
  48 + },
  49 + {
  50 + "pagePath": "custom-pages/custom-product/index",
  51 + "text": "产品介绍"
  52 + }
  53 + ]
  54 + },
  55 + "usingComponents": {
  56 + "mp-html": "mp-html",
  57 + "v-popup": "./components/v-popup/v-popup",
  58 + "mp-navigation-bar": "weui-miniprogram/navigation-bar/navigation-bar"
  59 + },
  60 + "requiredPrivateInfos": ["getFuzzyLocation"],
  61 + "permission": {
  62 + "scope.userFuzzyLocation": {
  63 + "desc": "你的位置信息将用于活动参与"
  64 + }
  65 + },
  66 + "plugins": {},
  67 + "useExtendedLib": {
  68 + "weui": true
  69 + },
  70 + "__usePrivacyCheck__": true,
  71 + "sitemapLocation": "sitemap.json"
  72 +}
  1 +/**app.wxss**/
  2 +
  3 +button {
  4 + padding: 0;
  5 + margin: 0;
  6 + border: 0;
  7 + background: transparent;
  8 + line-height: auto;
  9 + border-radius: 0;
  10 + /* line-height: 1; */
  11 +}
  12 +
  13 +button::after {
  14 + border: 0;
  15 + border-radius: 0;
  16 + width: 0;
  17 + height: 0;
  18 +}
  19 +
  20 +.btn-scan {
  21 + margin-bottom: 34rpx !important;
  22 + margin-top: 61rpx !important;
  23 +}
  24 +
  25 +.ellipsis {
  26 + overflow: hidden;
  27 + text-overflow: ellipsis;
  28 + white-space: nowrap;
  29 +}
  1 +// clearCode/index.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad(options) {
  15 +
  16 + },
  17 +
  18 + /**
  19 + * 生命周期函数--监听页面初次渲染完成
  20 + */
  21 + onReady() {
  22 +
  23 + },
  24 +
  25 + /**
  26 + * 生命周期函数--监听页面显示
  27 + */
  28 + onShow() {
  29 +
  30 + },
  31 +
  32 + /**
  33 + * 生命周期函数--监听页面隐藏
  34 + */
  35 + onHide() {
  36 +
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面卸载
  41 + */
  42 + onUnload() {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 页面相关事件处理函数--监听用户下拉动作
  48 + */
  49 + onPullDownRefresh() {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 页面上拉触底事件的处理函数
  55 + */
  56 + onReachBottom() {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * 用户点击右上角分享
  62 + */
  63 + onShareAppMessage() {
  64 +
  65 + }
  66 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<!--clearCode/index.wxml-->
  2 +<text>clearCode/index.wxml</text>
  1 +/* clearCode/index.wxss */
  1 +// clearCode/index/index.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad(options) {
  15 +
  16 + },
  17 +
  18 + /**
  19 + * 生命周期函数--监听页面初次渲染完成
  20 + */
  21 + onReady() {
  22 +
  23 + },
  24 +
  25 + /**
  26 + * 生命周期函数--监听页面显示
  27 + */
  28 + onShow() {
  29 +
  30 + },
  31 +
  32 + /**
  33 + * 生命周期函数--监听页面隐藏
  34 + */
  35 + onHide() {
  36 +
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面卸载
  41 + */
  42 + onUnload() {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 页面相关事件处理函数--监听用户下拉动作
  48 + */
  49 + onPullDownRefresh() {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 页面上拉触底事件的处理函数
  55 + */
  56 + onReachBottom() {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * 用户点击右上角分享
  62 + */
  63 + onShareAppMessage() {
  64 +
  65 + }
  66 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<!--clearCode/index/index.wxml-->
  2 +<text>clearCode/index/index.wxml</text>
  1 +/* clearCode/index/index.wxss */
  1 +Component({
  2 + /**
  3 + * 组件的属性列表
  4 + */
  5 + properties: {
  6 + sildeBlockCont: { //接受父组件值
  7 + type: String
  8 + },
  9 + isVisibile:{ //控制组件
  10 + type:Boolean
  11 + }
  12 + },
  13 + /**
  14 + * 组件的初始数据
  15 + */
  16 + data: {
  17 + slidebel:false,//滑动弹窗
  18 +     canfile_image:'',//裁剪图片
  19 +     canfile_index:'',//图片返回 1 至 3 之间的数
  20 +     canfile_x:'',//x返回 60 至 240 之间的数
  21 +     canfile_y:'',//y返回 0 至 50 之间的数
  22 +     slide_clientX:0,//移动位置
  23 +     slide_status:0,//0 停止操作   1 触发长按   2 正确   3 错误
  24 + originY:0, //y数据
  25 + trail:[], //数组
  26 + },
  27 + /**
  28 + * 组件的方法列表
  29 + */
  30 + methods: {
  31 + // 弹窗
  32 + visidlisd(e){
  33 + this.setData({
  34 +   slidebel:!this.data.slidebel
  35 + })
  36 + if(this.data.slidebel){
  37 +   this.slide_tap()
  38 + }
  39 + },
  40 + // 画布
  41 +  slide_tap(e){
  42 +     var that = this
  43 +     that.setData({
  44 +       canfile_index:Math.round(Math.random() * 8 + 1),
  45 +       canfile_x:Math.round(Math.random() * 180 + 60),
  46 +       canfile_y:Math.round(Math.random() * 54),
  47 +       canfile_image:''
  48 +     })
  49 +     clearTimeout(that.data.timeoutID)
  50 +     that.data.timeoutID = setTimeout(function () {
  51 +       var context = wx.createCanvasContext('firstCanvas',that)
  52 +       context.width = 300
  53 +       context.height = 150
  54 + wx.downloadFile({
  55 + url: 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/BUSINESS/SCAN/bpp/sliderVerify/'+that.data.canfile_index+'.jpg',
  56 + success:function(res){
  57 + var imgUrl= res.tempFilePath;
  58 + context.drawImage(imgUrl,0,0,context.width,context.height)
  59 + context.draw(true,(()=>{
  60 +       wx.canvasToTempFilePath({
  61 +           x: that.data.canfile_x,
  62 +           y: that.data.canfile_y,
  63 +           width:50,
  64 +           height:50,
  65 +           canvasId: 'firstCanvas',
  66 +           success: function (res) {
  67 + // console.log(res);
  68 +             that.setData({
  69 +               canfile_image:res.tempFilePath
  70 +             })
  71 +           }
  72 +         },that);
  73 + }))
  74 + }
  75 + })
  76 +     },300)
  77 + },
  78 + // 滑动开始
  79 + slide_start(e){
  80 + this.setData({
  81 +  slide_status:1,
  82 + originY: e.clientY || e.touches[0].clientY
  83 + })
  84 + },
  85 + // 滑动中
  86 + slide_hmove(e){
  87 + var eventY = e.clientY || e.touches[0].clientY;
  88 + var moveY = eventY - this.data.originY;
  89 + var arr=[]
  90 + arr.push(Math.round(moveY))
  91 + this.setData({
  92 + slide_clientX:(e.touches[0].clientX - 60) < 1 ? 0 : (e.touches[0].clientX - 60),
  93 + })
  94 + this.data.trail.push(Math.round(moveY))
  95 + },
  96 + //滑动结束
  97 + slide_chend(e){
  98 + // console.log(JSON.stringify(this.data.trail));
  99 + // 滑动结束验证
  100 + this.triggerEvent("verify",JSON.stringify(this.data.trail))
  101 + var that = this
  102 + var cliextX;
  103 + if(that.data.slide_clientX < 1){
  104 +   that.data.slide_status = 0
  105 + return false
  106 + }
  107 +  if(that.data.slide_clientX > 240){
  108 +     cliextX = 240
  109 +  }else{
  110 +     cliextX = that.data.slide_clientX
  111 +  }
  112 + if(((that.data.canfile_x + 5) > cliextX) && ((that.data.canfile_x - 5) < cliextX)){
  113 +      that.setData({
  114 +        slide_status:2,
  115 +        slide_clientX:that.data.canfile_x,
  116 +      })
  117 + // 验证成功触发父组件函数
  118 + this.triggerEvent("success")
  119 +     that.setData({
  120 +     slidebel:false,
  121 +     })
  122 +  }else{
  123 +     that.setData({
  124 +       slide_status:3,
  125 +     })
  126 + // 验证失败出发父组件函数
  127 + this.triggerEvent("fail")
  128 +  }
  129 +  setTimeout(function () {
  130 +      that.setData({
  131 +        slide_status:0,
  132 +        slide_clientX:0,
  133 +     })
  134 +  },1500)
  135 + },
  136 + },
  137 + lifetimes: {
  138 + created() {
  139 + // 在组件实例刚刚被创建时执行
  140 + },
  141 + attached: function() {
  142 + // 在组件实例进入页面节点树时执行
  143 + },
  144 + ready() {
  145 + // 在组件在视图层布局完成后执行
  146 + // console.log(this.properties.sildeBlockCont);
  147 + },
  148 + }
  149 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!-- 滑动验证弹窗 -->
  2 +<view class="slide_model" wx:if="{{slidebel}}">
  3 + <view>
  4 + <view class="canvas_img">
  5 + <canvas wx:if="{{!canfile_image}}" style="width: 300px; height: 104px;" canvas-id="firstCanvas" id="firstCanvas"></canvas>
  6 + <image wx:if="{{canfile_image}}" class="canvas_srinl" src='https://hbrand.oss-cn-hangzhou.aliyuncs.com/BUSINESS/SCAN/bpp/sliderVerify/{{canfile_index}}.jpg'></image>
  7 + <view class="canvas_view" style="left:{{canfile_x}}px;top:{{canfile_y}}px;"></view>
  8 + <image class="canfile_image" style="top:{{canfile_y}}px;left:{{slide_clientX > 250 ? 250 : slide_clientX}}px;" src="{{canfile_image}}"></image>
  9 + </view>
  10 + <!-- 滑块 -->
  11 + <view class="canvas_slide">
  12 + <view class="canvas_width" style="width:{{slide_clientX > 260?260:slide_clientX}}px;{{slide_status == 2?'background:#52CCBA;':''}}{{slide_status == 3?'background:#F57A7A;':''}}"></view>
  13 + <view class="canvas_kus" bindtouchstart="slide_start" bindtouchmove="slide_hmove" bindtouchend="slide_chend"
  14 + style="left:{{slide_clientX > 260?260:slide_clientX}}px;{{slide_status == 0?'color: #333;':''}}{{slide_status == 1?'background:#1991FA;':''}}{{slide_status == 2?'background:#52CCBA;':''}}{{slide_status == 3?'background:#F57A7A;':''}}">
  15 + <view wx:if="{{slide_status < 2}}" class="cuIcon-back_android"></view>
  16 + <view wx:if="{{slide_status == 2}}" class="cuIcon-check"></view>
  17 + <view wx:if="{{slide_status == 3}}" class="cuIcon-close"></view>
  18 + </view>
  19 + <view wx:if="{{slide_status == 0}}">拖动左边滑块完成上方拼图</view>
  20 + </view>
  21 + <!-- ------按钮------ -->
  22 + <view class="canvas_guil">
  23 + <!-- <view bindtap="visidlisd" class="cuIcon-roundclose">关闭</view> -->
  24 + <view bindtap="slide_tap" class="cuIcon-refresh">刷新</view>
  25 + </view>
  26 + </view>
  27 +</view>
  1 +/* components/SliderVerify/SliderVerify.wxss */
  2 +/* 滑动验证 */
  3 +.slide_model {
  4 + width: 100%;
  5 + height: 100vh;
  6 + z-index: 10;
  7 + position: fixed;
  8 + left: 0;
  9 + top: 0;
  10 + background: rgba(0, 0, 0, 0.4);
  11 + display: flex;
  12 + align-items: center;
  13 + justify-content: center;
  14 + }
  15 +
  16 + .slide_model>view {
  17 + float: left;
  18 + z-index: 1;
  19 + position: relative;
  20 + width: calc(300px + 60rpx);
  21 + background-color: rgb(255, 255, 255);
  22 + border-radius: 8px
  23 + }
  24 +
  25 + .canvas_img {
  26 + width: 300px;
  27 + height: 150px;
  28 + position: relative;
  29 + background-color: rgb(255, 255, 255);
  30 + float: left;
  31 + margin: 30rpx 30rpx 0;
  32 + }
  33 +
  34 + .canvas_view {
  35 + width: 50px;
  36 + height: 50px;
  37 + position: absolute;
  38 + background: #fff;
  39 + z-index: 2;
  40 + }
  41 +
  42 + .canfile_image {
  43 + width: 50px;
  44 + height: 50px;
  45 + position: absolute;
  46 + left: 0;
  47 + z-index: 3;
  48 + box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.2);
  49 + }
  50 +
  51 + .canvas_kus {
  52 + width: 40px;
  53 + height: 40px;
  54 + background-color: #fff;
  55 + font-size: 36rpx;
  56 + font-weight: 700;
  57 + position: absolute;
  58 + left: 0;
  59 + top: 0;
  60 + border: 1px solid #ddd;
  61 + color: #fff;
  62 + }
  63 +
  64 + .canvas_srinl {
  65 + width: 300px;
  66 + /* height: 104px; */
  67 + height: 150px;
  68 + }
  69 +
  70 + .canvas_width {
  71 + position: absolute;
  72 + left: 0;
  73 + top: 0;
  74 + height: 40px;
  75 + background-color: #1991FA;
  76 + width: 0;
  77 + border-top: 1px solid #ddd;
  78 + border-bottom: 1px solid #ddd;
  79 + }
  80 +
  81 + .cuIcon-back_android {
  82 + transform: rotate(180deg);
  83 + }
  84 +
  85 + .canvas_slide {
  86 + width: 300px;
  87 + height: 40px;
  88 + background: #eee;
  89 + text-align: center;
  90 + /* padding-left: 50rpx; */
  91 + line-height: 80rpx;
  92 + float: left;
  93 + margin: 30rpx;
  94 + position: relative;
  95 + font-size: 26rpx;
  96 + }
  97 +
  98 + .canvas_guil {
  99 + width: 100%;
  100 + border-top: 1px solid #f4f4f4;
  101 + height: 80rpx;
  102 + display: flex;
  103 + align-items: center;
  104 + float: left;
  105 + font-size: 35rpx;
  106 + color: #666;
  107 + }
  108 +
  109 + .canvas_guil>view {
  110 + margin-left: 30rpx;
  111 + }
  112 +
  1 +// components/bottomBar/bottomBar.js
  2 +Component({
  3 + /**
  4 + * 组件的属性列表
  5 + */
  6 + properties: {
  7 + active: {
  8 + type: String,
  9 + value: 'getCoupon'
  10 + }
  11 + },
  12 +
  13 + /**
  14 + * 组件的初始数据
  15 + */
  16 + data: {
  17 +
  18 + },
  19 +
  20 + /**
  21 + * 组件的方法列表
  22 + */
  23 + methods: {
  24 + goToFindShop() {
  25 + wx.redirectTo({
  26 + url: '/pages/findShop/findShop'
  27 + })
  28 + },
  29 + goToCouponPack() {
  30 + wx.redirectTo({
  31 + url: '/pages/couponPack/couponPack'
  32 + })
  33 + },
  34 + goToShopCoupon() {
  35 + wx.redirectTo({
  36 + url: '/pages/shopCoupon/shopCoupon'
  37 + })
  38 + }
  39 + }
  40 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<view class="tabbar">
  2 + <view class="tabbar-item" bindtap="goToShopCoupon">
  3 + <image class="tabbar-item__icon" src="icon/lingquan{{active=='getCoupon'?'2':'1'}}.png" mode="widthFix" />
  4 + <text class="tabbar-item__text {{active=='getCoupon'?'active':''}}">领券</text>
  5 + </view>
  6 + <view class="tabbar-item" bindtap="goToFindShop">
  7 + <image class="tabbar-item__icon" src="icon/zhaodian{{active=='findShop'?'2':'1'}}.png" mode="widthFix" />
  8 + <text class="tabbar-item__text {{active=='findShop'?'active':''}}">找店</text>
  9 + </view>
  10 + <view class="tabbar-item" bindtap="goToCouponPack">
  11 + <image class="tabbar-item__icon" src="icon/quanbao{{active=='couponPack'?'2':'1'}}.png" mode="widthFix" />
  12 + <text class="tabbar-item__text {{active=='couponPack'?'active':''}}">我的券包</text>
  13 + </view>
  14 +</view>
  15 +
  1 +/* 底部导航栏样式 */
  2 +.tabbar {
  3 + width: 100%;
  4 + height: 98rpx;
  5 + background-color: #fff;
  6 + position: fixed;
  7 + bottom: 0;
  8 + left: 0;
  9 + display: flex;
  10 + justify-content: center;
  11 +
  12 +}
  13 +
  14 +.tabbar-item {
  15 + height: 100%;
  16 + width: 33.33%;
  17 + color: #666;
  18 +
  19 +
  20 +}
  21 +
  22 +.tabbar-item__icon {
  23 + width: 40rpx;
  24 + height: 40rpx;
  25 + display: block;
  26 + margin: 15rpx auto 6rpx;
  27 +}
  28 +
  29 +.tabbar-item__text {
  30 + text-align: center;
  31 + display: block;
  32 + margin: 0 auto;
  33 + font-size: 22rpx;
  34 +}
  35 +
  36 +.active {
  37 + color: #FF7F00;
  38 +}
  1 +// components/button.js
  2 +Component({
  3 + /**
  4 + * 组件的属性列表
  5 + */
  6 + properties: {
  7 + text: {
  8 + type: String,
  9 + value: '',
  10 + },
  11 + type: {
  12 + type: String,
  13 + value: 'normal',
  14 + },
  15 + plain: {
  16 + type: Boolean,
  17 + value: false,
  18 + },
  19 + disabled: {
  20 + type: Boolean,
  21 + value: false,
  22 + }
  23 + },
  24 + /**
  25 + * 暴露class
  26 + */
  27 + externalClasses: ['lx-class'],
  28 +
  29 + /**
  30 + * 组件的初始数据
  31 + */
  32 + data: {
  33 + typeMap: {
  34 + normal: 'orange-theme',
  35 + success: 'green-theme',
  36 + primary: 'blue-theme',
  37 + danger: 'red-theme'
  38 + }
  39 + },
  40 +
  41 + /**
  42 + * 组件的方法列表
  43 + */
  44 + methods: {
  45 +
  46 + }
  47 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<button wx:if="{{plain}}" class="lx-class {{typeMap[type]}} btn btn-line" disabled="{{disabled}}">{{text}}</button>
  2 +
  3 +<button wx:else class="lx-class {{typeMap[type]}} btn btn-solid" disabled="{{disabled}}">{{text}}</button>
  4 +
  1 +/* components/button.wxss */
  2 +/* pages/couponDetail/couponDetail.wxss */
  3 +.btn {
  4 + width: 85%;
  5 + height: 80rpx;
  6 +
  7 + border-radius: 40rpx;
  8 +
  9 + font-size: 32rpx;
  10 + font-weight: 400;
  11 + display: block;
  12 + margin: 0 auto;
  13 +}
  14 +
  15 +.btn::after {
  16 + border: none;
  17 +}
  18 +
  19 +.btn-solid {
  20 + background-color: #FF7F00;
  21 + color: #fff !important;
  22 +}
  23 +
  24 +
  25 +.btn-line {
  26 + background-color: #fff !important;
  27 + border: 1px solid #FF7F00;
  28 + color: #FF7F00;
  29 +}
  30 +
  31 +.btn[disabled] {
  32 + background-color: rgba(255, 127, 0, 0.4) !important;
  33 + border-color: rgba(255, 127, 0, 0.4) !important;
  34 + color: #FFF !important;
  35 +}
  36 +
  37 +.green-theme {
  38 + background-color: #47BB01;
  39 + border-color: #47BB01;
  40 + color: #47BB01;
  41 +}
  42 +
  43 +.blue-theme {
  44 + background-color: #409eff;
  45 + border-color: #409eff;
  46 + color: #409eff;
  47 +}
  48 +
  49 +.danger-theme {
  50 + background-color: #f56c6c;
  51 + border-color: #f56c6c;
  52 + color: #f56c6c;
  53 +}
  1 +// component/v-noneData/v-noneData.js
  2 +Component({
  3 + /**
  4 + * 组件的属性列表
  5 + */
  6 + properties: {
  7 + imageUrl: String,
  8 + text: String,
  9 + subtitle: String,
  10 + top: {
  11 + type: String,
  12 + value: '0rpx'
  13 + }
  14 + },
  15 +
  16 + /**
  17 + * 组件的初始数据
  18 + */
  19 + data: {
  20 +
  21 + },
  22 +
  23 + /**
  24 + * 组件的方法列表
  25 + */
  26 + methods: {
  27 + imageLoad(e) {
  28 + let { width, height } = e.detail;
  29 + this.setData({
  30 + style: `width: ${width}rpx;height: ${height}rpx;`
  31 + })
  32 + }
  33 + }
  34 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +
  2 +@import '../../utils/less/global.less';
  3 +
  4 +.image{
  5 + margin: 0 auto;
  6 +}
  7 +
  8 +.hideImg{
  9 + display: none;
  10 +}
  11 +
  12 +.text{
  13 + text-align: center;
  14 + margin-top: 30rpx;
  15 + color: @subTitle-color;
  16 + font-size: 28rpx;
  17 +}
  1 +<!--component/v-noneData/v-noneData.wxml-->
  2 +
  3 +<view class='none' style='padding-top: {{ top }}'>
  4 + <image style='{{ style }}' class='image {{ style ? "" : "hideImg" }}' src='{{ imageUrl }}' bindload="imageLoad" />
  5 + <view class='text'>{{ text }}</view>
  6 + <view class='text' wx:if='{{ subtitle }}'>{{ subtitle }}</view>
  7 +</view>
  1 +.image {
  2 + display: block;
  3 + margin: 0 auto;
  4 +}
  5 +.hideImg {
  6 + display: none;
  7 +}
  8 +.text {
  9 + text-align: center;
  10 + margin-top: 30rpx;
  11 + color: #999999;
  12 + font-size: 28rpx;
  13 + width: 650rpx;
  14 + margin-left: 50rpx;
  15 +}
  1 +// component/v-noneData/v-noneData.js
  2 +Component({
  3 + /**
  4 + * 组件的属性列表
  5 + */
  6 + properties: {
  7 + showPopup: {
  8 + type: Boolean,
  9 + value: false
  10 + }
  11 + },
  12 +
  13 + /**
  14 + * 组件的初始数据
  15 + */
  16 + data: {
  17 +
  18 + },
  19 +
  20 + /**
  21 + * 组件的方法列表
  22 + */
  23 + methods: {
  24 +
  25 + }
  26 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--弹窗插件-->
  2 +<view class="mask" wx:if="{{showPopup}}">
  3 + <view class="mask-wrap">
  4 + <slot></slot>
  5 + </view>
  6 +</view>
  1 +.mask {
  2 + width: 100%;
  3 + height: 100%;
  4 + overflow: scroll;
  5 + background: rgba(0, 0, 0, 0.7);
  6 + position: fixed;
  7 + top: 0;
  8 + left: 0;
  9 + z-index: 1000;
  10 +}
  11 +
  12 +.mask-wrap {
  13 + display: flex;
  14 + flex-direction: column;
  15 + height: 100%;
  16 + align-items: center;
  17 + justify-content: center;
  18 +}
  1 +// components/v-tab/v-tab.js
  2 +const sliderWidth = 65
  3 +const app = getApp()
  4 +Component({
  5 + /**
  6 + * 组件的属性列表
  7 + */
  8 + externalClasses: ['extra-class'],
  9 + properties: {
  10 + dataList: {
  11 + type: Array,
  12 + value: [],
  13 + observer(selectIndex) {
  14 + this.menuData()
  15 + }
  16 + },
  17 + type: {
  18 + type: String,
  19 + value: 'array' // array 为 [1,2,3] 格式 objectArray 为 [{}]格式
  20 + },
  21 + selectIndex: {
  22 + type: Number,
  23 + value: 0,
  24 + observer(selectIndex) {
  25 + this.menuData()
  26 + }
  27 + }
  28 + },
  29 +
  30 + /**
  31 + * 组件的初始数据
  32 + */
  33 + data: {
  34 + sliderOffset: 0,
  35 + sliderLeft: 0
  36 + },
  37 +
  38 + // observers: {
  39 + // 'selectIndex': function(selectIndex) {
  40 + // this.menuData()
  41 + // }
  42 + // },
  43 +
  44 + lifetimes: {
  45 + attached() {
  46 + this.menuData()
  47 + }
  48 + },
  49 +
  50 + /**
  51 + * 组件的方法列表
  52 + */
  53 + methods: {
  54 + menuData() {
  55 + wx.getSystemInfo({
  56 + success: res => {
  57 + this.setData({
  58 + sliderLeft: (res.windowWidth / this.data.dataList.length - sliderWidth) / 2,
  59 + sliderOffset: res.windowWidth / this.data.dataList.length * this.data.selectIndex
  60 + })
  61 + }
  62 + })
  63 + },
  64 + tabClick(e) {
  65 + const { offsetLeft, id } = e.currentTarget
  66 + this.setData({
  67 + sliderOffset: offsetLeft,
  68 + selectIndex: id
  69 + })
  70 + if (this.data.type === 'array') {
  71 + this.triggerEvent('selectIndex', Number(id))
  72 + }
  73 + if (this.data.type === 'objectArray') {
  74 + this.triggerEvent('selectIndex', this.data.dataList[id].id)
  75 + }
  76 + }
  77 + }
  78 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +@import '../../utils/less/global.less';
  2 +
  3 +.v-tab {
  4 + width: 100%;
  5 + height: 80rpx;
  6 + background: #fff;
  7 + border-bottom: 1rpx solid @splitLine-color;
  8 + position: relative;
  9 +}
  10 +
  11 +.v-tabList {
  12 + width: 100%;
  13 + height: 100%;
  14 + display: flex;
  15 + align-items: center;
  16 + position: relative;
  17 +}
  18 +
  19 +.v-tab{
  20 + flex: 1;
  21 + color: @title-color;
  22 + font-size: 28rpx;
  23 + display: flex;
  24 + align-items: center;
  25 + justify-content: center;
  26 +}
  27 +
  28 +.v-tab-select {
  29 + font-size: 32rpx;
  30 + font-weight: 500;
  31 +}
  32 +
  33 +.v-tab-slider{
  34 + position: absolute;
  35 + left: 0;
  36 + bottom: 0;
  37 + width: 65px;
  38 + height: 5rpx;
  39 + background-color: @default-color;
  40 + transition: transform .3s;
  41 + border-radius: 3px;
  42 +}
  1 +<!--components/v-tab/v-tab.wxml-->
  2 +<view class='v-tab extra-class'>
  3 + <slot ></slot>
  4 + <view class='v-tabList'>
  5 + <view
  6 + class='v-tab {{ selectIndex == index && "v-tab-select" }}'
  7 + id='{{ index }}'
  8 + wx:for='{{ dataList }}'
  9 + wx:key='name'
  10 + bindtap='tabClick'>{{ type === 'array' ? item : item.name }}</view>
  11 + <view
  12 + class='v-tab-slider'
  13 + style='left: {{ sliderLeft }}px; transform: translateX({{ sliderOffset }}px); -webkit-transform: translateX({{ sliderOffset }}px);'></view>
  14 + </view>
  15 +</view>
  1 +.v-tab {
  2 + width: 100%;
  3 + height: 80rpx;
  4 + background: #fff;
  5 + /* border-bottom: 1rpx solid #d9d9d9; */
  6 + position: relative;
  7 +}
  8 +
  9 +.v-tabList {
  10 + width: 100%;
  11 + height: 100%;
  12 + display: flex;
  13 + align-items: center;
  14 + position: relative;
  15 +}
  16 +
  17 +.v-tab {
  18 + flex: 1;
  19 + color: #333333;
  20 + font-size: 28rpx;
  21 + display: flex;
  22 + align-items: center;
  23 + justify-content: center;
  24 +}
  25 +
  26 +.v-tab-select {
  27 + font-size: 32rpx;
  28 + font-weight: 500;
  29 +}
  30 +
  31 +.v-tab-slider {
  32 + position: absolute;
  33 + left: 0;
  34 + bottom: 0;
  35 + width: 65px;
  36 + height: 6rpx;
  37 + background-color: #FF9800;
  38 + transition: transform 0.3s;
  39 + border-radius: 6rpx;
  40 +}
  1 +import TouchEvent from "./utils/touchEvent";
  2 +const app = getApp()
  3 +Component({
  4 + properties: {
  5 + data: Array,
  6 + imgData:{
  7 + type:Array,
  8 + value:[]
  9 + },
  10 + back: {
  11 + type: String,
  12 + value: '#fff'
  13 + },
  14 + swiperCurIndex:{
  15 + type:Number,
  16 + value: 0,
  17 + observer: function(newVal, oldVal) {
  18 + if(newVal){
  19 +
  20 + }// 在这里可以对接收到的数据进行相应的处理
  21 + }
  22 +
  23 + }
  24 + },
  25 +
  26 + options: {
  27 + multipleSlots: true
  28 + },
  29 +
  30 + data: {
  31 + isLoading: false,
  32 + swiperData: [],
  33 + // swiperCurIndex: 0,
  34 + slideClass: "",
  35 + lockSwipe: false
  36 + },
  37 +
  38 + lifetimes: {
  39 + created() {
  40 + this.data.swiperData = this.data.swiperData.concat(this.data.data);
  41 + new TouchEvent(this, "touchCard", {
  42 + swipe: evt => {
  43 + if (evt.direction === "Left") this.next(evt);
  44 + if (evt.direction === "Right") this.prev(evt);
  45 + }
  46 + });
  47 + },
  48 + async attached() {
  49 + const res = await this.getImgData()
  50 + this.setData({
  51 + imgData:res.data.skuImgageList
  52 + }, () => {
  53 + let imgList = [ ].concat.apply([],this.data.imgData)
  54 + let swiperData = imgList.map(item=>{
  55 + return { url:item }
  56 + })
  57 + this.setData({
  58 + swiperData
  59 + })
  60 + })
  61 + },
  62 + ready(){
  63 +
  64 + },
  65 + },
  66 +
  67 + methods: {
  68 + getImgData(){
  69 + return app.utils.doPost({
  70 + url: '/junYao/homeSkuInfo.json',
  71 + params: {}
  72 + },true)
  73 + },
  74 + next(e) {
  75 + if (this.data.lockSwipe) return;
  76 + this.data.lockSwipe = true;
  77 + if (-this.data.swiperCurIndex >= this.data.swiperData.length - 1)
  78 + return (this.data.lockSwipe = false);
  79 +
  80 + if (-this.data.swiperCurIndex >= this.data.swiperData.length - 3) {
  81 + this.loadMore();
  82 + }
  83 +
  84 + const index = e.currentTarget.dataset["index"];
  85 + const { src } = e.currentTarget.dataset
  86 + let mySwiperIndex = this.data.swiperData.findIndex(item=>item.url==src)
  87 +
  88 + const tabIndex = this.data.imgData.findIndex(item => item.includes(this.data.swiperData[mySwiperIndex + 1].url));
  89 +
  90 + this.triggerEvent('updateTab',{ tabIndex })
  91 +
  92 + this.setData({ ["swiperData[" + index + "].slideClass"]: " ani-slide-up" }, () => {
  93 + this.setData({
  94 + swiperCurIndex: --this.data.swiperCurIndex
  95 + });
  96 + })
  97 +
  98 + setTimeout(() => {
  99 + this.data.lockSwipe = false;
  100 + this.setData({
  101 + ["swiperData[" + index + "].slideClass"]: ""
  102 + });
  103 + }, 360);
  104 + },
  105 +
  106 + prev(e) {
  107 + const index = e.currentTarget.dataset["index"] - 1;
  108 + const { src } = e.currentTarget.dataset
  109 + if (this.data.lockSwipe || index < 0) return;
  110 + this.data.lockSwipe = true;
  111 +
  112 + let mySwiperIndex = this.data.swiperData.findIndex(item=>item.url==src)
  113 +
  114 + const tabIndex = this.data.imgData.findIndex(item => item.includes(this.data.swiperData[mySwiperIndex - 1].url));
  115 +
  116 + this.triggerEvent('updateTab',{ tabIndex })
  117 +
  118 + this.setData({
  119 + swiperCurIndex: ++this.data.swiperCurIndex
  120 + });
  121 +
  122 + setTimeout(() => {
  123 + this.data.lockSwipe = false;
  124 + this.setData({
  125 + ["swiperData[" + index + "].slideClass"]: ""
  126 + });
  127 + }, 360);
  128 + },
  129 +
  130 + loadMore() {
  131 + this.isLoading = true;
  132 + this.triggerEvent("loadmore", { addToList: this.addToList.bind(this) });
  133 + },
  134 +
  135 + addToList(list) {
  136 + this.isLoading = false;
  137 + this.setData({
  138 + swiperData: this.data.swiperData.concat(list)
  139 + });
  140 + }
  141 + }
  142 +});
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!-- 决定将二维数组数据遍历出来 -->
  2 +<view class="card-swiper">
  3 + <view wx:for="{{swiperData}}" wx:key="index" data-index="{{index}}" data-src="{{item.url}}" style="background: {{back}};" class="{{'card-swiper-item curdistance' + (swiperCurIndex + index) + (!!item.slideClass? item.slideClass: '')}}" bindtap="next" catchtouchstart="touchCard.start" catchtouchmove="touchCard.move" catchtouchend="touchCard.end" catchtouchcancel="touchCard.cancel">
  4 + <image class="img_css" src="{{item.url}}" mode="scaleToFill"/>
  5 + </view>
  6 +</view>
  1 +/**index.wxss**/
  2 + .card-swiper{
  3 + position: relative;
  4 + width: 600rpx;
  5 + height: 1000rpx;
  6 + color: #666;
  7 + font-size: 28rpx;
  8 + width: 650rpx;
  9 + height: 1160rpx;
  10 + height: 100%;
  11 + box-shadow: 4rpx 6rpx 12rpx 0 #00438734;
  12 + }
  13 +
  14 +.card-swiper-item{
  15 + display: flex;
  16 + align-items: center;
  17 + justify-content: center;
  18 + position: absolute;
  19 + top: 0;
  20 + left: 0;
  21 + width: 600rpx;
  22 + height: 1000rpx;
  23 + width: 650rpx;
  24 + height: 1160rpx;
  25 + height: 100%;
  26 + background-color: #fff;
  27 + z-index: 0;
  28 + display: none;
  29 + }
  30 +
  31 + .card-swiper .card-swiper-item.curdistance0{
  32 + z-index: 10;
  33 + display: flex;
  34 + }
  35 +
  36 + .card-swiper .card-swiper-item.curdistance1{
  37 + display: flex;
  38 + z-index: 9;
  39 + }
  40 + .card-swiper .card-swiper-item.curdistance2{
  41 + display: flex;
  42 + z-index: 8;
  43 + }
  44 +
  45 + .ani-slide-up{
  46 + display: flex;
  47 + animation: slideUp .8s ease-out;
  48 + z-index: 11;
  49 + }
  50 +
  51 + .ani-slide-down{
  52 + display: flex;
  53 + animation: slideUp .6s ease-in;
  54 + animation-direction: reverse;
  55 + }
  56 +
  57 +
  58 + @keyframes slideUp{
  59 + 0% {
  60 + }
  61 + 70% {
  62 + opacity: 1;
  63 + }
  64 + 100% {
  65 + transform: rotate(-10deg) translate(-1500rpx,200rpx);
  66 + opacity: 0;
  67 + }
  68 + }
  69 + .img_css{
  70 + width: 100%;
  71 + height: 100%;
  72 + }
  73 +
  1 +var defaultOption = {
  2 + touchStart: function () { },
  3 + touchMove: function () { },
  4 + touchEnd: function () { },
  5 + touchCancel: function () { },
  6 + multipointStart: function () { },
  7 + multipointEnd: function () { },
  8 + tap: function () { },
  9 + doubleTap: function () { },
  10 + longTap: function () { },
  11 + singleTap: function () { },
  12 + rotate: function () { },
  13 + pinch: function () { },
  14 + pressMove: function () { },
  15 + swipe: function () { }
  16 +}
  17 +export default class YrobotTouch {
  18 + constructor(pageOBJ, name, option = {}) {
  19 + this.preV = { x: null, y: null };
  20 + this.pinchStartLen = null;
  21 + this.scale = 1;
  22 + this.isDoubleTap = false;
  23 +
  24 + this.delta = null;
  25 + this.last = null;
  26 + this.now = null;
  27 + this.tapTimeout = null;
  28 + this.singleTapTimeout = null;
  29 + this.longTapTimeout = null;
  30 + this.swipeTimeout = null;
  31 + this.x1 = this.x2 = this.y1 = this.y2 = null;
  32 + this.preTapPosition = { x: null, y: null };
  33 +
  34 + this.lastZoom = 1;
  35 + this.tempZoom = 1;
  36 +
  37 + try {
  38 + if (this._checkBeforeCreate(pageOBJ, name)) {
  39 + this._name = name
  40 + this._option = { ...defaultOption, ...option }
  41 + pageOBJ[name] = this
  42 + this._bindFunc(pageOBJ)
  43 + }
  44 + } catch (error) {
  45 + console.error(error)
  46 + }
  47 + }
  48 + _checkBeforeCreate(pageOBJ, name) {
  49 + if (!pageOBJ || !name) {
  50 + throw new Error('YrobotTouch实例化时,必须传入page对象和引用名')
  51 + return false
  52 + }
  53 + if (pageOBJ[name]) {
  54 + throw new Error('YrobotTouch实例化error: ' + name + ' 已经存在page中')
  55 + return false
  56 + }
  57 + return true
  58 + }
  59 + _bindFunc(pageOBJ) {
  60 + let funcNames = ['start', 'move', 'end', 'cancel']
  61 + for (let funcName of funcNames)
  62 + pageOBJ[this._name + '.' + funcName] = this[funcName].bind(this)
  63 + }
  64 + start(evt) {
  65 + if (!evt.touches) return;
  66 + this.now = Date.now();
  67 + this.x1 = evt.touches[0].pageX == null ? evt.touches[0].x : evt.touches[0].pageX;
  68 + this.y1 = evt.touches[0].pageY == null ? evt.touches[0].y : evt.touches[0].pageY;
  69 + this.delta = this.now - (this.last || this.now);
  70 + this._option.touchStart(evt);
  71 + if (this.preTapPosition.x !== null) {
  72 + this.isDoubleTap = (this.delta > 0 && this.delta <= 250 && Math.abs(this.preTapPosition.x - this.x1) < 30 && Math.abs(this.preTapPosition.y - this.y1) < 30);
  73 + }
  74 + this.preTapPosition.x = this.x1;
  75 + this.preTapPosition.y = this.y1;
  76 + this.last = this.now;
  77 + let preV = this.preV,
  78 + len = evt.touches.length;
  79 + if (len > 1) {
  80 + this._cancelLongTap();
  81 + this._cancelSingleTap();
  82 + let otx = evt.touches[1].pageX == null ? evt.touches[1].x : evt.touches[1].pageX;
  83 + let oty = evt.touches[1].pageY == null ? evt.touches[1].y : evt.touches[1].pageY;
  84 + let v = { x: otx - this.x1, y: oty - this.y1 };
  85 + preV.x = v.x;
  86 + preV.y = v.y;
  87 + this.pinchStartLen = getLen(preV);
  88 + this._option.multipointStart(evt);
  89 + }
  90 + this.longTapTimeout = setTimeout(function () {
  91 + evt.type = "longTap";
  92 + this._option.longTap(evt);
  93 + }.bind(this), 750);
  94 + }
  95 + move(evt) {
  96 + if (!evt.touches) return;
  97 + let preV = this.preV,
  98 + len = evt.touches.length,
  99 + currentX = evt.touches[0].pageX == null ? evt.touches[0].x : evt.touches[0].pageX,
  100 + currentY = evt.touches[0].pageY == null ? evt.touches[0].y : evt.touches[0].pageY;
  101 + this.isDoubleTap = false;
  102 + if (len > 1) {
  103 + let otx = evt.touches[1].pageX == null ? evt.touches[1].x : evt.touches[1].pageX;
  104 + let oty = evt.touches[1].pageY == null ? evt.touches[1].y : evt.touches[1].pageY;
  105 + let v = { x: otx - currentX, y: oty - currentY };
  106 +
  107 + if (preV.x !== null) {
  108 + if (this.pinchStartLen > 0) {
  109 + evt.singleZoom = getLen(v) / this.pinchStartLen;
  110 + evt.zoom = evt.singleZoom * this.lastZoom;
  111 + this.tempZoom = evt.zoom;
  112 + evt.type = "pinch";
  113 + this._option.pinch(evt);
  114 + }
  115 +
  116 + evt.angle = getRotateAngle(v, preV);
  117 + evt.type = "rotate";
  118 + this._option.rotate(evt);
  119 + }
  120 + preV.x = v.x;
  121 + preV.y = v.y;
  122 + } else {
  123 + if (this.x2 !== null) {
  124 + evt.deltaX = currentX - this.x2;
  125 + evt.deltaY = currentY - this.y2;
  126 +
  127 + } else {
  128 + evt.deltaX = 0;
  129 + evt.deltaY = 0;
  130 + }
  131 + this._option.pressMove(evt);
  132 + }
  133 +
  134 + this._option.touchMove(evt);
  135 +
  136 + this._cancelLongTap();
  137 + this.x2 = currentX;
  138 + this.y2 = currentY;
  139 + if (len > 1) {
  140 + // evt.preventDefault();
  141 + }
  142 + }
  143 + end(evt) {
  144 + if (!evt.changedTouches) return;
  145 + this._cancelLongTap();
  146 + let self = this;
  147 + evt.direction = this._swipeDirection(this.x1, this.x2, this.y1, this.y2); //在结束钩子都加入方向判断,但触发swipe瞬时必须位移大于30
  148 + if (evt.touches.length < 2) {
  149 + this.lastZoom = this.tempZoom;
  150 + this._option.multipointEnd(evt);
  151 + }
  152 + this._option.touchEnd(evt);
  153 + //swipe
  154 + if ((this.x2 && Math.abs(this.x1 - this.x2) > 30) ||
  155 + (this.y2 && Math.abs(this.y1 - this.y2) > 30)) {
  156 + // evt.direction = this._swipeDirection(this.x1, this.x2, this.y1, this.y2);
  157 + this.swipeTimeout = setTimeout(function () {
  158 + evt.type = "swipe";
  159 + self._option.swipe(evt);
  160 +
  161 + }, 0)
  162 + } else {
  163 + this.tapTimeout = setTimeout(function () {
  164 + evt.type = "tap";
  165 + self._option.tap(evt);
  166 + // trigger double tap immediately
  167 + if (self.isDoubleTap) {
  168 + evt.type = "doubleTap";
  169 + self._option.doubleTap(evt);
  170 + clearTimeout(self.singleTapTimeout);
  171 + self.isDoubleTap = false;
  172 + }
  173 + }, 0)
  174 +
  175 + if (!self.isDoubleTap) {
  176 + self.singleTapTimeout = setTimeout(function () {
  177 + self._option.singleTap(evt);
  178 + }, 250);
  179 + }
  180 + }
  181 +
  182 + this.preV.x = 0;
  183 + this.preV.y = 0;
  184 + this.scale = 1;
  185 + this.pinchStartLen = null;
  186 + this.x1 = this.x2 = this.y1 = this.y2 = null;
  187 + }
  188 + cancel(evt) {
  189 + clearTimeout(this.singleTapTimeout);
  190 + clearTimeout(this.tapTimeout);
  191 + clearTimeout(this.longTapTimeout);
  192 + clearTimeout(this.swipeTimeout);
  193 + this._option.touchCancel(evt);
  194 + }
  195 + _cancelLongTap() {
  196 + clearTimeout(this.longTapTimeout);
  197 + }
  198 +
  199 + _cancelSingleTap() {
  200 + clearTimeout(this.singleTapTimeout);
  201 + }
  202 +
  203 + _swipeDirection(x1, x2, y1, y2) {
  204 + return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down')
  205 + }
  206 + destroy() {
  207 + if (this.singleTapTimeout) clearTimeout(this.singleTapTimeout);
  208 + if (this.tapTimeout) clearTimeout(this.tapTimeout);
  209 + if (this.longTapTimeout) clearTimeout(this.longTapTimeout);
  210 + if (this.swipeTimeout) clearTimeout(this.swipeTimeout);
  211 +
  212 + this._option.rotate = null;
  213 + this._option.touchStart = null;
  214 + this._option.multipointStart = null;
  215 + this._option.multipointEnd = null;
  216 + this._option.pinch = null;
  217 + this._option.swipe = null;
  218 + this._option.tap = null;
  219 + this._option.doubleTap = null;
  220 + this._option.longTap = null;
  221 + this._option.singleTap = null;
  222 + this._option.pressMove = null;
  223 + this._option.touchMove = null;
  224 + this._option.touchEnd = null;
  225 + this._option.touchCancel = null;
  226 +
  227 + this.preV = this.pinchStartLen = this.scale = this.isDoubleTap = this.delta = this.last = this.now = this.tapTimeout = this.singleTapTimeout = this.longTapTimeout = this.swipeTimeout = this.x1 = this.x2 = this.y1 = this.y2 = this.preTapPosition = this.rotate = this.touchStart = this.multipointStart = this.multipointEnd = this.pinch = this.swipe = this.tap = this.doubleTap = this.longTap = this.singleTap = this.pressMove = this.touchMove = this.touchEnd = this.touchCancel = null;
  228 +
  229 + return null;
  230 + }
  231 +}
  232 +
  233 +function getLen(v) {
  234 + return Math.sqrt(v.x * v.x + v.y * v.y);
  235 +}
  236 +
  237 +function dot(v1, v2) {
  238 + return v1.x * v2.x + v1.y * v2.y;
  239 +}
  240 +
  241 +function getAngle(v1, v2) {
  242 + let mr = getLen(v1) * getLen(v2);
  243 + if (mr === 0) return 0;
  244 + let r = dot(v1, v2) / mr;
  245 + if (r > 1) r = 1;
  246 + return Math.acos(r);
  247 +}
  248 +
  249 +function cross(v1, v2) {
  250 + return v1.x * v2.y - v2.x * v1.y;
  251 +}
  252 +
  253 +function getRotateAngle(v1, v2) {
  254 + let angle = getAngle(v1, v2);
  255 + if (cross(v1, v2) > 0) {
  256 + angle *= -1;
  257 + }
  258 +
  259 + return angle * 180 / Math.PI;
  260 +}
  1 +Component({
  2 + /**
  3 + * 组件的属性列表
  4 + */
  5 + properties: {
  6 + transparent: { type: Boolean, value: false },
  7 + visible: { type: Boolean, value: false }
  8 + },
  9 +
  10 + /**
  11 + * 组件的初始数据
  12 + */
  13 + data: {},
  14 +
  15 + /**
  16 + * 组件的方法列表
  17 + */
  18 + methods: {
  19 + close() {
  20 + this.setData({
  21 + visible: false
  22 + })
  23 + }
  24 + }
  25 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<view class="cover" wx:if="{{visible}}">
  2 + <view class="popup {{transparent?'transparent':''}}">
  3 + <slot/>
  4 + <view class="icon-close" bindtap = "close"></view>
  5 + </view>
  6 +</view>
  1 +.cover {
  2 + width: 100%;
  3 + height: 100%;
  4 + position: fixed;
  5 + top: 0;
  6 + left: 0;
  7 + background: rgba(0, 0, 0, 0.8);
  8 + display: flex;
  9 + align-items: center;
  10 + justify-content: center;
  11 + z-index: 100;
  12 +}
  13 +
  14 +
  15 +.popup {
  16 + width: 658rpx;
  17 + max-height: 70vh;
  18 + background: #FFFFFF;
  19 + border-radius: 16rpx;
  20 + position: relative;
  21 + display: flex;
  22 + flex-direction: column;
  23 + align-items: center;
  24 + margin-bottom: 110rpx;
  25 +}
  26 +
  27 +.transparent {
  28 + background: none;
  29 +}
  30 +
  31 +.icon-close {
  32 + background: url('https://hbrand.oss-cn-hangzhou.aliyuncs.com/BUSINESS/CPP/weilong/icon_close.png') no-repeat center / cover;
  33 + width: 60rpx;
  34 + height: 60rpx;
  35 + position: absolute;
  36 + bottom: -110rpx;
  37 + left: calc(50% - 30rpx);
  38 +}
  1 +// custom-pages/custom-index/index.js
  2 +const app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + ruleShow:false,
  10 + groupId:null,
  11 + groupRule:'<p style="text-align:center;">\n\t消费者声明及活动详细规则\n</p>\n<p>\n\t请在参与本活动前仔细阅读本活动的各项条款,如果您参加了本活动,则活动主办方认为您已充分理解并同意该规则中的各条款:\n</p>\n<ol>\n\t<li>\n\t\t活动主办方及其联系方式:\n\t</li>\n</ol>\n<p style="text-indent:24px;">\n\t均瑶集团上海食品有限公司(以下简称“主办方”)\n</p>\n<p style="text-indent:24px;">\n\t联系电话:021-60251969(话费自理,工作日:9:00-12:00,13:30-18:00)\n</p>\n<ol>\n\t<li>\n\t\t活动期间及兑奖时间:\n\t</li>\n</ol>\n<p style="text-indent:24px;">\n\t即日起至2026年4月30日23:59:59截止。\n</p>\n<p style="text-indent:24px;">\n\t为充分保障中奖者权益,兑奖时间为即日起至2026年5月1日23:59:59截止,逾期视为自动放弃兑奖。\n</p>\n<ol>\n\t<li>\n\t\t活动区域:\n\t</li>\n</ol>\n<p style="text-indent:24px;">\n\t仅限中国大陆地区(不含港、澳、台)\n</p>\n<ol>\n\t<li>\n\t\t活动参与条件及参与方式:\n\t</li>\n</ol>\n<p style="text-indent:28px;">\n\t即日起,凡购买“扫码赢红包”味动力AD钙奶饮品(2个口味),揭开活动产品包装上活动标签(因其包装设计二维码于瓶盖内,故为揭开瓶盖,敬请谅解),微信扫描其内二维码,进入活动小程序,根据提示完成授权或登陆即可参与活动。参与活动的消费者有机会赢取666元微信红包一份、1.8元微信红包一份或0.6元微信红包一份;同时,还有机会获得复购奖励“1.8元复购红包”,获得复购奖励后再买一瓶活动产品并扫描再次购买的活动产品瓶盖内二维码后即可解锁领取1.8元现金红包,复购奖励数量有限,发完即止。\n</p>\n<ol>\n\t<li>\n\t\t开奖方式与开奖时间:\n\t</li>\n</ol>\n<p>\n\t&nbsp;&nbsp;&nbsp;&nbsp;参与活动后,根据微信平台活动小程序页面提示,手机扫码即时开奖,若显示中奖,则线上即时领取红包即可。\n</p>\n<ol>\n\t<li>\n\t\t奖项种类设置:\n\t</li>\n</ol>\n<p style="text-indent:24px;">\n\t本活动奖项种类分为常规抽奖与复购奖励。\n</p>\n<ol>\n\t<li>\n\t\t其中常规抽奖设立奖品价格、奖品品名、奖品种类、奖品数量及中奖概率如下:\n\t</li>\n</ol>\n<p style="text-indent:24px;">\n\t一等奖:666元微信现金红包一份,价值人民币六百六十六元,本活动共设18份;中奖概率约为0.0039%\n</p>\n<p style="text-indent:24px;">\n\t二等奖:1.8元微信现金红包一份,价值人民币一元八角,本活动共设6,000份;中奖概率约为1.33%\n</p>\n<p style="text-indent:24px;">\n\t三等奖:0.6元微信现金红包一份,价值人民币八角,本活动共设80,000份;中奖概率约为17.78%\n</p>\n<p style="text-indent:24px;">\n\t其余未中奖将出现“谢谢惠顾”字样。\n</p>\n<p style="text-indent:24px;">\n\t*各奖项中奖率无法整除,谨请谅解。\n</p>\n<ol>\n\t<li>\n\t\t复购奖励设立奖品价格、奖品品名、奖品种类、奖品数量如下:\n\t</li>\n</ol>\n<p style="text-indent:24px;">\n\t复购奖励:人民币1.8元微信现金红包一份,价值人民币壹元捌角,共30,000份,数量有限,先到先得,发完即止。\n</p>\n<ol>\n\t<li>\n\t\t兑奖条件、兑奖方式及奖品交付方式:\n\t</li>\n</ol>\n<p style="text-indent:24px;">\n\t微信扫描活动产品包装上活动标签后,按手机页面提示操作进行兑奖。\n</p>\n<ol>\n\t<li>\n\t\t常规抽奖兑换方式、兑奖方式及奖品交付方式如下:\n\t</li>\n</ol>\n<ol>\n\t<li>\n\t\t如若抽中一等奖666元,需要完善中奖者姓名、身份证、手机号信息并确认提交即可兑奖。提请注意:因微信平台对商家转账到零钱的单笔提现金额上限至200元,即该奖项到账微信钱包时会自动拆分成4笔同时到中奖者微信账户余额;\n\t</li>\n\t<li>\n\t\t如若抽中二等奖1.8元/三等奖0.8元,点击领取即可兑奖,不需要完善中奖者信息;所得现金红包将存入本人微信账户,可在历史中奖记录中查看。\n\t</li>\n</ol>\n<ol>\n\t<li>\n\t\t复购奖励兑换方式、兑奖方式及奖品交付方式如下:\n\t</li>\n</ol>\n<p>\n\t&nbsp;&nbsp;&nbsp;&nbsp;如若抽中复购奖励,复购奖励中奖者再买一瓶活动产品并点击活动页面中的“扫码激活”扫描再次购买的活动产品瓶盖内二维码后点击领取即可兑奖,不需要完善中奖者信息;所得现金红包将自动存入本人微信账户,可在历史中奖记录中查看。\n</p>\n<p style="text-indent:24px;">\n\t红包提现需遵守腾讯公司微信红包提现规则,由系统自动发放,转账延时属正常情况。本次活动所产生的个人所得税由均瑶集团上海食品有限公司依法代扣代缴,现金红包均为税后所得。\n</p>\n<ol>\n\t<li>\n\t\t活动声明、弃奖条件及注意事项:\n\t</li>\n</ol>\n<ol>\n\t<li>\n\t\t均瑶集团上海食品有限公司对活动产品真实性及有效性具有鉴定及确认权。\n\t</li>\n\t<li>\n\t\t本次活动产品总计投入2,250,000份,每个活动产品二维码只可参与一次抽奖活动,重复扫码无效。\n\t</li>\n\t<li>\n\t\t为保证活动参与体验,主办方将检测活动消费者所提交的相关数据以确保真实性。若检测出消费者有恶意或者虚假刷单行为,主办方有权取消其参加本次活动资格。提请注意:每个微信OpenID活动期间日参与次数限6次,超过参与次数后限制参与,并提示微信号参与已达日上限。消费者可以次日零点后再扫码参与。\n\t</li>\n\t<li>\n\t\t现金红包须在兑奖截止日期前(如需完善相关信息应当在兑换有效期内完善并正确)完成兑奖,过期视为弃奖,主办方不予补发。\n\t</li>\n\t<li>\n\t\t复购奖励中奖者,若未在中奖后72小时内再次购买活动产品并扫描再次购买的活动产品瓶盖内二维码的,视为弃奖。\n\t</li>\n\t<li>\n\t\t消费者应当在活动期间内参与活动并在兑奖期间内完成兑奖,否则视为弃奖。\n\t</li>\n\t<li>\n\t\t活动主办方不对因网络传输原因而导致消费者提交的信息错误或延误承担任何责任。\n\t</li>\n\t<li>\n\t\t消费者领奖过程中所发生的个人费用(包含但不限于上网费、手机流量费、短信费、咨询客服电话费)需自理,主办方不做任何形式的补偿。本活动对象为以消费为目的的消费者,禁止非真实活动参与者的刷单行为,活动参与者不遵守活动规则的,主办方有权根据法律法规及活动规则不予兑换/追回已兑换活动奖品,并且主办方保留追究无参与资格者一切法律责任的权力。\n\t</li>\n\t<li>\n\t\t若因消费者个人原因造成账号、密码遗失,并导致参与活动兑奖的消费者无法提交个人信息的情况,活动主办方不承担责任。\n\t</li>\n\t<li>\n\t\t如发现消费者恶意刷奖行为,包括但不限于:入侵本次活动所使用的网络服务器、使用技术手段获取活动后台信息或篡改活动后台中奖规则、参与记录不符合活动的最低参与要求、盗用他人信息参与活动、冒充他人获得红包等不正当行为,主办方有权取消其活动参与权和收回其所得红包。同时保留依法追究其法律责任的权利。\n\t</li>\n\t<li>\n\t\t活动过程中出现“不可抗力”事件或计算机系统故障直接或间接地造成活动主办方无法履行其全部或部分义务,则活动主办方将免予履行该义务,并无需承担相应的责任。“不可抗力”事件包括但不限于,地震、台风、火灾、水灾、战争、法律法规调整、政府命令禁止、因黑客攻击、计算机病毒影响、系统崩溃、数据丢失或其他人为原因造成计算机系统故障,及其他自然或人为灾害等导致活动无法继续开展的,且活动主办方不可预见、无法避免并无法控制的事件。\n\t</li>\n\t<li>\n\t\t活动过程中,如因政府法律法规调整或行政命令要求,活动主办方有权根据上述调整或要求随时调整活动内容及规则。活动内容及规则调整时,活动主办方将另行向活动参与者公告通知相关的调整,但无需征得活动参与者的同意。主办方有权根据法律法规、司法或行政命令的要求以及活动的实际情况,在法律允许的范围内随时取消、中止或终止此次活动。\n\t</li>\n\t<li>\n\t\t本次活动奖品所涉之相关服务由第三方服务提供商提供,使用服务的相关限制及注意事项以具体服务提供商的要求为准。对于消费者在领取和使用奖品过程中发生的任何伤害和损失,如该伤害和损失非由主办方之过错导致,主办方不承担任何责任。\n\t</li>\n\t<li>\n\t\t消费者需就因其违反本条款及细则的任何规定、侵犯他人权利或其他任何违法的行为而引起的所有索偿、责任、损失、损害、费用和开支对主办方做出补偿。\n\t</li>\n\t<li>\n\t\t本活动适用中华人民共和国法律。因本活动引起的或本活动有关的任何争议,由争议双方友好协商解决。如任何争议不能通过双方友好协商解决的,可通过其他有效法律途径征求最终解决方式。\n\t</li>\n\t<li>\n\t\t活动主办方、本促销活动的代理公司、广告公司、印刷商和相关合作企业之员工、家属,不可参加此次促销活动,&nbsp;以示公允。\n\t</li>\n\t<li>\n\t\t个人信息:\n\t</li>\n</ol>\n<ol>\n\t<li>\n\t\t用户向活动主办方提供的个人微信资料数据只会用作本次活动用途,及会被保密处理。\n\t</li>\n\t<li>\n\t\t用户必须授权使用个人微信账号登陆进行互动;若未能及时提供,将不能参加本次活动。\n\t</li>\n\t<li>\n\t\t用户进入本活动时,需要点击同意并授权个人的基本资料给活动主办方使用。本活动将通过微信收集用户基本信息,包括:微信信息资料。以上信息将被主办方委托的第三方用于本活动的奖品派发、活动数据分析等。活动主办方将采取适当的规范手段以保护个人信息安全,防止资料丢失、被盗用或遭篡改。\n\t</li>\n\t<li>\n\t\t用户在使用互联网时对个人信息的运用需进行监管和负责,如有通过公告版等形式自愿提供及公开的个人资料被他人使用或传播,与本活动无关。\n\t</li>\n\t<li>\n\t\t如用户本人主动将微信账号与密码共享,或因各种不可抗力因素所导致的个人资料泄露、丢失、被盗用或被篡改,主办方不承担任何责任。\n\t</li>\n\t<li>\n\t\t如经得用户同意,主办方可使用有关个人资料数据作直接商品促销用途;否则,主办方将不能使用其个人资料作前述直接促销用途。用户须确保所提供的个人资料属实及有效。\n\t</li>\n</ol>'
  12 + },
  13 +
  14 + /**
  15 + * 生命周期函数--监听页面加载
  16 + */
  17 + onLoad(options) {
  18 + // if (!app.utils.getToken()) {
  19 + // app.utils.needLogin()
  20 + // }else{
  21 + // this.getGroupId()
  22 + // }
  23 + this.getGroupId()
  24 + },
  25 +
  26 + /**
  27 + * 生命周期函数--监听页面初次渲染完成
  28 + */
  29 + onReady() {
  30 +
  31 + },
  32 +
  33 + /**
  34 + * 生命周期函数--监听页面显示
  35 + */
  36 + onShow() {
  37 + if (typeof this.getTabBar === 'function' &&
  38 + this.getTabBar()) {
  39 + this.getTabBar().setData({
  40 + active: 0
  41 + })
  42 + }
  43 + },
  44 + async getGroupId(){
  45 + const res = await app.utils.doPost({
  46 + url: '/junYao/homeGroupId.json',
  47 + params: {}
  48 + },true)
  49 + this.setData({
  50 + groupId:res.data
  51 + },()=>{
  52 + this.getGroupInfo(this.data.groupId)
  53 + })
  54 + },
  55 + getGroupInfo(id){
  56 + app.utils.doPost({
  57 + url: '/activity/getGroupInfo.json',
  58 + params: id
  59 + },true).then(res => {
  60 + this.setData({
  61 + // groupRule: res.data.summary,
  62 + })
  63 + })
  64 + },
  65 + goCode(){
  66 + wx.navigateTo({
  67 + url: '/pages/clearCode/index',
  68 + })
  69 + },
  70 + goRule(){
  71 + // wx.navigateTo({
  72 + // url: '/pages/webView/index',
  73 + // })
  74 + this.setData({
  75 + ruleShow:true
  76 + })
  77 + },
  78 + goRecord(){
  79 + wx.navigateTo({
  80 + url: `/scanGroup/jyScan/record/index?groupId=${this.data.groupId}`,
  81 + })
  82 + },
  83 +
  84 + openPrivacyGps(){
  85 + wx.navigateTo({
  86 + url: `/middlePage/pages/privacyGps/privacyGps`,
  87 + })
  88 + },
  89 +
  90 + /**
  91 + * 生命周期函数--监听页面隐藏
  92 + */
  93 + onHide() {
  94 +
  95 + },
  96 +
  97 + /**
  98 + * 生命周期函数--监听页面卸载
  99 + */
  100 + onUnload() {
  101 +
  102 + },
  103 +
  104 + /**
  105 + * 页面相关事件处理函数--监听用户下拉动作
  106 + */
  107 + onPullDownRefresh() {
  108 +
  109 + },
  110 +
  111 + /**
  112 + * 页面上拉触底事件的处理函数
  113 + */
  114 + onReachBottom() {
  115 +
  116 + },
  117 +
  118 + /**
  119 + * 用户点击右上角分享
  120 + */
  121 + onShareAppMessage() {
  122 +
  123 + }
  124 +})
  1 +{
  2 + "navigationStyle": "custom",
  3 + "usingComponents": {
  4 + "popup": "../components/popup/popup"
  5 + }
  6 +}
  1 +<!--custom-pages/custom-index/index.wxml-->
  2 +<view class="container_index">
  3 + <!-- <image class="index_img" src="https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/index.png" mode=""/> -->
  4 + <image class="index_img" src="/images/junyao/backgroundImg.png" mode="scaleToFill"/>
  5 + <image class="index_img logo" src="/images/junyao/logo.png" mode="widthFix"/>
  6 + <image class="index_img product" src="/images/junyao/product.png" mode="widthFix"/>
  7 + <image class="drink_power" src="/images/junyao/drinkPower.png" mode="widthFix"/>
  8 + <!-- <image class="index_img myPrize" src="/images/junyao/myPrize.png" mode="widthFix"/> -->
  9 + <!-- <image class="index_img welfareOfficer" src="/images/junyao/welfareOfficer.png" mode="widthFix"/> -->
  10 + <!-- <view bindtap="goRule">
  11 + <image class="draw_now" src="/images/junyao/drawNow.png" mode="widthFix"/>
  12 + </view> -->
  13 + <!-- <image class="code_index" src="https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/code_index.png" mode="" bindtap="goCode" /> -->
  14 + <!-- <view class="fixed_btn btn_1" bindtap="goRule">
  15 + <view class="mt_down">活动</view>
  16 + <view>规则</view>
  17 + </view> -->
  18 + <view bindtap="goRule" class="activity_box">
  19 + <!-- <image class="activity_rules" src="/images/junyao/activityRules.png" mode="widthFix"/> -->
  20 + <view class="activity_rules"></view>
  21 + <text class="activity_rules_text">活动规则</text>
  22 + </view>
  23 +
  24 + <!-- <view class="fixed_btn btn_2" bindtap="goRecord">
  25 + <view class="mt_down">中奖</view>
  26 + <view>记录</view>
  27 + </view> -->
  28 + <view class="btnPrivacy">
  29 + <!-- <button class="btn_privacy" id="agree-btn" type="default" bindtap="openPrivacyGps">隐私政策(调试用)</button> -->
  30 + </view>
  31 +
  32 + <!-- 活动规则 ruleShow-->
  33 + <popup visible="{{ ruleShow }}">
  34 + <view class="rule">
  35 + <view class="rule-title">—— 活动规则 ——</view>
  36 + <view class="rule-content">
  37 + <mp-html content="{{ groupRule }}"></mp-html>
  38 + </view>
  39 + </view>
  40 + </popup>
  41 +</view>
  1 +/* custom-pages/custom-index/index.wxss */
  2 +page {
  3 + /* height: 100%; */
  4 + /* height: auto; */
  5 + height: 100vh;
  6 + width: 100%;
  7 + overflow: hidden;
  8 + /* background-color: #004588; */
  9 + /* padding-bottom: 148rpx; */
  10 +}
  11 +
  12 +.container_index {
  13 + width: 100%;
  14 + height: 100vh;
  15 + /* height: calc(100% - 148rpx); */
  16 + position: relative;
  17 +}
  18 +
  19 +.index_img {
  20 + width: 100%;
  21 + height: calc(100% - 148rpx);
  22 + position: absolute;
  23 +}
  24 +
  25 +.logo{
  26 + right: 0;
  27 + left: 0;
  28 + margin: auto;
  29 + width: 250rpx;
  30 + top: 11.5%;
  31 +}
  32 +
  33 +.myPrize{
  34 + right: 10rpx;
  35 + width: 170rpx;
  36 + top: 30%;
  37 +}
  38 +
  39 +.welfareOfficer{
  40 + right: 10rpx;
  41 + width: 170rpx;
  42 + bottom: 28%;
  43 +}
  44 +
  45 +.activity_box {
  46 + width: 6em;
  47 + text-align: center;
  48 + position: absolute;
  49 + display: flex;
  50 + align-items: center;
  51 + right: 26rpx;
  52 + top: 13.5%;
  53 +}
  54 +
  55 +.activity_rules {
  56 + position: absolute;
  57 + width: 100%;
  58 + height: 60rpx;
  59 + background-color: #B03344;
  60 + border-radius: 20rpx;
  61 +}
  62 +
  63 +.activity_rules_text {
  64 + position: absolute;
  65 + width: 180rpx;
  66 + color: #fff;
  67 + border-radius: 20rpx;
  68 +}
  69 +
  70 +.product {
  71 + top: 0;
  72 + bottom: -13%;
  73 + margin: auto;
  74 +}
  75 +
  76 +.drink_power {
  77 + position: absolute;
  78 + width: 53%;
  79 + top: 17.5%;
  80 + margin: auto;
  81 + left: 0;
  82 + right: 0;
  83 +}
  84 +
  85 +.draw_now {
  86 + position: absolute;
  87 + margin: auto;
  88 + left: 0;
  89 + right: 0;
  90 + bottom: 130rpx;
  91 + width: 75%;
  92 +}
  93 +
  94 +.code_index {
  95 + width: 184rpx;
  96 + height: 234rpx;
  97 + position: fixed;
  98 + right: -35rpx;
  99 + bottom: 484rpx;
  100 +}
  101 +
  102 +.mt_1 {
  103 + right: -35rpx;
  104 + top: 500rpx;
  105 +}
  106 +
  107 +.fixed_btn {
  108 + width: 85rpx;
  109 + height: 80rpx;
  110 + background: #3f9ed1;
  111 + border-radius: 28rpx 0 0 28rpx;
  112 + font-weight: 500;
  113 + font-size: 28rpx;
  114 + color: #FFFFFF;
  115 + text-align: center;
  116 + letter-spacing: 0;
  117 + line-height: 28rpx;
  118 + position: absolute;
  119 + display: flex;
  120 + flex-direction: column;
  121 + justify-content: center;
  122 + align-items: center;
  123 +}
  124 +
  125 +.btn_1 {
  126 + right: 0rpx;
  127 + top: 428rpx;
  128 +}
  129 +
  130 +.btn_2 {
  131 + right: 0rpx;
  132 + top: 296rpx;
  133 + top: 524rpx;
  134 +}
  135 +
  136 +
  137 +.rule {
  138 + width: 100%;
  139 + height: 772rpx;
  140 + overflow-y: scroll;
  141 +}
  142 +
  143 +.rule-title {
  144 + font-weight: 400;
  145 + font-size: 34rpx;
  146 + color: #10111A;
  147 + text-align: center;
  148 + margin-top: 20rpx;
  149 +}
  150 +
  151 +.rule-content {
  152 + padding: 20rpx 48rpx 40rpx;
  153 +}
  154 +
  155 +.btnPrivacy {
  156 + position: absolute;
  157 + bottom: 80px;
  158 + margin: auto;
  159 + left: 0;
  160 + right: 0;
  161 + width: 160px;
  162 +}
  1 +// custom-pages/custom-product/index.js
  2 +const app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + tabs: [ ], // 选项卡标题
  10 + tabIndex:0,
  11 + currentPage: 0,
  12 + swiperData: [
  13 + // {
  14 + // name: "内容1",
  15 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  16 + // },
  17 + // {
  18 + // name: "内容2",
  19 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  20 + // }, {
  21 + // name: "内容3",
  22 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  23 + // },
  24 + // {
  25 + // name: "内容1",
  26 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  27 + // }, {
  28 + // name: "内容2",
  29 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  30 + // }, {
  31 + // name: "内容3",
  32 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  33 + // },
  34 + // {
  35 + // name: "内容1",
  36 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  37 + // }, {
  38 + // name: "内容2",
  39 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  40 + // }, {
  41 + // name: "内容3",
  42 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  43 + // },{
  44 + // name: "内容1",
  45 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  46 + // }, {
  47 + // name: "内容2",
  48 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  49 + // }, {
  50 + // name: "内容3",
  51 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  52 + // },{
  53 + // name: "内容1",
  54 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  55 + // }, {
  56 + // name: "内容2",
  57 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  58 + // }, {
  59 + // name: "内容3",
  60 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  61 + // },{
  62 + // name: "内容1",
  63 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  64 + // }, {
  65 + // name: "内容2",
  66 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  67 + // }, {
  68 + // name: "内容3",
  69 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  70 + // },{
  71 + // name: "内容1",
  72 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  73 + // }, {
  74 + // name: "内容2",
  75 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  76 + // }, {
  77 + // name: "内容3",
  78 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  79 + // },{
  80 + // name: "内容1",
  81 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  82 + // }, {
  83 + // name: "内容2",
  84 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  85 + // }, {
  86 + // name: "内容3",
  87 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  88 + // },{
  89 + // name: "内容1",
  90 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  91 + // }, {
  92 + // name: "内容2",
  93 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  94 + // }, {
  95 + // name: "内容3",
  96 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  97 + // },{
  98 + // name: "内容1",
  99 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  100 + // }, {
  101 + // name: "内容2",
  102 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  103 + // }, {
  104 + // name: "内容3",
  105 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  106 + // },{
  107 + // name: "内容1",
  108 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png'
  109 + // }, {
  110 + // name: "内容2",
  111 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png'
  112 + // }, {
  113 + // name: "内容3",
  114 + // url:'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png'
  115 + // },
  116 + ],
  117 + imgData:[
  118 + // [
  119 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-14.png',
  120 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-15.png',
  121 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-16.png',
  122 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-17.png',
  123 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-18.png',
  124 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-19.png',
  125 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-20.png',
  126 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-21.png',
  127 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate1/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-22.png',
  128 + // ],
  129 + // [
  130 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate2/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-01.png',
  131 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate2/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-02.png',
  132 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate2/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-03.png',
  133 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate2/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-04.png',
  134 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate2/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-05.png',
  135 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate2/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-06.png',
  136 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate2/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-07.png',
  137 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/cates/cate2/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C-p-08.png',
  138 + // ],
  139 + // [
  140 + // 'https://via.placeholder.com/400x200?text=Image+1_1',
  141 + // 'https://via.placeholder.com/400x200?text=Image+1_2',
  142 + // 'https://via.placeholder.com/400x200?text=Image+1_3',
  143 + // 'https://via.placeholder.com/400x200?text=Image+1_4',
  144 + // 'https://via.placeholder.com/400x200?text=Image+1_5',
  145 + // 'https://via.placeholder.com/400x200?text=Image+1_6',
  146 + // 'https://via.placeholder.com/400x200?text=Image+1_7',
  147 + // 'https://via.placeholder.com/400x200?text=Image+1_8',
  148 + // ],
  149 + // [
  150 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate1/0.png',
  151 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate1/1.png',
  152 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate1/2.png',
  153 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate1/3.png',
  154 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate1/4.png',
  155 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate1/5.png',
  156 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate1/6.png',
  157 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate1/7.png',
  158 + // ],
  159 + // [
  160 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate2/8.png',
  161 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate2/9.png',
  162 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate2/10.png',
  163 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate2/11.png',
  164 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate2/12.png',
  165 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate2/13.png',
  166 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate2/14.png',
  167 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate2/15.png',
  168 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate2/16.png',
  169 + // ],
  170 + // [
  171 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate3/21.png',
  172 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate3/22.png',
  173 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate3/23.png',
  174 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate3/24.png',
  175 + // ],
  176 + // [
  177 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate4/27.png',
  178 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate4/28.png',
  179 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate4/29.png',
  180 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate4/30.png',
  181 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate4/31.png',
  182 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate4/32.png',
  183 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate4/33.png',
  184 + // ],
  185 + // [
  186 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate5/17.png',
  187 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate5/18.png',
  188 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate5/19.png',
  189 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate5/20.png',
  190 + // ],
  191 + // [
  192 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate6/25.png',
  193 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate6/26.png',
  194 + // ],
  195 + // [
  196 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate7/34.png',
  197 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate7/35.png',
  198 + // 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/cpp/jyScan/SKUcates/cate7/36.png',
  199 + // ],
  200 + ]
  201 + },
  202 +
  203 + /**
  204 + * 生命周期函数--监听页面加载
  205 + */
  206 + async onLoad(options) {
  207 + const res = await this.getImgData()
  208 + this.setData({
  209 + tabs:res.data.skuClassList,
  210 + imgData:res.data.skuImgageList
  211 + }, () => {
  212 + let imgList = [ ].concat.apply([],this.data.imgData)
  213 + // console.log(imgList);
  214 + let swiperData = imgList.map(item=>{
  215 + return { url:item }
  216 + })
  217 + // console.log(swiperData);
  218 + this.setData({
  219 + swiperData
  220 + })
  221 + })
  222 +
  223 + // console.log(this.data.swiperData);
  224 + },
  225 +
  226 + /**
  227 + * 生命周期函数--监听页面初次渲染完成
  228 + */
  229 + onReady() {
  230 +
  231 + },
  232 +
  233 + /**
  234 + * 生命周期函数--监听页面显示
  235 + */
  236 + onShow() {
  237 + if (typeof this.getTabBar === 'function' &&
  238 + this.getTabBar()) {
  239 + this.getTabBar().setData({
  240 + active: 2
  241 + })
  242 + }
  243 + },
  244 + // 获取数据
  245 + getImgData(){
  246 + //旧厂商接口
  247 + return app.utils.doPost({
  248 + url: '/junYao/homeSkuInfo.json',
  249 + params: {}
  250 + },true)
  251 + },
  252 + changeTab(e){
  253 + const { imgData , swiperData } = this.data
  254 + const { index } = e.currentTarget.dataset
  255 + let swiperCurIndex = swiperData.findIndex(item=>{ //找到二维数组此分类下的第一张图片 第10张 索引为-9
  256 + return item.url == imgData[index][0]
  257 + })
  258 + // console.log(swiperCurIndex,"----");
  259 + this.setData({
  260 + tabIndex: index,
  261 + swiperCurIndex:-swiperCurIndex
  262 + })
  263 + },
  264 + updateTab(e){
  265 + const { tabIndex } = e.detail
  266 + this.setData({
  267 + tabIndex,
  268 + })
  269 + },
  270 +
  271 + /**
  272 + * 生命周期函数--监听页面隐藏
  273 + */
  274 + onHide() {
  275 + // console.log("页面隐藏了");
  276 + this.setData({
  277 + tabIndex: 0,
  278 + swiperCurIndex:0
  279 + })
  280 + },
  281 +
  282 + /**
  283 + * 生命周期函数--监听页面卸载
  284 + */
  285 + onUnload() {
  286 +
  287 + },
  288 +
  289 + /**
  290 + * 页面相关事件处理函数--监听用户下拉动作
  291 + */
  292 + onPullDownRefresh() {
  293 +
  294 + },
  295 +
  296 + /**
  297 + * 页面上拉触底事件的处理函数
  298 + */
  299 + onReachBottom() {
  300 +
  301 + },
  302 +
  303 + /**
  304 + * 用户点击右上角分享
  305 + */
  306 + onShareAppMessage() {
  307 +
  308 + }
  309 +})
  1 +{
  2 + "usingComponents": {
  3 + "CardSwiper": "../components/cardSwiper/cardSwiper"
  4 + }
  5 + }
  1 +<!--custom-pages/custom-product/index.wxml-->
  2 +<view class="container_box">
  3 + <CardSwiper data="{{swiperData}}" imgData='{{imgData}}' swiperCurIndex="{{swiperCurIndex}}" bindupdateTab="updateTab" bindloadmore="loadMore" back="#70a4d1"> </CardSwiper>
  4 + <!-- 分类导航条--选项卡 -->
  5 + <scroll-view class="cates_scroll" scroll-y="{{true}}" scroll-with-animation="{{true}}">
  6 + <view class="tab_box">
  7 + <!-- style="{{index == tabIndex ? 'color: #007bff;' : ''}}" -->
  8 + <view class="tab_item {{tabIndex==index ? 'tab_active' : ''}}" wx:for="{{tabs}}" wx:key="index" data-index="{{index}}" bindtap="changeTab">
  9 + {{item}}
  10 + </view>
  11 + </view>
  12 + </scroll-view>
  13 +</view>
  1 +/* custom-pages/custom-product/index.wxss */
  2 +page {
  3 + background: #F7F7F9;
  4 + height: 100vh;
  5 + /* align-items: center; */
  6 + display: flex;
  7 + justify-content: flex-start;
  8 +}
  9 +.container_box{
  10 + margin-left: 28rpx;
  11 + margin-top: 56rpx;
  12 + display: flex;
  13 + height: 80%;
  14 + /* width: 45%; */
  15 +}
  16 +.cates_scroll{
  17 + width: 70rpx;
  18 + /* height: 1160rpx; */
  19 + height: 100%;
  20 + /* border: 1px solid red; */
  21 +}
  22 +.tab_box{
  23 + display: flex;
  24 + align-items: center;
  25 + flex-direction: column;
  26 + justify-content: center;
  27 + min-height: 100%;
  28 +}
  29 +.tab_item {
  30 + width: 100%;
  31 + font-weight: 500;
  32 + font-size: 22rpx;
  33 + color: #666666;
  34 + padding: 14rpx 0;
  35 + writing-mode:vertical-lr;
  36 + display: flex;
  37 + justify-content: center;
  38 + align-items: center;
  39 + word-wrap: break-word;
  40 + /* transform: rotate(180deg); */
  41 +}
  42 +.tab_active{
  43 + display: flex;
  44 + justify-content: center;
  45 + align-items: flex-start;
  46 + font-weight: bold;
  47 + font-size: 30rpx;
  48 + color: #004487;
  49 + letter-spacing: 0;
  50 +}
  51 +::-webkit-scrollbar {
  52 + width: 0;
  53 + height: 0;
  54 + color: transparent;
  55 + display: none;
  56 +}
  1 +// custom-pages/custom-scan/index.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad(options) {
  15 +
  16 + },
  17 +
  18 + /**
  19 + * 生命周期函数--监听页面初次渲染完成
  20 + */
  21 + onReady() {
  22 +
  23 + },
  24 +
  25 + /**
  26 + * 生命周期函数--监听页面显示
  27 + */
  28 + onShow() {
  29 + if (typeof this.getTabBar === 'function' &&
  30 + this.getTabBar()) {
  31 + this.getTabBar().setData({
  32 + active: 1,
  33 + isShow:false
  34 + })
  35 + }
  36 + },
  37 +
  38 + /**
  39 + * 生命周期函数--监听页面隐藏
  40 + */
  41 + onHide() {
  42 +
  43 + },
  44 +
  45 + /**
  46 + * 生命周期函数--监听页面卸载
  47 + */
  48 + onUnload() {
  49 +
  50 + },
  51 +
  52 + /**
  53 + * 页面相关事件处理函数--监听用户下拉动作
  54 + */
  55 + onPullDownRefresh() {
  56 +
  57 + },
  58 +
  59 + /**
  60 + * 页面上拉触底事件的处理函数
  61 + */
  62 + onReachBottom() {
  63 +
  64 + },
  65 +
  66 + /**
  67 + * 用户点击右上角分享
  68 + */
  69 + onShareAppMessage() {
  70 +
  71 + }
  72 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<!--custom-pages/custom-scan/index.wxml-->
  2 +<text>custom-pages/custom-scan/index.wxml</text>
  1 +/* custom-pages/custom-scan/index.wxss */
  1 +// custom-tab-bar/index.js
  2 +const app = getApp()
  3 +const urlMap = {
  4 + 'coupon': '/pages/activityDetail/activityDetail',
  5 + 'y': '/scanGroup/index/index', // /pages/ywymReward/index /scanGroup/jyScan/index/index /middlePage/pages/privacyGps/privacyGps /scanGroup/index/index /scanGroup/dahaoda/index/index
  6 + 'jys': '/scanGroup/index/index',
  7 + 'costa': '/pages/costa/index/index',
  8 + 'x': '/scanGroup/index/index',
  9 + 'h': '/scanGroup/index/index', // 吉士丁扫码
  10 + 'jyo':'/scanGroup/index/index',
  11 + 'singleProduct': '/pages/index/index',
  12 + 'delivery-sxh': '/delivery/index/index',
  13 + 't': '/subPackages/tickets/index/index'
  14 +}
  15 +
  16 +const urls = {
  17 + 'HTTPS://M.HH66.CN/': '/pages/qptest/index',
  18 + 'https://test-utc-paltform.bzh001.com': '/subPackages/scan/middle/middle'
  19 +}
  20 +Component({
  21 + /**
  22 + * 组件的属性列表
  23 + */
  24 + properties: {
  25 +
  26 + },
  27 +
  28 + /**
  29 + * 组件的初始数据
  30 + */
  31 + data: {
  32 + // tabbar 的列表
  33 + tabbarLists:[
  34 + {
  35 + pagePath: "/custom-pages/custom-index/index",
  36 + text: "首页",
  37 + type:'page',
  38 + iconPath: "/images/icon_index.png",
  39 + selectedIconPath: "/images/icon_index_act.png"
  40 + },
  41 + {
  42 + pagePath: "/custom-pages/custom-scan/index",
  43 + text: "扫一扫",
  44 + type:'scan',
  45 + // iconPath: "/images/icon-pack.png",
  46 + selectedIconPath: "/images/tab_scan.png"
  47 + },
  48 + {
  49 + pagePath: "/custom-pages/custom-product/index",
  50 + text: "产品介绍",
  51 + // type:'page_pro',
  52 + type:'page',
  53 + iconPath: "/images/icon_pro.png",
  54 + selectedIconPath: "/images/icon_pro_act.png"
  55 + }
  56 + ],
  57 + active:null, //设为数字,会产生tabbar闪烁
  58 + isShow:true //控制显示隐藏tabbar
  59 + },
  60 +
  61 +
  62 + /**
  63 + * 组件的方法列表
  64 + */
  65 + methods: {
  66 + switchTab(e){
  67 + const { index,url,item } = e.currentTarget.dataset;
  68 + if(item.type!=='scan'){
  69 + // if(item.type=='page_pro'){
  70 + // wx.showModal({
  71 + // title: '提示',
  72 + // content: '暂未开放,敬请期待',
  73 + // showCancel:false,
  74 + // confirmText:'知道了',
  75 + // confirmColor:'#00478b',
  76 + // complete: (res) => {
  77 + // if (res.cancel) {
  78 +
  79 + // }
  80 +
  81 + // if (res.confirm) {
  82 +
  83 + // }
  84 + // }
  85 + // })
  86 + // return
  87 + // }
  88 + wx.switchTab({url})
  89 + }else{
  90 + console.log('扫码');
  91 + this.showScan()
  92 + }
  93 + },
  94 + showScan() {
  95 + wx.scanCode({
  96 + success(res) {
  97 + console.log(res,"res");
  98 + // success
  99 + var url = res.result
  100 + url = "HTTPS://AAX6.CN/JYS/:QD3T8+4:F-ZS19GIG,8DDHPVIT"
  101 + url = url.trim()
  102 + url = url.replace(/[\r\n]/g, '')
  103 + let type = app.GetUrlParh(url)
  104 + console.log(type,"--------");
  105 + // url = "HTTP://JY.AAX6.CN/Y/NZU-NWL.2BDJ8F$:IA,0000003101"
  106 + if (urlMap.hasOwnProperty(type)) {
  107 + wx.navigateTo({
  108 + url: `${urlMap[type]}?q=${encodeURIComponent(url)}`
  109 + })
  110 + return
  111 + }
  112 + for (const i in urls) {
  113 + if (url.indexOf(i) > -1) {
  114 + wx.navigateTo({
  115 + url: `${urls[i]}?q=${encodeURIComponent(url)}`
  116 + })
  117 + return
  118 + }
  119 + }
  120 + wx.showToast({
  121 + icon: 'none',
  122 + title: '无法找到页面资源'
  123 + })
  124 + }
  125 + })
  126 + },
  127 +
  128 + }
  129 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--custom-tab-bar/index.wxml-->
  2 +<view class="tab-bar" wx:if="{{isShow}}">
  3 + <block wx:for="{{tabbarLists}}" wx:key="item">
  4 + <view class="tab-bar-item"
  5 + data-index="{{index}}"
  6 + data-url="{{item.pagePath}}"
  7 + data-item="{{item}}"
  8 + bindtap="switchTab"
  9 + >
  10 + <block wx:if="{{item.type=='page'}}">
  11 + <view class="bar_item">
  12 + <image class="icon"
  13 + src="{{active == index?item.selectedIconPath:item.iconPath}}"></image>
  14 + <view class="text {{active == index ? 'active':''}}">{{item.text}}</view>
  15 + </view>
  16 + </block>
  17 + <block wx:else>
  18 + <view class="bar_item">
  19 + <image class="icon"
  20 + src="{{item.selectedIconPath}}"></image>
  21 + <view class="text">{{item.text}}</view>
  22 + </view>
  23 + </block>
  24 +
  25 + <!-- 设置选中状态下的背景 -->
  26 + <!-- <view wx:if="{{active == index}}" class="bg-item"></view> -->
  27 + </view>
  28 + </block>
  29 +</view>
  1 +/* custom-tab-bar/index.wxss */
  2 +.tab-bar{
  3 + height: 148rpx;
  4 + background-color: #ffffff;
  5 + display: flex;
  6 + border-top: 1rpx solid #f9f9f9;
  7 + box-shadow: 0 0 5rpx #f8f8f8;
  8 +}
  9 +.tab-bar-item{
  10 + display: flex;
  11 + flex: 1;
  12 + justify-content: center;
  13 + /* align-items: center; */
  14 +
  15 + position: relative;
  16 +}
  17 +.bar_item{
  18 + display: flex;
  19 + justify-content: flex-start;
  20 + align-items: center;
  21 + flex-direction: column;
  22 + margin-top: 19rpx;
  23 +}
  24 +.bar_scan_item{
  25 + margin-top: 13rpx;
  26 +}
  27 +.icon{
  28 + width: 36rpx;
  29 + height: 36rpx;
  30 +}
  31 +.icon_scan{
  32 + width: 80rpx;
  33 + height: 64rpx;
  34 +}
  35 +.text{
  36 + /* font-size: 26rpx;
  37 + padding: 0 5rpx;
  38 + letter-spacing: 0.1rem;
  39 + display: none; */
  40 + font-weight: 500;
  41 + font-size: 18rpx;
  42 + color: #8F9095;
  43 + margin-top: 2rpx;
  44 +}
  45 +.active{
  46 + /* color: #10B981;
  47 + display: block;
  48 + font-weight: 800; */
  49 + color: #004487;
  50 +}
  51 +.bg-item{
  52 + position: absolute;
  53 + width: 80%;
  54 + top: 15rpx;
  55 + bottom: 15rpx;
  56 + border-radius: 40rpx;
  57 + background-color:rgba(52, 211, 153,0.15);
  58 +}
  1 +{
  2 + "compilerOptions": {
  3 + "target": "es2015",
  4 + "module": "commonjs"
  5 + }
  6 +}
  1 +const appId = 'wx0f695ef70a18d602'; // 测试环境
  2 +// const appId = 'wx4eacc630b301f2dc'; // 正式环境
  3 +
  4 + const webUrl = 'https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/index.html';
  5 +// const webUrl = 'https://ucode-cdn.aax6.cn/front-end/project/junyao/junyaoH5/index.html';
  6 +
  1 +// middlePage/pages/animal/ainmal.js
  2 +Page({
  3 + /**
  4 + * 页面的初始数据
  5 + */
  6 + data: {},
  7 +
  8 + /**
  9 + * 生命周期函数--监听页面加载
  10 + */
  11 + onLoad(options) {},
  12 + showAnimal() {
  13 + this.setData({ start: true });
  14 + },
  15 + onShareAppMessage() {},
  16 +});
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<!-- middlePage/pages/animal/ainmal.wxml -->
  2 +<view class="box">
  3 + <view class="animal_box">
  4 + <image class="{{ start ? 'action ' : ''}}bottle" bindload="showAnimal" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg//bottle.png" mode="widthFix" />
  5 + <image class="{{ start ? 'action ' : ''}}cap" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg//cap.png" mode="widthFix" />
  6 + <image class="{{ start ? 'action ' : ''}}ele1" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/ele1.png" mode="widthFix" />
  7 + <image class="{{ start ? 'action ' : ''}}ele2" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/ele2.png" mode="widthFix" />
  8 + <image class="{{ start ? 'action ' : ''}}ele3" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/ele3.png" mode="widthFix" />
  9 + <image class="{{ start ? 'action ' : ''}}ele_ball" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/ele-ball.png" mode="widthFix" />
  10 + <image class="{{ start ? 'action ' : ''}}ele_gold" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/ele-gold.png" mode="widthFix" />
  11 + <image class="{{ start ? 'action ' : ''}}ele_milk" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/ele-milk.png" mode="widthFix" />
  12 + <image class="{{ start ? 'action ' : ''}}ele_milk1" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/ele-milk1.png" mode="widthFix" />
  13 + <image class="{{ start ? 'action ' : ''}}ele_milk2" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/ele-milk2.png" mode="widthFix" />
  14 + <image class="{{ start ? 'action ' : ''}}ele_milk3" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/ele-milk3.png" mode="widthFix" />
  15 + <image class="{{ start ? 'action ' : ''}}ele_redbag" src="https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/ele-redbag.png" mode="widthFix" />
  16 + </view>
  17 +</view>
  1 +/* middlePage/pages/animal/ainmal.wxss */
  2 +Page {
  3 + width: 100%;
  4 + height: 100%;
  5 + background: url('https://ucode-test-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/bg_animal.png') no-repeat center/cover;
  6 + /* background: url('https://ucode-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/bg_home.png') no-repeat center/contain,
  7 + url('https://ucode-cdn.aax6.cn/front-end/project/junyao/junyaoH5/bottleImg/bg.png') no-repeat center/cover; */
  8 +}
  9 +.box {
  10 + width: 100%;
  11 + height: 100%;
  12 + position: relative;
  13 + background-color: rgba(0, 0, 0, 0.75);
  14 +}
  15 +
  16 +.animal_box {
  17 + position: absolute;
  18 + left: 50%;
  19 + top: 0%;
  20 + transform: translateX(-50%);
  21 + width: 750rpx;
  22 + height: 100%;
  23 +}
  24 +
  25 +@keyframes box_animal {
  26 + 0% {
  27 + transform: translateX(-50%) rotate(0);
  28 + }
  29 + /* 50% {
  30 + transform: translateX(-50%) rotate(-10deg);
  31 + } */
  32 + 100% {
  33 + transform: translateX(-50%) rotate(-13deg);
  34 + }
  35 +}
  36 +
  37 +.bottle {
  38 + z-index: 2;
  39 + position: absolute;
  40 + left: 50%;
  41 + bottom: 42rpx;
  42 + transform: translateX(-50%);
  43 + /* width: 417rpx;
  44 + height: 1325rpx; */
  45 + width: calc(209rpx * 1.25);
  46 + height: calc(662rpx * 1.25);
  47 +}
  48 +
  49 +.action.bottle {
  50 + animation: box_animal 0.3s ease-in-out 0s 1 normal forwards;
  51 + /* animation: box_animal 0.6s ease-in-out 0s 1 normal forwards; */
  52 +}
  53 +
  54 +.cap {
  55 + z-index: 2;
  56 + position: absolute;
  57 + left: 50%;
  58 + bottom: 0;
  59 + transform: translateX(-50%);
  60 + width: calc(209rpx * 1.2);
  61 + height: calc(55rpx * 1.2);
  62 + transform-origin: left bottom;
  63 + /* width: 417rpx;
  64 + height: 110rpx; */
  65 +}
  66 +.action.cap {
  67 + animation: cap_animal 0.2s ease-in 0s 1 normal forwards;
  68 +}
  69 +
  70 +@keyframes cap_animal {
  71 + 0% {
  72 + left: 300rpx;
  73 + bottom: 700rpx;
  74 + transform: translateX(-50%) rotate(0);
  75 + }
  76 + 100% {
  77 + left: 240rpx;
  78 + bottom: 700rpx;
  79 + transform: translateX(-50%) rotate(-110deg);
  80 + }
  81 +}
  82 +
  83 +.ele1 {
  84 + z-index: 0;
  85 + position: absolute;
  86 + left: 50%;
  87 + bottom: 55rpx;
  88 + transform: translateX(-50%) scale(0);
  89 + width: 334rpx;
  90 + height: 105rpx;
  91 +}
  92 +.action.ele1 {
  93 + animation: ele1_pos_animal 0.6s ease-in 0.1s 1 normal forwards;
  94 + animation: ele1_pos_animal 0.2s ease-in 0.1s 1 normal forwards;
  95 +}
  96 +
  97 +@keyframes ele1_pos_animal {
  98 + 0% {
  99 + left: 260rpx;
  100 + bottom: 700rpx;
  101 + transform: translateX(-50%) rotate(0) scale(0);
  102 + }
  103 + 30% {
  104 + left: 260rpx;
  105 + bottom: 970rpx;
  106 + transform: translateX(-50%) rotate(-35deg) scale(1);
  107 + }
  108 + 41% {
  109 + left: 250rpx;
  110 + bottom: 1070rpx;
  111 + transform: translateX(-50%) rotate(-35deg) scale(1);
  112 + }
  113 + 100% {
  114 + left: 300rpx;
  115 + bottom: 1200rpx;
  116 + transform: translateX(-50%) rotate(0deg) scale(1.2);
  117 + }
  118 +}
  119 +
  120 +.ele2 {
  121 + position: absolute;
  122 + left: 280rpx;
  123 + bottom: 870rpx;
  124 + transform: translateX(-50%) scale(0);
  125 + width: 72rpx;
  126 + height: 69rpx;
  127 +}
  128 +.action.ele2 {
  129 + animation: ele2_pos_animal 0.6s ease-in 0.4s 1 normal forwards;
  130 + animation: ele2_pos_animal 0.2s ease-in 0.1s 1 normal forwards;
  131 +}
  132 +
  133 +@keyframes ele2_pos_animal {
  134 + 0% {
  135 + left: 280rpx;
  136 + bottom: 870rpx;
  137 + transform: translateX(-50%) rotate(0) scale(0);
  138 + }
  139 + 30% {
  140 + left: 300rpx;
  141 + bottom: 970rpx;
  142 + transform: translateX(-50%) rotate(0) scale(1);
  143 + }
  144 + 41% {
  145 + left: 300rpx;
  146 + bottom: 970rpx;
  147 + transform: translateX(-50%) rotate(0) scale(1);
  148 + }
  149 + 100% {
  150 + left: 450rpx;
  151 + bottom: 1070rpx;
  152 + transform: translateX(-50%) rotate(0deg) scale(1.8);
  153 + }
  154 +}
  155 +
  156 +.ele3 {
  157 + position: absolute;
  158 + left: 50%;
  159 + bottom: 700rpx;
  160 + transform: translateX(-50%) scale(0);
  161 + width: 68rpx;
  162 + height: 68rpx;
  163 +}
  164 +.action.ele3 {
  165 + animation: ele3_pos_animal 0.6s ease-in 0.8s 1 normal forwards;
  166 + animation: ele3_pos_animal 0.2s ease-in 0.1s 1 normal forwards;
  167 +}
  168 +
  169 +@keyframes ele3_pos_animal {
  170 + 0% {
  171 + left: 300rpx;
  172 + bottom: 770rpx;
  173 + transform: translateX(-50%) rotate(0) scale(0);
  174 + }
  175 + 30% {
  176 + left: 320rpx;
  177 + bottom: 870rpx;
  178 + transform: translateX(-50%) rotate(-10deg) scale(1);
  179 + }
  180 + 41% {
  181 + left: 420rpx;
  182 + bottom: 900rpx;
  183 + transform: translateX(-50%) rotate(0deg) scale(1.5);
  184 + }
  185 + 100% {
  186 + left: 580rpx;
  187 + bottom: 770rpx;
  188 + transform: translateX(-50%) rotate(0deg) scale(1.5);
  189 + }
  190 +}
  191 +
  192 +
  193 +.ele_ball {
  194 + position: absolute;
  195 + left: 580rpx;
  196 + bottom: 970rpx;
  197 + transform: translateX(-50%) scale(0);
  198 + width: 158rpx;
  199 + height: 164rpx;
  200 +}
  201 +
  202 +.action.ele_ball {
  203 + /* animation: ele_ball_animal 0.6s ease-in 0s 1 normal forwards; */
  204 + animation: ele_ball_animal 0.3s ease-in 0.1s 1 normal forwards;
  205 +}
  206 +@keyframes ele_ball_animal {
  207 + 0% {
  208 + left: 300rpx;
  209 + bottom: 700rpx;
  210 + transform: translateX(-50%) scale(0);
  211 + }
  212 + 50% {
  213 + left: 270rpx;
  214 + bottom: 950rpx;
  215 +
  216 + transform: translateX(-50%) scale(0.3);
  217 + }
  218 + 100% {
  219 + left: 290rpx;
  220 + bottom: 950rpx;
  221 + transform: translateX(-50%) scale(0.5);
  222 + }
  223 +}
  224 +
  225 +.ele_gold {
  226 + position: absolute;
  227 + left: 50%;
  228 + bottom: 30%;
  229 + transform: translateX(-50%) scale(0);
  230 + width: 174rpx;
  231 + height: 168rpx;
  232 +}
  233 +
  234 +.action.ele_gold {
  235 + /* animation: ele_gold_animal 0.6s ease-in 0s 1 normal forwards; */
  236 + animation: ele_gold_animal 0.3s ease-in 0.1s 1 normal forwards;
  237 +}
  238 +@keyframes ele_gold_animal {
  239 + 0% {
  240 + left: 300rpx;
  241 + bottom: 700rpx;
  242 + transform: translateX(-50%) scale(0);
  243 + }
  244 + 30% {
  245 + left: 320rpx;
  246 + bottom: 950rpx;
  247 +
  248 + transform: translateX(-50%) scale(0.3);
  249 + }
  250 + 70% {
  251 + left: 450rpx;
  252 + bottom: 1130rpx;
  253 +
  254 + transform: translateX(-50%) scale(0.3);
  255 + }
  256 + 100% {
  257 + left: 660rpx;
  258 + bottom: 1100rpx;
  259 +
  260 + transform: translateX(-50%) scale(0.5);
  261 + }
  262 +}
  263 +
  264 +.ele_milk {
  265 + position: absolute;
  266 + left: 400rpx;
  267 + bottom: 500rpx;
  268 + transform: translateX(-50%) rotate(15deg) scale(0);
  269 + width: 298rpx;
  270 + height: 372rpx;
  271 +}
  272 +
  273 +.action.ele_milk {
  274 + /* animation: ele_milk_animal 0.6s ease-in 0s 1 normal forwards; */
  275 + animation: ele_milk_animal 0.3s ease-in 0.1s 1 normal forwards;
  276 +}
  277 +@keyframes ele_milk_animal {
  278 + 0% {
  279 + left: 400rpx;
  280 + bottom: 500rpx;
  281 + transform: translateX(-50%) rotate(15deg) scale(0);
  282 + }
  283 +
  284 + 100% {
  285 + left: 290rpx;
  286 + bottom: 700rpx;
  287 +
  288 + transform: translateX(-50%) rotate(0deg) scale(0.55);
  289 + }
  290 +}
  291 +
  292 +
  293 +.ele_milk1 {
  294 + position: absolute;
  295 + left: 300rpx;
  296 + bottom: 700rpx;
  297 + transform: translateX(-50%) scale(0);
  298 + width: 264rpx;
  299 + height: 150rpx;
  300 +}
  301 +
  302 +.action.ele_milk1 {
  303 + /* animation: ele_milk1_animal 0.6s ease-in 0s 1 normal forwards; */
  304 + animation: ele_milk1_animal 0.3s ease-in 0.1s 1 normal forwards;
  305 +}
  306 +@keyframes ele_milk1_animal {
  307 + 0% {
  308 + left: 300rpx;
  309 + bottom: 700rpx;
  310 + transform: translateX(-50%) scale(0);
  311 + }
  312 + 50% {
  313 + left: 250rpx;
  314 + bottom: 800rpx;
  315 +
  316 + transform: translateX(-50%) scale(0.3);
  317 + }
  318 + 80%{
  319 + left: 180rpx;
  320 + bottom: 850rpx;
  321 + transform: translateX(-50%) scale(0.5);
  322 +
  323 + }
  324 + 100% {
  325 + left: 140rpx;
  326 + bottom: 800rpx;
  327 +
  328 + transform: translateX(-50%) rotate(-15deg) scale(0.5);
  329 + }
  330 +}
  331 +.ele_milk2 {
  332 + position: absolute;
  333 + left: 300rpx;
  334 + bottom: 700rpx;
  335 + transform: translateX(-50%) scale(0);
  336 + width: 366rpx;
  337 + height: 264rpx;
  338 +}
  339 +
  340 +.action.ele_milk2 {
  341 + /* animation: ele_milk2_animal 0.6s ease-in 0s 1 normal forwards; */
  342 + animation: ele_milk2_animal 0.3s ease-in 0.1s 1 normal forwards;
  343 +}
  344 +@keyframes ele_milk2_animal {
  345 + 0% {
  346 + left: 300rpx;
  347 + bottom: 700rpx;
  348 + transform: translateX(-50%) scale(0);
  349 + }
  350 + 50% {
  351 + left: 240rpx;
  352 + bottom: 800rpx;
  353 +
  354 + transform: translateX(-50%) scale(0.3);
  355 + }
  356 + 100% {
  357 + left: 130rpx;
  358 + bottom: 880rpx;
  359 + transform: translateX(-50%) scale(0.5);
  360 + }
  361 +}
  362 +
  363 +.ele_milk3 {
  364 + position: absolute;
  365 + left: 300rpx;
  366 + bottom: 700rpx;
  367 + transform: translateX(-50%) scale(0);
  368 + width: 300rpx;
  369 + height: 252rpx;
  370 +}
  371 +
  372 +.action.ele_milk3 {
  373 + /* animation: ele_milk3_animal 0.6s ease-in 0s 1 normal forwards; */
  374 + animation: ele_milk3_animal 0.3s ease-in 0.1s 1 normal forwards;
  375 +}
  376 +@keyframes ele_milk3_animal {
  377 + 0% {
  378 + left: 300rpx;
  379 + bottom: 700rpx;
  380 + transform: translateX(-50%) scale(0);
  381 + }
  382 + 50% {
  383 + left: 330rpx;
  384 + bottom: 790rpx;
  385 + transform: translateX(-50%) scale(0.3);
  386 + }
  387 + 100% {
  388 + left: 480rpx;
  389 + bottom: 830rpx;
  390 + transform: translateX(-50%) scale(0.5);
  391 + }
  392 +}
  393 +
  394 +.ele_redbag {
  395 + position: absolute;
  396 + left: 300rpx;
  397 + bottom: 700rpx;
  398 + transform: translateX(-50%) scale(0);
  399 + width: 380rpx;
  400 + height: 272rpx;
  401 +}
  402 +
  403 +.action.ele_redbag {
  404 + /* animation: ele_redbag_animal 0.6s ease-in 0s 1 normal forwards; */
  405 + animation: ele_redbag_animal 0.3s ease-in 0.1s 1 normal forwards;
  406 +}
  407 +@keyframes ele_redbag_animal {
  408 + 0% {
  409 + left: 300rpx;
  410 + bottom: 700rpx;
  411 + transform: translateX(-50%) scale(0);
  412 + }
  413 + 50% {
  414 + left: 450rpx;
  415 + bottom: 850rpx;
  416 + transform: translateX(-50%) scale(0.3);
  417 + }
  418 + 100% {
  419 + left: 600rpx;
  420 + bottom: 820rpx;
  421 + transform: translateX(-50%) scale(0.5);
  422 + }
  423 +}
  1 +// middlePage/privacyGps/privacyGps.js
  2 +const app = getApp();
  3 +
  4 +Page({
  5 + data: {
  6 + showPrivacy: false,
  7 + showGps: false,
  8 + contentPrivacyImage: decodeURIComponent(
  9 + 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Ftip_privacy.png'
  10 + ),
  11 + btnPrivacyAgree: decodeURIComponent(
  12 + 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Fbtn_agree.png'),
  13 + btnPrivacyReject: decodeURIComponent(
  14 + 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Fbtn_reject.png'
  15 + ),
  16 + contentGpsImage: decodeURIComponent(
  17 + 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Ftip_gps.png'),
  18 + },
  19 +
  20 + onLoad(options) {
  21 + // options.q='HTTP://JY.AAX6.CN/Y/FXYRLD*C3MVD2-0JS7'
  22 +
  23 + // latitude=34.80829&longitude=118.05272&openId=ozn1a5I4Ie_Bv3gITzMPgcowEFOU&q=HTTP://AAX6.CN/JY/DT5I+67$R$:I$70-SJ2J&bgImage=https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Fbg.png&contentPrivacyImage=https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Ftip_privacy.png&btnPrivacyAgree=https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Fbtn_agree.png&btnPrivacyReject=https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Fbtn_reject.png&contentGpsImage=https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Ftip_gps.png&btnGpsSetting=https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Ftip_gps.png&btnGpsReject=https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Ftip_gps.png&path=https%3A%2F%2Fucode-test-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2FjunyaoH5%2Findex.html%23%2Fhome&title=%E5%91%B3%E5%8A%A8%E5%8A%9B
  24 +
  25 + // let opt = {
  26 + // latitude: '34.80829',
  27 + // longitude: '118.05272',
  28 + // openId: 'ozn1a5I4Ie_Bv3gITzMPgcowEFOU',
  29 + // q: 'HTTP://AAX6.CN/JY/DT5I+67$R$:I$70-SJ2J',
  30 + // bgImage: 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Fbg.png',
  31 + // contentPrivacyImage: 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Ftip_privacy.png',
  32 + // btnPrivacyAgree: 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Fbtn_agree.png',
  33 + // btnPrivacyReject: 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Fbtn_reject.png',
  34 + // contentGpsImage: 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Ftip_gps.png',
  35 + // btnGpsSetting: 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Ftip_gps.png',
  36 + // btnGpsReject: 'https%3A%2F%2Fucode-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2Fminiprogram%2Ftip_gps.png',
  37 + // path: 'https%3A%2F%2Fucode-test-cdn.aax6.cn%2Ffront-end%2Fproject%2Fjunyao%2FjunyaoH5%2Findex.html%23%2Fhome',
  38 + // title: '%E5%91%B3%E5%8A%A8%E5%8A%9B',
  39 + // };
  40 + // options = opt
  41 +
  42 + let transitionStrArr = []; // 登录后跳转的参数
  43 + Object.keys(JSON.parse(JSON.stringify(options))).map((keys) => {
  44 + transitionStrArr.push(`${keys}=${JSON.parse(JSON.stringify(options))?.[keys]}`);
  45 + });
  46 + this.transitionStr = transitionStrArr.join('&');
  47 +
  48 + let decodeOptions = {}; // 当前页面参数
  49 + Object.keys(JSON.parse(JSON.stringify(options))).map((item) => {
  50 + decodeOptions[item] = decodeURIComponent(JSON.parse(JSON.stringify(options))?.[item]);
  51 + });
  52 + const {
  53 + isLogin,
  54 + bgImage,
  55 + contentPrivacyImage,
  56 + btnPrivacyAgree,
  57 + btnPrivacyReject,
  58 + contentGpsImage,
  59 + btnGpsSetting,
  60 + btnGpsReject,
  61 + path,
  62 + title,
  63 + ...others
  64 + } = decodeOptions;
  65 + this.options = others; // 逻辑参数
  66 + if (isLogin) this.isLogin = true;
  67 + this.setData({
  68 + bgImage,
  69 + contentPrivacyImage,
  70 + btnPrivacyAgree,
  71 + btnPrivacyReject,
  72 + contentGpsImage,
  73 + btnGpsSetting,
  74 + btnGpsReject,
  75 + path,
  76 + title
  77 + });
  78 +
  79 + // 设置页面title
  80 + wx.setNavigationBarTitle({
  81 + title,
  82 + success: (result) => {},
  83 + fail: () => {},
  84 + complete: () => {},
  85 + });
  86 + },
  87 +
  88 + onShow() {
  89 + // 查询是否需要展示隐私条款弹窗
  90 +
  91 + console.error('onshow --onShow');
  92 +
  93 + wx.getPrivacySetting({
  94 + success: (res) => {
  95 + if (res.needAuthorization) {
  96 + // 用户未同意隐私政策,提示用户同意
  97 + this.setData({
  98 + showPrivacy: true
  99 + });
  100 + // wx.onNeedPrivacyAuthorization((resolve) => {
  101 + // this.resolvePrivacyAuthorization = resolve;
  102 + // });
  103 + } else {
  104 + // 用户已同意隐私政策,调用后台数据获取接口
  105 + this.getLocation();
  106 + }
  107 + },
  108 + fail() {
  109 + },
  110 + });
  111 + },
  112 +
  113 + // 打开隐私条款页面
  114 + openPrivacyContract() {
  115 + wx.openPrivacyContract({
  116 + success: () => {}, // 打开成功
  117 + fail: () => {}, // 打开失败
  118 + complete: () => {},
  119 + });
  120 + },
  121 +
  122 + // 隐私条款 拒绝
  123 + privacyReject() {
  124 + // this.resolvePrivacyAuthorization({ event: 'disagree' });
  125 + wx.exitMiniProgram({});
  126 + },
  127 + // 隐私条款 同意
  128 + privacyAgree() {
  129 + // this.resolvePrivacyAuthorization({ buttonId: 'agree-btn', event: 'agree' });
  130 + this.setData({
  131 + showPrivacy: false
  132 + });
  133 + this.getLocation();
  134 + },
  135 +
  136 + async getLoginCode() {
  137 + return new Promise((resolve, reject) => {
  138 + wx.login({
  139 + success: (result) => {
  140 + resolve(result.code);
  141 + },
  142 + fail: () => {
  143 + reject(false);
  144 + },
  145 + complete: () => {},
  146 + });
  147 + });
  148 + },
  149 +
  150 + // 获取gps
  151 + getLocation() {
  152 + wx.getSetting({
  153 + success: (res) => {
  154 + if (!res.authSetting['scope.userFuzzyLocation']) {
  155 + // 用户未授权,请求授权
  156 + wx.authorize({
  157 + scope: 'scope.userFuzzyLocation',
  158 + success: () => {
  159 + console.log(1111);
  160 + // 用户已授权,调用 getFuzzyLocation
  161 + this.getFuzzyLocation();
  162 + },
  163 + fail: (err) => {
  164 + console.error('授权失败:', err);
  165 + wx.showModal({
  166 + title: '提示',
  167 + content: '需要获取您的地理位置权限,请前往设置开启',
  168 + success: (modalRes) => {
  169 + if (modalRes.confirm) {
  170 + wx.openSetting(); // 打开设置页面
  171 + }
  172 + },
  173 + });
  174 + },
  175 + });
  176 + } else {
  177 + // 用户已授权,直接调用 getFuzzyLocation
  178 + this.getFuzzyLocation();
  179 + }
  180 + },
  181 + fail: (err) => {
  182 + console.error('获取设置失败:', err);
  183 + },
  184 + })
  185 + },
  186 + getFuzzyLocation() {
  187 + let userInfo = getApp().globalData.userInfo
  188 + if(userInfo?.token){
  189 + //用户已登录
  190 + let qrCode = "HTTP://JY.AAX6.CN/Y/NZU-NWL.2BDJ8F$:IA,0000003101"
  191 + let id = "33426877997676"
  192 + let pageData = encodeURIComponent(JSON.stringify(Object.assign({ qrCode,id }, {})))
  193 + wx.navigateTo({
  194 + url: `/scanGroup/dahaoda/index/index?pageData=${pageData}`
  195 + })
  196 + }
  197 + else{
  198 + //未登录
  199 + wx.getFuzzyLocation({
  200 + type: 'wgs84',
  201 + success: async (res) => {
  202 + const latitude = res.latitude;
  203 + const longitude = res.longitude;
  204 + this.jumpFun({
  205 + latitude,
  206 + longitude
  207 + });
  208 + },
  209 + fail: (err) => {
  210 + console.log(err,"err");
  211 + const latitude = 22.793763;
  212 + const longitude = 108.346942;
  213 + this.jumpFun({
  214 + latitude,
  215 + longitude
  216 + });
  217 + return
  218 + if (this.isLogin) {
  219 + this.gpsReject();
  220 + } else {
  221 + this.setData({
  222 + showGps: true
  223 + });
  224 + }
  225 + },
  226 + });
  227 + }
  228 + },
  229 + // 跳转逻辑
  230 + async jumpFun(latLong) {
  231 + const {
  232 + latitude,
  233 + longitude
  234 + } = latLong || {};
  235 +
  236 + const subData = wx.getStorageSync('subData');
  237 +
  238 + if (!subData || !Object.keys(subData)?.length) {
  239 + wx.reLaunch({
  240 + url: `/pages/login/login?router=${encodeURIComponent(`/middlePage/pages/privacyGps/privacyGps?isLogin=${true}&${this.transitionStr}`)}`,
  241 + });
  242 + } else {
  243 + const code = await this.getLoginCode();
  244 + let query = latLong ?
  245 + `t=${+new Date()}&code=${code}&latitude=${latitude}&longitude=${longitude}` :
  246 + `code=${code}`;
  247 + Object.keys(subData).map((v) => {
  248 + if (!query.includes(`${v}=`)) query += `&${v}=${subData[v]}`;
  249 + });
  250 + if (this.options) {
  251 + Object.keys(this.options).map((v) => {
  252 + if (!query.includes(`${v}=`)) query += `&${v}=${this.options[v]}`;
  253 + });
  254 + }
  255 + const webUrl = `${this.data.path}?${query}`;
  256 +
  257 + this.setData({
  258 + webUrl,
  259 + showGps: false,
  260 + showPrivacy: false
  261 + });
  262 + }
  263 + },
  264 +
  265 + // gps 拒绝
  266 + gpsReject() {
  267 + this.getLocation();
  268 + // this.setData({ showGps: false, showPrivacy: false });
  269 + // this.jumpFun();
  270 + },
  271 + // gps 同意
  272 + gpsSetting() {
  273 + wx.openSetting({
  274 + success: (result) => {
  275 + console.log(result, "result");
  276 + },
  277 + fail: () => {
  278 + },
  279 + complete: () => {
  280 + this.getLocation();
  281 + },
  282 + });
  283 + },
  284 +
  285 + onShareAppMessage() {},
  286 +});
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<!-- middlePage/privacyGps/privacyGps.wxml -->
  2 +<!-- <view>隐私授权+gps</view> -->
  3 +<view class="modal" style="background-image: url('{{bgImage}}')">
  4 + <view class="mask" wx:if="{{showPrivacy || showGps}}"></view>
  5 + <view class="modal_content" wx:if="{{showPrivacy || showGps}}">
  6 + <!-- 隐私条款弹窗 -->
  7 + <view class="tip_privacy_box" wx:if="{{showPrivacy}}">
  8 + <image class="tip_privacy" bind:tap="openPrivacyContract" src="{{contentPrivacyImage}}" mode="widthFix" />
  9 + <view class="btn_privacy_box">
  10 + <image class="btn_privacy" id="disagree-btn" bind:tap="privacyReject" src="{{btnPrivacyReject}}" mode="widthFix" />
  11 + <button class="btn_privacy" id="agree-btn" style="background-image: url('{{btnPrivacyAgree}}')" type="default" open-type="agreePrivacyAuthorization" bindagreeprivacyauthorization="privacyAgree"></button>
  12 + </view>
  13 + </view>
  14 + <!-- GPS弹窗 -->
  15 + <view class="tip_gps_box" wx:if="{{showGps}}">
  16 + <image class="tip_gps" src="{{contentGpsImage}}" mode="widthFix" />
  17 + <view class="btn_gps_box">
  18 + <view class="btn_gps" bind:tap="gpsReject"></view>
  19 + <view class="btn_gps" bind:tap="gpsSetting"></view>
  20 + </view>
  21 + </view>
  22 + </view>
  23 +</view>
  24 +<web-view src="{{webUrl}}" wx:if="{{webUrl}}" bindmessage=""></web-view>
  1 +/* middlePage/privacyGps/privacyGps.wxss */
  2 +.modal {
  3 + position: absolute;
  4 + top: 0;
  5 + left: 0;
  6 + width: 100%;
  7 + height: 100%;
  8 + display: flex;
  9 + justify-content: center;
  10 + align-items: center;
  11 + background: no-repeat center center/cover;
  12 + z-index: -2;
  13 +}
  14 +
  15 +.mask {
  16 + position: absolute;
  17 + width: 100%;
  18 + height: 100%;
  19 + background: rgba(0, 0, 0, 0.75);
  20 + z-index: -1;
  21 +}
  22 +
  23 +.modal_content {
  24 + position: relative;
  25 + width: 685rpx;
  26 + margin-top: -20%;
  27 + text-align: center;
  28 +}
  29 +
  30 +.btn_privacy_box {
  31 + width: 600rpx;
  32 + box-sizing: border-box;
  33 + display: flex;
  34 + justify-content: space-around;
  35 + margin: 0 auto;
  36 + margin-top: 68rpx;
  37 +}
  38 +
  39 +.btn_privacy_box .btn_privacy {
  40 + width: 282rpx;
  41 + height: 106rpx;
  42 + background: no-repeat center center/cover;
  43 +}
  44 +
  45 +.tip_gps_box {
  46 + width: 670rpx;
  47 + height: 456rpx;
  48 + padding: 0;
  49 +}
  50 +
  51 +.tip_gps {
  52 + width: 670rpx;
  53 + height: 456rpx;
  54 +}
  55 +
  56 +.btn_gps_box {
  57 + height: 100rpx;
  58 + width: 670rpx;
  59 + position: absolute;
  60 + bottom: 2rpx;
  61 + display: flex;
  62 + justify-content: center;
  63 + align-items: flex-start;
  64 +}
  65 +.btn_gps_box .btn_gps {
  66 + flex: 1;
  67 + height: 100%;
  68 +}
  1 +// middlePage/pages/scanTest/scanTest.jsPage({
  2 +Page({
  3 + data: {},
  4 +
  5 + onLoad(options) {
  6 + this.options = options;
  7 + },
  8 + onShow() {
  9 + const webUrl = `https://ucode-cdn.aax6.cn/front-end/project/junyao/junyaoH5/index.html#/rule`;
  10 + console.log(webUrl, 'webUrl');
  11 +
  12 + this.setData({ webUrl });
  13 + },
  14 +
  15 + onShareAppMessage() {},
  16 +});
  1 +{
  2 + "navigationBarTitleText": "味动力测试环境",
  3 + "usingComponents": {}
  4 +}