cardHolder.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <view class="content">
  3. <u-navbar title="电子名片" placeholder>
  4. <view class="u-nav-slot relative" slot="left">
  5. <u-icon name="bell" size="26" @click="toNotice"></u-icon>
  6. <u-badge :isDot="true" type="error" class="point"></u-badge>
  7. </view>
  8. </u-navbar>
  9. <view class="content1 flex-row-center">
  10. <view class="col flex">
  11. <uni-icons type="scan" size="30" @click="scan"></uni-icons>
  12. </view>
  13. <view class="search flex flex-between" @click="search">
  14. <view class="left flex">
  15. <uni-icons type="search" size="24"></uni-icons>
  16. <text class="search-val"> {{searchVal?searchVal:'搜索名片'}}</text>
  17. </view>
  18. <view class="right">
  19. <uni-icons type="mic" size="24" @click.stop="micOpen"></uni-icons>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="content2">
  24. <view class="all-type flex" @click="selectType">
  25. <text>{{typeName?typeName:'全部分类'}}</text>
  26. <uni-icons type="bottom" size="20"></uni-icons>
  27. </view>
  28. </view>
  29. <view class="content3 flex">
  30. <view class="left">
  31. <view class="top flex-row-center">
  32. <image src="../../static/uni.png" mode="widthFix" class="img"></image>
  33. </view>
  34. <view class="bottom flex flex-evenly">
  35. <uni-icons type="home" size="20"></uni-icons>
  36. <text>默</text>
  37. <uni-icons type="redo" size="20"></uni-icons>
  38. </view>
  39. </view>
  40. <view class="right">
  41. <view class="row1 flex">
  42. <text>张三</text>
  43. <text class="line"></text>
  44. <text>总经理</text>
  45. </view>
  46. <view class="row2">
  47. 北京xxx有限公司
  48. </view>
  49. <view class="row3" @click="toMap">
  50. <uni-icons type="redo" size="20"></uni-icons>
  51. <text>北京市朝阳区幸福大街8号</text>
  52. </view>
  53. <view class="row3">
  54. <uni-icons type="redo" size="20"></uni-icons>
  55. <text>13333333333</text>
  56. </view>
  57. <view class="row3">
  58. <uni-icons type="redo" size="20"></uni-icons>
  59. <text>我是备注</text>
  60. </view>
  61. </view>
  62. </view>
  63. <u-picker :show="isShowType" :columns="typeColumns" keyName="label" title="选择分类" @close="isShowType=false"
  64. @cancel="isShowType=false" closeOnClickOverlay @confirm="typeConfirm"></u-picker>
  65. <lyuan-tx-asr ref="asr" :uploadMethod="uploadFile" @change="asrChange" @fileChange="fileChange" appId=""
  66. secretId="" secretKey=""></lyuan-tx-asr>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. searchVal: '',
  74. isShowType: false,
  75. typeName: '',
  76. typeColumns: [
  77. [{
  78. label: '重要客户',
  79. id: 2021
  80. }, {
  81. label: '常用客户',
  82. id: 804
  83. },
  84. {
  85. label: '次要客户',
  86. id: 804
  87. }
  88. ]
  89. ]
  90. };
  91. },
  92. onShow() {
  93. this.searchVal = uni.getStorageSync("search_val") ? uni.getStorageSync("search_val") : ''
  94. },
  95. methods: {
  96. toNotice(){
  97. uni.navigateTo({
  98. url:"/pages/cardHolder/notice"
  99. })
  100. },
  101. micOpen: function() {
  102. this.$refs.asr.show();
  103. },
  104. asrChange: function(res) {
  105. console.log('语音识别确认结果:' + res);
  106. },
  107. fileChange: function({
  108. file,
  109. content
  110. }) {
  111. console.log('录音文件', file);
  112. },
  113. uploadFile: function(tempFilePath) {
  114. return new Promise((resolve, reject) => {
  115. //调用你的接口把音频文件转为文字
  116. this.$minApi.upload('txasr/SentenceRecognition', null, tempFilePath)
  117. .then(res => {
  118. if (res.code == 1) {
  119. resolve(res.data.Result);
  120. } else {
  121. reject(e);
  122. }
  123. })
  124. .catch(e => {
  125. reject(e);
  126. });
  127. });
  128. },
  129. search() {
  130. uni.navigateTo({
  131. url: "/pages/cardHolder/search"
  132. })
  133. },
  134. input(res) {
  135. console.log('----input:', res)
  136. },
  137. clear(res) {
  138. uni.showToast({
  139. title: 'clear事件,清除值为:' + res.value,
  140. icon: 'none'
  141. })
  142. },
  143. blur(res) {
  144. uni.showToast({
  145. title: 'blur事件,输入值为:' + res.value,
  146. icon: 'none'
  147. })
  148. },
  149. focus(e) {
  150. uni.showToast({
  151. title: 'focus事件,输出值为:' + e.value,
  152. icon: 'none'
  153. })
  154. },
  155. cancel(res) {
  156. uni.showToast({
  157. title: '点击取消,输入值为:' + res.value,
  158. icon: 'none'
  159. })
  160. },
  161. selectType() {
  162. this.isShowType = true
  163. },
  164. typeConfirm(val) {
  165. console.log(val.value)
  166. this.typeName = val.value[0].label
  167. this.isShowType = false
  168. },
  169. scan() {
  170. // console.log(1)
  171. uni.scanCode({
  172. success: function(res) {
  173. console.log('条码类型:' + res.scanType);
  174. console.log('条码内容:' + res.result);
  175. }
  176. });
  177. },
  178. toMap() {
  179. uni.navigateTo({
  180. url: "/pages/cardHolder/map"
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style lang="scss" scoped>
  187. .content {
  188. padding: 0 20rpx;
  189. }
  190. .u-nav-slot {
  191. /deep/.u-badge {
  192. position: absolute;
  193. top: 0;
  194. right: 6rpx;
  195. }
  196. }
  197. .content1 {
  198. margin-top: 20rpx;
  199. .search {
  200. margin-left: 20rpx;
  201. border: 1px solid #ccc;
  202. border-radius: 50rpx;
  203. width: 100%;
  204. padding: 10rpx 30rpx;
  205. box-sizing: border-box;
  206. .left {
  207. .search-val {
  208. margin-left: 30rpx;
  209. }
  210. }
  211. }
  212. }
  213. .content2 {
  214. .all-type {
  215. }
  216. }
  217. .content3 {
  218. border: 1px solid #ccc;
  219. border-radius: 30rpx;
  220. padding: 40rpx;
  221. box-sizing: border-box;
  222. .left {
  223. width: 30%;
  224. .top {
  225. margin-bottom: 20rpx;
  226. }
  227. .img {
  228. width: 80%;
  229. }
  230. .bottom {
  231. }
  232. }
  233. .right {
  234. .row1 {
  235. .line {
  236. width: 1px;
  237. height: 20px;
  238. margin: 0 20rpx;
  239. background: black;
  240. }
  241. }
  242. }
  243. }
  244. </style>