ソースを参照

抽奖以及抽奖结果代码提交

user5 2 年 前
コミット
61eb80491a

+ 43 - 0
api/test/luckyDraw/LuckyDrawService.js

@@ -0,0 +1,43 @@
+import request from "../../../common/request"
+
+export default class LuckyDrawService {
+  save (inputForm) {
+    return request({
+      url: '/test/mobile/testMobile/save',
+      method: 'post',
+      data: inputForm
+    })
+  }
+
+  delete (ids) {
+    return request({
+      url: '/test/mobile/testMobile/delete',
+      method: 'delete',
+      params: {ids: ids}
+    })
+  }
+
+  queryById (id) {
+    return request({
+      url: '/test/mobile/testMobile/queryById',
+      method: 'get',
+      params: {id: id}
+    })
+  }
+
+  list (params) {
+    return request({
+      url: '/luckyDraw/info/pjList',
+      method: 'get',
+      params: params
+    })
+  }
+  
+  LuckyDraw (id,number,awardId) {
+    return request({
+      url: '/luckyDraw/info/luckyDraw',
+      method: 'post',
+      params: {id: id,number: number,awardId: awardId}
+    })
+  }
+}

+ 9 - 2
manifest.json

@@ -57,10 +57,10 @@
         }
     },
     "h5" : {
-        "title" : "jeeplus",
+        "title" : "h5",
         "domain" : "demo1.jeeplus.org",
         "devServer" : {
-            "port" : 8000,
+            "port" : 3000,
             "disableHostCheck" : true,
             "proxy" : {
                 "/api" : {
@@ -96,6 +96,13 @@
             "treeShaking" : {
                 "enable" : true
             }
+        },
+        "sdkConfigs" : {
+            "maps" : {
+                "qqmap" : {
+                    "key" : ""
+                }
+            }
         }
     },
     "vueVersion" : "2"

+ 8 - 0
pages.json

@@ -250,6 +250,14 @@
 		{
 		    "path" : "pages/test/mobile/TestMobileList",
 		    "style" : {}
+		},
+		{
+		    "path" : "pages/test/luckyDraw/LuckyDrawList",
+		    "style" : {}
+		},
+		{
+		    "path" : "pages/test/luckyDraw/LuckyDrawShowList",
+		    "style" : {}
 		}
     ],
 	"globalStyle": {

+ 16 - 0
pages/apps/apps.vue

@@ -87,6 +87,22 @@
 						</view>
 					</navigator>
 				</view>
+				<view class="padding-sm">
+					<navigator hover-class="none" url="/pages/test/luckyDraw/LuckyDrawList" >
+						<view class="padding radius text-center shadow-blur bg-white">
+							<text class="lg font-size-35 text-blue cuIcon-safe"></text>
+							<view class="margin-top-sm text-Abc">抽奖</view>
+						</view>
+					</navigator>
+				</view>
+				<view class="padding-sm">
+					<navigator hover-class="none" url="/pages/test/luckyDraw/LuckyDrawShowList" >
+						<view class="padding radius text-center shadow-blur bg-white">
+							<text class="lg font-size-35 text-blue cuIcon-safe"></text>
+							<view class="margin-top-sm text-Abc">中奖详情</view>
+						</view>
+					</navigator>
+				</view>
 
 			</view>
 			<view class="cu-tabbar-height"></view>

+ 157 - 0
pages/test/luckyDraw/LuckyDrawList.vue

@@ -0,0 +1,157 @@
+<template>
+	<view>
+		<cu-custom bgColor="bg-blue" :isBack="true">
+			<block slot="backText">返回</block>
+			<block slot="content"> 抽奖结果</block>
+		</cu-custom>
+		<view>
+			<view class="uni-container">
+				<uni-table ref="table" :loading="loading" stripe  emptyText="暂无更多数据" @selection-change="selectionChange">
+					<uni-tr >
+						<uni-th @filter-change="searchChangeHandle"   field="awardsName" @sort-change="sortChangeHandle"  align="center">奖项名称</uni-th>
+						<uni-th @filter-change="searchChangeHandle"   field="prizeName" @sort-change="sortChangeHandle"  align="center">奖品名称</uni-th>
+						<uni-th @filter-change="searchChangeHandle"   field="number"  @sort-change="sortChangeHandle"  align="center">数量</uni-th>
+						<uni-th style="width: 160px;">操作</uni-th>
+					</uni-tr>
+					<uni-tr v-for="(row, index) in dataList" :key="index">
+						<uni-td align="center" :style="row.showFlag === '2'?'background-color: bisque;':''">
+							<span v-if="row.showFlag === '2'"><b>{{row.awardsName}}</b></span>
+							<span v-if="row.showFlag === '1'"><b>{{row.awardsName}}</b></span>
+							<span v-if="row.showFlag === '0'">{{row.awardsName}}</span>
+						
+						</uni-td>
+						<uni-td align="center" :style="row.showFlag === '2'?'background-color: bisque;':''">
+							<span v-if="row.showFlag === '2'"><b>{{row.prizeName}}</b></span>
+							<span v-if="row.showFlag === '1'"><b>{{row.prizeName}}</b></span>
+							<span v-if="row.showFlag === '0'">{{row.prizeName}}</span>
+						</uni-td>
+						<uni-td align="center" :style="row.showFlag === '2'?'background-color: bisque;':''">
+							<span v-if="row.showFlag === '2'"><b>{{row.number}}</b></span>
+							<span v-if="row.showFlag === '1'"><b>{{row.number}}</b></span>
+							<span v-if="row.showFlag === '0'">{{row.number}}</span>
+						</uni-td>
+						<uni-td align="center" :style="row.showFlag === '2'?'background-color: bisque;':''">
+							<view class="uni-group">
+								<button class="uni-button" size="mini" v-if="row.luckyDrawFlag !== '1'" @click="LuckyDraw(row.eventsId,row.number,row.id)" type="warn">抽奖</button>
+							</view>
+						</uni-td>
+					</uni-tr>
+				</uni-table>
+				<!-- <view class="uni-pagination-box">
+					<uni-pagination show-icon :page-size="tablePage.pageSize" :current="tablePage.currentPage" :total="tablePage.total" @change="currentChangeHandle" />
+				</view> -->
+			</view>
+		
+			<!-- <uni-fab
+				:pattern=" {
+							color: '#7A7E83',
+							backgroundColor: '#fff',
+							selectedColor: '#007AFF',
+							buttonColor: '#007AFF'
+						}"
+				horizontal="right"
+				vertical="bottom"
+				@fabClick="add"
+			></uni-fab> -->
+		</view>
+		</view>
+</template>
+
+<script>
+  import uniFab from '@/components/uni-fab/uni-fab.vue';
+  import TestMobileService from '@/api/test/luckyDraw/LuckyDrawService'
+  export default {
+	onShow(option) {
+		
+	},
+	components:{
+		uniFab
+	},
+    data () {
+      return {
+        searchForm: {},
+        dataList: [], // 数据列表
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        loading: false
+      }
+    },
+    testMobileService: null,
+	onLoad() {
+	  this.testMobileService = new TestMobileService()
+	  this.refreshList()
+	},
+    methods: {
+	  // 新增
+	  add (){
+	  	uni.navigateTo({
+	  	  url: '/pages/test/mobile/TestMobileForm'
+	  	})
+	  },
+	  // 修改
+	  edit (id) {
+	  	uni.navigateTo({
+	  	  url: '/pages/test/mobile/TestMobileForm?id='+id
+	  	})
+	  },
+      // 删除
+	  LuckyDraw (id,number,awardId) {
+	  	uni.showModal({
+	  		title: '提示',
+	  		content: '您确认要对该奖项进行抽奖吗',
+	  		showCancel: true,
+	  		success: (res) => {
+	  			if (res.confirm) {
+	  				this.testMobileService.LuckyDraw(id,number,awardId).then(({data})=>{
+						console.log(data)
+	  					uni.showToast({
+	  						title: data.msg,
+	  						icon:"success"
+	  					})
+	  					this.refreshList()
+	  				})
+	  			}
+	  		}
+	  	});
+	  },
+	  /*获取数据列表 */
+	  refreshList() {
+	    this.loading = true
+	    this.testMobileService.list({
+	  	  'current': this.tablePage.currentPage,
+	  	  'size': this.tablePage.pageSize,
+	  	  'orders': this.tablePage.orders,
+	  	  ...this.searchForm
+	  	}).then(({data}) => {
+	  	  this.dataList = data.records
+	  	  this.tablePage.total = data.total
+	  	  this.loading = false
+	  	})
+	  	
+	  },
+	  // 排序
+	  sortChangeHandle (column) {
+	  	this.tablePage.orders = []
+	  	if (column.order != null) {
+	  	  this.tablePage.orders.push({column: this.$utils.toLine(column.property), asc: column.order === 'ascending'})
+	  	}
+	  	this.refreshList()
+	  },
+	// 检索
+	  searchChangeHandle (column) {
+		this.searchForm[column.property] = column.filter
+		this.refreshList()
+	  },
+	// 分页触发
+	  currentChangeHandle (e) {
+		this.tablePage.currentPage = e.current
+		this.refreshList()
+	  }
+    }
+  }
+</script>
+

+ 151 - 0
pages/test/luckyDraw/LuckyDrawShowList.vue

@@ -0,0 +1,151 @@
+<template>
+	<view>
+		<!-- <cu-custom bgColor="bg-blue" :isBack="true">
+			<block slot="backText">返回</block>
+			<block slot="content"> 测试移动表单</block>
+		</cu-custom> -->
+		<view>
+			<view class="uni-container">
+				<uni-table ref="table" :loading="loading" stripe  emptyText="暂无更多数据" @selection-change="selectionChange">
+					<uni-tr >
+						<uni-th @filter-change="searchChangeHandle"   field="awardsName" @sort-change="sortChangeHandle"  align="center">奖项名称</uni-th>
+						<uni-th @filter-change="searchChangeHandle"   field="prizeName" @sort-change="sortChangeHandle"  align="center">奖品名称</uni-th>
+						<uni-th @filter-change="searchChangeHandle"   field="number"  @sort-change="sortChangeHandle"  align="center">数量</uni-th>
+					</uni-tr>
+					<uni-tr v-for="(row, index) in dataList" :key="index">
+						<uni-td align="center" :style="row.showFlag === '2'?'background-color: bisque;':''">
+							<span v-if="row.showFlag === '2'"><b>{{row.awardsName}}</b></span>
+							<span v-if="row.showFlag === '1'"><b>{{row.awardsName}}</b></span>
+							<span v-if="row.showFlag === '0'">{{row.awardsName}}</span>
+						
+						</uni-td>
+						<uni-td align="center" :style="row.showFlag === '2'?'background-color: bisque;':''">
+							<span v-if="row.showFlag === '2'"><b>{{row.prizeName}}</b></span>
+							<span v-if="row.showFlag === '1'"><b>{{row.prizeName}}</b></span>
+							<span v-if="row.showFlag === '0'">{{row.prizeName}}</span>
+						</uni-td>
+						<uni-td align="center" :style="row.showFlag === '2'?'background-color: bisque;':''">
+							<span v-if="row.showFlag === '2'"><b>{{row.number}}</b></span>
+							<span v-if="row.showFlag === '1'"><b>{{row.number}}</b></span>
+							<span v-if="row.showFlag === '0'">{{row.number}}</span>
+						</uni-td>
+					</uni-tr>
+				</uni-table>
+				<!-- <view class="uni-pagination-box">
+					<uni-pagination show-icon :page-size="tablePage.pageSize" :current="tablePage.currentPage" :total="tablePage.total" @change="currentChangeHandle" />
+				</view> -->
+			</view>
+		
+			<!-- <uni-fab
+				:pattern=" {
+							color: '#7A7E83',
+							backgroundColor: '#fff',
+							selectedColor: '#007AFF',
+							buttonColor: '#007AFF'
+						}"
+				horizontal="right"
+				vertical="bottom"
+				@fabClick="add"
+			></uni-fab> -->
+		</view>
+		</view>
+</template>
+
+<script>
+  import uniFab from '@/components/uni-fab/uni-fab.vue';
+  import TestMobileService from '@/api/test/luckyDraw/LuckyDrawService'
+  export default {
+	onShow(option) {
+		
+	},
+	components:{
+		uniFab
+	},
+    data () {
+      return {
+        searchForm: {},
+        dataList: [], // 数据列表
+        tablePage: {
+          total: 0,
+          currentPage: 1,
+          pageSize: 10,
+          orders: []
+        },
+        loading: false
+      }
+    },
+    testMobileService: null,
+	onLoad() {
+	  this.testMobileService = new TestMobileService()
+	  this.refreshList()
+	},
+    methods: {
+	  // 新增
+	  add (){
+	  	uni.navigateTo({
+	  	  url: '/pages/test/mobile/TestMobileForm'
+	  	})
+	  },
+	  // 修改
+	  edit (id) {
+	  	uni.navigateTo({
+	  	  url: '/pages/test/mobile/TestMobileForm?id='+id
+	  	})
+	  },
+      // 删除
+	  LuckyDraw (id,number,awardId) {
+	  	uni.showModal({
+	  		title: '提示',
+	  		content: '您确认要对该奖项进行抽奖吗',
+	  		showCancel: true,
+	  		success: (res) => {
+	  			if (res.confirm) {
+	  				this.testMobileService.LuckyDraw(id,number,awardId).then(({data})=>{
+						console.log(data)
+	  					uni.showToast({
+	  						title: data.msg,
+	  						icon:"success"
+	  					})
+	  					this.refreshList()
+	  				})
+	  			}
+	  		}
+	  	});
+	  },
+	  /*获取数据列表 */
+	  refreshList() {
+	    this.loading = true
+	    this.testMobileService.list({
+	  	  'current': this.tablePage.currentPage,
+	  	  'size': this.tablePage.pageSize,
+	  	  'orders': this.tablePage.orders,
+	  	  ...this.searchForm
+	  	}).then(({data}) => {
+	  	  this.dataList = data.records
+	  	  this.tablePage.total = data.total
+	  	  this.loading = false
+	  	})
+	  	
+	  },
+	  // 排序
+	  sortChangeHandle (column) {
+	  	this.tablePage.orders = []
+	  	if (column.order != null) {
+	  	  this.tablePage.orders.push({column: this.$utils.toLine(column.property), asc: column.order === 'ascending'})
+	  	}
+	  	this.refreshList()
+	  },
+	// 检索
+	  searchChangeHandle (column) {
+		this.searchForm[column.property] = column.filter
+		this.refreshList()
+	  },
+	// 分页触发
+	  currentChangeHandle (e) {
+		this.tablePage.currentPage = e.current
+		this.refreshList()
+	  }
+    }
+  }
+</script>
+