index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <!-- <custom-navigation-bar class="bar">
  3. {{$t('navigationBarTitleText')}}
  4. </custom-navigation-bar> -->
  5. <!-- <page-meta>
  6. <navigation-bar
  7. :title="$t('navigationBarTitleText')"
  8. front-color="#fff"
  9. background-color="#648EB8"
  10. title-align="center"
  11. />
  12. </page-meta> -->
  13. <uv-toast ref="toast"></uv-toast>
  14. <view class="page">
  15. <view class="bar">
  16. <uv-text :text="$t('navigationBarTitleText')" align="center" color="#fff" size="20"></uv-text>
  17. </view>
  18. <view class="bottomarc"></view>
  19. <view>
  20. <uv-row justify="space-between" customStyle="margin-top: 6%">
  21. <uv-col span="10" offset="1" class="box1">
  22. <view class='hometitle'>
  23. {{$t('index_text_1')}}
  24. </view>
  25. <view class="userlist">
  26. <uv-row>
  27. <uv-col span="10" class="scroll_div">
  28. <uv-scroll-list :indicator="false">
  29. <view v-for="(item, index) in userlist" :key="index" class="item">
  30. <uv-image class="img" :src="item.photourl" mode="aspectFill"
  31. shape="circle" :lazy-load="true" width="60" height="60"
  32. :class="{ memberphoto_select: item.selected }"
  33. @click="selected(index)">
  34. </uv-image>
  35. <uv-text :text="item.membername" align="center" customStyle="margin-top:0.3rem"></uv-text>
  36. </view>
  37. </uv-scroll-list>
  38. </uv-col>
  39. <uv-col span="2">
  40. <view class="addmember">
  41. <uv-image class="img" src="/static/image/fabu1.png" mode="aspectFill"
  42. shape="circle" :lazy-load="true" width="50" height="50"
  43. @click="insertmembe">
  44. </uv-image>
  45. <uv-text :text="$t('new_member')" align="center" customStyle="margin-top:0.3rem"></uv-text>
  46. </view>
  47. </uv-col>
  48. </uv-row>
  49. </view>
  50. </uv-col>
  51. </uv-row>
  52. <view class="">
  53. <uv-row justify="space-between" customStyle="margin-top: 2rem">
  54. <uv-col span="10" offset="1">
  55. <view class="box2">
  56. <view class="scalename">
  57. {{$t('index_text_2')}}
  58. </view>
  59. <view class="div1">
  60. <uv-row>
  61. <uv-col span="6">
  62. <image class="img" src="http://qiniusave.chienxutech.com/sdzyy/img/xgng3.png" ></image>
  63. </uv-col>
  64. <uv-col span="6">
  65. <view class="">
  66. <uv-text :text="$t('index_text_3')"></uv-text>
  67. <uv-text :text="$t('index_text_4')" align="center" customStyle="margin-top:30px;margin-bottom:40px"></uv-text>
  68. <uv-text :text="$t('index_text_5')" align="center" size="12" color="#1a1a1a"></uv-text>
  69. </view>
  70. </uv-col>
  71. </uv-row>
  72. </view>
  73. <view class='scalename'>{{$t('index_text_6')}}</view>
  74. <view v-if="selectuser" class="btns">
  75. <!-- <view v-show="1!=selectuser.fmemberid"> -->
  76. <view>
  77. <uv-row v-show="0==reportinfo.comstatus">
  78. <uv-col span="6" offset="3">
  79. <view class='mybtn' @click="tostem">
  80. {{$t('index_btn_1')}}
  81. </view>
  82. </uv-col>
  83. </uv-row>
  84. <uv-row gutter="20" v-show="1==reportinfo.comstatus">
  85. <uv-col span="6" >
  86. <view class='mybtn' @click="showreport">
  87. {{$t('index_btn_2')}}
  88. </view>
  89. </uv-col>
  90. <uv-col span="6" >
  91. <view class='mybtn' @click="restem">
  92. {{$t('index_btn_3')}}
  93. </view>
  94. </uv-col>
  95. </uv-row>
  96. </view>
  97. </view>
  98. <view v-else>
  99. <p>{{$t('not_selected')}}</p>
  100. </view>
  101. <!-- mergerscale.comstatus -->
  102. </view>
  103. </uv-col>
  104. </uv-row>
  105. <!-- <uv-row justify="space-between" customStyle="margin-top: 6%">
  106. <uv-col span="10" offset="1" >
  107. <share @dosharewechat="share"></share>
  108. </uv-col>
  109. </uv-row> -->
  110. </view>
  111. </view>
  112. </view>
  113. </template>
  114. <script>
  115. import {getlist} from "@/common/api/fmember.js"
  116. import {querymergescalebyuserid} from "@/common/api/scale.js"
  117. import {tostemlistnext} from "@/common/js/common.js"
  118. import share from "@/components/share/share.vue"
  119. import {addlog} from "@/common/api/system.js"
  120. export default {
  121. data() {
  122. return {
  123. userinfo:{},
  124. userlist:[],
  125. reportinfo:{},
  126. selectuser:false
  127. }
  128. },
  129. components:{
  130. share
  131. },
  132. methods: {
  133. getlist(){
  134. let data ={userid:this.userinfo.id}
  135. getlist(data).then(res=>{
  136. res = res.data
  137. if(0==res.code){
  138. this.$refs.toast.show({
  139. type: 'error',
  140. message: res.errmsg
  141. })
  142. }
  143. if(200==res.code){
  144. let userlist = res.resultData
  145. let fmemberid = this.selectuser?this.selectuser.fmemberid:this.userinfo.fmemberid
  146. if(this.selectuser){
  147. userlist.map((item,index)=>{
  148. item.selected=0
  149. if(item.fmemberid==fmemberid){
  150. item.selected=1
  151. return
  152. }
  153. })
  154. }else{
  155. userlist[0].selected=1
  156. uni.setStorage({
  157. key: 'selectuser',
  158. data: userlist[0],
  159. });
  160. this.selectuser = userlist[0]
  161. uni.setStorage({
  162. key: 'selectuser',
  163. data: this.selectuser,
  164. });
  165. }
  166. userlist.map((item,index)=>{
  167. if(!item.gender){
  168. item.photourl="/static/image/member.svg"
  169. }else{
  170. switch(item.gender){
  171. case '1':
  172. item.photourl="/static/image/selecttype/man.png"
  173. break;
  174. case '2':
  175. item.photourl="/static/image/selecttype/woman.png"
  176. break;
  177. }
  178. }
  179. })
  180. this.userlist = userlist
  181. uni.setStorage({
  182. key: 'memberlist',
  183. data: this.userlist,
  184. });
  185. }
  186. })
  187. },
  188. selected(index){
  189. let that = this
  190. this.userlist.map((item,index1)=>{
  191. if(index1==index){
  192. item.selected=1
  193. that.selectuser = item
  194. }else{
  195. item.selected=0
  196. }
  197. })
  198. uni.setStorage({
  199. key: 'selectuser',
  200. data: this.selectuser,
  201. });
  202. this.querymergescalebyuserid()
  203. },
  204. insertmembe(){
  205. let count = this.userlist.length-1
  206. if(count>=this.userinfo.fmembercount){
  207. this.$refs.toast.show({
  208. type: 'error',
  209. message: this.$t('member_num_than_max')
  210. })
  211. }else{
  212. uni.navigateTo({
  213. url: '/pages/member/add'
  214. });
  215. }
  216. },
  217. querymergescalebyuserid(){
  218. let userid = this.userinfo.id
  219. let fmemberid=this.selectuser.fmemberid?this.selectuser.fmemberid:0
  220. let data={userid:userid,fmemberid:fmemberid}
  221. querymergescalebyuserid(data).then(res=>{
  222. res =res.data
  223. if(0==res.code){
  224. this.$refs.toast.show({
  225. type: 'error',
  226. message: res.errmsg
  227. })
  228. return false
  229. }
  230. if(200==res.code){
  231. this.reportinfo = res.resultData
  232. }
  233. })
  234. },
  235. showreport(){
  236. uni.navigateTo({
  237. url: '/pages/report/report'
  238. });
  239. },
  240. init(){
  241. this.userinfo = uni.getStorageSync("userinfo")
  242. this.selectuser = uni.getStorageSync("selectuser")
  243. this.getlist()
  244. this.querymergescalebyuserid()
  245. // uni.$on('dosharewechat',function(data){
  246. // uni.share({
  247. // provider: "weixin",
  248. // scene: "WXSceneSession",
  249. // type: 0,
  250. // href:"testapp://",
  251. // title: "uni-app分享",
  252. // summary: "我正在使用HBuilderX开发uni-app,赶紧跟我一起来体验!",
  253. // imageUrl: data.shareimg,
  254. // success: function (res) {
  255. // addlog({
  256. // json: JSON.stringify(res),
  257. // type: 'uniapp信息'
  258. // })
  259. // console.log("success:" + JSON.stringify(res));
  260. // },
  261. // fail: function (err) {
  262. // addlog({
  263. // json: JSON.stringify(res),
  264. // type: 'uniapp错误'
  265. // })
  266. // console.log("fail:" + JSON.stringify(err));
  267. // }
  268. // })
  269. // })
  270. },
  271. tostem(){
  272. if(this.reportinfo.stemlist == undefined){
  273. return
  274. }
  275. uni.setStorage({
  276. key: 'stemlist',
  277. data: this.reportinfo.stemlist,
  278. });
  279. if(this.reportinfo.srid == undefined){
  280. this.reportinfo.srid =0
  281. }
  282. let stemlist = this.reportinfo.stemlist
  283. let srid =this.reportinfo.srid
  284. uni.setStorage({
  285. key: 'srid',
  286. data: srid,
  287. });
  288. let stepprogress = this.reportinfo.stepprogress
  289. tostemlistnext(stepprogress)
  290. // let item = stemlist[stepprogress]
  291. // if(item.stemtype<101){
  292. // //标准答题
  293. // uni.navigateTo({
  294. // url: '/pages/topic/common'
  295. // });
  296. // }else{
  297. // //特殊答题
  298. // let scaleid=4
  299. // let url = "/pages/topic/"+item.stemdefinepage+"?scaleid="+scaleid + "&srid=" + srid + `&sindex=` + stepprogress
  300. // uni.navigateTo({
  301. // url: url
  302. // });
  303. // }
  304. },
  305. restem(){
  306. uni.setStorage({
  307. key: 'stemlist',
  308. data: this.reportinfo.stemlist,
  309. });
  310. if(this.reportinfo.srid == undefined){
  311. this.reportinfo.srid =0
  312. }
  313. let stemlist = this.reportinfo.stemlist
  314. let srid = 0
  315. uni.setStorage({
  316. key: 'srid',
  317. data: srid,
  318. });
  319. //let stepprogress = this.reportinfo.stepprogress
  320. let stepprogress = 0
  321. var scaleid = 4
  322. tostemlistnext(stepprogress,0,scaleid,srid)
  323. },
  324. share(data){
  325. // this.$refs.toast.show({
  326. // type: 'error',
  327. // message: data.shareimg
  328. // })
  329. // console.log(data)
  330. uni.share({
  331. provider: "weixin",
  332. scene: "WXSceneSession",
  333. type: 0,
  334. href:"testapp://",
  335. //title: this.$t('navigationBarTitleText')+"分享",
  336. title: this.$t('share'),
  337. summary: this.$t('share_text'),
  338. imageUrl: data.shareimg,
  339. success: function (res) {
  340. addlog({
  341. json: JSON.stringify(res),
  342. type: 'uniapp信息'
  343. })
  344. console.log("success:" + JSON.stringify(res));
  345. },
  346. fail: function (err) {
  347. addlog({
  348. json: JSON.stringify(err),
  349. type: 'uniapp错误'
  350. })
  351. console.log("fail:" + JSON.stringify(err));
  352. }
  353. })
  354. }
  355. },
  356. mounted() {
  357. // uni.setNavigationBarTitle({
  358. // title: this.$t('navigationBarTitleText')
  359. // });
  360. this.init()
  361. },
  362. onPullDownRefresh(){
  363. this.init()
  364. setTimeout(function () {
  365. uni.stopPullDownRefresh();
  366. }, 1000);
  367. }
  368. }
  369. </script>
  370. <style scoped>
  371. .box1{
  372. background-color: #fff;
  373. border-radius:20rpx;
  374. box-shadow: 3px 3px 0px 0px rgba(0, 0, 0, 0.3);
  375. display:flex;
  376. flex-direction:column;
  377. align-items:center;
  378. width: 80%;
  379. }
  380. .box1 .userlist{
  381. width: 100%;
  382. }
  383. .box1 .userlist .item{
  384. display: flex;
  385. flex-direction: column;
  386. align-items: center;
  387. text-align: center;
  388. width: 60px;
  389. }
  390. .box1 .userlist .scroll_div{
  391. max-width: 80%;
  392. }
  393. .addmember{
  394. width: 50px;
  395. display: flex;
  396. flex-direction: column;
  397. align-items: center;
  398. text-align: center;
  399. }
  400. .addmember{
  401. padding-bottom: 10px;
  402. }
  403. .box2{
  404. background-color: #fff;
  405. border-radius:20rpx;
  406. box-shadow: 3px 3px 0px 0px rgba(0, 0, 0, 0.3);
  407. display:flex;
  408. flex-direction:column;
  409. align-items:center;
  410. width: 100%;
  411. padding: 0.5em;
  412. box-sizing: border-box;
  413. }
  414. .box1 .hometitle{
  415. height:80rpx;
  416. display:flex;
  417. align-items:center;
  418. justify-content:center;
  419. font-weight:700;
  420. color:#47689D;
  421. }
  422. .box1 .userlist .item .memberphoto_select{
  423. overflow: hidden;
  424. box-shadow:1px 3px 3px 1px rgba(0, 0, 0, 0.3);
  425. }
  426. .box1 .userlist{
  427. padding-left: 10px;
  428. padding-right: 10px;
  429. }
  430. .box2 .scalename{
  431. font-size:36rpx;
  432. display:flex;
  433. justify-content:center;
  434. align-items:center;
  435. color:#648EB8;
  436. margin-top:5rpx;
  437. font-weight:700;
  438. }
  439. .box2 .img{
  440. width: 100%;
  441. object-fit: contain;
  442. height: 350rpx;
  443. }
  444. .box2 .div1{
  445. width: 100%;
  446. }
  447. .box2 .btns{
  448. width: 100%;
  449. margin-top: 30rpx;
  450. margin-bottom: 30rpx;
  451. }
  452. </style>