Giter Site home page Giter Site logo

weixin-xiaochengxu-vote's Introduction

微信小程序DEMO - 投票

本项目目的仅用于微信小程序开发培训,并非真实需求。
项目分为两块:

  • 前端开发,采用微信小程序规范的wxml、wxss、javascript语言开发,源码在app目录
  • 后端开发采用NAMI框架(https://github.com/wodenwang/nami),数据库DDL和逻辑源码在nami目录

效果图



数据库模型

实例共用了三张表,console截图:

建表语句:

/* *****************************************************************************
表名	DEMO_VOTE
表展示名	DEMO_投票主题
主键类型	字段名	展示名	类型	是否必须	长度(总长度,小数精度)	默认值
主键,自动递增	ID	ID	长整数	是	16,0	
非主键	TITLE	标题	大文本	是	0,0	
非主键	CREATE_TIME	创建时间	日期时间	是	0,0	
****************************************************************************** */
CREATE TABLE `DEMO_VOTE` (
  `ID` int(11) NOT NULL auto_increment,
  `TITLE` text,
  `CREATE_TIME` timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`ID`)
);

/* *****************************************************************************
表名	DEMO_VOTE_DETAIL
表展示名	DEMO_投票选项
主键类型	字段名	展示名	类型	是否必须	长度(总长度,小数精度)	默认值
主键,自动递增	ID	ID	长整数	是	16,0	
非主键	VOTE_ID	主题关联	长整数	是	16,0	
非主键	CONTENT	描述	大文本	是	0,0	
非主键	SORT	排序	整数	是	8,0	0
非主键	CREATE_TIME	创建时间	日期时间	是	0,0	
****************************************************************************** */
CREATE TABLE `DEMO_VOTE_DETAIL` (
  `ID` int(11) NOT NULL auto_increment,
  `VOTE_ID` int(11) not null,
  `CONTENT` text ,
  `SORT` int(11) not null default 0,
  `CREATE_TIME` timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`ID`)
);

/* *****************************************************************************
表名	DEMO_VOTE_RESULT
表展示名	DEMO_投票结果数据
主键类型	字段名	展示名	类型	是否必须	长度(总长度,小数精度)	默认值
主键,自动递增	ID	ID	长整数	是	16,0	
非主键	VOTE_ID	投票主题ID	长整数	是	16,0	
非主键	DETAIL_ID	明细ID	长整数	是	16,0	
非主键	OPEN_ID	投票人	字符串/文本	是	100,0	
非主键	CREATE_TIME	投票时间	日期时间	是	0,0	
****************************************************************************** */
CREATE TABLE `DEMO_VOTE_RESULT` (
  `ID` int(11) NOT NULL auto_increment,
  `VOTE_ID` int(11) not null,
  `DETAIL_ID` int(11) not null,
  `OPEN_ID` varchar(100) not null,
  `CREATE_TIME` timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`ID`)
);


/* *****************************************************************************
测试数据
****************************************************************************** */
insert into `DEMO_VOTE` (`TITLE`) values ('您预计微信小程序会在何时正式推出?');
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'十一月',0 from `DEMO_VOTE`;
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'十二月',1 from `DEMO_VOTE`;
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'明年一月',2 from `DEMO_VOTE`;
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'明年二月之后',3 from `DEMO_VOTE`;

insert into `DEMO_VOTE` (`TITLE`) values ('NAMI框架上手的难度如何?');
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'上手很简单',0 from `DEMO_VOTE`;
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'一般不算难',1 from `DEMO_VOTE`;
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'很难',2 from `DEMO_VOTE`;
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'压根不看',3 from `DEMO_VOTE`;

insert into `DEMO_VOTE` (`TITLE`) values ('微信公众平台您最看好的是?');
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'订阅号',0 from `DEMO_VOTE`;
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'服务号',1 from `DEMO_VOTE`;
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'企业号',2 from `DEMO_VOTE`;
insert into `DEMO_VOTE_DETAIL` (VOTE_ID,CONTENT,SORT) select max(ID),'小程序',3 from `DEMO_VOTE`;

更多关于NAMI

联系我们

欢迎关注我的公众号:全栈生姜头

weixin-xiaochengxu-vote's People

Contributors

wodenwang avatar

Stargazers

 avatar 田田MS avatar 爱唱歌的西小球 avatar 一只猜猜猜吃 avatar  avatar  avatar  avatar kking avatar Dean Qin avatar 同和君Hocassian avatar 善恶众相 avatar Leo Chen avatar eli avatar March21Sunny avatar haochuang avatar  avatar  avatar Hardy Simpson avatar  avatar Q14 avatar  avatar Bridge Li avatar 彭建超 avatar  avatar 阿汤哥 avatar LeoLee avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.