From c28b3b105e5294165ff6b278723df5e0889cb36f Mon Sep 17 00:00:00 2001 From: zhaojs <349234519@qq.com> Date: 星期一, 12 六月 2023 16:33:36 +0800 Subject: [PATCH] no message --- uniapp/manifest.json | 6 uniapp/uni_modules/m-start-ad/readme.md | 78 ++++++++ uniapp/pages/index/launchPage.vue | 77 ++++++++ uniapp/uni_modules/m-start-ad/components/m-start-ad/m-start-ad.vue | 232 +++++++++++++++++++++++++ uniapp/pages.json | 3 uniapp/App.vue | 15 + uniapp/components/indexPage.vue | 8 uniapp/uni_modules/m-start-ad/changelog.md | 4 uniapp/pages/active/vipsearch.vue | 8 uniapp/utils/utils.js | 2 uniapp/uni_modules/m-start-ad/package.json | 81 +++++++++ 11 files changed, 506 insertions(+), 8 deletions(-) diff --git a/uniapp/App.vue b/uniapp/App.vue index 2940aa8..f276460 100644 --- a/uniapp/App.vue +++ b/uniapp/App.vue @@ -139,6 +139,7 @@ ifwt: 0, hasinit:false, hasbcinit:false, + isLaunch:false }, onShow: function() { @@ -158,6 +159,7 @@ } if(!that.globalData.hasbcinit) { + console.log("鍒濆鍖栫櫨宸濇彃浠�") that.bcInit(); } /* let appInfo = utils.getCacheSync('appInfo') @@ -200,13 +202,20 @@ } }); } + else{ + that.globalData.hasbcinit=true; + } }, getAppInfo: function() { var that = this; + that.globalData.hasinit=true; this.$u.api.comminInt({}).then(e => { console.log(e) - if (e.code != 0) return that.$alert(e.msg) - that.globalData.hasinit=true; + if (e.code != 0) + { + that.globalData.hasinit=false; + return that.$alert(e.msg) + } that.globalData.appinfo = e.data.basic utils.setCache('appInfo', e.data.basic) utils.setCache('baseUrl', this.$u.http.config.baseUrl) @@ -237,7 +246,7 @@ } } // #endif - }).catch(function(err) {}) + }).catch(function(err) {that.globalData.hasinit=false;}) }, diff --git a/uniapp/components/indexPage.vue b/uniapp/components/indexPage.vue index c239708..a29517e 100644 --- a/uniapp/components/indexPage.vue +++ b/uniapp/components/indexPage.vue @@ -629,8 +629,12 @@ console.log(e) if (e.code == 1) return that.$alert(e.msg); var res = e.data.info; - this.topBannerList = res.topBannerList; - this.headerColor = this.topBannerList[0].colour; + if(res.topBannerList&&res.topBannerList.length>0) + { + this.topBannerList = res.topBannerList; + this.headerColor = this.topBannerList[0].colour; + } + this.singleLineList = res.singleLineList; this.doubleLineList = res.doubleLineList; this.bottomBannerList = res.bottomBannerList; diff --git a/uniapp/manifest.json b/uniapp/manifest.json index 3dabb34..3013d8c 100644 --- a/uniapp/manifest.json +++ b/uniapp/manifest.json @@ -12,8 +12,8 @@ "nvueCompiler" : "uni-app", "compilerVersion" : 3, "splashscreen" : { - "alwaysShowBeforeRender" : true, - "waiting" : true, + "alwaysShowBeforeRender" : false, + "waiting" : false, "autoclose" : true, "delay" : 0 }, @@ -126,7 +126,7 @@ } }, "splashscreen" : { - "androidStyle" : "default", + "androidStyle" : "common", "android" : { "hdpi" : "E:/OPProject/鍙戠増鐢╛鍕垮垹/寮�灞�/寮�灞忓皬.png", "xhdpi" : "E:/OPProject/鍥剧墖/寮�灞�/寮�灞忎腑.png", diff --git a/uniapp/pages.json b/uniapp/pages.json index b96baae..5abad81 100644 --- a/uniapp/pages.json +++ b/uniapp/pages.json @@ -4,6 +4,9 @@ "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" }, "pages": [ + { + "path": "pages/index/launchPage" + }, //棣栭〉 { "path": "pages/index/index", diff --git a/uniapp/pages/active/vipsearch.vue b/uniapp/pages/active/vipsearch.vue index 27a6a64..f34a2af 100644 --- a/uniapp/pages/active/vipsearch.vue +++ b/uniapp/pages/active/vipsearch.vue @@ -132,8 +132,16 @@ pageSize: 10, page: this.pageCurrent, }).then(e => { + console.log(e); if(e.code != 0)return that.$alert(e.msg) var res = e.data; + if(res.list==null) + { + that.pageCurrent++ + that.canloadmore = false + that.loadstatus = 'nomarl' + return; + } if (res.list < 10) { that.pageCurrent++ that.canloadmore = false diff --git a/uniapp/pages/index/launchPage.vue b/uniapp/pages/index/launchPage.vue new file mode 100644 index 0000000..381c371 --- /dev/null +++ b/uniapp/pages/index/launchPage.vue @@ -0,0 +1,77 @@ +<template> + <view v-if="list&&list.length>0"> + <m-start-ad :list="list" v-on:pgoUrl="goUrl" :time="time" url="/pages/index/index" /> + </view> + +</template> + +<script> + import utils from "../../utils/utils.js" + export default { + data() { + return { + list:[], + time:5 + }; + }, + + onShow: function () { + + var first = getApp().globalData.isLaunch; + if(first){ + uni.reLaunch({ + url: "/pages/index/index" + }); + } else { + + getApp().globalData.isLaunch=true; + var that = this; + this.$u.api.getBanner({ + type: '1,15' + }).then(e => { + + console.log(e) + if (e.code == 1) + {//杩斿洖澶辫触锛岀洿鎺ヨ烦棣栭〉 + this.t_index(); + return; + } + var res = e.data.info; + if(res.launchpic&&res.launchpic.length>0) + { + that.list=res.launchpic; + } + else{ + console.log("璺宠浆") + this.t_index(); + } + }).catch(function(err) { + console.log(err); + this.t_index(); + }) + } + }, + methods: { + goUrl(info) { + if (info.url_type == 1&&info.parameter_json.url=="/pages/index/index") + { + uni.reLaunch({ + url: './index' + }) + } + else{ + utils.goUrl(info, this) + } + }, + t_index() + { + uni.reLaunch({ + url: "/pages/index/index" + }); + /* setTimeout(()=>{ + + }, 500); */ + } + } + } +</script> diff --git a/uniapp/uni_modules/m-start-ad/changelog.md b/uniapp/uni_modules/m-start-ad/changelog.md new file mode 100644 index 0000000..0c306cc --- /dev/null +++ b/uniapp/uni_modules/m-start-ad/changelog.md @@ -0,0 +1,4 @@ +## 1.0.1锛�2022-11-11锛� +淇敼鏂囨。鎻忚堪 +## 1.0.0锛�2022-11-11锛� +鍒濇鐗堟湰鍙戝竷 diff --git a/uniapp/uni_modules/m-start-ad/components/m-start-ad/m-start-ad.vue b/uniapp/uni_modules/m-start-ad/components/m-start-ad/m-start-ad.vue new file mode 100644 index 0000000..2062a6d --- /dev/null +++ b/uniapp/uni_modules/m-start-ad/components/m-start-ad/m-start-ad.vue @@ -0,0 +1,232 @@ +<template> + <view class="start" v-if="show"> + <view class="skip" :style="skipPositionStyle" @click="onSkip">璺宠繃 {{time2}}</view> + <swiper class="swiper" :interval="interval" @change="onChangeSwiper"> + <swiper-item v-for="(item, index) in list" :key="index"> + <view class="swiper-item" :style="'background:'+ item.colour +';'" @click="goUrl(item)"> + <image class="image" :src="item.image" mode="widthFix"></image> + <view class="after" :style="afterStyle"></view> + </view> + </swiper-item> + <!-- autoplay --> + </swiper> + <view class="swiper-dot" v-if="list.length>1"> + <view class="view" :style="index === current ? currentStyle : ''" :class="{'active': index === current}" + v-for="(item, index) in list" :key="index" /> + </view> + </view> +</template> + +<script> + export default { + props: { + list: { + type: Array, + default () { + return [] + }, + required: true + }, + hasTabbar: { + type: Boolean, + default: false, + }, + hasNavbar: { + type: Boolean, + default: false, + }, + interval: { + type: Number, + default: 3000 + }, + time: { + type: Number, + default: 3 + }, + url: { + type: String, + default: '' + }, + bgColor: { + type: String, + default: '#BB1219' + }, + afterColor: { + type: String, + default: '' + }, + currentColor: { + type: String, + default: '#BB1219' + } + }, + data() { + return { + current: 0, + show: true, + timer: null, + time2: this.time + } + }, + watch: { + time2(val) { + if (val <= 0) { + this.onSkip() + } + } + }, + computed: { + bgStyle() { + return this.obj2strStyle({ + 'background-color': this.bgColor + }) + }, + afterStyle() { + return this.obj2strStyle({ + 'background-color': this.afterColor + }) + }, + currentStyle() { + return this.obj2strStyle({ + 'background-color': this.currentColor + }) + }, + skipPositionStyle() { + const { + statusBarHeight + } = uni.getSystemInfoSync() + if (!this.hasNavbar) { + return this.obj2strStyle({ + 'top': `${statusBarHeight*2 + 88 + 30}rpx` + }) + } + return this.obj2strStyle({ + 'top': '30rpx' + }) + } + }, + mounted() { + if (this.hasTabbar) { + uni.hideTabBar() + } + this.timer = setInterval(() => { + this.time2-- + }, 1000) + }, + methods: { + obj2strStyle(obj) { + let style = '' + for (let key in obj) { + style += `${key}:${obj[key]};` + } + return style + }, + goUrl(item) + { + this.$emit("pgoUrl",item); + }, + onSkip() { + const { + url, + hasTabbar, + timer + } = this + clearTimeout(timer) + this.show = false + if (hasTabbar) { + uni.showTabBar() + } + if (url) { + uni.reLaunch({ + url: url, + }) + } + }, + onChangeSwiper(e) { + this.current = e.detail.current + } + } + } +</script> + +<style scoped> + /* $nav-height: 44px; */ + .start { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 9999; + } + + .skip { + position: absolute; + z-index: 2; + background-color: rgba(0, 0, 0, 0.1); + color: #fff; + right: 30rpx; + font-size: 28rpx; + width: 133rpx; + height: 60rpx; + border-radius: 44rpx; + display: flex; + align-items: center; + justify-content: center; + } + + .swiper { + height: 100vh; + width: 100vw; + } + + .swiper-item { + height: 100vh; + width: 100vw; + display: flex; + justify-content: center; + align-items: center; + overflow: hidden; + background-color: transparent; + } + + .swiper-item .after { + width: 100vw; + height: 500rpx; + position: absolute; + left: 0; + bottom: 0; + z-index: 1; + } + + .swiper-item .image { + height: 100vh; + width: 100vw; + display: block; + position: relative; + z-index: 2; + } + + .swiper-dot { + position: absolute; + width: 100vw; + left: 0; + bottom: 100rpx; + z-index: 3; + display: flex; + justify-content: center; + } + + .swiper-dot .view { + width: 16rpx; + height: 16rpx; + border-radius: 100%; + background-color: rgba(0, 0, 0, 0.2); + margin: 0 12rpx; + } + + .swiper-dot .view.active { + width: 30rpx; + border-radius: 24rpx; + } +</style> diff --git a/uniapp/uni_modules/m-start-ad/package.json b/uniapp/uni_modules/m-start-ad/package.json new file mode 100644 index 0000000..2871587 --- /dev/null +++ b/uniapp/uni_modules/m-start-ad/package.json @@ -0,0 +1,81 @@ +{ + "id": "m-start-ad", + "displayName": "start-ad寮�灞忓箍鍛�", + "version": "1.0.1", + "description": "鑷畾涔夊紑灞忓箍鍛�", + "keywords": [ + "start銆佸紑灞忋�佸紑灞忓箍鍛�" +], + "repository": "", + "engines": { + "HBuilderX": "^3.2.12" + }, + "dcloudext": { + "type": "component-vue", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "鏃�", + "data": "鏃�", + "permissions": "鏃�" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "寰俊娴忚鍣�(Android)": "y", + "QQ娴忚鍣�(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "灏忕▼搴�": { + "寰俊": "y", + "闃块噷": "y", + "鐧惧害": "y", + "瀛楄妭璺冲姩": "y", + "QQ": "y", + "閽夐拤": "y", + "蹇墜": "y", + "椋炰功": "y", + "浜笢": "y" + }, + "蹇簲鐢�": { + "鍗庝负": "y", + "鑱旂洘": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uniapp/uni_modules/m-start-ad/readme.md b/uniapp/uni_modules/m-start-ad/readme.md new file mode 100644 index 0000000..5c6546c --- /dev/null +++ b/uniapp/uni_modules/m-start-ad/readme.md @@ -0,0 +1,78 @@ +# m-start-ad + +蹇�熷埗浣滀竴涓嚜瀹氫箟寮�灞忓箍鍛婏紝鏀寔杞挱 + +### 灞炴�ц鏄� + +| 灞炴�у悕 | 绫诲瀷 | 榛樿鍊� | 蹇呭~ | 璇存槑 | +| ------- | ------- | ------- | ------- | ------- | +| list | Array | [] | true | 寮�灞忓浘鐗囧垪琛� | +| hasTabbar | Boolean | false | false | 椤甸潰瀛樺湪鍘熺敓tabbar锛岀粍浠朵細鑷姩鍒ゆ柇闅愯棌tabbar | +| hasNavbar | Boolean | false | false | 椤甸潰鏄惁鍖呭惈navbar | +| interval | Number | 3000 | false | 杞挱鑷姩鎾斁鏃堕棿锛堝鍥炬椂鍙敤锛� | +| time | Number | 3 | false | 鍊掕鏃惰烦杩� | +| url | String | '' | false | 鏃堕棿鍊掕鏃剁粨鏉熷悗璺宠浆鍦板潃,濡傛灉鏄痶abbar椤甸潰锛屽彲涓虹┖ | +| bgColor | String | '#BB1219' | false | 椤甸潰鐨勮儗鏅鑹�, 寮�灞忓浘鐗囦负鑷姩鍨傜洿灞呬腑锛屽湪澶у睆骞曟墜鏈轰笅锛屾湁浜涙椂鍊欓珮搴︿笉澶熺殑鎯呭喌涓嬶紝浼氶�犳垚涓婁笅鐣欑櫧锛屼娇鐢ㄦ灞炴�у彲浠ュ~鍏呰儗鏅壊 | +| afterColor | String | '' | false | 椤甸潰搴曢儴鑳屾櫙鑹插~鍏咃紝鏈変簺鏃跺�欒缃細璁捐娓愬彉鑹插浘鐗囷紝濡傛灉鍙娇鐢╞gcolor鏃犳硶瑙e喅闇�姹傦紝姝ゆ椂瀹氫箟姝ゅ睘鎬э紝鍙湪鏈�涓嬮潰濉厖棰滆壊锛屼互杈惧埌棰滆壊杩囧害鏁堟灉 | +| currentColor | String | '#BB1219' | false | 瀹氫箟dot褰撳墠鐘舵�侀鑹�, list闀垮害澶т簬1鍙 | + + +### 濡備綍鍋氳嚜瀹氫箟寮�灞忕晫闈� + +#### 鏂瑰紡涓� +1銆佹柊寤轰竴涓柊椤甸潰 pages/start +2銆佷慨鏀筽ages.js閰嶇疆鏂囦欢锛屾妸start鍦板潃鏀惧湪鏈�鍓� +``` +{ + "pages": [ + { + "path" : "pages/start", //page绗竴椤靛氨鏄紑灞忕涓�涓〉闈� + "style" : + { + "navigationBarTitleText": "", + "navigationStyle": "custom" //鍙栨秷榛樿瀵艰埅鍋氬埌婊″睆鏁堟灉 + } + + } + ] +} +``` +3銆侀〉闈㈠紩鍏ョ粍浠讹紝浼犲叆list, url + +### 浣跨敤鏂瑰紡 +``` +<template> + <m-start-ad :list="list" url="pages/index/index" /> +</template> + +``` + +#### 鏂瑰紡浜� +1銆侀〉闈㈠叧闂師鐢熷鑸� +``` +{ + "pages": [ + { + "path" : "pages/index/index", + "style" : + { + "navigationBarTitleText": "", + "navigationStyle": "custom" //鍙栨秷榛樿瀵艰埅鍋氬埌婊″睆鏁堟灉 + } + + } + ] +} +``` +1銆侀〉闈㈢洿鎺ヤ娇鐢� +``` +<m-start-ad :list="list" /> +``` +2銆佸�掕鏃剁粨鏉熷悗锛岃嚜鍔ㄩ殣钘忕粍浠讹紙鏃犻渶鎿嶄綔锛� + + +### 鏂瑰紡瀵规瘮 + |瀵规瘮 | 浼樼偣 | 缂虹偣 | + | ------- | ------- |------- | + | 鏂瑰紡涓� | 鎵�鏈夐〉闈㈤兘鍙互鍏敤 | 濡傛灉鍐呴〉闇�瑕乼abbar,闇�瑕佽嚜瀹氫箟 | + | 鏂瑰紡浜� | 鎸夐渶閰嶇疆 | 鏃犳硶鎺у埗navbar锛岄渶瑕佽嚜瀹氫箟 | \ No newline at end of file diff --git a/uniapp/utils/utils.js b/uniapp/utils/utils.js index ac70b56..eafbf8e 100644 --- a/uniapp/utils/utils.js +++ b/uniapp/utils/utils.js @@ -56,7 +56,9 @@ url: '/pages/webView/webView?url=' + info.parameter_json.url }) } else if (info.url_type == 1) { + console.log("杩涙潵浜�1路11111111111") let url = info.parameter_json.url == undefined ? '' : info.parameter_json.url; + console.log(url) if(url == '') return false; uni.navigateTo({ url: url -- Gitblit v1.9.3