table.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="m_right">
  3. <img src="../../../assets/home/topImg.jpg" class="s_logo" mode=""></img>
  4. <view class="m_right_container">
  5. <table style="width: 100%;border: 1px solid #DDDDDD;border-collapse: collapse">
  6. <thead class="m-table-hander">
  7. <tr>
  8. <th>项目</th>
  9. <th>名称</th>
  10. <th>类型</th>
  11. <th>创建人</th>
  12. <th>查看</th>
  13. <th>是否为公共</th>
  14. </tr>
  15. </thead>
  16. <tbody>
  17. <tr v-for="(item,index) in tabledata" :key="index">
  18. <th>{{'项目'+(index+1)}}</th>
  19. <th>{{item.ProjectName}}</th>
  20. <th>{{item.Type}}</th>
  21. <th>{{item.CreateUserName}}</th>
  22. <th style="position: relative;"><button type="default" @click="find(item,index)" size="mini" class="m_delete">查看</button></th>
  23. <th>
  24. <checkbox-group>
  25. <label>
  26. <checkbox :checked="Boolean(item.IsPublic)" @click="onClickCheck"/>
  27. </label>
  28. </checkbox-group>
  29. </th>
  30. </tr>
  31. </tbody>
  32. </table>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. name: "home_table",
  39. data() {
  40. return {
  41. index: 1,
  42. tabledata: []
  43. }
  44. },
  45. components: {
  46. // locationtemp
  47. },
  48. mounted() {
  49. // this.getList();
  50. },
  51. methods: {
  52. paging(obj) {
  53. this.index = obj;
  54. },
  55. getList() {
  56. uni.request({
  57. url: mydata_api + "/project/getprojects",
  58. data: {
  59. "UserID": mydata_userInfo.UserID
  60. },
  61. method: "POST",
  62. dataType: "json",
  63. success: res => {
  64. this.tabledata = res.data.Projects
  65. console.log('tabledata=',this.tabledata)
  66. // let aData = {
  67. // "CreateTime": "2020-01-01 00:00:00",
  68. // "CreateUserID": "59458299-3b84-4895-98f6-b990cdaedc72",
  69. // "CreateUserName": "朱峰",
  70. // "Describe": '“实验以振兴国产科技电影”和“实现中国航天强国梦”的宏大蓝图为背景,以我国首次登陆火星计划为现实脚本,运用现场实时特效技术手段,对火星地面、外太空等场景进行“经典学习”和“实践创兴”并通过持续开发和学生在实验过程中的资源上传不断扩大现场创作的实景和虚拟资产库,使学生再学习过程中,即是资源学习者和方案讨论者,也是资源建设者',
  71. // "Id": 30,
  72. // "ProjectName": "《火星计划》",
  73. // "ProjectReviewImage": "../../../assets/studentAndTeacher/table/marsPlanReviewImage.png",
  74. // "ReviewImageOss": "../../../assets/studentAndTeacher/table/marsPlanMainCover.png",
  75. // "Type": "科幻",
  76. // }
  77. // this.tabledata.unshift(aData);
  78. // console.log("table页面请求所有项目",res);
  79. this.$forceUpdate();//强制刷新页面
  80. }
  81. })
  82. },
  83. //查看项目
  84. find(obj,index){
  85. this.$emit('viewProject',obj,index);
  86. },
  87. onClickCheck(e){
  88. if(this.bPublic==true){
  89. this.bPublic = false;
  90. } else {
  91. this.bPublic = true;
  92. }
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. .m_right {
  99. width: 100%;
  100. height: px2vh(960);
  101. margin-top: 5rpx;
  102. // padding: 0 150rpx;
  103. background-color: #fff;
  104. box-shadow: 3px 0px 6px 0px rgba(0, 0, 0, 0.1);
  105. .m_right_container {
  106. padding: 150rpx;
  107. }
  108. .s_logo {
  109. width: 100%;
  110. // height: 800rpx;
  111. }
  112. .m_right_hander {
  113. text-align: right;
  114. height: 250rpx;
  115. position: relative;
  116. .m_btn_red {
  117. position: absolute;
  118. height: 80rpx;
  119. line-height: 80rpx;
  120. padding: 0 40rpx;
  121. right: 0;
  122. top: 50%;
  123. transform: translateY(-50%);
  124. background: #EA252C;
  125. color: #fff;
  126. }
  127. }
  128. }
  129. tbody tr {
  130. border-top: 2rpx solid #DDDDDD !important;
  131. }
  132. tbody tr th:first-child {
  133. position: relative;
  134. }
  135. tbody tr th {
  136. font-weight: 400 !important;
  137. height: 140rpx;
  138. line-height: 140rpx;
  139. }
  140. tbody tr:hover {
  141. // color: #fff;
  142. background: #FDEBEC;
  143. // opacity: 0.08;
  144. }
  145. .m-table-hander {
  146. background-color: #FFF8F7;
  147. height: 140rpx;
  148. line-height: 140rpx;
  149. font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
  150. font-weight: bold;
  151. }
  152. .m_edit {
  153. position: absolute;
  154. top: 50%;
  155. left: 50%;
  156. transform: translate(-50%, -50%);
  157. background: rgb(67, 127, 250);
  158. color: rgb(255, 255, 255);
  159. min-width: 130rpx;
  160. }
  161. .m_delete {
  162. position: absolute;
  163. top: 50%;
  164. left: 50%;
  165. min-width: 130rpx;
  166. transform: translate(-50%, -50%);
  167. background: rgb(234, 37, 44);
  168. color: rgb(255, 255, 255);
  169. z-index: 3;
  170. }
  171. .m_right_footer {
  172. margin-top: 80rpx;
  173. }
  174. .m_logoimg {
  175. width: 80rpx;
  176. height: 80rpx;
  177. position: absolute;
  178. top: 50%;
  179. left: 50%;
  180. transform: translate(-50%, -50%);
  181. }
  182. .m_paging {
  183. text-align: right;
  184. .m_paging_item {
  185. padding: 10rpx 18rpx;
  186. border: 1rpx solid #DDDDDD;
  187. border-radius: 8rpx;
  188. margin-right: 10rpx;
  189. }
  190. .p_act {
  191. background: #EA252C;
  192. color: #fff;
  193. border: inherit;
  194. }
  195. }
  196. .m_paging_item:hover {
  197. background: #EA252C;
  198. color: #fff;
  199. border: inherit;
  200. }
  201. .m_act1 {
  202. color: #FF0019;
  203. }
  204. </style>