cardHolder.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961
  1. <template>
  2. <view class="content">
  3. <u-navbar title="电子名片" placeholder bgColor="#112253" titleStyle="color:#fff">
  4. <view class="u-nav-slot relative" slot="left">
  5. <u-icon name="bell" size="26" @click="toNotice" color="#fff"></u-icon>
  6. <u-badge :isDot="unread>0?true:false" type="error" class="point"></u-badge>
  7. </view>
  8. </u-navbar>
  9. <view class="content1 flex-row-center">
  10. <view class="search flex flex-between" @click="search">
  11. <view class="left flex">
  12. <uni-icons type="search" size="24" color="#9199af"></uni-icons>
  13. <text class="search-val"> {{searchVal?searchVal:'搜索名片'}}</text>
  14. <uni-icons type="closeempty" size="24" @click.native.stop="delSearchVal"
  15. v-if="searchVal"></uni-icons>
  16. </view>
  17. <view class="right">
  18. <uni-icons type="mic" size="24" @click.native.stop="micOpen" color="#9199af"></uni-icons>
  19. </view>
  20. </view>
  21. <view class="col flex">
  22. <uni-icons type="scan" size="30" @click="scan" color="#fff"></uni-icons>
  23. </view>
  24. </view>
  25. <view class="content2">
  26. <view class="all-type flex" @click="selectType">
  27. <text>{{typeName?typeName:'全部分类'}}</text>
  28. <uni-icons type="bottom" size="18" color="#fff"></uni-icons>
  29. </view>
  30. </view>
  31. <view class="content3">
  32. <mescroll-body v-if='cardHolderList' :up="upOption" ref="mescrollRef" @init="mescrollInit" @up="upCallback"
  33. @down="downCallback">
  34. <view v-for='(item,index) in cardHolderList' @longpress="longpress" class="item flex">
  35. <!-- <view class="card-list-item" style="background:red"> -->
  36. <view class="card-list-item" :style="'background:url('+item.currentBackground+');background-size:100% 100%'">
  37. <view class="card-content style1" v-if="item.cuttentTemplate==0">
  38. <view class="left">
  39. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px" shape="circle"></u--image>
  40. </view>
  41. <view class="right">
  42. <view class="row1">
  43. <text class="name">{{item.name}}</text>
  44. <text class="post">{{item.post}}</text>
  45. </view>
  46. <view class="row2">
  47. {{item.companyName}}
  48. </view>
  49. <view class="row3 flex">
  50. <uni-icons type="map-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
  51. </view>
  52. <view class="row4 flex">
  53. <uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.phone }}
  54. </view>
  55. <!-- <view class="">
  56. 备注
  57. </view> -->
  58. </view>
  59. </view>
  60. <view class="card-content style1 flex-between" v-if="item.cuttentTemplate==1">
  61. <view class="right">
  62. <view class="row1">
  63. <text class="name">{{item.name}}</text>
  64. <text class="post">{{item.post}}</text>
  65. </view>
  66. <view class="row2">
  67. {{item.companyName}}
  68. </view>
  69. <view class="row3 flex">
  70. <uni-icons type="map-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
  71. </view>
  72. <view class="row4 flex">
  73. <uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.phone }}
  74. </view>
  75. <!-- <view class="">
  76. 备注
  77. </view> -->
  78. </view>
  79. <view class="left">
  80. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px" shape="circle" v-if="item.headSculpture"></u--image>
  81. <u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px" height="66px" shape="circle" v-else></u--image>
  82. </view>
  83. </view>
  84. <view class="card-content style2" v-if="item.cuttentTemplate==2">
  85. <view class="top">
  86. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px" shape="circle" v-if="item.headSculpture"></u--image>
  87. <u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px" height="66px" shape="circle" v-else></u--image>
  88. </view>
  89. <view class="bottom flex">
  90. <view class="left">
  91. <view class="row1">
  92. <text class="name">{{item.name}}</text>
  93. <text class="post">{{item.post}}</text>
  94. </view>
  95. <view class="row2">
  96. {{item.companyName}}
  97. </view>
  98. </view>
  99. <view class="right">
  100. <view class="row1 flex">
  101. <uni-icons type="map-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
  102. </view>
  103. <view class="row2 flex">
  104. <uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.phone }}
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="card-content style2" v-if="item.cuttentTemplate==3">
  110. <view class="top">
  111. <view class="row1">
  112. <text class="name">{{item.name}}</text>
  113. <text class="post">{{item.post}}</text>
  114. </view>
  115. <view class="row2">
  116. {{item.companyName}}
  117. </view>
  118. </view>
  119. <view class="bottom flex">
  120. <view class="left">
  121. <u--image :showLoading="true" :src="item.headSculpture" width="66px" height="66px" shape="circle" v-if="item.headSculpture"></u--image>
  122. <u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px" height="66px" shape="circle" v-else></u--image>
  123. </view>
  124. <view class="right">
  125. <view class="row1 flex">
  126. <uni-icons type="map-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.province }}{{ item.city }}{{ item.area }}
  127. </view>
  128. <view class="row2 flex">
  129. <uni-icons type="phone-filled" size="20" style="margin-right: 20rpx;" color="#5e6d82"></uni-icons>{{ item.phone }}
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. <view class="car-bottom flex">
  135. <view class="left">
  136. <image src="../../static/imgs/card/home.png" mode="widthFix" style="width: 32rpx;" @click="toHome(item)"></image>
  137. <text @click='switchType(item)' style="color: #fff;">{{item.classify?item.classifyName:'默'}}</text>
  138. <image src="../../static/imgs/card/share.png" mode="widthFix" style="width: 35rpx;" @click="share(item)"></image>
  139. </view>
  140. <view class="right">
  141. </view>
  142. </view>
  143. </view>
  144. <!-- <view class="left">
  145. <view class="top flex-row-center">
  146. <image :src="item.headSculpture" mode="widthFix" class="img"></image>
  147. </view>
  148. <view class="bottom flex flex-evenly">
  149. <uni-icons @click="toHome(item)" type="home" size="20"></uni-icons>
  150. <text @click='switchType(item)'>{{item.classify?item.classifyName:'默'}}</text>
  151. <uni-icons @click='share(item)' type="redo" size="20" color=''></uni-icons>
  152. </view>
  153. </view>
  154. <view class="right">
  155. <view class="row1 flex">
  156. <text>{{item.name}}</text>
  157. <text class="line"></text>
  158. <text>{{item.post}}</text>
  159. <u-checkbox-group v-if='islongPress' placement="column"
  160. @change="checkboxChange($event,index)">
  161. <u-checkbox :name='index+1' :checked='item.checked'
  162. :customStyle="{marginBottom: '8px'}">
  163. </u-checkbox>
  164. </u-checkbox-group>
  165. </view>
  166. <view class="row2">
  167. {{item.companyName}}
  168. </view>
  169. <view class="row3" @click="toMap(item)">
  170. <uni-icons type="redo" size="20"></uni-icons>
  171. <text>{{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}</text>
  172. </view>
  173. <view class="row3">
  174. <uni-icons type="redo" size="20"></uni-icons>
  175. <text>{{item.phone}}</text>
  176. </view>
  177. <view @click='remarkEdit(item)' class="row3">
  178. <uni-icons type="redo" size="20"></uni-icons>
  179. <text>{{item.remark?item.remark:'单击添加备注'}}</text>
  180. </view>
  181. </view> -->
  182. </view>
  183. </mescroll-body>
  184. </view>
  185. <u-picker :show="isShowType" :columns="typeColumns" keyName="circleName" title="选择分类" @close="isShowType=false"
  186. @cancel="isShowType=false" closeOnClickOverlay @confirm="typeConfirm"></u-picker>
  187. <u-toast ref="uToast"></u-toast>
  188. <u-modal :show="delShow" title="提示" showCancelButton='true' @cancel="delShow=false" @confirm="delConfirm"
  189. :content='"已选中"+this.checkedList.length+"张名片,确定删除?"'></u-modal>
  190. <u-modal :show="modalShow" @confirm='remarkConfirm' :confirmColor="remark?'#2979ff':'#ccc'"
  191. showCancelButton='true' title="备注">
  192. <view class="slot-content">
  193. <u--textarea v-model="remark" placeholder="输入备注,不超过150个字"></u--textarea>
  194. </view>
  195. </u-modal>
  196. <view v-if='qrcodeShow' class="shade">
  197. <view class='qrCode'>
  198. <view style='text-align:right;'>
  199. <uni-icons @click='qrcodeShow=false' type="close" size="20"></uni-icons>
  200. </view>
  201. <image :src="currectData.qrCode" mode=""></image>
  202. </view>
  203. </view>
  204. <u-popup :show="popupshow" mode="bottom">
  205. <view>
  206. <view class="share-to">
  207. <text>分享到</text>
  208. </view>
  209. <view class="content">
  210. <view class="block" @click="toUrl()">
  211. <button class="moment">
  212. <text class="iconfont icon-weixin"></text>
  213. <!-- <image src="/static/img/moment.png" mode="aspectFill"></image> -->
  214. <text>扫码分享</text>
  215. </button>
  216. </view>
  217. <view class="block">
  218. <button class="shareBtn" type="default" data-name="shareBtn" open-type="share"> 分享</button>
  219. </view>
  220. </view>
  221. <view class="cancel" @click.stop="handleHiddenShare">
  222. <text>取消</text>
  223. </view>
  224. </view>
  225. </u-popup>
  226. <!-- <image :src="poster" style="width: 750rpx;height: 1334rpx;"></image> -->
  227. <!-- 生成图片 -->
  228. <poster :list="canvasData" background-color="#FFF" @on-success="posterSuccess" ref="poster"
  229. @on-error="posterError"></poster>
  230. </view>
  231. </template>
  232. <script>
  233. import Poster from '../../components/zhangyuhao-poster/Poster.vue'
  234. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  235. export default {
  236. mixins: [MescrollMixin],
  237. components: {
  238. Poster
  239. },
  240. data() {
  241. return {
  242. poster: '',
  243. canvasData: [],
  244. searchVal: '',
  245. isShowType: false,
  246. loading: true,
  247. typeName: '',
  248. typeColumns: [],
  249. cardHolderList: [],
  250. currectData: [],
  251. type: 1,
  252. popupshow: false,
  253. modalShow: false,
  254. remark: '',
  255. islongPress: false,
  256. checked: false,
  257. checkedList: [],
  258. delShow: false,
  259. qrcodeShow: false,
  260. unread: 0,
  261. noticeList: [],
  262. };
  263. },
  264. onShow() {
  265. if (uni.getStorageSync("userInfo")) {
  266. this.userInfo = uni.getStorageSync("userInfo")
  267. this.init()
  268. } else {
  269. this.login()
  270. }
  271. this.searchVal = uni.getStorageSync("search_val") ? uni.getStorageSync("search_val") : ''
  272. },
  273. mounted() {
  274. },
  275. onLoad: function() {
  276. wx.showShareMenu({
  277. withShareTicket: true,
  278. menus: ["shareAppMessage", "shareTimeline"]
  279. })
  280. },
  281. onShareAppMessage(res) {
  282. console.log(1111)
  283. let that = this;
  284. //生成名片图片
  285. let imageUrl = this.poster
  286. console.log("imageUrl", imageUrl)
  287. if (res.from === 'button') {
  288. let path = `/pages/cardHolder/scanCodeAddCard?id=${that.currectData.id}`
  289. return {
  290. title: `${that.currectData.name}分享的名片~`,
  291. path: path,
  292. imageUrl: imageUrl,
  293. };
  294. }
  295. if (res.from === 'menu') {
  296. return {
  297. title: '商通线上商城',
  298. path: '/pages/tabBarPro/index/index',
  299. imageUrl: imageUrl
  300. };
  301. }
  302. },
  303. // 分享到朋友圈
  304. onShareTimeline() {
  305. return {
  306. title: '商通线上商城',
  307. path: '/pages/index/index',
  308. imageUrl: 'https://cdn.uviewui.com/uview/swiper/1.jpg'
  309. };
  310. },
  311. methods: {
  312. posterError(err) {
  313. console.log(err)
  314. },
  315. posterSuccess(url) {
  316. console.log("hahahah", url)
  317. // 生成成功,会把临时路径在这里返回
  318. this.poster = url;
  319. console.log(url)
  320. },
  321. toHome(item) {
  322. uni.navigateTo({
  323. url: "/pages/mySet/myHome?id=" + item.personalHomeId
  324. })
  325. },
  326. delSearchVal() {
  327. this.searchVal = ""
  328. this.mescroll.resetUpScroll()
  329. },
  330. toUrl() {
  331. console.log(this.currectData)
  332. this.popupshow = false
  333. this.qrcodeShow = true
  334. },
  335. share(item) {
  336. debugger
  337. this.currectData = item
  338. this.canvasData = [{
  339. type: 'image',
  340. path: item.currentBackground,
  341. x: 0,
  342. y: 0,
  343. width: 750,
  344. height: 424
  345. },
  346. // {
  347. // type: 'text',
  348. // text:item.name,
  349. // x: 0,
  350. // y: 0,
  351. // size:13
  352. // },
  353. ]
  354. // this.popupshow = true
  355. },
  356. async delConfirm() {
  357. uni.showLoading({
  358. title: '数据加载中',
  359. mask: true
  360. })
  361. for (var i = 0; i < this.checkedList.length; i++) {
  362. await this.$request.baseRequest('admin.unimall.cardHolderInfo', 'delete', {
  363. id: this.checkedList[i].data.id,
  364. }, failres => {
  365. console.log('res+++++', failres.errmsg)
  366. this.$refs.uToast.show({
  367. type: 'error',
  368. message: failres.errmsg,
  369. })
  370. }).then(res => {
  371. console.log(i, this.checkedList.length - 1)
  372. if (i == this.checkedList.length - 1) {
  373. uni.hideLoading()
  374. this.$refs.uToast.show({
  375. type: 'success',
  376. message: '删除成功',
  377. })
  378. this.delShow = false
  379. this.islongPress = false
  380. this.mescroll.resetUpScroll()
  381. }
  382. })
  383. }
  384. },
  385. del() {
  386. this.delShow = true
  387. },
  388. longpress() {
  389. console.log("长按事件", 1111111111);
  390. this.islongPress = true;
  391. },
  392. checkboxChange(e, i) {
  393. console.log(e, i, 111111111)
  394. if (i === '') {
  395. console.log(this.checked)
  396. this.checked = !this.checked;
  397. this.cardHolderList.map(item => item.checked = this.checked);
  398. this.$forceUpdate()
  399. var checkList = this.cardHolderList.filter((item) => {
  400. return item.checked == true
  401. })
  402. var data = checkList.map((item, index) => {
  403. return {
  404. index: index,
  405. data: item
  406. }
  407. })
  408. this.checkedList = JSON.parse(JSON.stringify(data))
  409. } else {
  410. if (e[0]) {
  411. this.checkedList.push({
  412. index: i,
  413. data: this.cardHolderList[i]
  414. })
  415. } else {
  416. var index = this.checkedList.findIndex((item) => {
  417. return item.index == i
  418. })
  419. this.checkedList.splice(index, 1)
  420. }
  421. if (this.checkedList.length != this.cardHolderList.length) {
  422. this.checked = false
  423. }
  424. }
  425. // for(var i=0;i<this.cardList.length;i++){
  426. // console.log(this.cardList[i].checked)
  427. // // if(this.cardList[i].checkedList.length>0){
  428. // // this.checkedList.push(i)
  429. // // }
  430. // }
  431. console.log(this.checkedList)
  432. },
  433. remarkConfirm() {
  434. if (this.remark) {
  435. this.currectData.remark = this.remark
  436. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'update', {
  437. cardHolderInfo: JSON.stringify(this.currectData),
  438. }, failres => {
  439. console.log('res+++++', failres.errmsg)
  440. this.$refs.uToast.show({
  441. type: 'error',
  442. message: failres.errmsg,
  443. })
  444. }).then(res => {
  445. this.$refs.uToast.show({
  446. type: 'success',
  447. message: '修改备注成功',
  448. })
  449. this.modalShow = false
  450. this.mescroll.resetUpScroll()
  451. })
  452. }
  453. },
  454. remarkEdit(item) {
  455. this.currectData = item
  456. this.modalShow = true
  457. },
  458. switchType(item) {
  459. this.type = 2
  460. this.currectData = item
  461. this.isShowType = true
  462. },
  463. typeConfirm(e) {
  464. if (this.type == 2) {
  465. this.currectData.classify = e.value[0].circleName
  466. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'update', {
  467. cardHolderInfo: JSON.stringify(this.currectData),
  468. }, failres => {
  469. console.log('res+++++', failres.errmsg)
  470. this.$refs.uToast.show({
  471. type: 'error',
  472. message: failres.errmsg,
  473. })
  474. }).then(res => {
  475. this.$refs.uToast.show({
  476. type: 'success',
  477. message: '修改分类成功',
  478. })
  479. this.mescroll.resetUpScroll()
  480. })
  481. } else {
  482. this.typeName = e.value[0].circleName
  483. }
  484. this.isShowType = false
  485. },
  486. init() {
  487. this.getList()
  488. this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
  489. page: 1,
  490. limit: 9999,
  491. commonId: uni.getStorageSync("userInfo").id
  492. }, failres => {
  493. console.log('res+++++', failres.errmsg)
  494. this.$refs.uToast.show({
  495. type: 'error',
  496. message: failres.errmsg,
  497. })
  498. }).then(res => {
  499. this.typeColumns = [res.data.items]
  500. this.mescroll.resetUpScroll()
  501. console.log(this.typeColumns)
  502. })
  503. },
  504. getList() {
  505. this.$request.baseRequest('admin.unimall.cardNewsInfo', 'list', {
  506. receiveId: uni.getStorageSync("userInfo").id,
  507. }, failres => {
  508. console.log('res+++++', failres.errmsg)
  509. this.$refs.uToast.show({
  510. type: 'error',
  511. message: failres.errmsg,
  512. })
  513. }).then(res => {
  514. this.noticeList = res.data.items
  515. if (this.noticeList.length > 0) {
  516. var data = this.noticeList.filter((item) => {
  517. return item.newsFlag == 0
  518. })
  519. this.unread = data ? data.length : 0
  520. }
  521. console.log(this.unread)
  522. })
  523. },
  524. upCallback(page) {
  525. var that = this
  526. uni.showLoading({
  527. title: '数据加载中'
  528. })
  529. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'list', {
  530. page: page.num,
  531. limit: page.size,
  532. commonId: uni.getStorageSync("userInfo").id,
  533. searchContent: this.searchVal
  534. }, failres => {
  535. console.log('res+++++', failres.errmsg)
  536. this.$refs.uToast.show({
  537. type: 'error',
  538. message: failres.errmsg,
  539. })
  540. uni.hideLoading()
  541. }).then(res => {
  542. console.log(res)
  543. if (page.num == 1) this.cardHolderList = [];
  544. let curPageLen = res.data.items.length;
  545. let totalPage = res.data.total;
  546. for (var i = 0; i < res.data.items.length; i++) {
  547. res.data.items[i].checked = false
  548. if (res.data.items[i].classify) {
  549. res.data.items[i].classifyName = res.data.items[i].classify[0]
  550. }
  551. }
  552. this.cardHolderList = res.data.items
  553. this.loading = false
  554. // if(res.data.items.length>0){
  555. // for(var i=0;i<res.data.items.length;i++){
  556. // res.data.items[i].name=res.data.items[i].circleName[0]
  557. // }
  558. // var itemIndex=res.data.items.findIndex((item)=>{return item.topMarking==1})
  559. // if(itemIndex!=-1){
  560. // var data=res.data.items.splice(itemIndex,1)
  561. // if(page.num==1){
  562. // data.push({circleName:'默认分类',name:'默'})
  563. // }
  564. // res.data.items=data.concat(res.data.items)
  565. // }else{
  566. // if(page.num==1){
  567. // res.data.items=[{circleName:'默认分类',name:'默'}].concat(res.data.items)
  568. // }
  569. // }
  570. // this.cardTypeList=this.cardTypeList.concat(res.data.items)
  571. // }else{
  572. // if(page.num==1){
  573. // this.cardTypeList=[{circleName:'默认分类',name:'默'}]
  574. // }
  575. // }
  576. this.$nextTick(() => {
  577. console.log(that)
  578. // mescroll.endSuccess(data.result);
  579. that.mescroll.endBySize(curPageLen, totalPage)
  580. });
  581. // if (res.errno == 200) {
  582. uni.hideLoading()
  583. // }
  584. })
  585. },
  586. login() {
  587. let that = this
  588. uni.login({
  589. "provider": "weixin",
  590. success: function(wxres) {
  591. that.$request.baseRequest('commonUserApp', 'commonUserLogin', {
  592. loginType: 1,
  593. raw: JSON.stringify(wxres)
  594. }, failres => {
  595. this.$refs.uToast.show({
  596. type: 'error',
  597. message: failres.errmsg,
  598. })
  599. uni.hideLoading()
  600. }).then(res => {
  601. uni.getUserInfo({
  602. provider: 'weixin',
  603. success: function(info) {
  604. console.log(info)
  605. res.data.nickname = info.userInfo.nickName
  606. res.data.head = info.userInfo.avatarUrl
  607. that.$request.baseRequest('commonUserApp', 'edit', {
  608. commonUserInfo: JSON.stringify(res.data)
  609. }, failres => {
  610. this.$refs.uToast.show({
  611. type: 'error',
  612. message: failres.errmsg,
  613. })
  614. uni.hideLoading()
  615. }).then(res1 => {
  616. uni.setStorageSync("userInfo", res1.data)
  617. })
  618. }
  619. })
  620. })
  621. },
  622. fail: function(err) {
  623. // 登录授权失败
  624. // err.code是错误码
  625. }
  626. })
  627. },
  628. toNotice() {
  629. uni.navigateTo({
  630. url: "/pages/cardHolder/notice"
  631. })
  632. },
  633. micOpen: function() {
  634. uni.navigateTo({
  635. url: "/pages/cardHolder/search?mic=1"
  636. })
  637. },
  638. uploadFile: function(tempFilePath) {
  639. return new Promise((resolve, reject) => {
  640. //调用你的接口把音频文件转为文字
  641. this.$minApi.upload('txasr/SentenceRecognition', null, tempFilePath)
  642. .then(res => {
  643. if (res.code == 1) {
  644. resolve(res.data.Result);
  645. } else {
  646. reject(e);
  647. }
  648. })
  649. .catch(e => {
  650. reject(e);
  651. });
  652. });
  653. },
  654. search() {
  655. uni.navigateTo({
  656. url: "/pages/cardHolder/search"
  657. })
  658. },
  659. input(res) {
  660. console.log('----input:', res)
  661. },
  662. clear(res) {
  663. uni.showToast({
  664. title: 'clear事件,清除值为:' + res.value,
  665. icon: 'none'
  666. })
  667. },
  668. blur(res) {
  669. uni.showToast({
  670. title: 'blur事件,输入值为:' + res.value,
  671. icon: 'none'
  672. })
  673. },
  674. focus(e) {
  675. uni.showToast({
  676. title: 'focus事件,输出值为:' + e.value,
  677. icon: 'none'
  678. })
  679. },
  680. cancel(res) {
  681. uni.showToast({
  682. title: '点击取消,输入值为:' + res.value,
  683. icon: 'none'
  684. })
  685. },
  686. selectType() {
  687. this.isShowType = true
  688. this.type = 1
  689. },
  690. scan() {
  691. // console.log(1)
  692. // uni.navigateTo({
  693. // url: "/pages/cardHolder/scancode"
  694. // })
  695. uni.scanCode({
  696. success: function(res) {
  697. console.log('条码类型:' + res.scanType);
  698. console.log('条码内容:' + res.result);
  699. uni.navigateTo({
  700. url: "/pages/cardHolder/scanCodeAddCard?id=" + res.result
  701. })
  702. }
  703. });
  704. },
  705. toMap(item) {
  706. uni.navigateTo({
  707. url: "/pages/cardHolder/map?location=" + item.location
  708. })
  709. },
  710. }
  711. }
  712. </script>
  713. <style lang="scss" scoped>
  714. .content {
  715. // padding: 0 20rpx;
  716. }
  717. .u-nav-slot {
  718. /deep/.u-badge {
  719. position: absolute;
  720. top: 0;
  721. right: 6rpx;
  722. }
  723. }
  724. .content1 {
  725. padding: 20rpx;
  726. background-color: #112253;
  727. .search {
  728. color: #9199af;
  729. background: #22325f;
  730. border-radius: 50rpx;
  731. width: 100%;
  732. padding: 10rpx 30rpx;
  733. box-sizing: border-box;
  734. margin-right: 20rpx;
  735. }
  736. }
  737. .content2 {
  738. background: #112253;
  739. color: #fff;
  740. padding: 20rpx 20rpx 200rpx 20rpx;
  741. border-radius: 0px 0px 20px 20px;
  742. }
  743. .content3 {
  744. // padding:0 20rpx;
  745. position: relative;
  746. top: -170rpx;
  747. .style1{
  748. display: flex;
  749. padding: 20rpx 30rpx;
  750. width: 85%;
  751. margin-bottom: 90rpx;
  752. .left{
  753. width: 132rpx;
  754. height: 132rpx;
  755. border-radius: 50%;
  756. }
  757. .right{
  758. margin-left: 40rpx;
  759. .row1{
  760. .name{
  761. font-size: 38rpx;
  762. font-weight: bold;
  763. color: #040000;
  764. margin-right: 20rpx;
  765. }
  766. .post{
  767. font-size: 26rpx;
  768. font-weight: 500;
  769. color: #666666;
  770. }
  771. }
  772. .row2{
  773. margin-top: 20rpx;
  774. font-size: 24rpx;
  775. font-weight: bold;
  776. color: #323333;
  777. }
  778. .row3{
  779. margin-top: 30rpx;
  780. font-size: 24rpx;
  781. font-weight: 500;
  782. color: #323333;
  783. }
  784. }
  785. }
  786. .style2{
  787. padding:30rpx;
  788. margin-bottom: 100rpx;
  789. .top{
  790. .row1{
  791. .name{
  792. font-size: 38rpx;
  793. font-weight: bold;
  794. color: #040000;
  795. margin-right: 20rpx;
  796. }
  797. .post{
  798. font-size: 26rpx;
  799. font-weight: 500;
  800. color: #666666;
  801. }
  802. }
  803. .row2{
  804. margin-top: 20rpx;
  805. font-size: 24rpx;
  806. font-weight: bold;
  807. color: #323333;
  808. }
  809. }
  810. .bottom{
  811. margin-top: 48rpx;
  812. .left{
  813. margin-right: 40rpx;
  814. .row1{
  815. .name{
  816. font-size: 38rpx;
  817. font-weight: bold;
  818. color: #040000;
  819. margin-right: 20rpx;
  820. }
  821. .post{
  822. font-size: 26rpx;
  823. font-weight: 500;
  824. color: #666666;
  825. }
  826. }
  827. .row2{
  828. margin-top: 20rpx;
  829. font-size: 24rpx;
  830. font-weight: bold;
  831. color: #323333;
  832. }
  833. }
  834. .right{
  835. .row1,.row2{
  836. font-size: 24rpx;
  837. font-weight: 500;
  838. color: #323333;
  839. }
  840. .row2{
  841. margin-top: 20rpx;
  842. }
  843. }
  844. }
  845. }
  846. .card-list-item {
  847. width: calc(100%);
  848. // left:-20rpx;
  849. position: relative;
  850. border-radius: 30rpx;
  851. padding: 40rpx;
  852. box-sizing: border-box;
  853. .car-bottom{
  854. position: absolute;
  855. bottom: 63rpx;
  856. left:20rpx;
  857. // width: calc(100% - 40rpx);
  858. .left{
  859. // top: -40rpx;
  860. position: absolute;
  861. padding: 20rpx 0;
  862. width: 70vw;
  863. height: 80rpx;
  864. box-sizing: border-box;
  865. display: flex;
  866. align-items: center;
  867. justify-content: space-evenly;
  868. background: url("../../static/imgs/card/bgc1.png") no-repeat center;
  869. background-size: 100% 100%;
  870. }
  871. .right{
  872. position: absolute;
  873. left: 65vw;
  874. height: 80rpx;
  875. width: 30vw;
  876. background: url("../../static/imgs/card/right-bgc.png") no-repeat center;
  877. background-size: 100% 100%;
  878. }
  879. }
  880. .left {
  881. width: 30%;
  882. .top {
  883. margin-bottom: 20rpx;
  884. }
  885. .img {
  886. width: 80%;
  887. }
  888. .bottom {}
  889. }
  890. .right {
  891. .row1 {
  892. .line {
  893. width: 1px;
  894. height: 20px;
  895. margin: 0 20rpx;
  896. background: black;
  897. }
  898. }
  899. }
  900. }
  901. }
  902. .slot-content {
  903. width: 100%;
  904. }
  905. .shade {
  906. background: rgba(0, 0, 0, 0.2);
  907. width: 100%;
  908. height: 100vh;
  909. position: fixed;
  910. top: 0;
  911. left: 0;
  912. }
  913. .qrCode {
  914. position: absolute;
  915. top: 50%;
  916. left: 0;
  917. right: 0;
  918. transform: translateY(-50%);
  919. text-align: center;
  920. }
  921. </style>