Compare commits

...

2 Commits

Author SHA1 Message Date
xiaogang de96ecb2c4 解决掉冲突 2024-07-19 10:01:00 +08:00
xiaogang 1a41a89a44 吉林工行模板基本改动完毕 2024-07-19 09:58:49 +08:00
9 changed files with 123 additions and 77 deletions

View File

@ -3,17 +3,12 @@ import path from 'path'
const config = {
pages: './src/pages',
// pagesInclude: ['jlgh/coupon.vue', 'jlgh/redeem.vue'],
pagesInclude: ['jlgh/coupon.vue', 'jlgh/redeem.vue'],
// pagesInclude: ['jlgh/index.vue'],
// pagesInclude: ['jlgh/login.vue'],
// pagesInclude: ['jlgh'],
pagesInclude: ['index'],
}
const {
pages,
pagesInclude
} = config
const { pages, pagesInclude } = config
function getPages() {
const srcPath = path.resolve(__dirname, pages)
@ -75,7 +70,4 @@ function createOutputDir(pageInfo) {
}
}
export {
getPages,
createOutputDir
}
export { getPages, createOutputDir }

6
env/.env vendored
View File

@ -5,13 +5,13 @@ VITE_UNI_APPID = 'H57F2ACE4'
VITE_WX_APPID = 'wxa2abb91f64032a2b'
# h5部署网站的base配置到 manifest.config.ts 里的 h5.router.base
VITE_APP_PUBLIC_BASE = ./
VITE_APP_PUBLIC_BASE = './'
# 测试线上
# VITE_SERVER_BASEURL = 'https://gateway.dev.cdlsxd.cn'
VITE_SERVER_BASEURL = 'https://gateway.dev.cdlsxd.cn'
# 曾徐平
# VITE_SERVER_BASEURL = 'http://192.168.110.128:8081'
# 正式环境
VITE_SERVER_BASEURL = 'https://scens.h5.86698.cn'
# VITE_SERVER_BASEURL = 'https://scens.h5.86698.cn'
VITE_UPLOAD_BASEURL = 'https://ukw0y1.laf.run/upload'

View File

@ -22,7 +22,47 @@
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
<!-- 调试工具 -->
<script>
var clickCount = 0
var timer = null
var isShow = false
function insertScript(src) {
isShow = true
// 创建一个新的script元素
var src = 'https://fastly.jsdelivr.net/npm/eruda'
var script = document.createElement('script')
script.type = 'text/javascript'
script.src = src
// 插入到head中
document.head.appendChild(script)
script.onload = function () {
eruda.init()
}
}
document.addEventListener('click', function () {
if (isShow) return false
if (clickCount < 6) {
clickCount++
console.log(`Clicked ${clickCount} times`)
// 如果是第一次点击,则开始计时
if (clickCount === 1) {
timer = setTimeout(() => {
clickCount = 0 // 重置点击计数
}, 2000)
}
// 如果点击次数达到6次则清除计时器并重置状态
if (clickCount === 6) {
clearTimeout(timer)
insertScript()
clickCount = 0 // 重置点击计数
}
}
})
</script>
<!-- <script src="https://fastly.jsdelivr.net/npm/eruda"></script>
<script>
eruda.init()

View File

@ -39,11 +39,19 @@
},
"pages": [
{
"path": "pages/index/index",
"type": "home",
"path": "pages/jlgh/coupon",
"type": "page",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "首页"
"navigationBarTitleText": "我的奖品"
}
},
{
"path": "pages/jlgh/redeem",
"type": "page",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "奖品兑换"
}
}
],

View File

@ -208,7 +208,7 @@ export default {
},
onLoad(options) {
// eslint-disable-next-line camelcase
const { activity_code = 'JLGH', token } = this.getUrlParams()
const { activity_code, token } = this.getUrlParams()
const useStore = useUserStore()
if (token) {
useStore.setUserInfo({ token })
@ -279,23 +279,6 @@ export default {
}
})
},
deepClone(obj) {
//
const objClone = Array.isArray(obj) ? [] : {}
//
if (obj && typeof obj === 'object') {
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
if (obj[key] && typeof obj[key] === 'object') {
objClone[key] = deepClone1(obj[key])
} else {
objClone[key] = obj[key]
}
}
}
}
return objClone
},
//
getPrizeList() {
Api.getProducts({
@ -303,26 +286,6 @@ export default {
}).then((res) => {
if (res.code === 200) {
const { products } = res.data
const len = products.length
// len > 0 &&
// products.forEach((item) => {
// this.prizeList.push({
// prizeId: item.product_id,
// prizeName: item.show_name,
// name: item.show_name,
// })
// })
// if (len < 5) {
// const temp = this.deepClone(this.prizeList)
// for (let i = 0; i < 5 - len; i++) {
// if (this.prizeList.length >= 5) break
// this.prizeList.push(temp[i])
// if (i === len - 1) {
// i = 0
// }
// }
// }
// console.log(this.prizeList)
if (products.length > 0) {
while (this.prizeList.length < 5) {
products.forEach((item) => {
@ -340,8 +303,6 @@ export default {
prizeName: '谢谢参与',
name: '未中奖',
})
// const temp = this.prizeList
// this.prizeList = [...temp, ...temp]
} else {
uni.showToast({
title: res.message,
@ -424,6 +385,7 @@ export default {
this.prizeIndex = index
} else if (notwinCode.includes(res.code)) {
this.prizeIndex = this.prizeList.findIndex((ele) => ele.prizeId === 0)
this.jiang = res.message
} else {
this.prizeing = false
uni.showToast({
@ -441,15 +403,13 @@ export default {
console.log('旋转结束,执行拿到结果后到逻辑')
//
const prizeName = this.prizeList[this.prizeIndex].name
let tipContent = ''
if (prizeName === '谢谢参与' || prizeName === '未中奖') {
tipContent = '很遗憾,没有中奖,请再接再厉'
// tipContent = ''
this.isz = 0
} else {
this.isz = 1
tipContent = `${prizeName}`
this.jiang = `${prizeName}`
}
this.jiang = tipContent
this.prizeing = false
this.ismask2 = true
},

View File

@ -113,7 +113,7 @@ const login = async () => {
const params = {
phone: phone.value,
code: code.value,
activity_code: query.activity_code || 'JLGH',
activity_code: query.activity_code,
}
const res: any = await getLogin(params)
if (res.code === 200) {

View File

@ -111,7 +111,7 @@ import api from './api'
const ismask = ref<boolean>(false)
const info = reactive<any>({})
const phone = ref<string>('')
const linkUrl = ref<string>('')
onLoad((options) => {
const item = decodeURIComponent(options.item)
@ -120,8 +120,44 @@ onLoad((options) => {
function gomy() {
ismask.value = false
uni.navigateTo({
url: `/pages/jlgh/coupon?activity_code=${info.activity_code}`,
if (linkUrl.value) {
window.parent.postMessage(
{
data: {
message: 'success',
type: 'location',
url: linkUrl.value,
},
},
'*',
)
return false
}
const params = { id: info.id, activity_code: info.activity_code }
api.getCouponList(params).then((res: any) => {
if (res.code === 200) {
const dataInfo = res.data.data[0]
if (dataInfo.order_info && typeof dataInfo.order_info === 'string') {
window.parent.postMessage(
{
data: {
message: 'success',
type: 'location',
url: dataInfo.order_info,
},
},
'*',
)
} else {
uni.navigateTo({
url: `/pages/jlgh/coupon?activity_code=${info.activity_code}`,
})
}
} else {
uni.navigateTo({
url: `/pages/jlgh/coupon?activity_code=${info.activity_code}`,
})
}
})
}
@ -140,6 +176,9 @@ function dui() {
if (res.code === 200) {
ismask.value = true
uni.hideLoading()
if (res.data && typeof res.data === 'string') {
linkUrl.value = res.data
}
} else {
uni.hideLoading()
uni.showToast({

View File

@ -4,7 +4,8 @@
// Generated by vite-plugin-uni-pages
interface NavigateToOptions {
url: "/pages/index/index";
url: "/pages/jlgh/coupon" |
"/pages/jlgh/redeem";
}
interface RedirectToOptions extends NavigateToOptions {}

View File

@ -78,16 +78,22 @@ export default ({ command, mode }) => {
// 通过这个插件在修改vite.config.js文件则不需要重新运行也生效配置
restart: ['vite.config.js'],
}),
viteCopyToNewFolderPlugin({
outputDir: outputDirName,
}),
compresssionBuild({
sourceName: `dist/build/${outputDirName}`,
type: 'zip',
targetName: `dist/build/${outputDirName}`,
ignoreBase: false,
}),
vitePluginRemoveDir({ dirName: outputDirName }),
UNI_PLATFORM === 'h5' &&
mode === 'production' &&
viteCopyToNewFolderPlugin({
outputDir: outputDirName,
}),
UNI_PLATFORM === 'h5' &&
mode === 'production' &&
compresssionBuild({
sourceName: `dist/build/${outputDirName}`,
type: 'zip',
targetName: `dist/build/${outputDirName}`,
ignoreBase: false,
}),
UNI_PLATFORM === 'h5' &&
mode === 'production' &&
vitePluginRemoveDir({ dirName: outputDirName }),
// h5环境增加编译时间
UNI_PLATFORM === 'h5' && {
name: 'html-transform',