Commit 2e1d3283 authored by Zheng Gengqiong's avatar Zheng Gengqiong

done

parent 1112b924
// app.js
App({
onLaunch() {
}
})
{
"pages":[
"pages/index/index"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle":"black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
// index.js
Page({
data: {
originUrl: "https://s3.ax1x.com/2021/02/18/yWKsQ1.png",
url: "",
urls: ["https://s3.ax1x.com/2021/02/18/yWMc1s.png", "https://s3.ax1x.com/2021/02/18/yWM8te.png", "https://s3.ax1x.com/2021/02/18/yWMYpd.png", "https://s3.ax1x.com/2021/02/18/yWE99P.png"],
intervel: "",
index: 1
},
longpress(e) {
var intervel = setInterval(this.change, 2000)
this.setData({
intervel: intervel,
url: this.data.urls[0]
})
},
change() {
var index = this.data.index
this.setData({
url: this.data.urls[index]
})
if (++index <= 3) {
this.setData({
index: index++
})
} else {
this.setData({
index: 0
})
}
},
end() {
clearInterval(this.data.intervel)
this.setData({
index: 1
})
},
onLoad() {
this.setData({
url: this.data.originUrl
})
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!--index.wxml-->
<view class="container">
<image src="{{url}}" class="bg"></image>
<view bindtouchend="end" bindlongpress="longpress" class="dice"></view>
</view>
\ No newline at end of file
/**index.wxss**/
.container {
margin: 250rpx auto;
width: 100vw;
height: 100vw;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.bg {
position: absolute;
top: 0;
left: 0;
z-index: -10;
width: 100%;
height: 100%;
}
.dice{
width: 45%;
height: 45%;
margin-left: 60rpx;
background-image: url("https://s3.ax1x.com/2021/02/18/yWKGMq.png");
background-size: 100% auto;
background-position: center;
background-repeat: no-repeat;
}
\ No newline at end of file
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": true,
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true,
"autoAudits": false,
"coverView": true
},
"compileType": "miniprogram",
"libVersion": "2.15.0",
"appid": "wxecdb7dba6dbecfc4",
"projectname": "colorfulDice",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}
\ No newline at end of file
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment