Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Codet
mini-vote
提交
c81fc278
M
mini-vote
项目概览
Codet
/
mini-vote
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mini-vote
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c81fc278
编写于
9月 12, 2020
作者:
S
steven
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(*): update style , modify ts type, add home
上级
2d52240e
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
168 addition
and
116 deletion
+168
-116
src/App.vue
src/App.vue
+3
-0
src/common/interface.ts
src/common/interface.ts
+11
-15
src/components/vote-item/vote-item.vue
src/components/vote-item/vote-item.vue
+16
-2
src/components/vote-list/vote-list.vue
src/components/vote-list/vote-list.vue
+11
-2
src/main.ts
src/main.ts
+1
-0
src/mock/store.ts
src/mock/store.ts
+15
-15
src/pages.json
src/pages.json
+70
-63
src/pages/home/home.vue
src/pages/home/home.vue
+9
-0
src/pages/index/index.vue
src/pages/index/index.vue
+12
-2
src/servise/check-valid.ts
src/servise/check-valid.ts
+1
-0
src/sfc.d.ts
src/sfc.d.ts
+3
-3
src/vue.d.ts
src/vue.d.ts
+7
-0
投票小程序 .md
投票小程序 .md
+9
-14
未找到文件。
src/App.vue
浏览文件 @
c81fc278
...
...
@@ -18,6 +18,9 @@ export default Vue.extend({
onHide
()
{
console
.
log
(
"
App Hide
"
)
},
globalData
:
{
baseurl
:
"
huadongio.com
"
,
},
})
</
script
>
...
...
src/common/interface.ts
浏览文件 @
c81fc278
/*
* @Description:
* @Description:
* @Author: Steven
* @Date: 2020-09-11 16:32:30
* @LastEditors: Steven
...
...
@@ -22,22 +22,18 @@ export interface Iinfo {
name
:
string
// 属性名称
value
:
number
// 属性值
}
// 统计项
export
interface
Istats
{
info
:
Array
<
Iinfo
>
// 属性
}
// 投票规则
export
interface
Irule
{
day
:
number
// 一天可以投票最大次数
item
:
number
//一次可以投几人
day
:
number
// 一天可以投票最大次数
item
:
number
//一次可以投几人
}
// 活动
export
interface
Iactivate
{
id
:
number
// 活动编号
name
:
string
//活动名称
bannerImg
:
Array
<
string
>
//广告图片
startTime
:
string
//开始时间
endTime
:
string
//结束时间
rule
:
Irule
// 活动规则
desc
:
string
//活动描述
}
\ No newline at end of file
id
:
number
// 活动编号
name
:
string
//活动名称
bannerImg
:
Array
<
string
>
//广告图片
startTime
:
string
//开始时间
endTime
:
string
//结束时间
rule
:
Irule
// 活动规则
desc
:
string
//活动描述
}
src/components/vote-item/vote-item.vue
浏览文件 @
c81fc278
...
...
@@ -26,6 +26,7 @@
mode=
"widthFix"
style=
"width: 100%; background-color: #eeeeee;"
></image>
<view
class=
"text-gray-100 text-lg font-bold mt-1"
>
{{
item
.
name
}}
</view>
<view
class=
"text-gray-500 my-1"
>
{{
item
.
group
}}
</view>
</view>
...
...
@@ -37,8 +38,10 @@
>
<view
class=
"flex-1 border border-solid border-orange-500 bg-orange-500 text-white p-2"
>
投票
</view
@
click=
"vote"
>
投票
</view>
</view>
</view>
</view>
...
...
@@ -59,7 +62,18 @@ export default Vue.extend({
},
},
onLoad
()
{},
methods
:
{},
methods
:
{
vote
()
{
/**
* 1. 判断是否关注公众号
* 2. 判断是否在投票时间
* 3. 判断是否超出限制
* 可以抽离逻辑 isValid()
*/
// FIXME
this
.
$emit
(
"
plusVote
"
,
this
.
item
.
vote
+
1
)
},
},
computed
:
{
toUrl
():
string
{
return
`/pages/detail/detail?id=
${
this
.
item
.
id
}
`
...
...
src/components/vote-list/vote-list.vue
浏览文件 @
c81fc278
...
...
@@ -18,7 +18,12 @@
<view
class=
"flex flex-row flex-wrap w-full justify-center"
v-if=
"isIndex"
>
<block
v-for=
"item in items"
:key=
"item.id"
>
<vote-item
:item=
"item"
:index=
"true"
:col=
"2"
></vote-item>
<vote-item
:item=
"item"
:index=
"true"
:col=
"2"
@
plusVote=
"handlePlusVote"
></vote-item>
</block>
</view>
<view
v-else
>
...
...
@@ -43,7 +48,11 @@ export default Vue.extend({
pageType
:
String
,
},
onLoad
()
{},
methods
:
{},
methods
:
{
handlePlusVote
(
e
:
number
)
{
console
.
log
(
"
接收vote-item的数据
"
,
e
)
},
},
components
:
{
voteItem
,
},
...
...
src/main.ts
浏览文件 @
c81fc278
...
...
@@ -8,5 +8,6 @@
import
Vue
from
"
vue
"
import
App
from
"
./App.vue
"
import
request
from
"
./utils/request
"
Vue
.
prototype
.
$request
=
request
Vue
.
config
.
productionTip
=
false
new
App
().
$mount
()
src/mock/store.ts
浏览文件 @
c81fc278
...
...
@@ -5,7 +5,7 @@
* @LastEditors: Steven
* @LastEditTime: 2020-09-11 16:56:28
*/
import
{
Iinfo
,
Iitem
,
Istats
}
from
"
@/common/interface
"
import
{
Iinfo
,
Iitem
}
from
"
@/common/interface
"
export
const
items
:
Array
<
Iitem
>
=
[
{
id
:
1
,
...
...
@@ -100,17 +100,17 @@ export const indexstats: Array<Iinfo> = [
value
:
45597802
,
},
]
export
const
detailstats
:
Istats
=
[
{
name
:
"
当前票数
"
,
value
:
23460
,
},
{
name
:
"
排名
"
,
value
:
24
,
},
{
name
:
"
距上一名
"
,
value
:
494
,
},
]
export
const
detailstats
:
Array
<
Iinfo
>
=
[
{
name
:
"
当前票数
"
,
value
:
23460
,
},
{
name
:
"
排名
"
,
value
:
24
,
},
{
name
:
"
距上一名
"
,
value
:
494
,
},
]
src/pages.json
浏览文件 @
c81fc278
{
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path"
:
"pages/index/index"
,
"style"
:
{
"navigationBarTitleText"
:
"活动名称"
}
},
{
"path"
:
"pages/desc/desc"
,
"style"
:
{
"navigationBarTitleText"
:
"详情-活动名称"
}
},
{
"path"
:
"pages/rank/rank"
,
"style"
:
{
"navigationBarTitleText"
:
"排名"
}
},
{
"path"
:
"pages/detail/detail"
,
"style"
:
{
"navigationBarTitleText"
:
"我是1号,正在参加活动名称"
}
}
],
"globalStyle"
:
{
"navigationBarTextStyle"
:
"#cfcfcf"
,
"navigationBarTitleText"
:
"投票小程序"
,
"navigationBarBackgroundColor"
:
"#000"
,
"backgroundColor"
:
"#0d134d"
},
"tabBar"
:
{
"color"
:
"#8a8a8a"
,
"selectedColor"
:
"#ffffff"
,
"borderStyle"
:
"black"
,
"backgroundColor"
:
"#283079"
,
"height"
:
"50px"
,
"fontSize"
:
"10px"
,
"iconWidth"
:
"24px"
,
"spacing"
:
"3px"
,
"list"
:
[
{
"pagePath"
:
"pages/index/index"
,
"iconPath"
:
"static/home.png"
,
"selectedIconPath"
:
"static/home_HL.png"
,
"text"
:
"投票"
},
{
"pagePath"
:
"pages/desc/desc"
,
"iconPath"
:
"static/desc.png"
,
"selectedIconPath"
:
"static/desc_HL.png"
,
"text"
:
"详情"
},
{
"pagePath"
:
"pages/rank/rank"
,
"iconPath"
:
"static/rank.png"
,
"selectedIconPath"
:
"static/rank_HL.png"
,
"text"
:
"排名"
}
]
}
}
\ No newline at end of file
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path"
:
"pages/home/home"
,
"style"
:
{
"navigationBarTitleText"
:
"微投票"
}
},
{
"path"
:
"pages/index/index"
,
"style"
:
{
"navigationBarTitleText"
:
"活动名称"
}
},
{
"path"
:
"pages/desc/desc"
,
"style"
:
{
"navigationBarTitleText"
:
"详情-活动名称"
}
},
{
"path"
:
"pages/rank/rank"
,
"style"
:
{
"navigationBarTitleText"
:
"排名"
}
},
{
"path"
:
"pages/detail/detail"
,
"style"
:
{
"navigationBarTitleText"
:
"我是1号,正在参加活动名称"
}
}
],
"globalStyle"
:
{
"navigationBarTextStyle"
:
"#cfcfcf"
,
"navigationBarTitleText"
:
"投票小程序"
,
"navigationBarBackgroundColor"
:
"#000"
,
"backgroundColor"
:
"#0d134d"
},
"tabBar"
:
{
"color"
:
"#8a8a8a"
,
"selectedColor"
:
"#ffffff"
,
"borderStyle"
:
"black"
,
"backgroundColor"
:
"#283079"
,
"height"
:
"50px"
,
"fontSize"
:
"10px"
,
"iconWidth"
:
"24px"
,
"spacing"
:
"3px"
,
"list"
:
[
{
"pagePath"
:
"pages/index/index"
,
"iconPath"
:
"static/home.png"
,
"selectedIconPath"
:
"static/home_HL.png"
,
"text"
:
"投票"
},
{
"pagePath"
:
"pages/desc/desc"
,
"iconPath"
:
"static/desc.png"
,
"selectedIconPath"
:
"static/desc_HL.png"
,
"text"
:
"详情"
},
{
"pagePath"
:
"pages/rank/rank"
,
"iconPath"
:
"static/rank.png"
,
"selectedIconPath"
:
"static/rank_HL.png"
,
"text"
:
"排名"
}
]
}
}
src/pages/home/home.vue
0 → 100644
浏览文件 @
c81fc278
<
template
>
<view>
小程序首页
</view>
</
template
>
<
script
>
export
default
{}
</
script
>
<
style
></
style
>
src/pages/index/index.vue
浏览文件 @
c81fc278
...
...
@@ -49,9 +49,19 @@ export default Vue.extend({
}
},
async
onLoad
()
{
console
.
log
(
"
Vue
"
,
Vue
)
/**
* 1. 下载活动信息
* 2. 下载选手信息
* TODO: 思考做成一个接口
*/
this
.
getActivate
()
this
.
$_request
({
url
:
"
/api/user
"
})
.
then
((
res
:
object
)
=>
console
.
log
(
res
))
.
catch
((
err
:
object
)
=>
console
.
error
(
err
))
},
methods
:
{
getActivate
()
{},
},
methods
:
{},
components
:
{
banner
,
title
,
...
...
src/servise/check-valid.ts
0 → 100644
浏览文件 @
c81fc278
export
function
isValid
(
params
:
type
)
{}
src/sfc.d.ts
浏览文件 @
c81fc278
declare
module
"
*.vue
"
{
import
Vue
from
'
vue
'
export
default
Vue
}
\ No newline at end of file
import
Vue
from
"
vue
"
export
default
Vue
}
src/vue.d.ts
0 → 100644
浏览文件 @
c81fc278
import
Vue
from
"
vue
"
declare
module
"
vue/types/vue
"
{
interface
Vue
{
$_request
:
Promise
<
object
>
}
}
投票小程序 .md
浏览文件 @
c81fc278
...
...
@@ -28,13 +28,13 @@ export interface Iitem {
```
typescript
export
interface
Iactivate
{
id
:
number
// 活动编号
name
:
string
//活动名称
bannerImg
:
Array
<
string
>
//广告图片
startTime
:
string
//开始时间
endTime
:
string
//结束时间
rule
:
Irule
// 活动规则
desc
:
string
//活动描述
id
:
number
// 活动编号
name
:
string
//活动名称
bannerImg
:
Array
<
string
>
//广告图片
startTime
:
string
//开始时间
endTime
:
string
//结束时间
rule
:
Irule
// 活动规则
desc
:
string
//活动描述
}
```
...
...
@@ -46,18 +46,13 @@ export interface Iinfo {
name
:
string
// 属性名称
value
:
number
// 属性值
}
// 统计项
export
interface
Istats
{
info
:
Array
<
Iinfo
>
// 属性
}
```
投票规则:
```
typescript
export
interface
Irule
{
day
:
number
// 一天可以投票最大次数
item
:
number
//一次可以投几人
day
:
number
// 一天可以投票最大次数
item
:
number
//一次可以投几人
}
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录