lion 2 years ago
parent 5e9e3702be
commit a3138f79c5

@ -0,0 +1,160 @@
<script>
const jwx = require('jweixin-module')
export default {
onLaunch: function() {
// this.$nextTick(() => {
// })
},
onShow: function() {
let link = window.location.href;
uni.showModal({title:'进入'})
if (/code=/.test(link) || link.indexOf("code") > -1) {
let temp = decodeURIComponent((new RegExp('[?|&]' + 'code' + '=' + '([^&;]+?)(&|#|;|$)')
.exec(link) || [, ''])[1].replace(/\+/g, '%20')) || null
uni.showModal({title:'code:'+temp})
let tadk2_lifeData = uni.getStorageSync('tadk2_lifeData')
if (!tadk2_lifeData.vuex_token) {
uni.showModal({title:'无Token'})
this.$u.api.login({
code: temp
}).then(res => {
uni.showModal({title:'获取到Token'})
this.$u.vuex('vuex_token', res.token)
this.$u.api.user().then(res => {
uni.showModal({title:'获取到user'})
this.$u.vuex('vuex_user', res)
let url = location.href.split('#')[0]
let link = "https://vr.langye.net/h5tadk/";
this.$u.api.share({
url
}).then(res => {
uni.showModal({title:'获取到share'})
this.$u.vuex('vuex_share', true)
jwx.config({
debug: false, // , api alert pc log pc
appId: res.appId,
jsApiList: res.jsApiList,
nonceStr: res.nonceStr,
signature: res.signature,
timestamp: res.timestamp,
})
jwx.ready(() => {
jwx.updateAppMessageShareData({
title: '阵地有声 理响通安', //
link: link, // ,JS
desc: '点击查看',
imgUrl: 'https://vr.langye.net/storage/files/170899758665dd3bd2c88c7.png', //
success: () => {
console.log(
'updateAppMessageShareData-success'
)
},
});
jwx.updateTimelineShareData({
title: '阵地有声 理响通安', //
desc: '点击查看',
link: link, // ,JS
imgUrl: 'https://vr.langye.net/storage/files/170899758665dd3bd2c88c7.png', //
success: () => {
console.log(
'updateTimelineShareData-success'
)
}
});
})
uni.showModal({title:'请求结束'})
this.$isResolve()
// console.log("123---to")
// uni.reLaunch({
// url: '/pages/index/index',
// });
})
})
})
} else {
uni.showModal({title:'有Token'})
this.$u.api.user().then(res => {
uni.showModal({title:'获取user'})
this.$u.vuex('vuex_user', res)
let url = location.href.split('#')[0]
let link = "https://vr.langye.net/h5tadk/";
this.$u.api.share({
url
}).then(res => {
this.$u.vuex('vuex_share', true)
uni.showModal({title:'获取share'})
jwx.config({
debug: false, // , api alert pc log pc
appId: res.appId,
jsApiList: res.jsApiList,
nonceStr: res.nonceStr,
signature: res.signature,
timestamp: res.timestamp,
})
jwx.ready(() => {
jwx.updateAppMessageShareData({
title: '阵地有声 理响通安', //
desc: '点击查看',
link: link, // ,JS
imgUrl: 'https://vr.langye.net/storage/files/170899758665dd3bd2c88c7.png', //
success: () => {
console.log(
'updateAppMessageShareData-success'
)
},
});
jwx.updateTimelineShareData({
title: '阵地有声 理响通安', //
desc: '点击查看',
link: link, // ,JS
imgUrl: 'https://vr.langye.net/storage/files/170899758665dd3bd2c88c7.png', //
success: () => {
console.log(
'updateTimelineShareData-success'
)
}
});
})
uni.showModal({title:'请求结束'})
this.$isResolve()
// console.log("123---to")
// uni.reLaunch({
// url: '/pages/index/index',
// });
})
})
}
} else {
// let that = this
// setInterval(function(){
// console.log("asd-------------")
// that.$u.vuex('vuex_token', "8801|764nhDiiWEGvu0TPh0wyhl3Pfq01Oozhgu8X8Cvl")
// that.$u.vuex('vuex_share', true)
// },10000)
this.$u.api.getAppId().then(res => {
let redirect = encodeURIComponent(link.replace(/#\//, ""))
uni.showModal({title:'跳转到公众号链接'})
window.location.href =
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.appid}&redirect_uri=${redirect}&response_type=code&scope=snsapi_base#wechat_redirect`
})
}
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/*每个页面公共css */
@import "uview-ui/index.scss";
</style>

@ -22,7 +22,6 @@
url url
}).then(res => { }).then(res => {
this.$u.vuex('vuex_share', true) this.$u.vuex('vuex_share', true)
this.$isResolve()
jwx.config({ jwx.config({
debug: false, // , api alert pc log pc debug: false, // , api alert pc log pc
appId: res.appId, appId: res.appId,
@ -36,7 +35,7 @@
title: '阵地有声 理响通安', // title: '阵地有声 理响通安', //
link: link, // ,JS link: link, // ,JS
desc: '点击查看', desc: '点击查看',
imgUrl: 'https://vr.langye.net/storage/files/170899758665dd3bd2c88c7.png', // imgUrl: 'https://vr.langye.net/storage/files/170951606765e52523351d8.jpg', //
success: () => { success: () => {
console.log( console.log(
'updateAppMessageShareData-success' 'updateAppMessageShareData-success'
@ -48,7 +47,7 @@
title: '阵地有声 理响通安', // title: '阵地有声 理响通安', //
desc: '点击查看', desc: '点击查看',
link: link, // ,JS link: link, // ,JS
imgUrl: 'https://vr.langye.net/storage/files/170899758665dd3bd2c88c7.png', // imgUrl: 'https://vr.langye.net/storage/files/170951606765e52523351d8.jpg', //
success: () => { success: () => {
console.log( console.log(
'updateTimelineShareData-success' 'updateTimelineShareData-success'
@ -56,6 +55,7 @@
} }
}); });
}) })
this.$isResolve()
// console.log("123---to") // console.log("123---to")
// uni.reLaunch({ // uni.reLaunch({
// url: '/pages/index/index', // url: '/pages/index/index',
@ -73,7 +73,6 @@
url url
}).then(res => { }).then(res => {
this.$u.vuex('vuex_share', true) this.$u.vuex('vuex_share', true)
this.$isResolve()
jwx.config({ jwx.config({
debug: false, // , api alert pc log pc debug: false, // , api alert pc log pc
appId: res.appId, appId: res.appId,
@ -87,7 +86,7 @@
title: '阵地有声 理响通安', // title: '阵地有声 理响通安', //
desc: '点击查看', desc: '点击查看',
link: link, // ,JS link: link, // ,JS
imgUrl: 'https://vr.langye.net/storage/files/170899758665dd3bd2c88c7.png', // imgUrl: 'https://vr.langye.net/storage/files/170951606765e52523351d8.jpg', //
success: () => { success: () => {
console.log( console.log(
'updateAppMessageShareData-success' 'updateAppMessageShareData-success'
@ -99,7 +98,7 @@
title: '阵地有声 理响通安', // title: '阵地有声 理响通安', //
desc: '点击查看', desc: '点击查看',
link: link, // ,JS link: link, // ,JS
imgUrl: 'https://vr.langye.net/storage/files/170899758665dd3bd2c88c7.png', // imgUrl: 'https://vr.langye.net/storage/files/170951606765e52523351d8.jpg', //
success: () => { success: () => {
console.log( console.log(
'updateTimelineShareData-success' 'updateTimelineShareData-success'
@ -107,6 +106,7 @@
} }
}); });
}) })
this.$isResolve()
// console.log("123---to") // console.log("123---to")
// uni.reLaunch({ // uni.reLaunch({
// url: '/pages/index/index', // url: '/pages/index/index',
@ -120,12 +120,13 @@
// let that = this // let that = this
// setInterval(function(){ // setInterval(function(){
// console.log("asd-------------") // console.log("asd-------------")
// that.$u.vuex('vuex_token', "8801|764nhDiiWEGvu0TPh0wyhl3Pfq01Oozhgu8X8Cvl") // that.$u.vuex('vuex_token', "8849|gyvzzL2oj23cjFEHLkL3R6D3nG1G2LjkXj9j6NfP")
// that.$u.vuex('vuex_share', true) // that.$u.vuex('vuex_share', true)
// },10000) // },10000)
// this.$u.vuex('vuex_token', "8849|gyvzzL2oj23cjFEHLkL3R6D3nG1G2LjkXj9j6NfP")
this.$u.api.getAppId().then(res => { this.$u.api.getAppId().then(res => {
let redirect = encodeURIComponent(link.replace(/#\//, "")) let redirect = encodeURIComponent(link.replace(/#\//, ""))
console.log(redirect)
window.location.href = window.location.href =
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.appid}&redirect_uri=${redirect}&response_type=code&scope=snsapi_base#wechat_redirect` `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.appid}&redirect_uri=${redirect}&response_type=code&scope=snsapi_base#wechat_redirect`
}) })
@ -134,7 +135,7 @@
}, },
onShow: function() { onShow: function() {
console.log('App Show')
}, },
onHide: function() { onHide: function() {
console.log('App Hide') console.log('App Hide')

@ -21,10 +21,9 @@
</div> </div>
</div> </div>
<!-- <div class="footer"> <div class="footer">
主办单位中共苏州市委党史工作办公室 <br> 技术支撑江苏有线苏州分公司
承办单位江苏有线苏州分公司 </div>
</div> -->
<transition name="share-pop" enter-active-class="fade-in" leave-to-class="fade-out"> <transition name="share-pop" enter-active-class="fade-in" leave-to-class="fade-out">
<view class="share_cover" v-show="isShare" @click="isShare = false"> <view class="share_cover" v-show="isShare" @click="isShare = false">
@ -159,9 +158,9 @@ export default {
} }
.footer { .footer {
text-align: center; text-align: center;
font-size: 18rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
color: #F8DB97; color: #f8cd82;
padding: 20rpx 0; padding: 20rpx 0;
position: absolute; position: absolute;

@ -67,7 +67,8 @@
hasAnswer:false, hasAnswer:false,
// goBack:false, // goBack:false,
showAnswer:false, showAnswer:false,
isSubmit:false isSubmit:false,
isNext:false
}; };
}, },
methods: { methods: {
@ -133,9 +134,10 @@
toast('请先答题') toast('请先答题')
return return
} }
if(this.isSubmit){ if(this.isSubmit || this.isNext){
return return
} }
this.isNext = true
if(this.currentIndex==this.question_list.length-1){ if(this.currentIndex==this.question_list.length-1){
uni.showLoading({title:'提交中'}) uni.showLoading({title:'提交中'})
this.isSubmit = true this.isSubmit = true
@ -178,6 +180,7 @@
that.currentIndex++ that.currentIndex++
that.showAnswer = false that.showAnswer = false
that.hasAnswer = false that.hasAnswer = false
that.isNext = false
} }
},1200) },1200)
@ -261,6 +264,7 @@
&-text { &-text {
color: #000000; color: #000000;
font-size: 32rpx; font-size: 32rpx;
padding-left:30rpx;
} }
} }
&-answer{ &-answer{

@ -0,0 +1,219 @@
<template>
<view class="container">
<image class="logo" :src="require('@/static/index-logo.png')"></image>
<image class="logo1" :src="require('@/static/index-logo1.png')"></image>
<view style="height:100px;color:red" @click="clearHistory"></view>
<view class="titlewrap">
<image class="title" :src="require('@/static/index-title.png')"></image>
<view class="title-progress">
<view class="progress-text">{{progressPercentage}}%</view>
<view>interval0::::{{interval0}}</view>
<view>isOk::::{{isOk}}</view>
<view>token:::{{token}}</view>
<view>user:::{{user}}</view>
<view>isShare::::{{isShare}}</view>
<view>inter::::{{interval}}</view>
<view>shareFalse101::::{{shareFalse101}}</view>
<view class="progress-bar-container">
<view class="progress-bar" :style="{'width':progressPercentage+'%'}"></view>
</view>
</view>
</view>
<!-- <view class="support">
<view>
<p>主办单位中共苏州工业园区斜塘街道工作委员会</p>
<p>承办单位江苏有线苏州分公司</p>
</view>
</view> -->
</view>
</template>
<script>
export default {
data() {
return {
progressPercentage: 0,
interval0:null,
interval:null,
isShare:false,
shareFalse101:0,
isOk:'未请求完毕',
token:'--1',
user:'--2'
}
},
async onLoad() {
uni.showModal({
title:'index--onload'
})
this.startBefore()
uni.showModal({
title:'end--startBefore'
})
await this.$onLaunched;
uni.showModal({
title:'this.$onLaunched'
})
this.token = uni.getStorageSync('tadk2_lifeData').vuex_token
this.user = uni.getStorageSync('tadk2_lifeData').vuex_user
console.log("请求完毕,开始执行")
this.isOk =" 请求完毕,开始执行"
this.start();
},
beforeDestroy() {
clearInterval(this.interval0);
clearInterval(this.interval);
},
methods: {
clearHistory() {
// history
const history = window.history;
// 使pushStateURLURL
history.pushState(null, "", "#");
// popstate退
window.addEventListener("popstate", function(event) {
history.pushState(null, "", "#");
});
},
startBefore(){
this.interval0 = setInterval(() => {
if(this.progressPercentage<33){
this.progressPercentage++;
}else{
clearInterval(this.interval0);
}
}, 50);
},
start() {
this.interval = setInterval(() => {
this.isShare = uni.getStorageSync('tadk2_lifeData').vuex_share?true:false
const userInfo = uni.getStorageSync('tadk2_lifeData').vuex_user
if(this.isShare){
if(this.progressPercentage<100){
this.progressPercentage++;
}else{
clearInterval(this.interval);
if(userInfo && userInfo.mobile){
uni.navigateTo({
url:'/pages/map/map'
})
}else{
uni.navigateTo({
url:'/pages/login/login'
})
}
}
}else{
if(this.progressPercentage<99){
this.progressPercentage++;
}else{
this.shareFalse101 = this.progressPercentage
}
}
}, 50);
},
},
}
</script>
<style lang="scss">
.container {
height: 100vh;
width: 100vw;
background: #e1f1f2;
position: relative;
.logo {
width: 59rpx;
height: 106rpx;
position: absolute;
top: 35rpx;
left: 65rpx;
}
.logo1 {
width: 97rpx;
height: 86rpx;
position: absolute;
top: 45rpx;
left: 140rpx
}
.titlewrap{
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
.title {
width: 633rpx;
height: 498rpx;
}
.title-progress{
margin-top:30rpx;
.progress-text{
text-align: center;
color:#156e68;
font-size: 60rpx;
margin-bottom:20rpx
}
.progress-bar-container {
width: 90%;
height: 55rpx;
background-color: #f7f1e1;
overflow: hidden;
border:4rpx solid #156e68;
border-radius: 20rpx;
margin:0 auto;
font-size: 0;
}
.progress-bar {
height: 100%;
background-color: #156e68;
width:0;
border-radius:0 16rpx 16rpx 0;
// transition: width 0.5s;
// animation: width100 5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
// @keyframes width100 {
// 0% {
// width:0%
// }
// 30% {
// width:30%
// }
// 50%{
// width:30%
// }
// 70%{
// width:70%
// }
// 100% {
// width:100%
// }
// }
}
}
.support {
position: absolute;
bottom: 10rpx;
width: 100%;
font-size: 24rpx;
color: #666;
font-family: '宋体';
opacity: 1;
text-align: center;
z-index: 9;
}
}
</style>

@ -6,10 +6,7 @@
<image class="title" :src="require('@/static/index-title.png')"></image> <image class="title" :src="require('@/static/index-title.png')"></image>
<view class="title-progress"> <view class="title-progress">
<view class="progress-text">{{progressPercentage}}%</view> <view class="progress-text">{{progressPercentage}}%</view>
<!-- <view>isOk::::{{isOk}}</view>
<view>isShare::::{{isShare}}</view>
<view>shareFalse101::::{{shareFalse101}}</view>
<view>inter::::{{interval}}</view> -->
<view class="progress-bar-container"> <view class="progress-bar-container">
<view class="progress-bar" :style="{'width':progressPercentage+'%'}"></view> <view class="progress-bar" :style="{'width':progressPercentage+'%'}"></view>
</view> </view>
@ -17,12 +14,11 @@
</view> </view>
<!-- <view class="support"> <view class="support">
<view> <view>
<p>主办单位中共苏州工业园区斜塘街道工作委员会</p> <p>技术支撑江苏有线苏州分公司</p>
<p>承办单位江苏有线苏州分公司</p> </view>
</view> </view>
</view> -->
</view> </view>
</template> </template>
@ -31,18 +27,12 @@
data() { data() {
return { return {
progressPercentage: 0, progressPercentage: 0,
// interval0:null,
interval:null, interval:null,
isShare:false, isShare:false,
// shareFalse101:0,
// isOk:'',
} }
}, },
async onLoad() { async onLoad() {
await this.startBefore() // await this.$onLaunched;
await this.$onLaunched;
// console.log("")
// this.isOk =" "
this.start(); this.start();
}, },
@ -50,20 +40,11 @@
clearInterval(this.interval); clearInterval(this.interval);
}, },
methods: { methods: {
startBefore(){
this.interval0 = setInterval(() => {
if(this.progressPercentage<33){
this.progressPercentage++;
}else{
clearInterval(this.interval0);
}
}, 50);
},
start() { start() {
this.interval = setInterval(() => { this.interval = setInterval(() => {
this.isShare = uni.getStorageSync('tadk2_lifeData').vuex_share?true:false this.isShare = uni.getStorageSync('tadk2_lifeData').vuex_share?true:false
const userInfo = uni.getStorageSync('tadk2_lifeData').vuex_user const userInfo = uni.getStorageSync('tadk2_lifeData').vuex_user
if(this.isShare){ // if(this.isShare){
if(this.progressPercentage<100){ if(this.progressPercentage<100){
this.progressPercentage++; this.progressPercentage++;
}else{ }else{
@ -78,15 +59,13 @@
}) })
} }
} }
}else{ // }else{
if(this.progressPercentage<99){ // if(this.progressPercentage<99){
this.progressPercentage++; // this.progressPercentage++;
}else{ // }
this.shareFalse101 = this.progressPercentage // }
}
}
}, 50); }, 60);
}, },
}, },
} }
@ -177,7 +156,7 @@
bottom: 10rpx; bottom: 10rpx;
width: 100%; width: 100%;
font-size: 24rpx; font-size: 24rpx;
color: #666; color: #333;
font-family: '宋体'; font-family: '宋体';
opacity: 1; opacity: 1;
text-align: center; text-align: center;

@ -148,6 +148,15 @@
background: #e1f1f2; background: #e1f1f2;
position: relative; position: relative;
overflow: scroll; overflow: scroll;
::v-deep .u-drawer-content-visible{
height:60%!important;
.u-datetime-picker{
height:100%!important;
.u-picker-body{
height:100%!important;
}
}
}
.show-modal{ .show-modal{
width: 100%; width: 100%;
height: 100%; height: 100%;

@ -97,7 +97,7 @@
area: { area: {
w: 2212, w: 2212,
h: 1583, h: 1583,
x: -523 / 2 x: -2212 / 4.8
}, },
pointers: [] pointers: []
}; };

Loading…
Cancel
Save