rabin 7 years ago
parent
commit
98bb9e0dd3
5 changed files with 10 additions and 4 deletions
  1. 1 1
      model/farm.py
  2. 3 2
      model/farm_work.py
  3. 1 1
      model/origin_batch.py
  4. 3 0
      web/page/origin.py
  5. 2 0
      web/templates/mobile/origin/index.html

+ 1 - 1
model/farm.py

@@ -13,7 +13,7 @@ class Farm(Model):
 	id = Fields(type='int', primaryKey=True, autoIncrement=True, comment='园区ID')
 	name = Fields(type='varchar(200)', comment='园区名')
 	info = Fields(type='text', comment='园区介绍')
-	pic = Fields(type='varchar(255)', comment='园区图片')
+	pic = Fields(type='text', comment='园区图片')
 	location = Fields(type='varchar(200)', comment='园区位置')
 	tel = Fields(type='varchar(50)', comment='联系电话')
 	address = Fields(type='varchar(200)', comment='联系地址')

+ 3 - 2
model/farm_work.py

@@ -16,7 +16,8 @@ class Farm_work(Model):
 	content = Fields(type='varchar(250)', comment='劳作内容')
 	category_id = Fields(type='int', comment='劳作分类id')
 	land_id = Fields(type='uuid', comment='地块id')
-	pic = Fields(type='varchar(255)', comment='图像记录')
+	pic = Fields(type='text', comment='图像记录')
 	workdate = Fields(type='int', comment='劳作时间')
 	state = Fields(type='boolean', default='True', comment='数据存在状态')
-	cdate = Fields(type='int', default='time', comment='创建时间')
+	cdate = Fields(type='int', default='time', comment='创建时间')
+	#ALTER TABLE demeter_farm_work ALTER pic TYPE text;

+ 1 - 1
model/origin_batch.py

@@ -18,6 +18,6 @@ class Origin_batch(Model):
 	land_id = Fields(type='uuid', comment='地块id')
 	gateway_id = Fields(type='uuid', comment='网关id')
 	number = Fields(type='varchar(32)', comment='批号')
-	pic = Fields(type='varchar(255)', comment='图像记录')
+	pic = Fields(type='text', comment='图像记录')
 	state = Fields(type='boolean', default='True', comment='数据存在状态')
 	cdate = Fields(type='int', default='time', comment='创建时间')

+ 3 - 0
web/page/origin.py

@@ -25,6 +25,9 @@ class Origin(object):
 		self.data['info'] = self.service('common').one('origin_batch', id=id)
 		if not self.data['info']:
 			self.redirect('/')
+		if self.data['info']['pic']:
+			pic = self.data['info']['pic'].split(',')
+			self.data['info']['pic'] = pic[0]
 		self.data['farm'] = self.service('common').one('farm', id=self.data['info']['farm_id'])
 		if self.data['info']['csdate'] > self.data['info']['zzdate']:
 			self.data['zhou'] = self.data['info']['csdate'] - self.data['info']['zzdate']

+ 2 - 0
web/templates/mobile/origin/index.html

@@ -8,9 +8,11 @@
 <body>
     <section class="m-wrapper">
         {%include 'menu.html'%}
+        {% if data['info']['pic'] %}
         <section class="banner">
             <img src="{{data['info']['pic']}}" width="100%">
         </section>
+        {% end %}
         <section class="li-1">
             <dl>
                 <dt><i class="ico ico1"></i></dt>