EarnPoints.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <div class="right-wrap">
  3. <div class="myTabs" style="background: #fff;min-height: 500px;">
  4. <el-tabs style="padding: 0 20px 40px 20px;" v-model="activeName" @tab-click="handleClick">
  5. <el-tab-pane label="证书列表" name="first">
  6. <el-button size="small" type="primary" @click="dialogVisible = true">上传证书</el-button>
  7. <el-table size="small" :data="dataList" border style="margin-top: 20px;width: 100%">
  8. <el-table-column align="center" type="index" width="50" label="序号"></el-table-column>
  9. <el-table-column min-width="100" align="center" prop="typeName" label="类型"></el-table-column>
  10. <el-table-column align="center" prop="categoryName" min-width="100" label="名称"></el-table-column>
  11. <el-table-column align="center" label="证书">
  12. <template slot-scope="props">
  13. <div v-for="(item, index) in props.row.files" :key="index">
  14. <a style="color: #1e80ff;" target="_blank" :href="item.url">{{ item.oldName }}</a>
  15. </div>
  16. </template>
  17. </el-table-column>
  18. <el-table-column align="center" prop="integral" min-width="100" label="积分"></el-table-column>
  19. <el-table-column min-width="60" align="center" prop="statusName" label="状态"></el-table-column>
  20. <el-table-column min-width="150" align="center" prop="createTime" label="上传时间"></el-table-column>
  21. </el-table>
  22. <!-- 分页 -->
  23. <div class="myPage">
  24. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  25. :current-page="currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="10"
  26. layout="total, sizes, prev, pager, next, jumper" :total="total">
  27. </el-pagination>
  28. </div>
  29. </el-tab-pane>
  30. <el-tab-pane label="积分获取规则" name="second">
  31. <el-empty v-if="!integralRules" :image-size="200"></el-empty>
  32. <div v-else v-html="integralRules"></div>
  33. </el-tab-pane>
  34. </el-tabs>
  35. </div>
  36. <el-dialog title="上传证书" :visible.sync="dialogVisible" width="40%">
  37. <el-form :rules="rules" ref="dataForm" :model="dataForm" label-width="80px">
  38. <el-form-item label="类别:" prop="type">
  39. <el-cascader clearable size="small" style="width: 95%;" v-model="dataForm.type" :options="typeList"
  40. :props="{ value: 'id',label: 'typeName',children: 'children'}"
  41. @change="handleChange"></el-cascader>
  42. </el-form-item>
  43. <el-form-item label="证书:" prop="fileIds">
  44. <el-upload :action="fileUrl" :file-list="dataForm.files" :on-success="handleAvatarSuccess"
  45. :before-upload="beforeUploadFile" :before-remove="beforeRemove" :on-remove="handleRemove">
  46. <el-button size="small" type="primary">点击上传</el-button>
  47. </el-upload>
  48. </el-form-item>
  49. </el-form>
  50. <span slot="footer" class="dialog-footer">
  51. <el-button size="small" type="primary" @click="submitForm">确 定</el-button>
  52. </span>
  53. </el-dialog>
  54. </div>
  55. </template>
  56. <script scoped>
  57. import { certificatePage, certificateUpload, notice, certificatType } from "@/api/allApi";
  58. import { handleTree } from '@/utils/index'
  59. export default {
  60. data() {
  61. return {
  62. integralRules: '',
  63. typeList: [],
  64. activeName: 'first',
  65. fileUrl: this.baseUrl,
  66. dataList: [],
  67. dialogVisible: false,
  68. rules: {
  69. type: [{ required: true, message: "请选择证书类别", trigger: "blur" }],
  70. fileIds: [{ required: true, message: "请上传附件", trigger: "blur" }],
  71. },
  72. total: 0,
  73. listQuery: {
  74. page: 1,
  75. limit: 10,
  76. },
  77. dataForm: {
  78. type: [],
  79. fileIds: '',
  80. }
  81. };
  82. },
  83. created() {
  84. this.getTypeList();
  85. this.getDataList();
  86. this.getIntegralNotice();
  87. },
  88. methods: {
  89. getTypeList(){
  90. certificatType().then(response => {
  91. this.typeList = handleTree(response.data.data);
  92. console.log(this.typeList);
  93. })
  94. },
  95. handleClick(tab, event) {
  96. console.log(tab.name, event);
  97. },
  98. getIntegralNotice() {
  99. notice({ noticeType: 'certificatNotice' }).then(response => {
  100. this.integralRules = response.data.data.content;
  101. })
  102. },
  103. handleChange(value) {
  104. console.log(value);
  105. },
  106. beforeRemove(file, fileList) {
  107. return this.$confirm(`确定移除 ${file.name}?`);
  108. },
  109. handleRemove(file, fileList) {
  110. console.log(file, fileList);
  111. let fileIds = [];
  112. for (let i in fileList) {
  113. let id = fileList[i].response.data.id;
  114. fileIds.push(id);
  115. }
  116. this.dataForm.fileIds = fileIds.join(",");
  117. },
  118. beforeUploadFile(file) {
  119. console.log(file);
  120. const size = file.size / 1024 / 1024;
  121. console.log(size);
  122. // if(size > 10 ){
  123. // this.$message.error("文件大小不能超过10MB!");
  124. // return false;
  125. // }
  126. },
  127. handleAvatarSuccess(res, file, fileList) {
  128. console.log(file, fileList);
  129. console.log("------", "==========");
  130. console.log("res = ", res);
  131. let fileIds = [];
  132. for (let i in fileList) {
  133. let response = fileList[i].response;
  134. if (response.errno && response.errno != "0") {
  135. this.$message.error("该文件上传失败,已被移除,请重新上传!");
  136. // 上传失败移除该 file 对象
  137. fileList.splice(i, 1);
  138. } else {
  139. let id = fileList[i].response.data.id;
  140. fileIds.push(id);
  141. }
  142. }
  143. this.dataForm.fileIds = fileIds.join(",");
  144. },
  145. resetForm() {
  146. this.$refs['dataForm'].resetFields();
  147. },
  148. submitForm() {
  149. this.$refs['dataForm'].validate((valid) => {
  150. if (valid) {
  151. certificateUpload(this.dataForm)
  152. .then((response) => {
  153. this.dialogVisible = false;
  154. this.$notify({
  155. title: "成功",
  156. message: "证书上传成功",
  157. type: "success",
  158. duration: 2000,
  159. });
  160. this.getDataList();
  161. })
  162. .catch(() => { });
  163. } else {
  164. return false;
  165. }
  166. });
  167. },
  168. getDataList() {
  169. certificatePage(this.listQuery).then(response => {
  170. this.dataList = response.data.data.items;
  171. this.total = response.data.data.total;
  172. })
  173. },
  174. handleSizeChange(val) {
  175. this.listQuery.limit = val
  176. this.getDataList()
  177. },
  178. handleCurrentChange(val) {
  179. this.listQuery.page = val
  180. this.getDataList()
  181. },
  182. },
  183. };
  184. </script>
  185. <style scoped>
  186. .right-wrap {
  187. width: 100%;
  188. }
  189. .myPage {
  190. margin-top: 30px;
  191. display: flex;
  192. justify-content: center;
  193. align-items: center;
  194. }
  195. .gainList_container {
  196. min-height: 560px;
  197. }
  198. .gainList_container .gains_wrapper {
  199. position: relative;
  200. box-sizing: border-box;
  201. padding-top: 20px;
  202. padding-left: 20px;
  203. }
  204. .gainList_container .gains_wrapper .list {
  205. display: flex;
  206. flex-wrap: wrap;
  207. margin: -20px 0 0 -20px;
  208. }
  209. .item.isVirtual {
  210. background: #f7f8fa;
  211. border: 1px solid #e5e6eb;
  212. }
  213. .item {
  214. display: flex;
  215. align-items: center;
  216. flex: 0 1 auto;
  217. width: calc(50% - 30px);
  218. min-width: 410px;
  219. height: 116px;
  220. padding-right: 6px;
  221. background: #fff;
  222. border: 1px solid #e5e6eb;
  223. box-sizing: border-box;
  224. border-radius: 4px;
  225. margin-right: 20px;
  226. margin-top: 20px;
  227. }
  228. .item .img-wapper {
  229. width: 114px;
  230. height: 114px;
  231. margin-right: 16px;
  232. background: #f7f8fa;
  233. display: flex;
  234. align-items: center;
  235. justify-content: center;
  236. }
  237. .item .img-wapper .item-icon {
  238. max-width: 72px;
  239. max-height: 72px;
  240. }
  241. .item .main {
  242. flex: auto;
  243. }
  244. .item .date,
  245. .item .goods_name {
  246. overflow: hidden;
  247. text-overflow: ellipsis;
  248. }
  249. .item .goods_name {
  250. display: -webkit-box;
  251. -webkit-box-orient: vertical;
  252. -webkit-line-clamp: 1;
  253. font-size: 16px;
  254. line-height: 24px;
  255. color: #252933;
  256. padding-bottom: 4px;
  257. }
  258. .item p {
  259. margin: 0;
  260. }
  261. .item .date {
  262. white-space: nowrap;
  263. font-size: 14px;
  264. line-height: 22px;
  265. color: #8a919f;
  266. }
  267. .item .buttons {
  268. margin-top: 8px;
  269. margin-left: -8px;
  270. display: flex;
  271. align-items: center;
  272. }
  273. .item .button-item.actived {
  274. background: #f2f3f5;
  275. color: #8a919f;
  276. }
  277. .item .button-item {
  278. cursor: pointer;
  279. display: flex;
  280. align-items: center;
  281. font-size: 13px;
  282. padding: 0 8px;
  283. height: 26px;
  284. margin-left: 8px;
  285. font-weight: 500;
  286. background: #f2f3f5;
  287. border-radius: 50px;
  288. color: #8a919f;
  289. white-space: nowrap;
  290. border: none;
  291. }
  292. .item .arrow {
  293. width: 12px;
  294. height: 12px;
  295. margin-left: 2px;
  296. transform: rotate(-90deg);
  297. }
  298. svg:not(:root) {
  299. overflow: hidden;
  300. }
  301. .item .button-item svg path {
  302. fill: currentColor;
  303. }
  304. .status {
  305. margin-right: 30px;
  306. font-size: 13px;
  307. }
  308. .status.bottom {
  309. margin-top: 55px;
  310. }
  311. .status .use-btn {
  312. color: #1e80ff;
  313. }
  314. .timeline-container {
  315. margin: 0 auto;
  316. }
  317. .timeline-entry-list {
  318. margin-right: 17.5rem;
  319. border-radius: 2px;
  320. width: 720px;
  321. position: relative;
  322. }
  323. .entry-list-container {
  324. background-color: #fff;
  325. border-radius: 4px;
  326. min-height: 500px;
  327. }
  328. .entry-list-container .tab-header {
  329. display: flex;
  330. align-items: center;
  331. justify-content: space-between;
  332. padding: 20px 20px 16px;
  333. border-bottom: 1px solid #e5e6eb;
  334. overflow: hidden;
  335. }
  336. .tab-header .tab-title {
  337. white-space: nowrap;
  338. font-size: 18px;
  339. font-weight: 600;
  340. }
  341. .content-body {
  342. padding: 10px 20px 16px;
  343. }
  344. .serie {
  345. margin: 0 0 40px;
  346. }
  347. .serie .serie-title {
  348. height: 32px;
  349. width: 100%;
  350. display: flex;
  351. justify-content: center;
  352. align-items: center;
  353. text-align: center;
  354. margin-bottom: 20px;
  355. }
  356. .serie .serie-title .title {
  357. font-style: normal;
  358. font-weight: 600;
  359. font-size: 20px;
  360. color: #1d2129;
  361. margin: 0 16px;
  362. }
  363. .serie .serie-title .series-left,
  364. .serie .serie-title .series-right {
  365. width: 16px;
  366. height: 2px;
  367. }
  368. img {
  369. border-style: none;
  370. }
  371. .serie .badge-icon-list {
  372. display: grid;
  373. justify-content: space-between;
  374. grid-template-columns: repeat(auto-fill, 150px);
  375. grid-gap: 10px 20px;
  376. flex-wrap: wrap;
  377. }
  378. .serie .badge-icon-list .badge-icon-item {
  379. -webkit-tap-highlight-color: transparent;
  380. cursor: pointer;
  381. width: 150px;
  382. font-style: normal;
  383. font-weight: 400;
  384. display: flex;
  385. flex-direction: column;
  386. justify-content: center;
  387. align-items: center;
  388. }
  389. .serie .badge-icon-list .badge-icon-item .badge-item-icon {
  390. width: 65px;
  391. height: 65px;
  392. }
  393. .serie .badge-icon-list .badge-icon-item .badge-item-icon .not-obtain {
  394. filter: grayscale(100%);
  395. }
  396. .serie .badge-icon-list .badge-icon-item .badge-item-icon img {
  397. width: 100%;
  398. height: 100%;
  399. }
  400. .serie .badge-icon-list .badge-icon-item .badge-desc {
  401. /* margin-top: -10px; */
  402. text-align: center;
  403. color: #1d2129;
  404. font-size: 16px;
  405. line-height: 28px;
  406. }
  407. .serie .badge-icon-list .badge-icon-item .obtain-date {
  408. font-size: 14px;
  409. text-align: center;
  410. color: #86909c;
  411. height: 24px;
  412. line-height: 24px;
  413. }
  414. </style>