index-nav.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class="pages">
  3. <swiper style="resistanceRatio : 0" class="swiper" :style="'height: '+currentPageHeight+'upx;'"
  4. :duration="duration" :interval="interval" :autoplay="autoplay" @change="categoryChange">
  5. <swiper-item v-for="(page, pageindex) in categoryList" :key="pageindex">
  6. <view class="category-list">
  7. <view class="icon" v-for="category in page" :key="category.cat_id" @tap="tapEvent(category)"
  8. v-if="category.featureHideHandling">
  9. <image :src="category.img" :style="{width:category.width,height:category.height}" mode="">
  10. </image>
  11. <view class="category-title">{{ category.title }}</view>
  12. </view>
  13. </view>
  14. </swiper-item>
  15. </swiper>
  16. <view class="dots">
  17. <view v-for="(page, pageindex) in categoryList" :key="pageindex"
  18. :class="{ active: pageindex == currentPageindex }"></view>
  19. </view>
  20. <u-toast :type="type" ref="uToast"></u-toast>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. mapState,
  26. mapMutations
  27. } from "vuex";
  28. import {
  29. pathToBase64,
  30. base64ToPath
  31. } from '@/common/image-tools-base64.js';
  32. import bankBin from "@/common/bankcardinfo.js"
  33. export default {
  34. props: {
  35. resdata: Array,
  36. row: {
  37. type: Number,
  38. default: 2
  39. },
  40. autoplay: { //自动轮播
  41. type: Boolean,
  42. default: false,
  43. },
  44. duration: { //切换时长
  45. type: Number,
  46. default: 500
  47. },
  48. interval: { //间隔时长
  49. type: Number,
  50. default: 5000
  51. }
  52. },
  53. data() {
  54. return {
  55. xuelishow: false,
  56. border: false,
  57. form: {
  58. name: "",
  59. identifyNumber: "",
  60. identifyValidDate: "",
  61. address: "",
  62. name4: "",
  63. name5: "",
  64. xueli: "",
  65. },
  66. labelPosition: 'left',
  67. errorType: ['message'],
  68. type: 'warning',
  69. title: '请先实名认证',
  70. icon: true,
  71. position: 'center',
  72. url: '',
  73. show1: false,
  74. content: '慈母手中线,游子身上衣',
  75. contentSlot: true,
  76. showTitle: false,
  77. asyncClose: false,
  78. currentPageindex: 0,
  79. currentPageHeight: "310upx",
  80. getApplicationStatus: "",
  81. }
  82. },
  83. computed: {
  84. categoryList() {
  85. this.currentPageHeight = 120 * this.row + 10;
  86. let totalPages = Math.floor(this.resdata.length / (this.row * 5));
  87. if (this.resdata.length % (this.row * 5) != 0) {
  88. totalPages += 1;
  89. }
  90. let list = [];
  91. for (let i = 0; i < totalPages; i++) {
  92. let item = [];
  93. item = this.resdata.slice(this.row * 5 * i, this.row * 5 * (i + 1));
  94. list.push(item)
  95. }
  96. return list;
  97. },
  98. ...mapState(['userInfo'])
  99. },
  100. onReady() {
  101. this.$refs.uForm.setRules(this.rules);
  102. },
  103. methods: {
  104. // 验证银行卡
  105. async validateBankCard() {
  106. var that = this;
  107. that.bankname = "";
  108. await bankBin.getBankBin(this.form.name4)
  109. .then((data) => {
  110. that.form.name5 = data.bankName;
  111. return true;
  112. })
  113. .catch((err) => {
  114. return uni.showToast({
  115. title: err.split(":")[1],
  116. icon: "none"
  117. });
  118. })
  119. },
  120. async chooseImage() {
  121. var _this = this;
  122. uni.chooseImage({
  123. count: 1,
  124. sizeType: "compressed",
  125. success(res) {
  126. pathToBase64(res.tempFilePaths[0])
  127. .then(async base64 => {
  128. var paramImg = {
  129. "image": base64, //图片base64
  130. "imgType": "1" //1身份证 2行驶证
  131. }
  132. let res2 = await _this.$http.post('/api/huanong/imgAI', paramImg);
  133. var data = res2.data.customerInfo;
  134. data.identifyValidDate = data.identifyValidDate.substr(0, 4) + '-' +
  135. data.identifyValidDate.substr(4, 2) + "-" + data.identifyValidDate
  136. .substr(6, 2)
  137. _this.form.name = data.name;
  138. _this.form.identifyNumber = data.identifyNumber;
  139. _this.form.identifyValidDate = data.identifyValidDate;
  140. })
  141. }
  142. });
  143. },
  144. show() {
  145. this.$refs.uToast.show({
  146. title: this.title,
  147. position: this.position,
  148. type: this.type,
  149. icon: this.icon,
  150. duration: 1000,
  151. });
  152. },
  153. event(item) {},
  154. //分类跳转
  155. async tapEvent(e) {
  156. console.log(e);
  157. this.form.name = "";
  158. this.form.identifyNumber = "";
  159. this.form.identifyValidDate = "";
  160. this.form.address = "";
  161. this.form.name4 = "";
  162. this.form.name5 = "";
  163. this.form.xueli = "";
  164. if (this.userInfo.sysUser.status == '0' && this.userInfo.sysUser.managementSource == '2') {
  165. if (this.userInfo.sysUser.factorVerify == '2') {
  166. uni.navigateTo({
  167. url: "/pages/user/authInfo"
  168. })
  169. } else {
  170. this.$emit('authModal', true);
  171. }
  172. } else if (this.userInfo.sysUser.status == '8' || this.userInfo.sysUser.status == '3') {
  173. uni.navigateTo({
  174. url: "/pages/user/practitionerInfo"
  175. })
  176. } else if (this.userInfo.sysUser.status == '2') {
  177. uni.navigateTo({
  178. url: "/pages/user/authResult1"
  179. })
  180. } else if (this.userInfo.sysUser.status == '1') {
  181. if (!e.src || e.src == '#' || e.src == '') {
  182. uni.showToast({
  183. icon: "none",
  184. title: '正在开发中...',
  185. duration: 1500
  186. })
  187. } else {
  188. this.navigate({
  189. url: e.src
  190. }, "navigateTo", true)
  191. }
  192. }
  193. },
  194. xueliConfirm(e) {
  195. this.form.xueli = e[0].value;
  196. },
  197. //更新分类指示器
  198. categoryChange(event) {
  199. this.currentPageindex = event.detail.current;
  200. }
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. .pages {
  206. background: #FFFFFF;
  207. box-shadow: 0px 2px 5px 0px rgba(95, 107, 132, 0.05);
  208. border-radius: 6px;
  209. padding: 10px 10px;
  210. border-bottom: 1px solid #E2E6EC;
  211. }
  212. .dots {
  213. display: flex;
  214. justify-content: center;
  215. height: 15upx;
  216. width: 100%;
  217. }
  218. .dots>view {
  219. width: 30upx;
  220. height: 5upx;
  221. background-color: #E5E5E5;
  222. }
  223. .dots>view.active {
  224. border-radius: 2px;
  225. background-color: #0052FF;
  226. }
  227. .swiper {
  228. padding-bottom: 8upx;
  229. }
  230. .category-list {
  231. width: 100%;
  232. height: auto;
  233. display: flex;
  234. justify-content: flex-start;
  235. flex-flow: wrap;
  236. }
  237. .category-title {
  238. font-size: 25upx;
  239. }
  240. .icon {
  241. margin-top: 5upx;
  242. margin-bottom: 5upx;
  243. width: 20%;
  244. display: flex;
  245. flex-flow: wrap;
  246. justify-content: center;
  247. font-size: 25upx;
  248. color: #666;
  249. }
  250. .icon image {
  251. margin: 5upx;
  252. width: 65%;
  253. }
  254. .icon>view {
  255. width: 100%;
  256. display: flex;
  257. justify-content: center;
  258. }
  259. </style>