提交 c81fc278 编写于 作者: S steven

fix(*): update style , modify ts type, add home

上级 2d52240e
......@@ -18,6 +18,9 @@ export default Vue.extend({
onHide() {
console.log("App Hide")
},
globalData: {
baseurl: "huadongio.com",
},
})
</script>
......
/*
* @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 //活动描述
}
......@@ -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}`
......
......@@ -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,
},
......
......@@ -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()
......@@ -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,
},
]
{
"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": "排名"
}
]
}
}
<template>
<view>小程序首页</view>
</template>
<script>
export default {}
</script>
<style></style>
......@@ -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,
......
export function isValid(params: type) {}
declare module "*.vue" {
import Vue from 'vue'
export default Vue
}
\ No newline at end of file
import Vue from "vue"
export default Vue
}
import Vue from "vue"
declare module "vue/types/vue" {
interface Vue {
$_request: Promise<object>
}
}
......@@ -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.
先完成此消息的编辑!
想要评论请 注册